Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bd901cee0 | ||
|
|
bf35469684 | ||
|
|
60f29edbca | ||
|
|
60cffe1ed1 | ||
|
|
e77e7d1643 | ||
|
|
5dc22f502e | ||
|
|
7a309c1175 | ||
|
|
9ce5baad9e | ||
|
|
a4aa9a76f2 | ||
|
|
befa25de5c | ||
|
|
83175d5c09 | ||
|
|
d8df8e8778 | ||
|
|
09957d0279 | ||
|
|
9e44985f56 | ||
|
|
b657a84699 | ||
|
|
5ec7835556 | ||
|
|
03a864156d | ||
|
|
c823bf3320 | ||
|
|
4f4d2f1f4c | ||
|
|
1bb389052d | ||
|
|
31fdc5bbc1 | ||
|
|
db3833430d | ||
|
|
6d2212d259 | ||
|
|
83b62e7f53 | ||
|
|
e5b5b53ede | ||
|
|
912c0e7fc4 | ||
|
|
43d232819a | ||
|
|
302eaf60b5 | ||
|
|
84535faa90 | ||
|
|
8c55d3c705 | ||
|
|
75b4b10caa | ||
|
|
1732e927c1 | ||
|
|
ec11b9268f | ||
|
|
a45af4a80c | ||
|
|
df627b6830 | ||
|
|
dfbeaf30ad | ||
|
|
a03f74b125 | ||
|
|
1a01f1299c | ||
|
|
fc5cab4b62 | ||
|
|
c7fcf814ef | ||
|
|
91f0cdbaca | ||
|
|
e50bd4125d | ||
|
|
ded2c8a7c8 | ||
|
|
88ce9fc0a6 | ||
|
|
3c713248b3 | ||
|
|
75f3edcd92 | ||
|
|
081a7779a6 | ||
|
|
6e995207a6 | ||
|
|
3492b77aa0 | ||
|
|
e864901035 | ||
|
|
7ee6de6b6a | ||
|
|
914fed4a1a | ||
|
|
6b1e9751a6 | ||
|
|
afa41fa88e | ||
|
|
53010deb8b | ||
|
|
785c33f5a8 | ||
|
|
dbdbe95164 | ||
|
|
5b7720fe65 | ||
|
|
332369a910 | ||
|
|
b92d3dd7ae | ||
|
|
91c943263e | ||
|
|
3a0419703d | ||
|
|
47011c8e07 | ||
|
|
a0035f6258 | ||
|
|
528ae085e6 | ||
|
|
553b8ccf6b | ||
|
|
bceef0b861 | ||
|
|
53cce6c6bb | ||
|
|
b95047d09f | ||
|
|
c6cb4375f5 | ||
|
|
a07e2b8eda | ||
|
|
98e7002167 | ||
|
|
3428dde3c6 | ||
|
|
13d48f982b | ||
|
|
b2e4dc27e4 | ||
|
|
deddeab049 | ||
|
|
c3a6410822 | ||
|
|
c5915091aa | ||
|
|
4401f0659e | ||
|
|
a0c72d32e8 | ||
|
|
1493045ec4 | ||
|
|
210efb2be7 | ||
|
|
a02fc1de63 | ||
|
|
7755bfc861 | ||
|
|
01172bca77 | ||
|
|
143cbc8587 | ||
|
|
b65f655a8a | ||
|
|
ed04c86369 | ||
|
|
c0eaa17eb3 | ||
|
|
6383a55038 | ||
|
|
574df60d58 | ||
|
|
61ee575cd3 | ||
|
|
bdd963081e | ||
|
|
6b908d7a14 | ||
|
|
7d0d70c094 | ||
|
|
e75c5a9248 | ||
|
|
b8ed5f4f1a | ||
|
|
660d7060e4 | ||
|
|
79c5f57714 | ||
|
|
606d8fbe55 | ||
|
|
edfa116a40 | ||
|
|
0ef51011d4 | ||
|
|
0b6796cad9 | ||
|
|
55ca0c712f | ||
|
|
16bef488ee | ||
|
|
82d784d9f8 | ||
|
|
103fb2dfc1 | ||
|
|
bba3e1810b | ||
|
|
af5333f63e | ||
|
|
ea77a5fb53 | ||
|
|
a4aef0894b | ||
|
|
bab7972518 | ||
|
|
88853a7aee | ||
|
|
d3339df853 | ||
|
|
385614b448 | ||
|
|
c47ba80f5d | ||
|
|
6de0700f49 | ||
|
|
d9fe52b1a1 | ||
|
|
ccfc476ec0 | ||
|
|
f518b3c48b | ||
|
|
81d52db722 | ||
|
|
df9973da99 | ||
|
|
ca4c779c66 | ||
|
|
7897352175 | ||
|
|
e0e75eac33 | ||
|
|
31d83dd26e | ||
|
|
698a0b811f | ||
|
|
f69609b403 | ||
|
|
56259e3476 | ||
|
|
f3dfa53f31 | ||
|
|
e10d60c08e | ||
|
|
ad4037351f | ||
|
|
f9e1da8c9f | ||
|
|
2f05137af7 | ||
|
|
c305e31c2e | ||
|
|
a55fabe4f9 | ||
|
|
c58848b298 | ||
|
|
ede644d3c4 | ||
|
|
4ff98e62a9 | ||
|
|
e87fd2fff6 | ||
|
|
33e8b10579 | ||
|
|
d11780f62d | ||
|
|
7706aa0bf0 | ||
|
|
cf96e10552 | ||
|
|
1d01e1e6cd | ||
|
|
a5c4759662 | ||
|
|
e7ff1d693b | ||
|
|
9b4354a057 | ||
|
|
51a46ba92c | ||
|
|
31c4e0d59f | ||
|
|
6b246548c3 | ||
|
|
57dda3843a | ||
|
|
b04ac14751 | ||
|
|
5ad8497db2 | ||
|
|
672f07a5ee | ||
|
|
aceffafc4e | ||
|
|
891b3183ed | ||
|
|
26dd066280 | ||
|
|
157ebdb5fe | ||
|
|
1a18839f82 | ||
|
|
e7f8e7628f | ||
|
|
07190571a1 | ||
|
|
f04d922fca | ||
|
|
7fa382d4e9 | ||
|
|
97766710c0 | ||
|
|
994ee060a7 | ||
|
|
589c27fdcf | ||
|
|
37a018fda4 | ||
|
|
f49381d1c5 | ||
|
|
573095bbad | ||
|
|
0fdcc8e288 | ||
|
|
03d7e26c3d | ||
|
|
3a5cd835ad | ||
|
|
47a8f081e9 | ||
|
|
ad8d691c11 | ||
|
|
8186696e62 | ||
|
|
183ec22923 | ||
|
|
5376995350 | ||
|
|
acb6e30fad | ||
|
|
fe0dabb177 | ||
|
|
194ae46ce8 | ||
|
|
2e9f1bfe90 | ||
|
|
a82adc4948 | ||
|
|
6440c70a38 | ||
|
|
748eb07c9a | ||
|
|
5be2f591d2 | ||
|
|
f2e4950e89 | ||
|
|
7444c5b826 | ||
|
|
5f6cca68cc | ||
|
|
3d33e5351b | ||
|
|
c6e245450d | ||
|
|
36854a16b7 | ||
|
|
b4ee8229ee | ||
|
|
cf0a3841e8 | ||
|
|
3ebd2257f8 | ||
|
|
844d1967cc | ||
|
|
dac37f8938 | ||
|
|
dd74bc7c2b | ||
|
|
7eec58a834 | ||
|
|
da81998c71 | ||
|
|
d1552e7b71 | ||
|
|
c64e10083b | ||
|
|
43e2be58da | ||
|
|
63b60d2546 | ||
|
|
91ddc709eb | ||
|
|
1bcb67ffb9 | ||
|
|
976177c244 | ||
|
|
a37c81a142 | ||
|
|
58de3a35a0 | ||
|
|
44b8a8a0d8 | ||
|
|
b0f5f4338f | ||
|
|
6457847633 | ||
|
|
69d47a5e53 | ||
|
|
02177a7794 | ||
|
|
65c15126f1 | ||
|
|
76c78b8e63 | ||
|
|
f63342ff0f | ||
|
|
e3410cf34c | ||
|
|
7a129047e7 | ||
|
|
343716b7da | ||
|
|
1687fb9120 | ||
|
|
3e89057c23 | ||
|
|
774587efa6 | ||
|
|
2dc8bf321e | ||
|
|
992813d770 | ||
|
|
46882dee93 | ||
|
|
8bbb7b540f | ||
|
|
f5f1ab036d | ||
|
|
f15d556c05 | ||
|
|
570a664db8 | ||
|
|
52f69324d9 | ||
|
|
ea6016b1ba | ||
|
|
30fcffd63c | ||
|
|
50446bbde4 | ||
|
|
b307033aab | ||
|
|
3e5985833c | ||
|
|
8421f02aab | ||
|
|
b6daafec17 | ||
|
|
fc058b669e | ||
|
|
99214b98b9 | ||
|
|
ab35a44ed9 | ||
|
|
125b82a5bb | ||
|
|
f294ea157f | ||
|
|
486ae052ef | ||
|
|
53b5442dad | ||
|
|
507c5f75bd | ||
|
|
0fb72c579e | ||
|
|
c5d6ac63c5 | ||
|
|
a934c76263 | ||
|
|
0098c3bbc0 | ||
|
|
f3eedc03e6 | ||
|
|
17c71a2528 | ||
|
|
d2ecbd7c6e | ||
|
|
2ce7dc0c37 | ||
|
|
b648424c18 | ||
|
|
301754c857 | ||
|
|
c9a3c4c9b8 | ||
|
|
ce0c8b363a | ||
|
|
9d6c38004c | ||
|
|
19a58cc8c6 | ||
|
|
d855c39da2 | ||
|
|
03f4bfecc1 | ||
|
|
c8d9e4c7b3 | ||
|
|
cb2b8f2e7c | ||
|
|
0272dd4c24 | ||
|
|
3b327937c2 | ||
|
|
f8f2f17184 | ||
|
|
2efaebcf89 | ||
|
|
150c695979 | ||
|
|
6fe87ab05a | ||
|
|
f6613a5555 | ||
|
|
947d5c2739 | ||
|
|
1544706ff4 | ||
|
|
e121d1a8a1 | ||
|
|
badbdbf03f | ||
|
|
3b5495b53a | ||
|
|
545027ae64 | ||
|
|
91896433f8 | ||
|
|
a60074fc8a | ||
|
|
eb82aa14bb | ||
|
|
cb4b640730 | ||
|
|
266d9a3c71 | ||
|
|
7a5a704a15 | ||
|
|
29ed8de935 | ||
|
|
3418cab5de | ||
|
|
e2ce015d49 | ||
|
|
0d0ab3f414 | ||
|
|
22b5bcc7e1 | ||
|
|
34d5d73d7e | ||
|
|
7ae4441731 | ||
|
|
d0b7f6203c | ||
|
|
3757f3ae57 | ||
|
|
8f9366da5a | ||
|
|
b8e55f87a9 | ||
|
|
b469f70e02 | ||
|
|
6df69b24db | ||
|
|
0133a5eb23 | ||
|
|
86712c2c48 | ||
|
|
5195caa3c6 | ||
|
|
684ad38d4b | ||
|
|
c6d292a3d7 | ||
|
|
246414a735 | ||
|
|
429bcffaf8 | ||
|
|
d92e7b138c | ||
|
|
cd51ad2a25 | ||
|
|
8732825404 | ||
|
|
fc37cdcc95 | ||
|
|
2435ec9515 | ||
|
|
623fab8ea8 | ||
|
|
e063345c4b | ||
|
|
27533a1dcd | ||
|
|
d232e0e2c6 | ||
|
|
0475489e24 | ||
|
|
34b35db27f | ||
|
|
b47bc12e48 | ||
|
|
4d102dcf68 | ||
|
|
a8c9663200 | ||
|
|
57660cc5af | ||
|
|
c459e918af | ||
|
|
962abba1b2 | ||
|
|
5297d18f92 | ||
|
|
7853e48a6f | ||
|
|
303d87f69d | ||
|
|
9dcdc9500d | ||
|
|
7723bafff6 | ||
|
|
d74a89c6c1 | ||
|
|
cce443be0b | ||
|
|
81fa3d27bf | ||
|
|
493091cd66 | ||
|
|
c75f5ee961 | ||
|
|
083e0ca2e0 | ||
|
|
79bd89016c | ||
|
|
eca7e38763 | ||
|
|
b5cbfb970f | ||
|
|
74e1cafd9d | ||
|
|
ee7381b67d | ||
|
|
7f93bc305d | ||
|
|
c7931ca69c | ||
|
|
90f06a3289 | ||
|
|
0e344a7e02 | ||
|
|
3f91a4e908 | ||
|
|
fb443c58ab | ||
|
|
b233514b58 | ||
|
|
11615171d1 | ||
|
|
2df4738af2 | ||
|
|
9e62f5bd52 | ||
|
|
80349ae8ee | ||
|
|
06d51f2648 | ||
|
|
fcc810f703 | ||
|
|
d6d70e1525 | ||
|
|
e5f79e061c | ||
|
|
ad3c0a1ffd | ||
|
|
2ef935198a | ||
|
|
dc3b9c648a | ||
|
|
2d610d40b6 | ||
|
|
d2c686f48b | ||
|
|
5cafec3262 | ||
|
|
580c42d167 | ||
|
|
dcfec35e57 | ||
|
|
701bac6e11 | ||
|
|
0c46d593d8 | ||
|
|
b867de0667 | ||
|
|
e207b75c7a | ||
|
|
fc3df5bfe4 | ||
|
|
dfb05b9d39 | ||
|
|
19702daecd | ||
|
|
dde4b4df3b | ||
|
|
c070930a8c | ||
|
|
d36b5f7c59 | ||
|
|
0e517907ce | ||
|
|
739e9716ab | ||
|
|
0e5972d895 | ||
|
|
71975658ca | ||
|
|
6572e29a64 | ||
|
|
41b21c2a0c | ||
|
|
2b19d2e6de | ||
|
|
f99aa3459c | ||
|
|
5bce9d5abf | ||
|
|
abe102649e | ||
|
|
424fcdc63a | ||
|
|
a3fd451c74 | ||
|
|
731fd113d2 | ||
|
|
c9ca1bda5c | ||
|
|
58ea822050 | ||
|
|
671484d6f9 | ||
|
|
e6e74194bc | ||
|
|
04432c8368 | ||
|
|
6782876c0c | ||
|
|
4b09e92d7c | ||
|
|
3266f64fb9 | ||
|
|
2a9886e698 | ||
|
|
1319e3a811 | ||
|
|
6cbb40f874 | ||
|
|
07fd6a3ad4 | ||
|
|
8891869013 | ||
|
|
04fc735e12 | ||
|
|
7b9860f1be | ||
|
|
38f26a2bd8 | ||
|
|
a9750f8cff | ||
|
|
ad86e7f34a | ||
|
|
496435ef3b | ||
|
|
5275b31e7e | ||
|
|
e341991703 | ||
|
|
fb65496507 | ||
|
|
abe52ba440 | ||
|
|
ee5d097201 | ||
|
|
0ea182d04f | ||
|
|
8d737c96c9 | ||
|
|
5c93b90c2e | ||
|
|
41bee850da | ||
|
|
416c2a9e9d | ||
|
|
8fa9fccc79 | ||
|
|
c5a4071a06 | ||
|
|
930e48ad39 | ||
|
|
868678f321 | ||
|
|
8530b6512c | ||
|
|
2a5f487e5f | ||
|
|
141f6c51dc | ||
|
|
1fc9492b30 | ||
|
|
65782d3d75 | ||
|
|
b5cb6dfb9d | ||
|
|
6667e4b8bc | ||
|
|
5e2492a930 | ||
|
|
4f07372e0f | ||
|
|
80a1a97083 | ||
|
|
204476c55d | ||
|
|
8fab258778 | ||
|
|
12059955e5 | ||
|
|
3ca1f957ba | ||
|
|
b11362aec1 | ||
|
|
75630df10e | ||
|
|
4d93abb7ac | ||
|
|
731943f980 | ||
|
|
265dc1f296 | ||
|
|
c449ffcc98 | ||
|
|
34500d32d0 | ||
|
|
d3e5dfc346 | ||
|
|
8ed11107eb | ||
|
|
2f51108783 | ||
|
|
2667a66419 | ||
|
|
0fd073f2f0 | ||
|
|
840cf4e00a | ||
|
|
d5d99f94b7 | ||
|
|
dea19e4416 | ||
|
|
f7612d7398 | ||
|
|
e39182607e | ||
|
|
79f1febbce | ||
|
|
120def9676 | ||
|
|
82562bc20d | ||
|
|
1c51361120 | ||
|
|
c07e79deb7 | ||
|
|
81cb1111b4 | ||
|
|
369307181e | ||
|
|
7881e04e6b | ||
|
|
66a72eb1be | ||
|
|
ad77f11859 | ||
|
|
96d177876f | ||
|
|
dc7392f86b | ||
|
|
6f6252b6f8 | ||
|
|
20b32df2c6 | ||
|
|
d413d02bf7 | ||
|
|
426c0366cc | ||
|
|
d3d3655580 | ||
|
|
d4a011ee6d | ||
|
|
b08118734e | ||
|
|
41ee6de784 | ||
|
|
139d2e6be8 | ||
|
|
a866461b0a | ||
|
|
6f61331d46 | ||
|
|
7731ca9fb2 | ||
|
|
3de0c4f5d8 | ||
|
|
2e602f8861 | ||
|
|
1a7d92a082 | ||
|
|
5aa2a0c821 | ||
|
|
4f2328b8dc | ||
|
|
e929e524a3 | ||
|
|
e6b9f18d3d | ||
|
|
7f197ef84e | ||
|
|
a9d7ca3332 | ||
|
|
a65e586de5 | ||
|
|
7072a50060 | ||
|
|
fc1a367c2e | ||
|
|
3b376d85d4 | ||
|
|
9aca8438a2 | ||
|
|
c2d37dfb61 | ||
|
|
3c3bd0f0ea | ||
|
|
958db336b7 | ||
|
|
342d570b3b | ||
|
|
67457c25df | ||
|
|
a98d46f8a8 | ||
|
|
b2fca84b15 | ||
|
|
2e31169738 | ||
|
|
4cda2c8093 | ||
|
|
73b4e8a988 | ||
|
|
82dbfb4379 | ||
|
|
0e2ff2390a | ||
|
|
220d5db739 | ||
|
|
212d475f50 | ||
|
|
b7fbd0433f | ||
|
|
d28dd96aa0 | ||
|
|
0e46f91c51 | ||
|
|
d6dabacb05 | ||
|
|
4363473955 | ||
|
|
7e5fd4e290 | ||
|
|
191dfbe1bd | ||
|
|
c30a0cd4f1 | ||
|
|
8b06822092 | ||
|
|
98d56a38f5 | ||
|
|
e4bef0e3f4 | ||
|
|
f26e95e7c9 | ||
|
|
c755a4d8b6 | ||
|
|
f39e1a9b70 | ||
|
|
1d5b531ba3 | ||
|
|
a90bd08405 | ||
|
|
1cbb726cab | ||
|
|
ce61d00dcf | ||
|
|
2d92b798c6 | ||
|
|
cc62164a7c | ||
|
|
af510bce93 | ||
|
|
4ba60bedcd | ||
|
|
583bf26129 | ||
|
|
d8c3623141 | ||
|
|
2cd0875da6 | ||
|
|
73d0848f7e | ||
|
|
d757e82e3f | ||
|
|
007238e7dd | ||
|
|
944e019020 | ||
|
|
634f8897b4 | ||
|
|
7651d31c50 | ||
|
|
1702873ab1 | ||
|
|
44e7d5249c | ||
|
|
8ab37040db | ||
|
|
ac203b0ccb | ||
|
|
557546c9c3 | ||
|
|
09c5baa899 | ||
|
|
ea6506f9f4 | ||
|
|
5dd7e548c0 | ||
|
|
b0928f3601 | ||
|
|
52a94dbe78 | ||
|
|
f4ffc19981 | ||
|
|
ac3c117b03 | ||
|
|
1ac008ab02 | ||
|
|
78ff158cb5 | ||
|
|
02b42e4dbb | ||
|
|
82083827ff | ||
|
|
571ea6fbc9 | ||
|
|
8af4a67f5e | ||
|
|
58ac86e3bf | ||
|
|
2bc6c77fce | ||
|
|
1daf06858b | ||
|
|
a4e8ce7f01 | ||
|
|
87d9f09f72 | ||
|
|
ed6e16cdce | ||
|
|
57bb92a36c | ||
|
|
142540e263 | ||
|
|
5a17430747 | ||
|
|
23c84a9e96 | ||
|
|
6bb9dcc216 | ||
|
|
1901e4dbdc | ||
|
|
1657f769da | ||
|
|
c82eb489fe | ||
|
|
9f05befd70 | ||
|
|
f274ed3fd8 | ||
|
|
f6e027abcb | ||
|
|
a92114a854 | ||
|
|
ffb84705d3 | ||
|
|
2f8366b6f9 | ||
|
|
a6f062c126 | ||
|
|
41c24f3bc9 | ||
|
|
af40bdb11b | ||
|
|
00a69e6aed | ||
|
|
04b2d784ce | ||
|
|
a5de51b039 | ||
|
|
4a80e9f20f | ||
|
|
8676769a8f | ||
|
|
2f8c7a81ca | ||
|
|
ac11af6048 | ||
|
|
7c558802a4 | ||
|
|
5a516aa1ad | ||
|
|
4d1b6ed974 | ||
|
|
e8e6bb0499 | ||
|
|
58f94666d1 | ||
|
|
085efaa605 | ||
|
|
6028e392f0 | ||
|
|
fa67dd74a0 | ||
|
|
cb734b50c3 | ||
|
|
087e58b88b | ||
|
|
78b9d67aaa | ||
|
|
a6015e4647 | ||
|
|
fcbe95447a | ||
|
|
760fe392a8 | ||
|
|
5dab606980 | ||
|
|
c265575dfd | ||
|
|
4a1f526ac6 | ||
|
|
497b633661 | ||
|
|
c7f54a98e0 | ||
|
|
7da8c20409 | ||
|
|
116328c7bf | ||
|
|
bd68fef4a2 | ||
|
|
7759d56ad3 | ||
|
|
9c7020a369 | ||
|
|
f8c1903316 | ||
|
|
652423ad14 |
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -1,191 +0,0 @@
|
||||
/* include/curl/curlbuild.h. Generated from curlbuild.h.in by configure. */
|
||||
#ifndef __CURL_CURLBUILD_H
|
||||
#define __CURL_CURLBUILD_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* ================================================================ */
|
||||
/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* NOTE 1:
|
||||
* -------
|
||||
*
|
||||
* Nothing in this file is intended to be modified or adjusted by the
|
||||
* curl library user nor by the curl library builder.
|
||||
*
|
||||
* If you think that something actually needs to be changed, adjusted
|
||||
* or fixed in this file, then, report it on the libcurl development
|
||||
* mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
|
||||
*
|
||||
* This header file shall only export symbols which are 'curl' or 'CURL'
|
||||
* prefixed, otherwise public name space would be polluted.
|
||||
*
|
||||
* NOTE 2:
|
||||
* -------
|
||||
*
|
||||
* Right now you might be staring at file include/curl/curlbuild.h.in or
|
||||
* at file include/curl/curlbuild.h, this is due to the following reason:
|
||||
*
|
||||
* On systems capable of running the configure script, the configure process
|
||||
* will overwrite the distributed include/curl/curlbuild.h file with one that
|
||||
* is suitable and specific to the library being configured and built, which
|
||||
* is generated from the include/curl/curlbuild.h.in template file.
|
||||
*
|
||||
*/
|
||||
|
||||
/* ================================================================ */
|
||||
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
|
||||
/* ================================================================ */
|
||||
|
||||
#ifdef CURL_SIZEOF_LONG
|
||||
# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||
# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SIZEOF_CURL_SOCKLEN_T
|
||||
# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_OFF_T
|
||||
# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_CURL_OFF_T
|
||||
# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_CURL_OFF_TU
|
||||
# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_FORMAT_OFF_T
|
||||
# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SIZEOF_CURL_OFF_T
|
||||
# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SUFFIX_CURL_OFF_T
|
||||
# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined
|
||||
#endif
|
||||
|
||||
#ifdef CURL_SUFFIX_CURL_OFF_TU
|
||||
# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
|
||||
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined
|
||||
#endif
|
||||
|
||||
/* ================================================================ */
|
||||
/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
|
||||
/* ================================================================ */
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file ws2tcpip.h must be included by the external interface. */
|
||||
#define CURL_PULL_WS2TCPIP_H 1
|
||||
#ifdef CURL_PULL_WS2TCPIP_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file sys/types.h must be included by the external interface. */
|
||||
#define CURL_PULL_SYS_TYPES_H 1
|
||||
#ifdef CURL_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file stdint.h must be included by the external interface. */
|
||||
#define CURL_PULL_STDINT_H 1
|
||||
#ifdef CURL_PULL_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file inttypes.h must be included by the external interface. */
|
||||
#define CURL_PULL_INTTYPES_H 1
|
||||
#ifdef CURL_PULL_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
/* Configure process defines this to 1 when it finds out that system */
|
||||
/* header file sys/socket.h must be included by the external interface. */
|
||||
/* #undef CURL_PULL_SYS_SOCKET_H */
|
||||
#ifdef CURL_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#define CURL_SIZEOF_LONG 4
|
||||
|
||||
/* Integral data type used for curl_socklen_t. */
|
||||
#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
|
||||
/* The size of `curl_socklen_t', as computed by sizeof. */
|
||||
#define CURL_SIZEOF_CURL_SOCKLEN_T 4
|
||||
|
||||
/* Data type definition of curl_socklen_t. */
|
||||
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
|
||||
|
||||
/* Signed integral data type used for curl_off_t. */
|
||||
#define CURL_TYPEOF_CURL_OFF_T int64_t
|
||||
|
||||
/* Data type definition of curl_off_t. */
|
||||
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
|
||||
|
||||
/* curl_off_t formatting string directive without "%" conversion specifier. */
|
||||
#define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
|
||||
/* unsigned curl_off_t formatting string without "%" conversion specifier. */
|
||||
#define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
|
||||
/* curl_off_t formatting string directive with "%" conversion specifier. */
|
||||
#define CURL_FORMAT_OFF_T "%I64d"
|
||||
|
||||
/* The size of `curl_off_t', as computed by sizeof. */
|
||||
#define CURL_SIZEOF_CURL_OFF_T 8
|
||||
|
||||
/* curl_off_t constant suffix. */
|
||||
#define CURL_SUFFIX_CURL_OFF_T LL
|
||||
|
||||
/* unsigned curl_off_t constant suffix. */
|
||||
#define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
|
||||
#endif /* __CURL_CURLBUILD_H */
|
||||
@@ -1,261 +0,0 @@
|
||||
#ifndef __CURL_CURLRULES_H
|
||||
#define __CURL_CURLRULES_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* ================================================================ */
|
||||
/* COMPILE TIME SANITY CHECKS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* NOTE 1:
|
||||
* -------
|
||||
*
|
||||
* All checks done in this file are intentionally placed in a public
|
||||
* header file which is pulled by curl/curl.h when an application is
|
||||
* being built using an already built libcurl library. Additionally
|
||||
* this file is also included and used when building the library.
|
||||
*
|
||||
* If compilation fails on this file it is certainly sure that the
|
||||
* problem is elsewhere. It could be a problem in the curlbuild.h
|
||||
* header file, or simply that you are using different compilation
|
||||
* settings than those used to build the library.
|
||||
*
|
||||
* Nothing in this file is intended to be modified or adjusted by the
|
||||
* curl library user nor by the curl library builder.
|
||||
*
|
||||
* Do not deactivate any check, these are done to make sure that the
|
||||
* library is properly built and used.
|
||||
*
|
||||
* You can find further help on the libcurl development mailing list:
|
||||
* http://cool.haxx.se/mailman/listinfo/curl-library/
|
||||
*
|
||||
* NOTE 2
|
||||
* ------
|
||||
*
|
||||
* Some of the following compile time checks are based on the fact
|
||||
* that the dimension of a constant array can not be a negative one.
|
||||
* In this way if the compile time verification fails, the compilation
|
||||
* will fail issuing an error. The error description wording is compiler
|
||||
* dependent but it will be quite similar to one of the following:
|
||||
*
|
||||
* "negative subscript or subscript is too large"
|
||||
* "array must have at least one element"
|
||||
* "-1 is an illegal array size"
|
||||
* "size of array is negative"
|
||||
*
|
||||
* If you are building an application which tries to use an already
|
||||
* built libcurl library and you are getting this kind of errors on
|
||||
* this file, it is a clear indication that there is a mismatch between
|
||||
* how the library was built and how you are trying to use it for your
|
||||
* application. Your already compiled or binary library provider is the
|
||||
* only one who can give you the details you need to properly use it.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Verify that some macros are actually defined.
|
||||
*/
|
||||
|
||||
#ifndef CURL_SIZEOF_LONG
|
||||
# error "CURL_SIZEOF_LONG definition is missing!"
|
||||
Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||
# error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!"
|
||||
Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_SIZEOF_CURL_SOCKLEN_T
|
||||
# error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!"
|
||||
Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_TYPEOF_CURL_OFF_T
|
||||
# error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
|
||||
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_FORMAT_CURL_OFF_T
|
||||
# error "CURL_FORMAT_CURL_OFF_T definition is missing!"
|
||||
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_FORMAT_CURL_OFF_TU
|
||||
# error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
|
||||
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_FORMAT_OFF_T
|
||||
# error "CURL_FORMAT_OFF_T definition is missing!"
|
||||
Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_SIZEOF_CURL_OFF_T
|
||||
# error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
|
||||
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_SUFFIX_CURL_OFF_T
|
||||
# error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
|
||||
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
|
||||
#endif
|
||||
|
||||
#ifndef CURL_SUFFIX_CURL_OFF_TU
|
||||
# error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
|
||||
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros private to this header file.
|
||||
*/
|
||||
|
||||
#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
|
||||
|
||||
#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
|
||||
|
||||
/*
|
||||
* Verify that the size previously defined and expected for long
|
||||
* is the same as the one reported by sizeof() at compile time.
|
||||
*/
|
||||
|
||||
typedef char
|
||||
__curl_rule_01__
|
||||
[CurlchkszEQ(long, CURL_SIZEOF_LONG)];
|
||||
|
||||
/*
|
||||
* Verify that the size previously defined and expected for
|
||||
* curl_off_t is actually the the same as the one reported
|
||||
* by sizeof() at compile time.
|
||||
*/
|
||||
|
||||
typedef char
|
||||
__curl_rule_02__
|
||||
[CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
|
||||
|
||||
/*
|
||||
* Verify at compile time that the size of curl_off_t as reported
|
||||
* by sizeof() is greater or equal than the one reported for long
|
||||
* for the current compilation.
|
||||
*/
|
||||
|
||||
typedef char
|
||||
__curl_rule_03__
|
||||
[CurlchkszGE(curl_off_t, long)];
|
||||
|
||||
/*
|
||||
* Verify that the size previously defined and expected for
|
||||
* curl_socklen_t is actually the the same as the one reported
|
||||
* by sizeof() at compile time.
|
||||
*/
|
||||
|
||||
typedef char
|
||||
__curl_rule_04__
|
||||
[CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];
|
||||
|
||||
/*
|
||||
* Verify at compile time that the size of curl_socklen_t as reported
|
||||
* by sizeof() is greater or equal than the one reported for int for
|
||||
* the current compilation.
|
||||
*/
|
||||
|
||||
typedef char
|
||||
__curl_rule_05__
|
||||
[CurlchkszGE(curl_socklen_t, int)];
|
||||
|
||||
/* ================================================================ */
|
||||
/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
|
||||
/* ================================================================ */
|
||||
|
||||
/*
|
||||
* CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
|
||||
* these to be visible and exported by the external libcurl interface API,
|
||||
* while also making them visible to the library internals, simply including
|
||||
* setup.h, without actually needing to include curl.h internally.
|
||||
* If some day this section would grow big enough, all this should be moved
|
||||
* to its own header file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Figure out if we can use the ## preprocessor operator, which is supported
|
||||
* by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
|
||||
* or __cplusplus so we need to carefully check for them too.
|
||||
*/
|
||||
|
||||
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
|
||||
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
|
||||
defined(__ILEC400__)
|
||||
/* This compiler is believed to have an ISO compatible preprocessor */
|
||||
#define CURL_ISOCPP
|
||||
#else
|
||||
/* This compiler is believed NOT to have an ISO compatible preprocessor */
|
||||
#undef CURL_ISOCPP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
|
||||
# define __CURL_OFF_T_C_HLPR2(x) x
|
||||
# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
|
||||
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
|
||||
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
|
||||
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
|
||||
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
|
||||
#else
|
||||
# ifdef CURL_ISOCPP
|
||||
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
|
||||
# else
|
||||
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
|
||||
# endif
|
||||
# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
|
||||
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
|
||||
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get rid of macros private to this header file.
|
||||
*/
|
||||
|
||||
#undef CurlchkszEQ
|
||||
#undef CurlchkszGE
|
||||
|
||||
/*
|
||||
* Get rid of macros not intended to exist beyond this point.
|
||||
*/
|
||||
|
||||
#undef CURL_PULL_WS2TCPIP_H
|
||||
#undef CURL_PULL_SYS_TYPES_H
|
||||
#undef CURL_PULL_SYS_SOCKET_H
|
||||
#undef CURL_PULL_STDINT_H
|
||||
#undef CURL_PULL_INTTYPES_H
|
||||
|
||||
#undef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||
#undef CURL_TYPEOF_CURL_OFF_T
|
||||
|
||||
#ifdef CURL_NO_OLDIES
|
||||
#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */
|
||||
#endif
|
||||
|
||||
#endif /* __CURL_CURLRULES_H */
|
||||
@@ -1 +0,0 @@
|
||||
/* not used */
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+36
-24
@@ -4,7 +4,7 @@ project(libgme)
|
||||
include (CheckCXXCompilerFlag)
|
||||
|
||||
# When version is changed, also change the one in gme/gme.h to match
|
||||
set(GME_VERSION 0.6.2 CACHE INTERNAL "libgme Version")
|
||||
set(GME_VERSION 0.6.3 CACHE INTERNAL "libgme Version")
|
||||
|
||||
# 2.6+ always assumes FATAL_ERROR, but 2.4 and below don't.
|
||||
# Of course, 2.4 might work, in which case you're welcome to drop
|
||||
@@ -48,10 +48,18 @@ if (NOT DEFINED USE_GME_SPC)
|
||||
SET(USE_GME_SPC 1 CACHE BOOL "Enable SNES SPC music emulation")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED GME_SPC_ISOLATED_ECHO_BUFFER)
|
||||
option(GME_SPC_ISOLATED_ECHO_BUFFER "Enable isolated echo buffer on SPC emulator to allow correct playing of \"dodgy\" SPC files made for various ROM hacks ran on ZSNES" OFF)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED USE_GME_VGM)
|
||||
SET(USE_GME_VGM 1 CACHE BOOL "Enable Sega VGM/VGZ music emulation")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED GME_YM2612_EMU)
|
||||
SET(GME_YM2612_EMU "Nuked" CACHE STRING "Which YM2612 emulator to use: \"Nuked\" (LGPLv2.1+), \"MAME\" (GPLv2+), or \"GENS\" (LGPLv2.1+)")
|
||||
endif()
|
||||
|
||||
if (USE_GME_NSFE AND NOT USE_GME_NSF)
|
||||
MESSAGE(" -- NSFE support requires NSF, enabling NSF support. --")
|
||||
SET(USE_GME_NSF 1 CACHE BOOL "Enable NES NSF music emulation" FORCE)
|
||||
@@ -59,32 +67,36 @@ endif()
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared library (set to OFF for static library)" ON)
|
||||
|
||||
# Check for GCC "visibility" support.
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
check_cxx_compiler_flag (-fvisibility=hidden __LIBGME_TEST_VISIBILITY)
|
||||
set (ENABLE_VISIBILITY OFF)
|
||||
if (__LIBGME_TEST_VISIBILITY)
|
||||
# get the gcc version
|
||||
exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
|
||||
string (REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
|
||||
option(ENABLE_UBSAN "Enable Undefined Behavior Sanitizer error-checking" ON)
|
||||
|
||||
# gcc <4.1 had poor support for symbol visibility
|
||||
if ((${_gcc_version} VERSION_GREATER "4.1") OR (${_gcc_version} VERSION_EQUAL "4.1"))
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||
set (ENABLE_VISIBILITY ON)
|
||||
add_definitions (-DLIBGME_VISIBILITY)
|
||||
option(BUILD_FRAMEWORK "Build framework instead of dylib (on macOS)" OFF)
|
||||
|
||||
# GCC >= 4.2 also correctly supports making inline members have hidden
|
||||
# visibility by default.
|
||||
if ((${_gcc_version} VERSION_GREATER "4.2") OR (${_gcc_version} VERSION_EQUAL "4.2"))
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
|
||||
endif()
|
||||
endif()
|
||||
endif() # test visibility
|
||||
# Check for GCC/Clang "visibility" support.
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
|
||||
OR
|
||||
CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
# Cache this result
|
||||
set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for hidden visibility")
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -W -Wextra")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
# Assume we have visibility support on any compiler that supports C++11
|
||||
add_definitions (-DLIBGME_VISIBILITY)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
|
||||
# Try to protect against undefined behavior from signed integer overflow
|
||||
# This has caused miscompilation of code already and there are other
|
||||
# potential uses; see https://bitbucket.org/mpyne/game-music-emu/issues/18/
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fwrapv")
|
||||
|
||||
if (ENABLE_UBSAN)
|
||||
# GCC needs -static-libubsan
|
||||
if (NOT BUILD_SHARED_LIBS AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -static-libubsan")
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Shared library defined here
|
||||
add_subdirectory(gme)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Game_Music_Emu Change Log
|
||||
-------------------------
|
||||
|
||||
Please see the git version history (e.g. git shortlog tags/0.6.0..tags/0.6.1)
|
||||
for the accurate change log.
|
||||
Game_Music_Emu Change Log
|
||||
-------------------------
|
||||
|
||||
Please see the git version history (e.g. git shortlog tags/0.6.0..tags/0.6.1)
|
||||
for the accurate change log.
|
||||
+194
-194
@@ -1,194 +1,194 @@
|
||||
Game_Music_Emu 0.6.0 Design
|
||||
---------------------------
|
||||
This might be slightly out-of-date at times, but will be a big help in
|
||||
understanding the library implementation.
|
||||
|
||||
|
||||
Architecture
|
||||
------------
|
||||
The library is essentially a bunch of independent game music file
|
||||
emulators unified with a common interface.
|
||||
|
||||
Gme_File and Music_Emu provide a common interface to the emulators. The
|
||||
virtual functions are protected rather than public to allow pre- and
|
||||
post-processing of arguments and data in one place. This allows the
|
||||
emulator classes to assume that everything is set up properly when
|
||||
starting a track and playing samples.
|
||||
|
||||
All file input is done with the Data_Reader interface. Many derived
|
||||
classes are present, for the usual disk-based file and block of memory,
|
||||
to specialized adaptors for things like reading a subset of data or
|
||||
combining a block of memory with a Data_Reader to the remaining data.
|
||||
This makes the library much more flexible with regard to the source of
|
||||
game music file data. I still added a specialized load_mem() function to
|
||||
have the emulator keep a pointer to data already read in memory, for
|
||||
those formats whose files can be absolutely huge (GYM, some VGMs). This
|
||||
is important if for some reason the caller must load the data ahead of
|
||||
time, but doesn't want the emulator needlessly making a copy.
|
||||
|
||||
Since silence checking and fading are relatively complex, they are kept
|
||||
separate from basic file loading and track information, which are
|
||||
handled in the base class Gme_File. My original intent was to use
|
||||
Gme_File as the common base class for full emulators and track
|
||||
information-only readers, but implementing the C interface was much
|
||||
simpler if both derived from Music_Emu. User C++ code can still benefit
|
||||
from static checking by using Gme_File where only track information will
|
||||
be accessed.
|
||||
|
||||
Each emulator generally has three components: main emulator, CPU
|
||||
emulator, and sound chip emulator(s). Each component has minimal
|
||||
coupling, so use in a full emulator or stand alone is fairly easy. This
|
||||
modularity really helps reduce complexity. Blip_Buffer helps a lot with
|
||||
simplifying the APU interfaces and implementation.
|
||||
|
||||
The "classic" emulators derive from Classic_Emu, which handles
|
||||
Blip_Buffer filling and multiple channels. It uses Multi_Buffer for
|
||||
output, allowing you to derive a custom buffer that could output each
|
||||
voice to a separate sound channel and do different processing on each.
|
||||
At some point I'm going to implement a better Effects_Buffer that allows
|
||||
individual control of every channel.
|
||||
|
||||
In implementing the C interface, I wanted a way to specify an emulator
|
||||
type that didn't require linking in all the emulators. For each emulator
|
||||
type there is a global object with pointers to functions to create the
|
||||
emulator or a track information reader. The emulator type is thus a
|
||||
pointer to this, which conveniently allows for a NULL value. The user
|
||||
referencing this emulator type object is what ultimately links the
|
||||
emulator in (unless new Foo_Emu is used in C++, of course). This type
|
||||
also serves as a useful substitute for RTTI on older C++ compilers.
|
||||
|
||||
Addendum: I have since added gme_type_list(), which causes all listed
|
||||
emulators to be linked in. To avoid this, I make the list itself
|
||||
editable in blargg_config.h. Having a built-in list allows
|
||||
gme_load_file() to take a path and give back an emulator with the file
|
||||
loaded, which is extremely useful for new users.
|
||||
|
||||
|
||||
Interface conventions
|
||||
----------------------
|
||||
If a function retains a pointer to or replaces the value of an object
|
||||
passed, it takes a pointer so that it will be clear in the caller's
|
||||
source code that care is required.
|
||||
|
||||
Multi-word names have an underscore '_' separator between individual
|
||||
words.
|
||||
|
||||
Functions are named with lowercase words. Functions which perform an
|
||||
action with side-effects are named with a verb phrase (i.e. load, move,
|
||||
run). Functions which return the value of a piece of state are named
|
||||
using a noun phrase (i.e. loaded, moved, running).
|
||||
|
||||
Classes are named with capitalized words. Only the first letter of an
|
||||
acronym is capitalized. Class names are nouns, sometimes suggestive of
|
||||
what they do (i.e. File_Scanner).
|
||||
|
||||
Structure, enumeration, and typedefs to these and built-in types are
|
||||
named using lowercase words with a _t suffix.
|
||||
|
||||
Macros are named with all-uppercase words.
|
||||
|
||||
Internal names which can't be hidden due to technical reasons have an
|
||||
underscore '_' suffix.
|
||||
|
||||
|
||||
Managing Complexity
|
||||
-------------------
|
||||
Complexity has been a factor in most library decisions. Many features
|
||||
have been passed by due to the complexity they would add. Once
|
||||
complexity goes past a certain level, it mentally grasping the library
|
||||
in its entirety, at which point more defects will occur and be hard to
|
||||
find.
|
||||
|
||||
I chose 16-bit signed samples because it seems to be the most common
|
||||
format. Supporting multiple formats would add too much complexity to be
|
||||
worth it. Other formats can be obtained via conversion.
|
||||
|
||||
I've kept interfaces fairly lean, leaving many possible features
|
||||
untapped but easy to add if necessary. For example the classic emulators
|
||||
could have volume and frequency equalization adjusted separately for
|
||||
each channel, since they each have an associated Blip_Synth.
|
||||
|
||||
Source files of 400 lines or less seem to be the best size to limit
|
||||
complexity. In a few cases there is no reasonable way to split longer
|
||||
files, or there is benefit from having the source together in one file.
|
||||
|
||||
|
||||
Preventing Bugs
|
||||
---------------
|
||||
I've done many things to reduce the opportunity for defects. A general
|
||||
principle is to write code so that defects will be as visible as
|
||||
possible. I've used several techniques to achieve this.
|
||||
|
||||
I put assertions at key points where defects seem likely or where
|
||||
corruption due to a defect is likely to be visible. I've also put
|
||||
assertions where violations of the interface are likely. In emulators
|
||||
where I am unsure of exact hardware operation in a particular case, I
|
||||
output a debug-only message noting that this has occurred; many times I
|
||||
haven't implemented a hardware feature because nothing uses it. I've
|
||||
made code brittle where there is no clear reason flexibility; code
|
||||
written to handle every possibility sacrifices quality and reliability
|
||||
to handle vaguely defined situations.
|
||||
|
||||
|
||||
Flexibility through indirection
|
||||
-------------------------------
|
||||
I've tried to allow the most flexibility of modules by using indirection
|
||||
to allow extension by the user. This keeps each module simpler and more
|
||||
focused on its unique task.
|
||||
|
||||
The classic emulators use Multi_Buffer, which potentially allows a
|
||||
separate Blip_Buffer for each channel. This keeps emulators free of
|
||||
typical code to allow output in mono, stereo, panning, etc.
|
||||
|
||||
All emulators use a reader object to access file data, allowing it to be
|
||||
stored in a regular file, compressed archive, memory, or generated
|
||||
on-the-fly. Again, the library can be kept free of the particulars of
|
||||
file access and changes required to support new formats.
|
||||
|
||||
|
||||
Emulators in general
|
||||
--------------------
|
||||
When I wrote the first NES sound emulator, I stored most of the state in
|
||||
an emulator-specific format, with significant redundancy. In the
|
||||
register write function I decoded everything into named variables. I
|
||||
became tired of the verbosity and wanted to more closely model the
|
||||
hardware, so I moved to a style of storing the last written value to
|
||||
each register, along with as little other state as possible, mostly the
|
||||
internal hardware registers. While this involves slightly more
|
||||
recalculation, in most cases the emulation code is of comparable size.
|
||||
It also makes state save/restore (for use in a full emulator) much
|
||||
simpler. Finally, it makes debugging easier since the hardware registers
|
||||
used in emulation are obvious.
|
||||
|
||||
|
||||
CPU Cores
|
||||
---------
|
||||
I've spent lots of time coming up with techniques to optimize the CPU
|
||||
cores. Some of the most important: execute multiple instructions during
|
||||
an emulation call, keep state in local variables to allow register
|
||||
assignment, optimize state representation for most common instructions,
|
||||
defer status flag calculation until actually needed, read program code
|
||||
directly without a call to the memory read function, always pre-fetch
|
||||
the operand byte before decoding instruction, and emulate instructions
|
||||
using common blocks of code.
|
||||
|
||||
I've successfully used Nes_Cpu in a fairly complete NES emulator, and
|
||||
I'd like to make all the CPU emulators suitable for use in emulators. It
|
||||
seems a waste for them to be used only for the small amount of emulation
|
||||
necessary for game music files.
|
||||
|
||||
I debugged the CPU cores by writing a test shell that ran them in
|
||||
parallel with other CPU cores and compared all memory accesses and
|
||||
processor states at each step. This provided good value at little cost.
|
||||
|
||||
The CPU mapping page size is adjustable to allow the best tradeoff
|
||||
between memory/cache usage and handler granularity. The interface allows
|
||||
code to be somewhat independent of the page size.
|
||||
|
||||
I optimize program memory accesses to direct reads rather than calls to
|
||||
the memory read function. My assumption is that it would be difficult to
|
||||
get useful code out of hardware I/O addresses, so no software will
|
||||
intentionally execute out of I/O space. Since the page size can be
|
||||
changed easily, most program memory mapping schemes can be accommodated.
|
||||
This greatly reduces memory access function calls.
|
||||
|
||||
Game_Music_Emu 0.6.0 Design
|
||||
---------------------------
|
||||
This might be slightly out-of-date at times, but will be a big help in
|
||||
understanding the library implementation.
|
||||
|
||||
|
||||
Architecture
|
||||
------------
|
||||
The library is essentially a bunch of independent game music file
|
||||
emulators unified with a common interface.
|
||||
|
||||
Gme_File and Music_Emu provide a common interface to the emulators. The
|
||||
virtual functions are protected rather than public to allow pre- and
|
||||
post-processing of arguments and data in one place. This allows the
|
||||
emulator classes to assume that everything is set up properly when
|
||||
starting a track and playing samples.
|
||||
|
||||
All file input is done with the Data_Reader interface. Many derived
|
||||
classes are present, for the usual disk-based file and block of memory,
|
||||
to specialized adaptors for things like reading a subset of data or
|
||||
combining a block of memory with a Data_Reader to the remaining data.
|
||||
This makes the library much more flexible with regard to the source of
|
||||
game music file data. I still added a specialized load_mem() function to
|
||||
have the emulator keep a pointer to data already read in memory, for
|
||||
those formats whose files can be absolutely huge (GYM, some VGMs). This
|
||||
is important if for some reason the caller must load the data ahead of
|
||||
time, but doesn't want the emulator needlessly making a copy.
|
||||
|
||||
Since silence checking and fading are relatively complex, they are kept
|
||||
separate from basic file loading and track information, which are
|
||||
handled in the base class Gme_File. My original intent was to use
|
||||
Gme_File as the common base class for full emulators and track
|
||||
information-only readers, but implementing the C interface was much
|
||||
simpler if both derived from Music_Emu. User C++ code can still benefit
|
||||
from static checking by using Gme_File where only track information will
|
||||
be accessed.
|
||||
|
||||
Each emulator generally has three components: main emulator, CPU
|
||||
emulator, and sound chip emulator(s). Each component has minimal
|
||||
coupling, so use in a full emulator or stand alone is fairly easy. This
|
||||
modularity really helps reduce complexity. Blip_Buffer helps a lot with
|
||||
simplifying the APU interfaces and implementation.
|
||||
|
||||
The "classic" emulators derive from Classic_Emu, which handles
|
||||
Blip_Buffer filling and multiple channels. It uses Multi_Buffer for
|
||||
output, allowing you to derive a custom buffer that could output each
|
||||
voice to a separate sound channel and do different processing on each.
|
||||
At some point I'm going to implement a better Effects_Buffer that allows
|
||||
individual control of every channel.
|
||||
|
||||
In implementing the C interface, I wanted a way to specify an emulator
|
||||
type that didn't require linking in all the emulators. For each emulator
|
||||
type there is a global object with pointers to functions to create the
|
||||
emulator or a track information reader. The emulator type is thus a
|
||||
pointer to this, which conveniently allows for a NULL value. The user
|
||||
referencing this emulator type object is what ultimately links the
|
||||
emulator in (unless new Foo_Emu is used in C++, of course). This type
|
||||
also serves as a useful substitute for RTTI on older C++ compilers.
|
||||
|
||||
Addendum: I have since added gme_type_list(), which causes all listed
|
||||
emulators to be linked in. To avoid this, I make the list itself
|
||||
editable in blargg_config.h. Having a built-in list allows
|
||||
gme_load_file() to take a path and give back an emulator with the file
|
||||
loaded, which is extremely useful for new users.
|
||||
|
||||
|
||||
Interface conventions
|
||||
----------------------
|
||||
If a function retains a pointer to or replaces the value of an object
|
||||
passed, it takes a pointer so that it will be clear in the caller's
|
||||
source code that care is required.
|
||||
|
||||
Multi-word names have an underscore '_' separator between individual
|
||||
words.
|
||||
|
||||
Functions are named with lowercase words. Functions which perform an
|
||||
action with side-effects are named with a verb phrase (i.e. load, move,
|
||||
run). Functions which return the value of a piece of state are named
|
||||
using a noun phrase (i.e. loaded, moved, running).
|
||||
|
||||
Classes are named with capitalized words. Only the first letter of an
|
||||
acronym is capitalized. Class names are nouns, sometimes suggestive of
|
||||
what they do (i.e. File_Scanner).
|
||||
|
||||
Structure, enumeration, and typedefs to these and built-in types are
|
||||
named using lowercase words with a _t suffix.
|
||||
|
||||
Macros are named with all-uppercase words.
|
||||
|
||||
Internal names which can't be hidden due to technical reasons have an
|
||||
underscore '_' suffix.
|
||||
|
||||
|
||||
Managing Complexity
|
||||
-------------------
|
||||
Complexity has been a factor in most library decisions. Many features
|
||||
have been passed by due to the complexity they would add. Once
|
||||
complexity goes past a certain level, it mentally grasping the library
|
||||
in its entirety, at which point more defects will occur and be hard to
|
||||
find.
|
||||
|
||||
I chose 16-bit signed samples because it seems to be the most common
|
||||
format. Supporting multiple formats would add too much complexity to be
|
||||
worth it. Other formats can be obtained via conversion.
|
||||
|
||||
I've kept interfaces fairly lean, leaving many possible features
|
||||
untapped but easy to add if necessary. For example the classic emulators
|
||||
could have volume and frequency equalization adjusted separately for
|
||||
each channel, since they each have an associated Blip_Synth.
|
||||
|
||||
Source files of 400 lines or less seem to be the best size to limit
|
||||
complexity. In a few cases there is no reasonable way to split longer
|
||||
files, or there is benefit from having the source together in one file.
|
||||
|
||||
|
||||
Preventing Bugs
|
||||
---------------
|
||||
I've done many things to reduce the opportunity for defects. A general
|
||||
principle is to write code so that defects will be as visible as
|
||||
possible. I've used several techniques to achieve this.
|
||||
|
||||
I put assertions at key points where defects seem likely or where
|
||||
corruption due to a defect is likely to be visible. I've also put
|
||||
assertions where violations of the interface are likely. In emulators
|
||||
where I am unsure of exact hardware operation in a particular case, I
|
||||
output a debug-only message noting that this has occurred; many times I
|
||||
haven't implemented a hardware feature because nothing uses it. I've
|
||||
made code brittle where there is no clear reason flexibility; code
|
||||
written to handle every possibility sacrifices quality and reliability
|
||||
to handle vaguely defined situations.
|
||||
|
||||
|
||||
Flexibility through indirection
|
||||
-------------------------------
|
||||
I've tried to allow the most flexibility of modules by using indirection
|
||||
to allow extension by the user. This keeps each module simpler and more
|
||||
focused on its unique task.
|
||||
|
||||
The classic emulators use Multi_Buffer, which potentially allows a
|
||||
separate Blip_Buffer for each channel. This keeps emulators free of
|
||||
typical code to allow output in mono, stereo, panning, etc.
|
||||
|
||||
All emulators use a reader object to access file data, allowing it to be
|
||||
stored in a regular file, compressed archive, memory, or generated
|
||||
on-the-fly. Again, the library can be kept free of the particulars of
|
||||
file access and changes required to support new formats.
|
||||
|
||||
|
||||
Emulators in general
|
||||
--------------------
|
||||
When I wrote the first NES sound emulator, I stored most of the state in
|
||||
an emulator-specific format, with significant redundancy. In the
|
||||
register write function I decoded everything into named variables. I
|
||||
became tired of the verbosity and wanted to more closely model the
|
||||
hardware, so I moved to a style of storing the last written value to
|
||||
each register, along with as little other state as possible, mostly the
|
||||
internal hardware registers. While this involves slightly more
|
||||
recalculation, in most cases the emulation code is of comparable size.
|
||||
It also makes state save/restore (for use in a full emulator) much
|
||||
simpler. Finally, it makes debugging easier since the hardware registers
|
||||
used in emulation are obvious.
|
||||
|
||||
|
||||
CPU Cores
|
||||
---------
|
||||
I've spent lots of time coming up with techniques to optimize the CPU
|
||||
cores. Some of the most important: execute multiple instructions during
|
||||
an emulation call, keep state in local variables to allow register
|
||||
assignment, optimize state representation for most common instructions,
|
||||
defer status flag calculation until actually needed, read program code
|
||||
directly without a call to the memory read function, always pre-fetch
|
||||
the operand byte before decoding instruction, and emulate instructions
|
||||
using common blocks of code.
|
||||
|
||||
I've successfully used Nes_Cpu in a fairly complete NES emulator, and
|
||||
I'd like to make all the CPU emulators suitable for use in emulators. It
|
||||
seems a waste for them to be used only for the small amount of emulation
|
||||
necessary for game music files.
|
||||
|
||||
I debugged the CPU cores by writing a test shell that ran them in
|
||||
parallel with other CPU cores and compared all memory accesses and
|
||||
processor states at each step. This provided good value at little cost.
|
||||
|
||||
The CPU mapping page size is adjustable to allow the best tradeoff
|
||||
between memory/cache usage and handler granularity. The interface allows
|
||||
code to be somewhat independent of the page size.
|
||||
|
||||
I optimize program memory accesses to direct reads rather than calls to
|
||||
the memory read function. My assumption is that it would be difficult to
|
||||
get useful code out of hardware I/O addresses, so no software will
|
||||
intentionally execute out of I/O space. Since the page size can be
|
||||
changed easily, most program memory mapping schemes can be accommodated.
|
||||
This greatly reduces memory access function calls.
|
||||
|
||||
+376
-376
@@ -1,376 +1,376 @@
|
||||
Game_Music_Emu 0.6.2
|
||||
--------------------
|
||||
Author : Shay Green <gblargg@gmail.com>
|
||||
Maintainer : Michael Pyne <mpyne@purinchu.net>
|
||||
Website : https://bitbucket.org/mpyne/game-music-emu/
|
||||
Source : https://bitbucket.org/mpyne/game-music-emu/
|
||||
License : GNU Lesser General Public License (LGPL), see LICENSE.txt
|
||||
|
||||
Contents
|
||||
--------
|
||||
* Overview
|
||||
* Error handling
|
||||
* Emulator types
|
||||
* M3U playlist support
|
||||
* Information fields
|
||||
* Track length
|
||||
* Loading file data
|
||||
* Sound parameters
|
||||
* VGM/GYM YM2413 & YM2612 FM sound
|
||||
* Modular construction
|
||||
* Obscure features
|
||||
* Solving problems
|
||||
* Thanks
|
||||
|
||||
|
||||
Overview
|
||||
--------
|
||||
This library can open game music files, play tracks, and read game and
|
||||
track information tags. To play a game music file, do the following:
|
||||
|
||||
* Open the file with gme_open_file()
|
||||
* Start a track with gme_start_track();
|
||||
* Generate samples as needed with gme_play()
|
||||
* Play samples through speaker using your operating system
|
||||
* Delete emulator when done with gme_delete()
|
||||
|
||||
Your code must arrange for the generated samples to be played through
|
||||
the computer's speaker using whatever method your operating system
|
||||
requires.
|
||||
|
||||
There are many additional features available; you can:
|
||||
|
||||
* Determine of the type of a music file without opening it with
|
||||
gme_identify_*()
|
||||
* Load just the file's information tags with gme_info_only
|
||||
* Load from a block of memory rather than a file with gme_load_data()
|
||||
* Arrange for a fade-out at a particular time with gme_set_fade
|
||||
* Find when a track has ended with gme_track_ended()
|
||||
* Seek to a new time in the track with gme_seek()
|
||||
* Load an extended m3u playlist with gme_load_m3u()
|
||||
* Get a list of the voices (channels) and mute them individually with
|
||||
gme_voice_names() and gme_mute_voice()
|
||||
* Change the playback tempo without affecting pitch with gme_set_tempo()
|
||||
* Adjust treble/bass equalization with gme_set_equalizer()
|
||||
* Associate your own data with an emulator and later get it back with
|
||||
gme_set_user_data()
|
||||
* Register a function of yours to be called back when the emulator is
|
||||
deleted with gme_set_user_cleanup()
|
||||
|
||||
Refer to gme.h for a comprehensive summary of features.
|
||||
|
||||
|
||||
Error handling
|
||||
--------------
|
||||
Functions which can fail have a return type of gme_err_t, which is a
|
||||
pointer to an error string (const char*). If a function is successful it
|
||||
returns NULL. Errors that you can easily avoid are checked with debug
|
||||
assertions; gme_err_t return values are only used for genuine run-time
|
||||
errors that can't be easily predicted in advance (out of memory, I/O
|
||||
errors, incompatible file data). Your code should check all error
|
||||
values.
|
||||
|
||||
When loading a music file in the wrong emulator or trying to load a
|
||||
non-music file, gme_wrong_file_type is returned. You can check for this
|
||||
error in C++ like this:
|
||||
|
||||
gme_err_t err = gme_open_file( path, &emu );
|
||||
if ( err == gme_wrong_file_type )
|
||||
...
|
||||
|
||||
To check for minor problems, call gme_warning() to get a string
|
||||
describing the last warning. Your player should allow the user some way
|
||||
of knowing when this is the case, since these minor errors could affect
|
||||
playback. Without this information the user can't solve problems as
|
||||
well. When playing a track, gme_warning() returns minor playback-related
|
||||
problems (major playback problems end the track immediately and set the
|
||||
warning string).
|
||||
|
||||
|
||||
Emulator types
|
||||
--------------
|
||||
The library includes several game music emulators that each support a
|
||||
different file type. Each is identified by a gme_type_t constant defined
|
||||
in gme.h, for example gme_nsf_emu is for the NSF emulator. If you use
|
||||
gme_open_file() or gme_open_data(), the library does the work of
|
||||
determining the file type and creating an appropriate emulator. If you
|
||||
want more control over this process, read on.
|
||||
|
||||
There are two basic ways to identify a game music file's type: look at
|
||||
its file extension, or read the header data. The library includes
|
||||
functions to help with both methods. The first is preferable because it
|
||||
is fast and the most common way to identify files. Sometimes the
|
||||
extension is lost or wrong, so the header must be read.
|
||||
|
||||
Use gme_identify_extension() to find the correct game music type based
|
||||
on a filename. To identify a file based on its extension and header
|
||||
contents, use gme_identify_file(). If you read the header data yourself,
|
||||
use gme_identify_header().
|
||||
|
||||
If you want to remove support for some music types to reduce your
|
||||
executable size, edit GME_TYPE_LIST in blargg_config.h. For example, to
|
||||
support just NSF and GBS, use this:
|
||||
|
||||
#define GME_TYPE_LIST \
|
||||
gme_nsf_type,\
|
||||
gme_gbs_type
|
||||
|
||||
|
||||
M3U playlist support
|
||||
--------------------
|
||||
The library supports playlists in an extended m3u format with
|
||||
gme_load_m3u() to give track names and times to multi-song formats: AY,
|
||||
GBS, HES, KSS, NSF, NSFE, and SAP. Some aspects of the file format
|
||||
itself is not well-defined so some m3u files won't work properly
|
||||
(particularly those provided with KSS files). Only m3u files referencing
|
||||
a single file are supported; your code must handle m3u files covering
|
||||
more than one game music file, though it can use the built-in m3u
|
||||
parsing provided by the library.
|
||||
|
||||
|
||||
Information fields
|
||||
------------------
|
||||
Support is provided for the various text fields and length information
|
||||
in a file with gme_track_info(). If you just need track information for
|
||||
a file (for example, building a playlist), use gme_new_info() in place
|
||||
of gme_new_emu(), load the file normally, then you can access the track
|
||||
count and info, but nothing else.
|
||||
|
||||
M3U VGM GYM SPC SAP NSFE NSF AY GBS HES KSS
|
||||
-------------------------------------------------------
|
||||
Track Count | * * * * * * * * *
|
||||
|
|
||||
System | * * * * * * * * * *
|
||||
|
|
||||
Game | * * * * * * *
|
||||
|
|
||||
Song | * * * * * * *
|
||||
|
|
||||
Author | * * * * * * * *
|
||||
|
|
||||
Copyright | * * * * * * * *
|
||||
|
|
||||
Comment | * * * *
|
||||
|
|
||||
Dumper | * * * *
|
||||
|
|
||||
Length | * * * * * *
|
||||
|
|
||||
Intro Length| * * *
|
||||
|
|
||||
Loop Length | * * *
|
||||
|
||||
As listed above, the HES and KSS file formats don't include a track
|
||||
count, and tracks are often scattered over the 0-255 range, so an m3u
|
||||
playlist for these is a must.
|
||||
|
||||
Unavailable text fields are set to an empty string and times to -1. Your
|
||||
code should be prepared for any combination of available and unavailable
|
||||
fields, as a particular music file might not use all of the supported
|
||||
fields listed above.
|
||||
|
||||
Currently text fields are truncated to 255 characters. Obscure fields of
|
||||
some formats are not currently decoded; contact me if you want one
|
||||
added.
|
||||
|
||||
|
||||
Track length
|
||||
------------
|
||||
The library leaves it up to you as to when to stop playing a track. You
|
||||
can ask for available length information and then tell the library what
|
||||
time it should start fading the track with gme_set_fade(). By default it
|
||||
also continually checks for 6 or more seconds of silence to mark the end
|
||||
of a track. Here is a reasonable algorithm you can use to decide how
|
||||
long to play a track:
|
||||
|
||||
* If the track length is > 0, use it
|
||||
* If the loop length > 0, play for intro + loop * 2
|
||||
* Otherwise, default to 2.5 minutes (150000 msec)
|
||||
|
||||
If you want to play a track longer than normal, be sure the loop length
|
||||
isn't zero. See Music_Player.cpp around line 145 for example code.
|
||||
|
||||
By default, the library skips silence at the beginning of a track. It
|
||||
also continually checks for the end of a non-looping track by watching
|
||||
for 6 seconds of unbroken silence. When doing this is scans *ahead* by
|
||||
several seconds so it can report the end of the track after only one
|
||||
second of silence has actually played. This feature can be disabled with
|
||||
gme_ignore_silence().
|
||||
|
||||
|
||||
Loading file data
|
||||
-----------------
|
||||
The library allows file data to be loaded in many different ways. All
|
||||
load functions return an error which you should check. The following
|
||||
examples assume these variables:
|
||||
|
||||
Music_Emu* emu;
|
||||
gme_err_t error;
|
||||
|
||||
If you're letting the library determine a file's type, you can use
|
||||
either gme_open_file() or gme_open_data():
|
||||
|
||||
error = gme_open_file( pathname, &emu );
|
||||
error = gme_open_data( pointer, size, &emu );
|
||||
|
||||
If you're manually determining file type and using used gme_new_emu() to
|
||||
create an emulator, you can use the following methods of loading:
|
||||
|
||||
* From a block of memory:
|
||||
|
||||
error = gme_load_data( emu, pointer, size );
|
||||
|
||||
* Have library call your function to read data:
|
||||
|
||||
gme_err_t my_read( void* my_data, void* out, long count )
|
||||
{
|
||||
// code that reads 'count' bytes into 'out' buffer
|
||||
// and return 0 if no error
|
||||
}
|
||||
|
||||
error = gme_load_custom( emu, my_read, file_size, my_data );
|
||||
|
||||
|
||||
Sound parameters
|
||||
----------------
|
||||
All emulators support an arbitrary output sampling rate. A rate of 44100
|
||||
Hz should work well on most systems. Since band-limited synthesis is
|
||||
used, a sampling rate above 48000 Hz is not necessary and will actually
|
||||
reduce sound quality and performance.
|
||||
|
||||
All emulators also support adjustable gain, mainly for the purpose of
|
||||
getting consistent volume between different music formats and avoiding
|
||||
excessive modulation. The gain can only be set *before* setting the
|
||||
emulator's sampling rate, so it's not useful as a general volume
|
||||
control. The default gains of emulators are set so that they give
|
||||
generally similar volumes, though some soundtracks are significantly
|
||||
louder or quieter than normal.
|
||||
|
||||
Some emulators support adjustable treble and bass frequency equalization
|
||||
(AY, GBS, HES, KSS, NSF, NSFE, SAP, VGM) using set_equalizer().
|
||||
Parameters are specified using gme_equalizer_t eq = { treble_dB,
|
||||
bass_freq }. Treble_dB sets the treble level (in dB), where 0.0 dB gives
|
||||
normal treble; -200.0 dB is quite muffled, and 5.0 dB emphasizes treble
|
||||
for an extra crisp sound. Bass_freq sets the frequency where bass
|
||||
response starts to diminish; 15 Hz is normal, 0 Hz gives maximum bass,
|
||||
and 15000 Hz removes all bass. For example, the following makes the
|
||||
sound extra-crisp but lacking bass:
|
||||
|
||||
gme_equalizer_t eq = { 5.0, 1000 };
|
||||
gme_set_equalizer( music_emu, &eq );
|
||||
|
||||
Each emulator's equalization defaults to approximate the particular
|
||||
console's sound quality; this default can be determined by calling
|
||||
equalizer() just after creating the emulator. The Music_Emu::tv_eq
|
||||
profile gives sound as if coming from a TV speaker, and some emulators
|
||||
include other profiles for different versions of the system. For
|
||||
example, to use Famicom sound equalization with the NSF emulator, do the
|
||||
following:
|
||||
|
||||
music_emu->set_equalizer( Nsf_Emu::famicom_eq );
|
||||
|
||||
|
||||
VGM/GYM YM2413 & YM2612 FM sound
|
||||
--------------------------------
|
||||
The library plays Sega Genesis/Mega Drive music using a YM2612 FM sound
|
||||
chip emulator based on the Gens project. Because this has some
|
||||
inaccuracies, other YM2612 emulators can be used in its place by
|
||||
re-implementing the interface in YM2612_Emu.h. Available on my website
|
||||
is a modified version of MAME's YM2612 emulator, which sounds better in
|
||||
some ways and whose author is still making improvements.
|
||||
|
||||
VGM music files using the YM2413 FM sound chip are also supported, but a
|
||||
YM2413 emulator isn't included with the library due to technical
|
||||
reasons. I have put one of the available YM2413 emulators on my website
|
||||
that can be used directly.
|
||||
|
||||
|
||||
Modular construction
|
||||
--------------------
|
||||
The library is made of many fairly independent modules. If you're using
|
||||
only one music file emulator, you can eliminate many of the library
|
||||
sources from your program. Refer to the files list in readme.txt to get
|
||||
a general idea of what can be removed, and be sure to edit GME_TYPE_LIST
|
||||
(see "Emulator types" above). Post to the forum if you'd like me to put
|
||||
together a smaller version for a particular use, as this only takes me a
|
||||
few minutes to do.
|
||||
|
||||
If you want to use one of the individual sound chip emulators (or CPU
|
||||
cores) in your own console emulator, first check the libraries page on
|
||||
my website since I have released several of them as stand alone
|
||||
libraries with included documentation and examples on their use. If you
|
||||
don't find it as a standalone library, contact me and I'll consider
|
||||
separating it.
|
||||
|
||||
The "classic" sound chips use my Blip_Buffer library, which greatly
|
||||
simplifies their implementation and efficiently handles band-limited
|
||||
synthesis. It is also available as a stand alone library with
|
||||
documentation and many examples.
|
||||
|
||||
|
||||
Obscure features
|
||||
----------------
|
||||
The library's flexibility allows many possibilities. Contact me if you
|
||||
want help implementing ideas or removing limitations.
|
||||
|
||||
* Uses no global/static variables, allowing multiple instances of any
|
||||
emulator. This is useful in a music player if you want to allow
|
||||
simultaneous recording or scanning of other tracks while one is already
|
||||
playing. This will also be useful if your platform disallows global
|
||||
data.
|
||||
|
||||
* Emulators that support a custom sound buffer can have *every* voice
|
||||
routed to a different Blip_Buffer, allowing custom processing on each
|
||||
voice. For example you could record a Game Boy track as a 4-channel
|
||||
sound file.
|
||||
|
||||
* Defining BLIP_BUFFER_FAST uses lower quality, less-multiply-intensive
|
||||
synthesis on "classic" emulators, which might help on some really old
|
||||
processors. This significantly lowers sound quality and prevents treble
|
||||
equalization. Try this if your platform's processor isn't fast enough
|
||||
for normal quality. Even on my ten-year-old 400 MHz Mac, this reduces
|
||||
processor usage at most by about 0.6% (from 4% to 3.4%), hardly worth
|
||||
the quality loss.
|
||||
|
||||
|
||||
Solving problems
|
||||
----------------
|
||||
If you're having problems, try the following:
|
||||
|
||||
* If you're getting garbled sound, try this simple siren generator in
|
||||
place of your call to play(). This will quickly tell whether the problem
|
||||
is in the library or in your code.
|
||||
|
||||
static void play_siren( long count, short* out )
|
||||
{
|
||||
static double a, a2;
|
||||
while ( count-- )
|
||||
*out++ = 0x2000 * sin( a += .1 + .05*sin( a2+=.00005 ) );
|
||||
}
|
||||
|
||||
* Enable debugging support in your environment. This enables assertions
|
||||
and other run-time checks.
|
||||
|
||||
* Turn the compiler's optimizer is off. Sometimes an optimizer generates
|
||||
bad code.
|
||||
|
||||
* If multiple threads are being used, ensure that only one at a time is
|
||||
accessing a given set of objects from the library. This library is not
|
||||
in general thread-safe, though independent objects can be used in
|
||||
separate threads.
|
||||
|
||||
* If all else fails, see if the demos work.
|
||||
|
||||
|
||||
Thanks
|
||||
------
|
||||
Big thanks to Chris Moeller (kode54) for help with library testing and
|
||||
feedback, for maintaining the Foobar2000 plugin foo_gep based on it, and
|
||||
for original work on openspc++ that was used when developing Spc_Emu.
|
||||
Brad Martin's excellent OpenSPC SNES DSP emulator worked well from the
|
||||
start. Also thanks to Richard Bannister, Mahendra Tallur, Shazz,
|
||||
nenolod, theHobbit, Johan Samuelsson, and nes6502 for testing, using,
|
||||
and giving feedback for the library in their respective game music
|
||||
players. More recently, Lucas Paul and Michael Pyne have helped nudge the
|
||||
library into a public repository and get its interface more stable for use
|
||||
in shared libraries.
|
||||
Game_Music_Emu 0.6.3
|
||||
--------------------
|
||||
Author : Shay Green <gblargg@gmail.com>
|
||||
Maintainer : Michael Pyne <mpyne@purinchu.net>
|
||||
Website : https://bitbucket.org/mpyne/game-music-emu/
|
||||
Source : https://bitbucket.org/mpyne/game-music-emu/
|
||||
License : GNU Lesser General Public License (LGPL), see LICENSE.txt
|
||||
|
||||
Contents
|
||||
--------
|
||||
* Overview
|
||||
* Error handling
|
||||
* Emulator types
|
||||
* M3U playlist support
|
||||
* Information fields
|
||||
* Track length
|
||||
* Loading file data
|
||||
* Sound parameters
|
||||
* VGM/GYM YM2413 & YM2612 FM sound
|
||||
* Modular construction
|
||||
* Obscure features
|
||||
* Solving problems
|
||||
* Thanks
|
||||
|
||||
|
||||
Overview
|
||||
--------
|
||||
This library can open game music files, play tracks, and read game and
|
||||
track information tags. To play a game music file, do the following:
|
||||
|
||||
* Open the file with gme_open_file()
|
||||
* Start a track with gme_start_track();
|
||||
* Generate samples as needed with gme_play()
|
||||
* Play samples through speaker using your operating system
|
||||
* Delete emulator when done with gme_delete()
|
||||
|
||||
Your code must arrange for the generated samples to be played through
|
||||
the computer's speaker using whatever method your operating system
|
||||
requires.
|
||||
|
||||
There are many additional features available; you can:
|
||||
|
||||
* Determine of the type of a music file without opening it with
|
||||
gme_identify_*()
|
||||
* Load just the file's information tags with gme_info_only
|
||||
* Load from a block of memory rather than a file with gme_load_data()
|
||||
* Arrange for a fade-out at a particular time with gme_set_fade
|
||||
* Find when a track has ended with gme_track_ended()
|
||||
* Seek to a new time in the track with gme_seek()
|
||||
* Load an extended m3u playlist with gme_load_m3u()
|
||||
* Get a list of the voices (channels) and mute them individually with
|
||||
gme_voice_names() and gme_mute_voice()
|
||||
* Change the playback tempo without affecting pitch with gme_set_tempo()
|
||||
* Adjust treble/bass equalization with gme_set_equalizer()
|
||||
* Associate your own data with an emulator and later get it back with
|
||||
gme_set_user_data()
|
||||
* Register a function of yours to be called back when the emulator is
|
||||
deleted with gme_set_user_cleanup()
|
||||
|
||||
Refer to gme.h for a comprehensive summary of features.
|
||||
|
||||
|
||||
Error handling
|
||||
--------------
|
||||
Functions which can fail have a return type of gme_err_t, which is a
|
||||
pointer to an error string (const char*). If a function is successful it
|
||||
returns NULL. Errors that you can easily avoid are checked with debug
|
||||
assertions; gme_err_t return values are only used for genuine run-time
|
||||
errors that can't be easily predicted in advance (out of memory, I/O
|
||||
errors, incompatible file data). Your code should check all error
|
||||
values.
|
||||
|
||||
When loading a music file in the wrong emulator or trying to load a
|
||||
non-music file, gme_wrong_file_type is returned. You can check for this
|
||||
error in C++ like this:
|
||||
|
||||
gme_err_t err = gme_open_file( path, &emu );
|
||||
if ( err == gme_wrong_file_type )
|
||||
...
|
||||
|
||||
To check for minor problems, call gme_warning() to get a string
|
||||
describing the last warning. Your player should allow the user some way
|
||||
of knowing when this is the case, since these minor errors could affect
|
||||
playback. Without this information the user can't solve problems as
|
||||
well. When playing a track, gme_warning() returns minor playback-related
|
||||
problems (major playback problems end the track immediately and set the
|
||||
warning string).
|
||||
|
||||
|
||||
Emulator types
|
||||
--------------
|
||||
The library includes several game music emulators that each support a
|
||||
different file type. Each is identified by a gme_type_t constant defined
|
||||
in gme.h, for example gme_nsf_emu is for the NSF emulator. If you use
|
||||
gme_open_file() or gme_open_data(), the library does the work of
|
||||
determining the file type and creating an appropriate emulator. If you
|
||||
want more control over this process, read on.
|
||||
|
||||
There are two basic ways to identify a game music file's type: look at
|
||||
its file extension, or read the header data. The library includes
|
||||
functions to help with both methods. The first is preferable because it
|
||||
is fast and the most common way to identify files. Sometimes the
|
||||
extension is lost or wrong, so the header must be read.
|
||||
|
||||
Use gme_identify_extension() to find the correct game music type based
|
||||
on a filename. To identify a file based on its extension and header
|
||||
contents, use gme_identify_file(). If you read the header data yourself,
|
||||
use gme_identify_header().
|
||||
|
||||
If you want to remove support for some music types to reduce your
|
||||
executable size, edit GME_TYPE_LIST in blargg_config.h. For example, to
|
||||
support just NSF and GBS, use this:
|
||||
|
||||
#define GME_TYPE_LIST \
|
||||
gme_nsf_type,\
|
||||
gme_gbs_type
|
||||
|
||||
|
||||
M3U playlist support
|
||||
--------------------
|
||||
The library supports playlists in an extended m3u format with
|
||||
gme_load_m3u() to give track names and times to multi-song formats: AY,
|
||||
GBS, HES, KSS, NSF, NSFE, and SAP. Some aspects of the file format
|
||||
itself is not well-defined so some m3u files won't work properly
|
||||
(particularly those provided with KSS files). Only m3u files referencing
|
||||
a single file are supported; your code must handle m3u files covering
|
||||
more than one game music file, though it can use the built-in m3u
|
||||
parsing provided by the library.
|
||||
|
||||
|
||||
Information fields
|
||||
------------------
|
||||
Support is provided for the various text fields and length information
|
||||
in a file with gme_track_info(). If you just need track information for
|
||||
a file (for example, building a playlist), use gme_new_info() in place
|
||||
of gme_new_emu(), load the file normally, then you can access the track
|
||||
count and info, but nothing else.
|
||||
|
||||
M3U VGM GYM SPC SAP NSFE NSF AY GBS HES KSS
|
||||
-------------------------------------------------------
|
||||
Track Count | * * * * * * * * *
|
||||
|
|
||||
System | * * * * * * * * * *
|
||||
|
|
||||
Game | * * * * * * *
|
||||
|
|
||||
Song | * * * * * * *
|
||||
|
|
||||
Author | * * * * * * * *
|
||||
|
|
||||
Copyright | * * * * * * * *
|
||||
|
|
||||
Comment | * * * *
|
||||
|
|
||||
Dumper | * * * *
|
||||
|
|
||||
Length | * * * * * *
|
||||
|
|
||||
Intro Length| * * *
|
||||
|
|
||||
Loop Length | * * *
|
||||
|
||||
As listed above, the HES and KSS file formats don't include a track
|
||||
count, and tracks are often scattered over the 0-255 range, so an m3u
|
||||
playlist for these is a must.
|
||||
|
||||
Unavailable text fields are set to an empty string and times to -1. Your
|
||||
code should be prepared for any combination of available and unavailable
|
||||
fields, as a particular music file might not use all of the supported
|
||||
fields listed above.
|
||||
|
||||
Currently text fields are truncated to 255 characters. Obscure fields of
|
||||
some formats are not currently decoded; contact me if you want one
|
||||
added.
|
||||
|
||||
|
||||
Track length
|
||||
------------
|
||||
The library leaves it up to you as to when to stop playing a track. You
|
||||
can ask for available length information and then tell the library what
|
||||
time it should start fading the track with gme_set_fade(). By default it
|
||||
also continually checks for 6 or more seconds of silence to mark the end
|
||||
of a track. Here is a reasonable algorithm you can use to decide how
|
||||
long to play a track:
|
||||
|
||||
* If the track length is > 0, use it
|
||||
* If the loop length > 0, play for intro + loop * 2
|
||||
* Otherwise, default to 2.5 minutes (150000 msec)
|
||||
|
||||
If you want to play a track longer than normal, be sure the loop length
|
||||
isn't zero. See Music_Player.cpp around line 145 for example code.
|
||||
|
||||
By default, the library skips silence at the beginning of a track. It
|
||||
also continually checks for the end of a non-looping track by watching
|
||||
for 6 seconds of unbroken silence. When doing this is scans *ahead* by
|
||||
several seconds so it can report the end of the track after only one
|
||||
second of silence has actually played. This feature can be disabled with
|
||||
gme_ignore_silence().
|
||||
|
||||
|
||||
Loading file data
|
||||
-----------------
|
||||
The library allows file data to be loaded in many different ways. All
|
||||
load functions return an error which you should check. The following
|
||||
examples assume these variables:
|
||||
|
||||
Music_Emu* emu;
|
||||
gme_err_t error;
|
||||
|
||||
If you're letting the library determine a file's type, you can use
|
||||
either gme_open_file() or gme_open_data():
|
||||
|
||||
error = gme_open_file( pathname, &emu );
|
||||
error = gme_open_data( pointer, size, &emu );
|
||||
|
||||
If you're manually determining file type and using used gme_new_emu() to
|
||||
create an emulator, you can use the following methods of loading:
|
||||
|
||||
* From a block of memory:
|
||||
|
||||
error = gme_load_data( emu, pointer, size );
|
||||
|
||||
* Have library call your function to read data:
|
||||
|
||||
gme_err_t my_read( void* my_data, void* out, long count )
|
||||
{
|
||||
// code that reads 'count' bytes into 'out' buffer
|
||||
// and return 0 if no error
|
||||
}
|
||||
|
||||
error = gme_load_custom( emu, my_read, file_size, my_data );
|
||||
|
||||
|
||||
Sound parameters
|
||||
----------------
|
||||
All emulators support an arbitrary output sampling rate. A rate of 44100
|
||||
Hz should work well on most systems. Since band-limited synthesis is
|
||||
used, a sampling rate above 48000 Hz is not necessary and will actually
|
||||
reduce sound quality and performance.
|
||||
|
||||
All emulators also support adjustable gain, mainly for the purpose of
|
||||
getting consistent volume between different music formats and avoiding
|
||||
excessive modulation. The gain can only be set *before* setting the
|
||||
emulator's sampling rate, so it's not useful as a general volume
|
||||
control. The default gains of emulators are set so that they give
|
||||
generally similar volumes, though some soundtracks are significantly
|
||||
louder or quieter than normal.
|
||||
|
||||
Some emulators support adjustable treble and bass frequency equalization
|
||||
(AY, GBS, HES, KSS, NSF, NSFE, SAP, VGM) using set_equalizer().
|
||||
Parameters are specified using gme_equalizer_t eq = { treble_dB,
|
||||
bass_freq }. Treble_dB sets the treble level (in dB), where 0.0 dB gives
|
||||
normal treble; -200.0 dB is quite muffled, and 5.0 dB emphasizes treble
|
||||
for an extra crisp sound. Bass_freq sets the frequency where bass
|
||||
response starts to diminish; 15 Hz is normal, 0 Hz gives maximum bass,
|
||||
and 15000 Hz removes all bass. For example, the following makes the
|
||||
sound extra-crisp but lacking bass:
|
||||
|
||||
gme_equalizer_t eq = { 5.0, 1000 };
|
||||
gme_set_equalizer( music_emu, &eq );
|
||||
|
||||
Each emulator's equalization defaults to approximate the particular
|
||||
console's sound quality; this default can be determined by calling
|
||||
equalizer() just after creating the emulator. The Music_Emu::tv_eq
|
||||
profile gives sound as if coming from a TV speaker, and some emulators
|
||||
include other profiles for different versions of the system. For
|
||||
example, to use Famicom sound equalization with the NSF emulator, do the
|
||||
following:
|
||||
|
||||
music_emu->set_equalizer( Nsf_Emu::famicom_eq );
|
||||
|
||||
|
||||
VGM/GYM YM2413 & YM2612 FM sound
|
||||
--------------------------------
|
||||
The library plays Sega Genesis/Mega Drive music using a YM2612 FM sound
|
||||
chip emulator based on the Gens project. Because this has some
|
||||
inaccuracies, other YM2612 emulators can be used in its place by
|
||||
re-implementing the interface in YM2612_Emu.h. Available on my website
|
||||
is a modified version of MAME's YM2612 emulator, which sounds better in
|
||||
some ways and whose author is still making improvements.
|
||||
|
||||
VGM music files using the YM2413 FM sound chip are also supported, but a
|
||||
YM2413 emulator isn't included with the library due to technical
|
||||
reasons. I have put one of the available YM2413 emulators on my website
|
||||
that can be used directly.
|
||||
|
||||
|
||||
Modular construction
|
||||
--------------------
|
||||
The library is made of many fairly independent modules. If you're using
|
||||
only one music file emulator, you can eliminate many of the library
|
||||
sources from your program. Refer to the files list in readme.txt to get
|
||||
a general idea of what can be removed, and be sure to edit GME_TYPE_LIST
|
||||
(see "Emulator types" above). Post to the forum if you'd like me to put
|
||||
together a smaller version for a particular use, as this only takes me a
|
||||
few minutes to do.
|
||||
|
||||
If you want to use one of the individual sound chip emulators (or CPU
|
||||
cores) in your own console emulator, first check the libraries page on
|
||||
my website since I have released several of them as stand alone
|
||||
libraries with included documentation and examples on their use. If you
|
||||
don't find it as a standalone library, contact me and I'll consider
|
||||
separating it.
|
||||
|
||||
The "classic" sound chips use my Blip_Buffer library, which greatly
|
||||
simplifies their implementation and efficiently handles band-limited
|
||||
synthesis. It is also available as a stand alone library with
|
||||
documentation and many examples.
|
||||
|
||||
|
||||
Obscure features
|
||||
----------------
|
||||
The library's flexibility allows many possibilities. Contact me if you
|
||||
want help implementing ideas or removing limitations.
|
||||
|
||||
* Uses no global/static variables, allowing multiple instances of any
|
||||
emulator. This is useful in a music player if you want to allow
|
||||
simultaneous recording or scanning of other tracks while one is already
|
||||
playing. This will also be useful if your platform disallows global
|
||||
data.
|
||||
|
||||
* Emulators that support a custom sound buffer can have *every* voice
|
||||
routed to a different Blip_Buffer, allowing custom processing on each
|
||||
voice. For example you could record a Game Boy track as a 4-channel
|
||||
sound file.
|
||||
|
||||
* Defining BLIP_BUFFER_FAST uses lower quality, less-multiply-intensive
|
||||
synthesis on "classic" emulators, which might help on some really old
|
||||
processors. This significantly lowers sound quality and prevents treble
|
||||
equalization. Try this if your platform's processor isn't fast enough
|
||||
for normal quality. Even on my ten-year-old 400 MHz Mac, this reduces
|
||||
processor usage at most by about 0.6% (from 4% to 3.4%), hardly worth
|
||||
the quality loss.
|
||||
|
||||
|
||||
Solving problems
|
||||
----------------
|
||||
If you're having problems, try the following:
|
||||
|
||||
* If you're getting garbled sound, try this simple siren generator in
|
||||
place of your call to play(). This will quickly tell whether the problem
|
||||
is in the library or in your code.
|
||||
|
||||
static void play_siren( long count, short* out )
|
||||
{
|
||||
static double a, a2;
|
||||
while ( count-- )
|
||||
*out++ = 0x2000 * sin( a += .1 + .05*sin( a2+=.00005 ) );
|
||||
}
|
||||
|
||||
* Enable debugging support in your environment. This enables assertions
|
||||
and other run-time checks.
|
||||
|
||||
* Turn the compiler's optimizer is off. Sometimes an optimizer generates
|
||||
bad code.
|
||||
|
||||
* If multiple threads are being used, ensure that only one at a time is
|
||||
accessing a given set of objects from the library. This library is not
|
||||
in general thread-safe, though independent objects can be used in
|
||||
separate threads.
|
||||
|
||||
* If all else fails, see if the demos work.
|
||||
|
||||
|
||||
Thanks
|
||||
------
|
||||
Big thanks to Chris Moeller (kode54) for help with library testing and
|
||||
feedback, for maintaining the Foobar2000 plugin foo_gep based on it, and
|
||||
for original work on openspc++ that was used when developing Spc_Emu.
|
||||
Brad Martin's excellent OpenSPC SNES DSP emulator worked well from the
|
||||
start. Also thanks to Richard Bannister, Mahendra Tallur, Shazz,
|
||||
nenolod, theHobbit, Johan Samuelsson, and nes6502 for testing, using,
|
||||
and giving feedback for the library in their respective game music
|
||||
players. More recently, Lucas Paul and Michael Pyne have helped nudge the
|
||||
library into a public repository and get its interface more stable for use
|
||||
in shared libraries.
|
||||
@@ -0,0 +1,89 @@
|
||||
/* Included at the beginning of library source files, after all other #include lines.
|
||||
* Sets up helpful macros and services used in my source code. They don't need
|
||||
* module an annoying module prefix on their names since they are defined after
|
||||
* all other #include lines. */
|
||||
|
||||
#ifndef BLARGG_SOURCE_H
|
||||
#define BLARGG_SOURCE_H
|
||||
|
||||
/* If debugging is enabled, abort program if expr is false. Meant for checking
|
||||
* internal state and consistency. A failed assertion indicates a bug in the module.
|
||||
* void assert( bool expr ); */
|
||||
#include <assert.h>
|
||||
|
||||
/* If debugging is enabled and expr is false, abort program. Meant for checking
|
||||
* caller-supplied parameters and operations that are outside the control of the
|
||||
* module. A failed requirement indicates a bug outside the module.
|
||||
* void require( bool expr ); */
|
||||
#undef require
|
||||
#define require( expr ) assert( expr )
|
||||
|
||||
/* Use to provide hints to compiler for optimized code layout in situations where we
|
||||
* can almost always expect a conditional to go one way or the other. Should only be
|
||||
* used in situations where an unexpected branch is truly exceptional though! */
|
||||
#undef likely
|
||||
#undef unlikely
|
||||
#ifdef __GNUC__
|
||||
#define likely( x ) __builtin_expect(x, 1)
|
||||
#define unlikely( x ) __builtin_expect(x, 0)
|
||||
#else
|
||||
#define likely( x ) (x)
|
||||
#define unlikely( x ) (x)
|
||||
#endif
|
||||
|
||||
/* Like printf() except output goes to debug log file. Might be defined to do
|
||||
* nothing (not even evaluate its arguments).
|
||||
* void debug_printf( const char* format, ... ); */
|
||||
#if defined(__cplusplus)
|
||||
static inline void blargg_dprintf_( const char* fmt_str, ... ) { (void) fmt_str; }
|
||||
#undef debug_printf
|
||||
#define debug_printf (1) ? (void) 0 : blargg_dprintf_
|
||||
#endif
|
||||
|
||||
/* If enabled, evaluate expr and if false, make debug log entry with source file
|
||||
* and line. Meant for finding situations that should be examined further, but that
|
||||
* don't indicate a problem. In all cases, execution continues normally. */
|
||||
#undef check
|
||||
#define check( expr ) ((void) 0)
|
||||
|
||||
/* If expr yields error string, return it from current function, otherwise continue. */
|
||||
#undef RETURN_ERR
|
||||
#define RETURN_ERR( expr ) do { \
|
||||
blargg_err_t blargg_return_err_ = (expr); \
|
||||
if ( blargg_return_err_ ) return blargg_return_err_; \
|
||||
} while ( 0 )
|
||||
|
||||
/* If ptr is 0, return out of memory error string. */
|
||||
#undef CHECK_ALLOC
|
||||
#define CHECK_ALLOC( ptr ) do { if ( (ptr) == 0 ) return "Out of memory"; } while ( 0 )
|
||||
|
||||
/* TODO: good idea? bad idea? */
|
||||
#undef byte
|
||||
#define byte byte_
|
||||
typedef unsigned char byte;
|
||||
|
||||
/* Setup compiler defines useful for exporting required public API symbols in gme.cpp */
|
||||
#ifndef BLARGG_EXPORT
|
||||
#if defined (_WIN32)
|
||||
#if defined(BLARGG_BUILD_DLL)
|
||||
#define BLARGG_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define BLARGG_EXPORT /* Leave blank: friendly with both static and shared linking */
|
||||
#endif
|
||||
#elif defined (LIBGME_VISIBILITY) && defined(__cplusplus)
|
||||
#define BLARGG_EXPORT __attribute__((visibility ("default")))
|
||||
#else
|
||||
#define BLARGG_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* deprecated */
|
||||
#define BLARGG_CHECK_ALLOC CHECK_ALLOC
|
||||
#define BLARGG_RETURN_ERR RETURN_ERR
|
||||
|
||||
/* BLARGG_SOURCE_BEGIN: If defined, #included, allowing redefition of debug_printf and check */
|
||||
#ifdef BLARGG_SOURCE_BEGIN
|
||||
#include BLARGG_SOURCE_BEGIN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+90
-49
@@ -1,14 +1,16 @@
|
||||
/* Game music emulator library C interface (also usable from C++) */
|
||||
|
||||
/* Game_Music_Emu 0.6.1 */
|
||||
/* Game_Music_Emu 0.6.3 */
|
||||
#ifndef GME_H
|
||||
#define GME_H
|
||||
|
||||
#include "blargg_source.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GME_VERSION 0x000601 /* 1 byte major, 1 byte minor, 1 byte patch-level */
|
||||
#define GME_VERSION 0x000603 /* 1 byte major, 1 byte minor, 1 byte patch-level */
|
||||
|
||||
/* Error string returned by library functions, or NULL if no error (success) */
|
||||
typedef const char* gme_err_t;
|
||||
@@ -20,41 +22,60 @@ typedef struct Music_Emu Music_Emu;
|
||||
/******** Basic operations ********/
|
||||
|
||||
/* Create emulator and load game music file/data into it. Sets *out to new emulator. */
|
||||
gme_err_t gme_open_file( const char path [], Music_Emu** out, int sample_rate );
|
||||
BLARGG_EXPORT gme_err_t gme_open_file( const char path [], Music_Emu** out, int sample_rate );
|
||||
|
||||
/* Number of tracks available */
|
||||
int gme_track_count( Music_Emu const* );
|
||||
BLARGG_EXPORT int gme_track_count( Music_Emu const* );
|
||||
|
||||
/* Start a track, where 0 is the first track */
|
||||
gme_err_t gme_start_track( Music_Emu*, int index );
|
||||
BLARGG_EXPORT gme_err_t gme_start_track( Music_Emu*, int index );
|
||||
|
||||
/* Generate 'count' 16-bit signed samples info 'out'. Output is in stereo. */
|
||||
gme_err_t gme_play( Music_Emu*, int count, short out [] );
|
||||
BLARGG_EXPORT gme_err_t gme_play( Music_Emu*, int count, short out [] );
|
||||
|
||||
/* Finish using emulator and free memory */
|
||||
void gme_delete( Music_Emu* );
|
||||
BLARGG_EXPORT void gme_delete( Music_Emu* );
|
||||
|
||||
|
||||
/******** Track position/length ********/
|
||||
|
||||
/* Set time to start fading track out. Once fade ends track_ended() returns true.
|
||||
Fade time can be changed while track is playing. */
|
||||
void gme_set_fade( Music_Emu*, int start_msec );
|
||||
BLARGG_EXPORT void gme_set_fade( Music_Emu*, int start_msec );
|
||||
|
||||
/**
|
||||
* If do_autoload_limit is nonzero, then automatically load track length
|
||||
* metadata (if present) and terminate playback once the track length has been
|
||||
* reached. Otherwise playback will continue for an arbitrary period of time
|
||||
* until a prolonged period of silence is detected.
|
||||
*
|
||||
* Not all individual emulators support this setting.
|
||||
*
|
||||
* By default, playback limits are loaded and applied.
|
||||
*
|
||||
* @since 0.6.2
|
||||
*/
|
||||
BLARGG_EXPORT void gme_set_autoload_playback_limit( Music_Emu *, int do_autoload_limit );
|
||||
|
||||
/** See gme_set_autoload_playback_limit.
|
||||
* @since 0.6.2
|
||||
*/
|
||||
BLARGG_EXPORT int gme_autoload_playback_limit( Music_Emu const* );
|
||||
|
||||
/* True if a track has reached its end */
|
||||
int gme_track_ended( Music_Emu const* );
|
||||
BLARGG_EXPORT int gme_track_ended( Music_Emu const* );
|
||||
|
||||
/* Number of milliseconds (1000 = one second) played since beginning of track */
|
||||
int gme_tell( Music_Emu const* );
|
||||
BLARGG_EXPORT int gme_tell( Music_Emu const* );
|
||||
|
||||
/* Number of samples generated since beginning of track */
|
||||
int gme_tell_samples( Music_Emu const* );
|
||||
BLARGG_EXPORT int gme_tell_samples( Music_Emu const* );
|
||||
|
||||
/* Seek to new time in track. Seeking backwards or far forward can take a while. */
|
||||
gme_err_t gme_seek( Music_Emu*, int msec );
|
||||
BLARGG_EXPORT gme_err_t gme_seek( Music_Emu*, int msec );
|
||||
|
||||
/* Equivalent to restarting track then skipping n samples */
|
||||
gme_err_t gme_seek_samples( Music_Emu*, int n );
|
||||
BLARGG_EXPORT gme_err_t gme_seek_samples( Music_Emu*, int n );
|
||||
|
||||
|
||||
/******** Informational ********/
|
||||
@@ -65,24 +86,24 @@ enum { gme_info_only = -1 };
|
||||
|
||||
/* Most recent warning string, or NULL if none. Clears current warning after returning.
|
||||
Warning is also cleared when loading a file and starting a track. */
|
||||
const char* gme_warning( Music_Emu* );
|
||||
BLARGG_EXPORT const char* gme_warning( Music_Emu* );
|
||||
|
||||
/* Load m3u playlist file (must be done after loading music) */
|
||||
gme_err_t gme_load_m3u( Music_Emu*, const char path [] );
|
||||
BLARGG_EXPORT gme_err_t gme_load_m3u( Music_Emu*, const char path [] );
|
||||
|
||||
/* Clear any loaded m3u playlist and any internal playlist that the music format
|
||||
supports (NSFE for example). */
|
||||
void gme_clear_playlist( Music_Emu* );
|
||||
BLARGG_EXPORT void gme_clear_playlist( Music_Emu* );
|
||||
|
||||
/* Gets information for a particular track (length, name, author, etc.).
|
||||
Must be freed after use. */
|
||||
typedef struct gme_info_t gme_info_t;
|
||||
gme_err_t gme_track_info( Music_Emu const*, gme_info_t** out, int track );
|
||||
BLARGG_EXPORT gme_err_t gme_track_info( Music_Emu const*, gme_info_t** out, int track );
|
||||
|
||||
/* Frees track information */
|
||||
void gme_free_info( gme_info_t* );
|
||||
BLARGG_EXPORT void gme_free_info( gme_info_t* );
|
||||
|
||||
struct gme_info_t
|
||||
struct BLARGG_EXPORT gme_info_t
|
||||
{
|
||||
/* times in milliseconds; -1 if unknown */
|
||||
int length; /* total length, if file specifies it */
|
||||
@@ -112,32 +133,32 @@ struct gme_info_t
|
||||
|
||||
/* Adjust stereo echo depth, where 0.0 = off and 1.0 = maximum. Has no effect for
|
||||
GYM, SPC, and Sega Genesis VGM music */
|
||||
void gme_set_stereo_depth( Music_Emu*, double depth );
|
||||
BLARGG_EXPORT void gme_set_stereo_depth( Music_Emu*, double depth );
|
||||
|
||||
/* Disable automatic end-of-track detection and skipping of silence at beginning
|
||||
if ignore is true */
|
||||
void gme_ignore_silence( Music_Emu*, int ignore );
|
||||
BLARGG_EXPORT void gme_ignore_silence( Music_Emu*, int ignore );
|
||||
|
||||
/* Adjust song tempo, where 1.0 = normal, 0.5 = half speed, 2.0 = double speed.
|
||||
Track length as returned by track_info() assumes a tempo of 1.0. */
|
||||
void gme_set_tempo( Music_Emu*, double tempo );
|
||||
BLARGG_EXPORT void gme_set_tempo( Music_Emu*, double tempo );
|
||||
|
||||
/* Number of voices used by currently loaded file */
|
||||
int gme_voice_count( Music_Emu const* );
|
||||
BLARGG_EXPORT int gme_voice_count( Music_Emu const* );
|
||||
|
||||
/* Name of voice i, from 0 to gme_voice_count() - 1 */
|
||||
const char* gme_voice_name( Music_Emu const*, int i );
|
||||
BLARGG_EXPORT const char* gme_voice_name( Music_Emu const*, int i );
|
||||
|
||||
/* Mute/unmute voice i, where voice 0 is first voice */
|
||||
void gme_mute_voice( Music_Emu*, int index, int mute );
|
||||
BLARGG_EXPORT void gme_mute_voice( Music_Emu*, int index, int mute );
|
||||
|
||||
/* Set muting state of all voices at once using a bit mask, where -1 mutes all
|
||||
voices, 0 unmutes them all, 0x01 mutes just the first voice, etc. */
|
||||
void gme_mute_voices( Music_Emu*, int muting_mask );
|
||||
BLARGG_EXPORT void gme_mute_voices( Music_Emu*, int muting_mask );
|
||||
|
||||
/* Frequency equalizer parameters (see gme.txt) */
|
||||
/* Implementers: If modified, also adjust Music_Emu::make_equalizer as needed */
|
||||
typedef struct gme_equalizer_t
|
||||
typedef struct BLARGG_EXPORT gme_equalizer_t
|
||||
{
|
||||
double treble; /* -50.0 = muffled, 0 = flat, +5.0 = extra-crisp */
|
||||
double bass; /* 1 = full bass, 90 = average, 16000 = almost no bass */
|
||||
@@ -146,13 +167,13 @@ typedef struct gme_equalizer_t
|
||||
} gme_equalizer_t;
|
||||
|
||||
/* Get current frequency equalizater parameters */
|
||||
void gme_equalizer( Music_Emu const*, gme_equalizer_t* out );
|
||||
BLARGG_EXPORT void gme_equalizer( Music_Emu const*, gme_equalizer_t* out );
|
||||
|
||||
/* Change frequency equalizer parameters */
|
||||
void gme_set_equalizer( Music_Emu*, gme_equalizer_t const* eq );
|
||||
BLARGG_EXPORT void gme_set_equalizer( Music_Emu*, gme_equalizer_t const* eq );
|
||||
|
||||
/* Enables/disables most accurate sound emulation options */
|
||||
void gme_enable_accuracy( Music_Emu*, int enabled );
|
||||
BLARGG_EXPORT void gme_enable_accuracy( Music_Emu*, int enabled );
|
||||
|
||||
|
||||
/******** Game music types ********/
|
||||
@@ -161,7 +182,7 @@ void gme_enable_accuracy( Music_Emu*, int enabled );
|
||||
typedef const struct gme_type_t_* gme_type_t;
|
||||
|
||||
/* Emulator type constants for each supported file type */
|
||||
extern const gme_type_t
|
||||
extern BLARGG_EXPORT const gme_type_t
|
||||
gme_ay_type,
|
||||
gme_gbs_type,
|
||||
gme_gym_type,
|
||||
@@ -175,69 +196,89 @@ extern const gme_type_t
|
||||
gme_vgz_type;
|
||||
|
||||
/* Type of this emulator */
|
||||
gme_type_t gme_type( Music_Emu const* );
|
||||
BLARGG_EXPORT gme_type_t gme_type( Music_Emu const* );
|
||||
|
||||
/* Pointer to array of all music types, with NULL entry at end. Allows a player linked
|
||||
to this library to support new music types without having to be updated. */
|
||||
gme_type_t const* gme_type_list();
|
||||
BLARGG_EXPORT gme_type_t const* gme_type_list();
|
||||
|
||||
/* Name of game system for this music file type */
|
||||
const char* gme_type_system( gme_type_t );
|
||||
BLARGG_EXPORT const char* gme_type_system( gme_type_t );
|
||||
|
||||
/* True if this music file type supports multiple tracks */
|
||||
int gme_type_multitrack( gme_type_t );
|
||||
BLARGG_EXPORT int gme_type_multitrack( gme_type_t );
|
||||
|
||||
/* whether the pcm output retrieved by gme_play() will have all 8 voices rendered to their
|
||||
* individual stereo channel or (if false) these voices get mixed into one single stereo channel
|
||||
* @since 0.6.2 */
|
||||
BLARGG_EXPORT int gme_multi_channel( Music_Emu const* );
|
||||
|
||||
/******** Advanced file loading ********/
|
||||
|
||||
/* Error returned if file type is not supported */
|
||||
extern const char* const gme_wrong_file_type;
|
||||
extern BLARGG_EXPORT const char* const gme_wrong_file_type;
|
||||
|
||||
/* Same as gme_open_file(), but uses file data already in memory. Makes copy of data. */
|
||||
gme_err_t gme_open_data( void const* data, long size, Music_Emu** out, int sample_rate );
|
||||
/* Same as gme_open_file(), but uses file data already in memory. Makes copy of data.
|
||||
* The resulting Music_Emu object will be set to single channel mode. */
|
||||
BLARGG_EXPORT gme_err_t gme_open_data( void const* data, long size, Music_Emu** out, int sample_rate );
|
||||
|
||||
/* Determine likely game music type based on first four bytes of file. Returns
|
||||
string containing proper file suffix (i.e. "NSF", "SPC", etc.) or "" if
|
||||
file header is not recognized. */
|
||||
const char* gme_identify_header( void const* header );
|
||||
BLARGG_EXPORT const char* gme_identify_header( void const* header );
|
||||
|
||||
/* Get corresponding music type for file path or extension passed in. */
|
||||
gme_type_t gme_identify_extension( const char path_or_extension [] );
|
||||
BLARGG_EXPORT gme_type_t gme_identify_extension( const char path_or_extension [] );
|
||||
|
||||
/**
|
||||
* Get typical file extension for a given music type. This is not a replacement
|
||||
* for a file content identification library (but see gme_identify_header).
|
||||
*
|
||||
* @since 0.6.2
|
||||
*/
|
||||
BLARGG_EXPORT const char* gme_type_extension( gme_type_t music_type );
|
||||
|
||||
/* Determine file type based on file's extension or header (if extension isn't recognized).
|
||||
Sets *type_out to type, or 0 if unrecognized or error. */
|
||||
gme_err_t gme_identify_file( const char path [], gme_type_t* type_out );
|
||||
BLARGG_EXPORT gme_err_t gme_identify_file( const char path [], gme_type_t* type_out );
|
||||
|
||||
/* Create new emulator and set sample rate. Returns NULL if out of memory. If you only need
|
||||
track information, pass gme_info_only for sample_rate. */
|
||||
Music_Emu* gme_new_emu( gme_type_t, int sample_rate );
|
||||
BLARGG_EXPORT Music_Emu* gme_new_emu( gme_type_t, int sample_rate );
|
||||
|
||||
/* Create new multichannel emulator and set sample rate. Returns NULL if out of memory.
|
||||
* If you only need track information, pass gme_info_only for sample_rate.
|
||||
* (see gme_multi_channel for more information on multichannel support)
|
||||
* @since 0.6.2
|
||||
*/
|
||||
BLARGG_EXPORT Music_Emu* gme_new_emu_multi_channel( gme_type_t, int sample_rate );
|
||||
|
||||
/* Load music file into emulator */
|
||||
gme_err_t gme_load_file( Music_Emu*, const char path [] );
|
||||
BLARGG_EXPORT gme_err_t gme_load_file( Music_Emu*, const char path [] );
|
||||
|
||||
/* Load music file from memory into emulator. Makes a copy of data passed. */
|
||||
gme_err_t gme_load_data( Music_Emu*, void const* data, long size );
|
||||
BLARGG_EXPORT gme_err_t gme_load_data( Music_Emu*, void const* data, long size );
|
||||
|
||||
/* Load music file using custom data reader function that will be called to
|
||||
read file data. Most emulators load the entire file in one read call. */
|
||||
typedef gme_err_t (*gme_reader_t)( void* your_data, void* out, int count );
|
||||
gme_err_t gme_load_custom( Music_Emu*, gme_reader_t, long file_size, void* your_data );
|
||||
BLARGG_EXPORT gme_err_t gme_load_custom( Music_Emu*, gme_reader_t, long file_size, void* your_data );
|
||||
|
||||
/* Load m3u playlist file from memory (must be done after loading music) */
|
||||
gme_err_t gme_load_m3u_data( Music_Emu*, void const* data, long size );
|
||||
BLARGG_EXPORT gme_err_t gme_load_m3u_data( Music_Emu*, void const* data, long size );
|
||||
|
||||
|
||||
/******** User data ********/
|
||||
|
||||
/* Set/get pointer to data you want to associate with this emulator.
|
||||
You can use this for whatever you want. */
|
||||
void gme_set_user_data( Music_Emu*, void* new_user_data );
|
||||
void* gme_user_data( Music_Emu const* );
|
||||
BLARGG_EXPORT void gme_set_user_data( Music_Emu*, void* new_user_data );
|
||||
BLARGG_EXPORT void* gme_user_data( Music_Emu const* );
|
||||
|
||||
/* Register cleanup function to be called when deleting emulator, or NULL to
|
||||
clear it. Passes user_data to cleanup function. */
|
||||
typedef void (*gme_user_cleanup_t)( void* user_data );
|
||||
void gme_set_user_cleanup( Music_Emu*, gme_user_cleanup_t func );
|
||||
BLARGG_EXPORT void gme_set_user_cleanup( Music_Emu*, gme_user_cleanup_t func );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
+504
-504
File diff suppressed because it is too large.
Load diff
+241
-231
@@ -1,231 +1,241 @@
|
||||
Game_Music_Emu 0.6.2: Game Music Emulators
|
||||
------------------------------------------
|
||||
Game_Music_Emu is a collection of video game music file emulators that
|
||||
support the following formats and systems:
|
||||
|
||||
AY ZX Spectrum/Amstrad CPC
|
||||
GBS Nintendo Game Boy
|
||||
GYM Sega Genesis/Mega Drive
|
||||
HES NEC TurboGrafx-16/PC Engine
|
||||
KSS MSX Home Computer/other Z80 systems (doesn't support FM sound)
|
||||
NSF/NSFE Nintendo NES/Famicom (with VRC 6, Namco 106, and FME-7 sound)
|
||||
SAP Atari systems using POKEY sound chip
|
||||
SPC Super Nintendo/Super Famicom
|
||||
VGM/VGZ Sega Master System/Mark III, Sega Genesis/Mega Drive,BBC Micro
|
||||
|
||||
Features:
|
||||
* C interface for use in C, C++, and other compatible languages
|
||||
* High emphasis has been placed on making the library very easy to use
|
||||
* One set of common functions work with all emulators the same way
|
||||
* Several code examples, including music player using SDL
|
||||
* Portable code for use on any system with modern or older C++ compilers
|
||||
* Adjustable output sample rate using quality band-limited resampling
|
||||
* Uniform access to text information fields and track timing information
|
||||
* End-of-track fading and automatic look ahead silence detection
|
||||
* Treble/bass and stereo echo for AY/GBS/HES/KSS/NSF/NSFE/SAP/VGM
|
||||
* Tempo can be adjusted and individual voices can be muted while playing
|
||||
* Can read music data from file, memory, or custom reader function/class
|
||||
* Can access track information without having to load into full emulator
|
||||
* M3U track listing support for multi-track formats
|
||||
* Modular design allows elimination of unneeded emulators/features
|
||||
|
||||
This library has been used in game music players for Windows, Linux on
|
||||
several architectures, Mac OS, MorphOS, Xbox, PlayStation Portable,
|
||||
GP2X, and Nintendo DS.
|
||||
|
||||
Author : Shay Green <gblargg@gmail.com>
|
||||
Website: https://bitbucket.org/mpyne/game-music-emu/wiki/Home
|
||||
License: GNU Lesser General Public License (LGPL)
|
||||
|
||||
Current Maintainer: Michael Pyne <mpyne@purinchu.net>
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
Build a program consisting of demo/basics.c, demo/Wave_Writer.cpp, and
|
||||
all source files in gme/.
|
||||
|
||||
Or, if you have CMake 2.6 or later, execute at a command prompt (from the
|
||||
extracted source directory):
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../ # <-- Pass any needed CMake flags here
|
||||
make # To build the library
|
||||
cd demo
|
||||
make # To build the demo itself
|
||||
|
||||
Be sure "test.nsf" is in the same directory as the demo program. Running it
|
||||
should generate the recording "out.wav".
|
||||
|
||||
You can use "make install" to install the library. To choose where to install
|
||||
the library to, use the CMake argument "-DCMAKE_INSTALL_PREFIX=/usr/local"
|
||||
(and replace /usr/local with the base path you wish to use). Alternately, you
|
||||
can specify the base path to install to when you run "make install" by passing
|
||||
'DESTDIR=/usr/local' on the make install command line (again, replace
|
||||
/usr/local as appropriate).
|
||||
|
||||
To build a static library instead of shared (the default), pass
|
||||
-DBUILD_SHARED_LIBS=OFF to the cmake command when running cmake.
|
||||
|
||||
A slightly more extensive demo application is available in the player/
|
||||
directory. It requires SDL to build.
|
||||
|
||||
Read gme.txt for more information. Post to the discussion forum for
|
||||
assistance.
|
||||
|
||||
Files
|
||||
-----
|
||||
gme.txt General notes about the library
|
||||
changes.txt Changes made since previous releases
|
||||
design.txt Library design notes
|
||||
license.txt GNU Lesser General Public License
|
||||
CMakeLists.txt CMake build rules
|
||||
|
||||
test.nsf Test file for NSF emulator
|
||||
test.m3u Test m3u playlist for features.c demo
|
||||
|
||||
demo/
|
||||
basics.c Records NSF file to wave sound file
|
||||
features.c Demonstrates many additional features
|
||||
Wave_Writer.h WAVE sound file writer used for demo output
|
||||
Wave_Writer.cpp
|
||||
CMakeLists.txt CMake build rules
|
||||
|
||||
player/ Player using the SDL multimedia library
|
||||
player.cpp Simple music player with waveform display
|
||||
Music_Player.cpp Stand alone player for background music
|
||||
Music_Player.h
|
||||
Audio_Scope.cpp Audio waveform scope
|
||||
Audio_Scope.h
|
||||
CMakeLists.txt CMake build rules
|
||||
|
||||
gme/
|
||||
blargg_config.h Library configuration (modify this file as needed)
|
||||
|
||||
gme.h Library interface header file
|
||||
gme.cpp
|
||||
|
||||
Ay_Emu.h ZX Spectrum AY emulator
|
||||
Ay_Emu.cpp
|
||||
Ay_Apu.cpp
|
||||
Ay_Apu.h
|
||||
Ay_Cpu.cpp
|
||||
Ay_Cpu.h
|
||||
|
||||
Gbs_Emu.h Nintendo Game Boy GBS emulator
|
||||
Gbs_Emu.cpp
|
||||
Gb_Apu.cpp
|
||||
Gb_Apu.h
|
||||
Gb_Cpu.cpp
|
||||
Gb_Cpu.h
|
||||
gb_cpu_io.h
|
||||
Gb_Oscs.cpp
|
||||
Gb_Oscs.h
|
||||
|
||||
Hes_Emu.h TurboGrafx-16/PC Engine HES emulator
|
||||
Hes_Apu.cpp
|
||||
Hes_Apu.h
|
||||
Hes_Cpu.cpp
|
||||
Hes_Cpu.h
|
||||
hes_cpu_io.h
|
||||
Hes_Emu.cpp
|
||||
|
||||
Kss_Emu.h MSX Home Computer/other Z80 systems KSS emulator
|
||||
Kss_Emu.cpp
|
||||
Kss_Cpu.cpp
|
||||
Kss_Cpu.h
|
||||
Kss_Scc_Apu.cpp
|
||||
Kss_Scc_Apu.h
|
||||
Ay_Apu.h
|
||||
Ay_Apu.cpp
|
||||
Sms_Apu.h
|
||||
Sms_Apu.cpp
|
||||
Sms_Oscs.h
|
||||
|
||||
Nsf_Emu.h Nintendo NES NSF/NSFE emulator
|
||||
Nsf_Emu.cpp
|
||||
Nes_Apu.cpp
|
||||
Nes_Apu.h
|
||||
Nes_Cpu.cpp
|
||||
Nes_Cpu.h
|
||||
nes_cpu_io.h
|
||||
Nes_Oscs.cpp
|
||||
Nes_Oscs.h
|
||||
Nes_Fme7_Apu.cpp
|
||||
Nes_Fme7_Apu.h
|
||||
Nes_Namco_Apu.cpp
|
||||
Nes_Namco_Apu.h
|
||||
Nes_Vrc6_Apu.cpp
|
||||
Nes_Vrc6_Apu.h
|
||||
Nsfe_Emu.h NSFE support
|
||||
Nsfe_Emu.cpp
|
||||
|
||||
Spc_Emu.h Super Nintendo SPC emulator
|
||||
Spc_Emu.cpp
|
||||
Snes_Spc.cpp
|
||||
Snes_Spc.h
|
||||
Spc_Cpu.cpp
|
||||
Spc_Cpu.h
|
||||
Spc_Dsp.cpp
|
||||
Spc_Dsp.h
|
||||
Fir_Resampler.cpp
|
||||
Fir_Resampler.h
|
||||
|
||||
Sap_Emu.h Atari SAP emulator
|
||||
Sap_Emu.cpp
|
||||
Sap_Apu.cpp
|
||||
Sap_Apu.h
|
||||
Sap_Cpu.cpp
|
||||
Sap_Cpu.h
|
||||
sap_cpu_io.h
|
||||
|
||||
Vgm_Emu.h Sega VGM emulator
|
||||
Vgm_Emu_Impl.cpp
|
||||
Vgm_Emu_Impl.h
|
||||
Vgm_Emu.cpp
|
||||
Ym2413_Emu.cpp
|
||||
Ym2413_Emu.h
|
||||
Gym_Emu.h Sega Genesis GYM emulator
|
||||
Gym_Emu.cpp
|
||||
Sms_Apu.cpp Common Sega emulator files
|
||||
Sms_Apu.h
|
||||
Sms_Oscs.h
|
||||
Ym2612_Emu.cpp
|
||||
Ym2612_Emu.h
|
||||
Dual_Resampler.cpp
|
||||
Dual_Resampler.h
|
||||
Fir_Resampler.cpp
|
||||
Fir_Resampler.h
|
||||
|
||||
M3u_Playlist.h M3U playlist support
|
||||
M3u_Playlist.cpp
|
||||
|
||||
Effects_Buffer.h Sound buffer with stereo echo and panning
|
||||
Effects_Buffer.cpp
|
||||
|
||||
blargg_common.h Common files needed by all emulators
|
||||
blargg_endian.h
|
||||
blargg_source.h
|
||||
Blip_Buffer.cpp
|
||||
Blip_Buffer.h
|
||||
Gme_File.h
|
||||
Gme_File.cpp
|
||||
Music_Emu.h
|
||||
Music_Emu.cpp
|
||||
Classic_Emu.h
|
||||
Classic_Emu.cpp
|
||||
Multi_Buffer.h
|
||||
Multi_Buffer.cpp
|
||||
Data_Reader.h
|
||||
Data_Reader.cpp
|
||||
|
||||
CMakeLists.txt CMake build rules
|
||||
|
||||
|
||||
Legal
|
||||
-----
|
||||
Game_Music_Emu library copyright (C) 2003-2009 Shay Green.
|
||||
Sega Genesis YM2612 emulator copyright (C) 2002 Stephane Dallongeville.
|
||||
|
||||
--
|
||||
Shay Green <gblargg@gmail.com>
|
||||
Game_Music_Emu 0.6.3: Game Music Emulators
|
||||
------------------------------------------
|
||||
Game_Music_Emu is a collection of video game music file emulators that
|
||||
support the following formats and systems:
|
||||
|
||||
AY ZX Spectrum/Amstrad CPC
|
||||
GBS Nintendo Game Boy
|
||||
GYM Sega Genesis/Mega Drive
|
||||
HES NEC TurboGrafx-16/PC Engine
|
||||
KSS MSX Home Computer/other Z80 systems (doesn't support FM sound)
|
||||
NSF/NSFE Nintendo NES/Famicom (with VRC 6, Namco 106, and FME-7 sound)
|
||||
SAP Atari systems using POKEY sound chip
|
||||
SPC Super Nintendo/Super Famicom
|
||||
VGM/VGZ Sega Master System/Mark III, Sega Genesis/Mega Drive,BBC Micro
|
||||
|
||||
Features:
|
||||
* C interface for use in C, C++, and other compatible languages
|
||||
* High emphasis has been placed on making the library very easy to use
|
||||
* One set of common functions work with all emulators the same way
|
||||
* Several code examples, including music player using SDL
|
||||
* Portable code for use on any system with modern or older C++ compilers
|
||||
* Adjustable output sample rate using quality band-limited resampling
|
||||
* Uniform access to text information fields and track timing information
|
||||
* End-of-track fading and automatic look ahead silence detection
|
||||
* Treble/bass and stereo echo for AY/GBS/HES/KSS/NSF/NSFE/SAP/VGM
|
||||
* Tempo can be adjusted and individual voices can be muted while playing
|
||||
* Can read music data from file, memory, or custom reader function/class
|
||||
* Can access track information without having to load into full emulator
|
||||
* M3U track listing support for multi-track formats
|
||||
* Modular design allows elimination of unneeded emulators/features
|
||||
|
||||
This library has been used in game music players for Windows, Linux on
|
||||
several architectures, Mac OS, MorphOS, Xbox, PlayStation Portable,
|
||||
GP2X, and Nintendo DS.
|
||||
|
||||
Author : Shay Green <gblargg@gmail.com>
|
||||
Website: https://bitbucket.org/mpyne/game-music-emu/wiki/Home
|
||||
License: GNU Lesser General Public License (LGPL)
|
||||
|
||||
Note: When you will use MAME YM2612 emulator, the license of library
|
||||
will be GNU General Public License (GPL) v2.0+!
|
||||
|
||||
Current Maintainer: Michael Pyne <mpyne@purinchu.net>
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
Build a program consisting of demo/basics.c, demo/Wave_Writer.cpp, and
|
||||
all source files in gme/.
|
||||
|
||||
Or, if you have CMake 2.6 or later, execute at a command prompt (from the
|
||||
extracted source directory):
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../ # <-- Pass any needed CMake flags here
|
||||
make # To build the library
|
||||
cd demo
|
||||
make # To build the demo itself
|
||||
|
||||
Be sure "test.nsf" is in the same directory as the demo program. Running it
|
||||
should generate the recording "out.wav".
|
||||
|
||||
You can use "make install" to install the library. To choose where to install
|
||||
the library to, use the CMake argument "-DCMAKE_INSTALL_PREFIX=/usr/local"
|
||||
(and replace /usr/local with the base path you wish to use). Alternately, you
|
||||
can specify the base path to install to when you run "make install" by passing
|
||||
'DESTDIR=/usr/local' on the make install command line (again, replace
|
||||
/usr/local as appropriate).
|
||||
|
||||
To build a static library instead of shared (the default), pass
|
||||
-DBUILD_SHARED_LIBS=OFF to the cmake command when running cmake.
|
||||
|
||||
A slightly more extensive demo application is available in the player/
|
||||
directory. It requires SDL to build.
|
||||
|
||||
Read gme.txt for more information. Post to the discussion forum for
|
||||
assistance.
|
||||
|
||||
Files
|
||||
-----
|
||||
gme.txt General notes about the library
|
||||
changes.txt Changes made since previous releases
|
||||
design.txt Library design notes
|
||||
license.txt GNU Lesser General Public License
|
||||
CMakeLists.txt CMake build rules
|
||||
|
||||
test.nsf Test file for NSF emulator
|
||||
test.m3u Test m3u playlist for features.c demo
|
||||
|
||||
demo/
|
||||
basics.c Records NSF file to wave sound file
|
||||
features.c Demonstrates many additional features
|
||||
Wave_Writer.h WAVE sound file writer used for demo output
|
||||
Wave_Writer.cpp
|
||||
CMakeLists.txt CMake build rules
|
||||
|
||||
player/ Player using the SDL multimedia library
|
||||
player.cpp Simple music player with waveform display
|
||||
Music_Player.cpp Stand alone player for background music
|
||||
Music_Player.h
|
||||
Audio_Scope.cpp Audio waveform scope
|
||||
Audio_Scope.h
|
||||
CMakeLists.txt CMake build rules
|
||||
|
||||
gme/
|
||||
blargg_config.h Library configuration (modify this file as needed)
|
||||
|
||||
gme.h Library interface header file
|
||||
gme.cpp
|
||||
|
||||
Ay_Emu.h ZX Spectrum AY emulator
|
||||
Ay_Emu.cpp
|
||||
Ay_Apu.cpp
|
||||
Ay_Apu.h
|
||||
Ay_Cpu.cpp
|
||||
Ay_Cpu.h
|
||||
|
||||
Gbs_Emu.h Nintendo Game Boy GBS emulator
|
||||
Gbs_Emu.cpp
|
||||
Gb_Apu.cpp
|
||||
Gb_Apu.h
|
||||
Gb_Cpu.cpp
|
||||
Gb_Cpu.h
|
||||
gb_cpu_io.h
|
||||
Gb_Oscs.cpp
|
||||
Gb_Oscs.h
|
||||
|
||||
Hes_Emu.h TurboGrafx-16/PC Engine HES emulator
|
||||
Hes_Apu.cpp
|
||||
Hes_Apu.h
|
||||
Hes_Cpu.cpp
|
||||
Hes_Cpu.h
|
||||
hes_cpu_io.h
|
||||
Hes_Emu.cpp
|
||||
|
||||
Kss_Emu.h MSX Home Computer/other Z80 systems KSS emulator
|
||||
Kss_Emu.cpp
|
||||
Kss_Cpu.cpp
|
||||
Kss_Cpu.h
|
||||
Kss_Scc_Apu.cpp
|
||||
Kss_Scc_Apu.h
|
||||
Ay_Apu.h
|
||||
Ay_Apu.cpp
|
||||
Sms_Apu.h
|
||||
Sms_Apu.cpp
|
||||
Sms_Oscs.h
|
||||
|
||||
Nsf_Emu.h Nintendo NES NSF/NSFE emulator
|
||||
Nsf_Emu.cpp
|
||||
Nes_Apu.cpp
|
||||
Nes_Apu.h
|
||||
Nes_Cpu.cpp
|
||||
Nes_Cpu.h
|
||||
nes_cpu_io.h
|
||||
Nes_Oscs.cpp
|
||||
Nes_Oscs.h
|
||||
Nes_Fme7_Apu.cpp
|
||||
Nes_Fme7_Apu.h
|
||||
Nes_Namco_Apu.cpp
|
||||
Nes_Namco_Apu.h
|
||||
Nes_Vrc6_Apu.cpp
|
||||
Nes_Vrc6_Apu.h
|
||||
Nsfe_Emu.h NSFE support
|
||||
Nsfe_Emu.cpp
|
||||
|
||||
Spc_Emu.h Super Nintendo SPC emulator
|
||||
Spc_Emu.cpp
|
||||
Snes_Spc.cpp
|
||||
Snes_Spc.h
|
||||
Spc_Cpu.cpp
|
||||
Spc_Cpu.h
|
||||
Spc_Dsp.cpp
|
||||
Spc_Dsp.h
|
||||
Fir_Resampler.cpp
|
||||
Fir_Resampler.h
|
||||
|
||||
Sap_Emu.h Atari SAP emulator
|
||||
Sap_Emu.cpp
|
||||
Sap_Apu.cpp
|
||||
Sap_Apu.h
|
||||
Sap_Cpu.cpp
|
||||
Sap_Cpu.h
|
||||
sap_cpu_io.h
|
||||
|
||||
Vgm_Emu.h Sega VGM emulator
|
||||
Vgm_Emu_Impl.cpp
|
||||
Vgm_Emu_Impl.h
|
||||
Vgm_Emu.cpp
|
||||
Ym2413_Emu.cpp
|
||||
Ym2413_Emu.h
|
||||
Gym_Emu.h Sega Genesis GYM emulator
|
||||
Gym_Emu.cpp
|
||||
Sms_Apu.cpp Common Sega emulator files
|
||||
Sms_Apu.h
|
||||
Sms_Oscs.h
|
||||
Ym2612_Emu.h
|
||||
Ym2612_GENS.cpp GENS 2.10 YM2612 emulator (LGPLv2.1+ license)
|
||||
Ym2612_GENS.h
|
||||
Ym2612_MAME.cpp MAME YM2612 emulator (GPLv2.0+ license)
|
||||
Ym2612_MAME.h
|
||||
Ym2612_Nuked.cpp Nuked OPN2 emulator (LGPLv2.1+ license)
|
||||
Ym2612_Nuked.h
|
||||
Dual_Resampler.cpp
|
||||
Dual_Resampler.h
|
||||
Fir_Resampler.cpp
|
||||
Fir_Resampler.h
|
||||
|
||||
M3u_Playlist.h M3U playlist support
|
||||
M3u_Playlist.cpp
|
||||
|
||||
Effects_Buffer.h Sound buffer with stereo echo and panning
|
||||
Effects_Buffer.cpp
|
||||
|
||||
blargg_common.h Common files needed by all emulators
|
||||
blargg_endian.h
|
||||
blargg_source.h
|
||||
Blip_Buffer.cpp
|
||||
Blip_Buffer.h
|
||||
Gme_File.h
|
||||
Gme_File.cpp
|
||||
Music_Emu.h
|
||||
Music_Emu.cpp
|
||||
Classic_Emu.h
|
||||
Classic_Emu.cpp
|
||||
Multi_Buffer.h
|
||||
Multi_Buffer.cpp
|
||||
Data_Reader.h
|
||||
Data_Reader.cpp
|
||||
|
||||
CMakeLists.txt CMake build rules
|
||||
|
||||
|
||||
Legal
|
||||
-----
|
||||
Game_Music_Emu library copyright (C) 2003-2009 Shay Green.
|
||||
Sega Genesis YM2612 emulator copyright (C) 2002 Stephane Dallongeville.
|
||||
MAME YM2612 emulator copyright (C) 2003 Jarek Burczynski, Tatsuyuki Satoh
|
||||
Nuked OPN2 emulator copyright (C) 2017 Alexey Khokholov (Nuke.YKT)
|
||||
|
||||
--
|
||||
Shay Green <gblargg@gmail.com>
|
||||
Binary file not shown.
Binary file not shown.
+3
-2
@@ -102,6 +102,8 @@ ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
|
||||
MINGW=1
|
||||
SDL=1
|
||||
WINDOWSHELL=1
|
||||
HAVE_DISCORDRPC=0
|
||||
NOUPX=1
|
||||
|
||||
else # if you on the *nix
|
||||
|
||||
@@ -286,7 +288,7 @@ else
|
||||
endif
|
||||
else
|
||||
ifdef X86_64
|
||||
ARCHOPTS?=-march=nocona
|
||||
ARCHOPTS?=-march=native -O3 -finline-functions
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -533,7 +535,6 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/i_time.o \
|
||||
$(OBJDIR)/lzf.o \
|
||||
$(OBJDIR)/b_bot.o \
|
||||
$(OBJDIR)/hashtable.o \
|
||||
$(i_net_o) \
|
||||
$(i_system_o) \
|
||||
$(i_sound_o) \
|
||||
|
||||
+1
-1
@@ -338,7 +338,7 @@ endif
|
||||
WFLAGS+=-Wfloat-equal
|
||||
#WFLAGS+=-Wtraditional
|
||||
ifdef VCHELP
|
||||
WFLAGS+=-Wdeclaration-after-statement
|
||||
#WFLAGS+=-Wdeclaration-after-statement
|
||||
WFLAGS+=-Wno-error=declaration-after-statement
|
||||
endif
|
||||
WFLAGS+=-Wundef
|
||||
|
||||
@@ -233,6 +233,11 @@ INT32 I_mkdir(const char *dirname, INT32 unixright)
|
||||
return -1;
|
||||
}
|
||||
|
||||
const CPUInfoFlags *I_CPUInfo(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *I_LocateWad(void)
|
||||
{
|
||||
return "/sdcard/srb2";
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ void luaV_gettable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
void luaV_settable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
int loop;
|
||||
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
||||
TValue *tm;
|
||||
TValue *tm = NULL;
|
||||
if (ttistable(t)) { /* `t' is a table? */
|
||||
Table *h = hvalue(t);
|
||||
TValue *oldval = luaH_set(L, h, key); /* do a primitive set */
|
||||
|
||||
+2
-4
@@ -1478,7 +1478,6 @@ badinput:
|
||||
//
|
||||
|
||||
static boolean serverloading = false;
|
||||
static boolean serverloadingstealth = false;
|
||||
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
@@ -1506,7 +1505,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
cvar = CV_FindNetVar(netid);
|
||||
svalue = (char *)*p;
|
||||
SKIPSTRING(*p);
|
||||
stealth = READUINT8(*p) || (serverloading && serverloadingstealth);
|
||||
stealth = READUINT8(*p);
|
||||
|
||||
if (!cvar)
|
||||
{
|
||||
@@ -1560,14 +1559,13 @@ void CV_SaveNetVars(UINT8 **p, boolean isdemorecording)
|
||||
WRITEUINT16(count_p, count);
|
||||
}
|
||||
|
||||
void CV_LoadNetVars(UINT8 **p, boolean onlyIfChanged)
|
||||
void CV_LoadNetVars(UINT8 **p)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
UINT16 count;
|
||||
|
||||
// prevent "invalid command received"
|
||||
serverloading = true;
|
||||
serverloadingstealth = onlyIfChanged;
|
||||
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
if (cvar->flags & CV_NETVAR)
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ void CV_SaveVariables(FILE *f);
|
||||
|
||||
// load/save gamesate (load and save option and for network join in game)
|
||||
void CV_SaveNetVars(UINT8 **p, boolean isdemorecording);
|
||||
void CV_LoadNetVars(UINT8 **p, boolean onlyIfChanged);
|
||||
void CV_LoadNetVars(UINT8 **p);
|
||||
|
||||
// reset cheat netvars after cheats is deactivated
|
||||
void CV_ResetCheatNetVars(void);
|
||||
|
||||
+2
-3
@@ -54,7 +54,6 @@ static boolean con_started = false; // console has been initialised
|
||||
boolean con_startup = false; // true at game startup, screen need refreshing
|
||||
static boolean con_forcepic = true; // at startup toggle console translucency when first off
|
||||
boolean con_recalc; // set true when screen size has changed
|
||||
boolean con_muted = false;
|
||||
|
||||
static tic_t con_tick; // console ticker for anim or blinking prompt cursor
|
||||
// con_scrollup should use time (currenttime - lasttime)..
|
||||
@@ -113,7 +112,7 @@ static void CONS_backcolor_Change(void);
|
||||
#ifdef macintosh
|
||||
#define CON_BUFFERSIZE 4096 // my compiler can't handle local vars >32k
|
||||
#else
|
||||
#define CON_BUFFERSIZE 16384
|
||||
#define CON_BUFFERSIZE 32768
|
||||
#endif
|
||||
|
||||
static char con_buffer[CON_BUFFERSIZE];
|
||||
@@ -1261,7 +1260,7 @@ static void CON_Print(char *msg)
|
||||
INT32 controlchars = 0; // for color changing
|
||||
char color = '\x80'; // keep color across lines
|
||||
|
||||
if (msg == NULL || con_muted)
|
||||
if (msg == NULL)
|
||||
return;
|
||||
|
||||
if (*msg == '\3') // chat text, makes ding sound
|
||||
|
||||
@@ -27,9 +27,6 @@ extern boolean con_recalc;
|
||||
|
||||
extern boolean con_startup;
|
||||
|
||||
// no messages will be printed while the console is muted
|
||||
extern boolean con_muted;
|
||||
|
||||
// top clip value for view render: do not draw part of view hidden by console
|
||||
extern INT32 con_clipviewtop;
|
||||
|
||||
|
||||
+92
-901
File diff suppressed because it is too large.
Load diff
+2
-29
@@ -41,19 +41,6 @@ applications may follow different packet versions.
|
||||
#define BACKUPTICS 32
|
||||
#define TICQUEUE 512 // more than enough for most timeouts....
|
||||
#define MAXTEXTCMD 256
|
||||
|
||||
// How many time bits to encode into ticcmds (aiming and angle components, respectively)
|
||||
#define ENCODE_TICCMD_TIMES
|
||||
#define TICCMD_TIMEBITS_AIMING 3
|
||||
#define TICCMD_TIMEBITS_ANGLE 2
|
||||
#define TICCMD_TIMEMASK_AIMING (~(0xFFFFFFFF<<TICCMD_TIMEBITS_AIMING))
|
||||
#define TICCMD_TIMEMASK_ANGLE (~(0xFFFFFFFF<<TICCMD_TIMEBITS_ANGLE))
|
||||
#define TICCMD_TIME_SIZE (1<<(TICCMD_TIMEBITS_AIMING+TICCMD_TIMEBITS_ANGLE))
|
||||
|
||||
// Maximum number of client-side simulations allowed. A simulation is a version of the game state extrapolated some frames ahead to cancel out network latency
|
||||
#define MAXSIMULATIONS TICRATE //one second of simulations
|
||||
#define MAXLOCALSAVESTATES 8
|
||||
|
||||
//
|
||||
// Packet structure
|
||||
//
|
||||
@@ -555,17 +542,6 @@ typedef enum
|
||||
|
||||
} kickreason_t;
|
||||
|
||||
// Player movement histories for simulated gamestates
|
||||
typedef struct
|
||||
{
|
||||
// stores historical simulated positions where 0 is the real game position and simtic-gametic is the latest simulated position
|
||||
fixed_t histx[MAXSIMULATIONS + 1], histy[MAXSIMULATIONS + 1], histz[MAXSIMULATIONS + 1];
|
||||
|
||||
// stores the final simulated position for each simulated gametic
|
||||
fixed_t simx[MAXSIMULATIONS], simy[MAXSIMULATIONS], simz[MAXSIMULATIONS];
|
||||
|
||||
} steadyplayer_t;
|
||||
|
||||
/* the max number of name changes in some time period */
|
||||
#define MAXNAMECHANGES (5)
|
||||
#define NAMECHANGERATE (60*TICRATE)
|
||||
@@ -577,10 +553,7 @@ extern boolean dedicated; // For dedicated server
|
||||
extern UINT16 software_MAXPACKETLENGTH;
|
||||
extern boolean acceptnewnode;
|
||||
extern SINT8 servernode;
|
||||
extern char connectedservername[MAXSERVERNAME];
|
||||
|
||||
extern boolean issimulation; // whether the currently executed tic is part of a simulated gamestate
|
||||
extern steadyplayer_t steadyplayers[MAXPLAYERS];
|
||||
extern char connectedservername[MAXSERVERNAME+1];
|
||||
|
||||
void Command_Ping_f(void);
|
||||
extern tic_t connectiontimeout;
|
||||
@@ -594,7 +567,7 @@ extern consvar_t
|
||||
#ifdef VANILLAJOINNEXTROUND
|
||||
cv_joinnextround,
|
||||
#endif
|
||||
cv_netticbuffer, cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
cv_netticbuffer, cv_allownewplayer, cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
|
||||
extern consvar_t cv_connectawaittime;
|
||||
|
||||
|
||||
+30
-37
@@ -136,8 +136,6 @@ char srb2path[256] = ".";
|
||||
boolean usehome = true;
|
||||
const char *pandf = "%s" PATHSEP "%s";
|
||||
|
||||
extern char netDebugText[10000];
|
||||
|
||||
//
|
||||
// EVENT HANDLING
|
||||
//
|
||||
@@ -449,17 +447,14 @@ static void D_Display(void)
|
||||
viewwindowx = 0;
|
||||
viewwindowy = viewheight;
|
||||
}
|
||||
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
|
||||
break;
|
||||
case 2:
|
||||
viewwindowx = 0;
|
||||
viewwindowy = viewheight;
|
||||
M_Memcpy(ylookup, ylookup3, viewheight*sizeof (ylookup[0]));
|
||||
break;
|
||||
case 3:
|
||||
viewwindowx = viewwidth;
|
||||
viewwindowy = viewheight;
|
||||
M_Memcpy(ylookup, ylookup4, viewheight*sizeof (ylookup[0]));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -469,9 +464,6 @@ static void D_Display(void)
|
||||
}
|
||||
|
||||
R_RenderPlayerView(&players[displayplayers[i]]);
|
||||
|
||||
if (i > 0)
|
||||
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,28 +588,6 @@ static void D_Display(void)
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s);
|
||||
}
|
||||
|
||||
//netsimstat srb2netplus
|
||||
if (cv_netsimstat.value && netDebugText[0] != 0)
|
||||
{
|
||||
const char *str = netDebugText;
|
||||
int y = 0;
|
||||
|
||||
while (str != NULL)
|
||||
{
|
||||
char temp[1024];
|
||||
const char *nextStr = strstr(str + 1, "\n");
|
||||
int len = nextStr ? nextStr - str : strlen(str);
|
||||
|
||||
memcpy(temp, str, len);
|
||||
temp[len] = 0;
|
||||
|
||||
V_DrawRightAlignedSmallString(BASEVIDWIDTH, y, V_YELLOWMAP, temp);
|
||||
|
||||
y += 5;
|
||||
str = nextStr ? nextStr + 1 : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_shittyscreen.value)
|
||||
V_DrawVhsEffect(cv_shittyscreen.value == 2);
|
||||
|
||||
@@ -990,7 +960,7 @@ static void D_FindAddonsToAutoload(void)
|
||||
|
||||
INT32 i, len;
|
||||
boolean hasprefix = false;
|
||||
char wadsToAutoload[256] = "", renameAutoloadStrings[256] = "";
|
||||
char wadsToAutoload[256] = "";
|
||||
|
||||
// does it exist tho
|
||||
autoloadpath = va("%s"PATHSEP"%s",srb2home,AUTOLOADCONFIGFILENAME);
|
||||
@@ -1094,15 +1064,21 @@ static boolean AddIWAD(void)
|
||||
}
|
||||
}
|
||||
|
||||
// extra graphic patches for saturn specific thingies
|
||||
boolean found_extra_kart;
|
||||
boolean found_extra2_kart;
|
||||
|
||||
boolean snw_speedo; // snowy speedometer check
|
||||
boolean xtra_speedo; // extra speedometer check
|
||||
boolean xtra_speedo_clr; // extra speedometer colour check
|
||||
boolean achi_speedo; // achiiro speedometer check
|
||||
boolean achi_speedo_clr; // extra speedometer colour check
|
||||
boolean clr_hud; // colour hud check
|
||||
boolean big_lap; // bigger lap counter
|
||||
boolean big_lap_color; // bigger lap counter but colour
|
||||
boolean kartzspeedo; // kartZ speedometer
|
||||
boolean statdp; // New stat
|
||||
boolean kartzspeedo; // kartZ speedo
|
||||
boolean statdp; // stat display for extended player setup
|
||||
boolean nametaggfx; // Nametag stuffs
|
||||
boolean driftgaugegfx;
|
||||
|
||||
static void IdentifyVersion(void)
|
||||
{
|
||||
@@ -1464,9 +1440,19 @@ void D_SRB2Main(void)
|
||||
if (found_extra2_kart)
|
||||
mainwads++;
|
||||
|
||||
// now check for speedometer stuff
|
||||
// now check for extra speedometer stuff
|
||||
if (W_CheckMultipleLumps("SP_SMSTC", "K_TRNULL", "SP_MKMH", "SP_MMPH", "SP_MFRAC", "SP_MPERC", NULL))
|
||||
snw_speedo = true;
|
||||
xtra_speedo = true;
|
||||
|
||||
if (W_CheckMultipleLumps("SC_SMSTC", NULL))
|
||||
xtra_speedo_clr = true;
|
||||
|
||||
// now check for achii speedometer stuff
|
||||
if (W_CheckMultipleLumps("SP_AMSTC", "K_TRNULL", "SP_AKMH", "SP_AMPH", "SP_AFRAC", "SP_APERC", NULL))
|
||||
achi_speedo = true;
|
||||
|
||||
if (W_CheckMultipleLumps("SC_AMSTC", "K_TRNULL", "SC_AKMH", "SC_AMPH", "SC_AFRAC", "SC_APERC", NULL))
|
||||
achi_speedo_clr = true;
|
||||
|
||||
// check for bigger lap count
|
||||
if (W_CheckMultipleLumps("K_STLAPB", "K_STLA2B", NULL))
|
||||
@@ -1474,7 +1460,7 @@ void D_SRB2Main(void)
|
||||
|
||||
// now check for colour hud stuff
|
||||
if (W_CheckMultipleLumps("K_SCTIME", "K_SCTIMW", "K_SCLAPS", "K_SCLAPW", \
|
||||
"K_SCBALN", "K_SCBALW", "K_SCKARM", "K_SCTOUT", "K_ISMULC", "K_ITMULC", "K_ITBC","K_ITBCD", "K_ISBC", "K_ISBCD", NULL))
|
||||
"K_SCBALN", "K_SCBALW", "K_SCKARM", "K_SCTOUT", "K_ISMULC", "K_ITMULC", "K_ITBC", "K_ITBCD", "K_ISBC", "K_ISBCD", NULL))
|
||||
clr_hud = true;
|
||||
|
||||
// check for bigger lap count but color** its color bitch
|
||||
@@ -1492,6 +1478,13 @@ void D_SRB2Main(void)
|
||||
if (W_CheckMultipleLumps("K_STATNB", "K_STATN1", "K_STATN2", "K_STATN3", "K_STATN4", \
|
||||
"K_STATN5", "K_STATN6", NULL))
|
||||
statdp = true;
|
||||
|
||||
// Nametag stuffs
|
||||
if (W_CheckMultipleLumps("NTLINE", "NTLINEV", "NTSP", "NTWH", NULL))
|
||||
nametaggfx = true;
|
||||
|
||||
if (W_CheckMultipleLumps("K_DGAU","K_DCAU","K_DGSU","K_DCSU", NULL))
|
||||
driftgaugegfx = true;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+11
-4
@@ -28,12 +28,19 @@ extern char srb2path[256]; //Alam: SRB2's Home
|
||||
extern boolean found_extra_kart; // for use in k_kart.c
|
||||
extern boolean found_extra2_kart; // for use in k_kart.c
|
||||
|
||||
extern boolean snw_speedo; // snowy speedometer check
|
||||
// extra graphic patches for saturn specific thingies
|
||||
extern boolean xtra_speedo; // extra speedometer check
|
||||
extern boolean xtra_speedo_clr; // extra speedometer colour check
|
||||
extern boolean achi_speedo; // achiiro speedometer check
|
||||
extern boolean achi_speedo_clr; // extra speedometer colour check
|
||||
extern boolean clr_hud; // colour hud check
|
||||
extern boolean big_lap; // bigger lap counter
|
||||
extern boolean big_lap_color; //bigger lap counter but colour
|
||||
extern boolean kartzspeedo; //kartZ speedo
|
||||
extern boolean statdp; //stat display for extended player setup
|
||||
extern boolean big_lap_color; // bigger lap counter but colour
|
||||
extern boolean kartzspeedo; // kartZ speedo
|
||||
extern boolean statdp; // stat display for extended player setup
|
||||
extern boolean nametaggfx; // Nametag stuffs
|
||||
extern boolean driftgaugegfx;
|
||||
|
||||
|
||||
extern boolean autoloading;
|
||||
extern boolean autoloaded;
|
||||
|
||||
+4
-3
@@ -1010,7 +1010,7 @@ void Command_Droprate(void)
|
||||
static boolean ShouldDropPacket(void)
|
||||
{
|
||||
return (packetdropquantity[netbuffer->packettype])
|
||||
|| (packetdroprate != 0 && rand() < (RAND_MAX * (packetdroprate / 100.f))) || packetdroprate == 100;
|
||||
|| (packetdroprate != 0 && rand() < (((double)RAND_MAX) * (packetdroprate / 100.f))) || packetdroprate == 100;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1171,8 +1171,9 @@ boolean HGetPacket(void)
|
||||
if (netbuffer->checksum != NetbufferChecksum())
|
||||
{
|
||||
DEBFILE("Bad packet checksum\n");
|
||||
//Net_CloseConnection(nodejustjoined ? (doomcom->remotenode | FORCECLOSE) : doomcom->remotenode);
|
||||
Net_CloseConnection(doomcom->remotenode);
|
||||
// Do not disconnect or anything, just ignore the packet.
|
||||
// Bad checksums with UDP tend to happen very scarcely
|
||||
// so they are not normally an issue.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+72
-174
@@ -50,7 +50,6 @@
|
||||
#include "y_inter.h"
|
||||
#include "fastcmp.h"
|
||||
#include "m_perfstats.h"
|
||||
#include "i_net.h"
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
#define CV_RESTRICT CV_NETVAR
|
||||
@@ -122,10 +121,6 @@ static void KartEncore_OnChange(void);
|
||||
static void KartComeback_OnChange(void);
|
||||
static void KartEliminateLast_OnChange(void);
|
||||
|
||||
//netplus stuff
|
||||
static void TimeFudge_OnChange(void);
|
||||
void Command_Autotimefudge(void);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
static void Fishcake_OnChange(void);
|
||||
#endif
|
||||
@@ -457,14 +452,12 @@ static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "
|
||||
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_forceskin = {"forceskin", "Off", CV_NETVAR|CV_CALL|CV_CHEAT, Forceskin_cons_t, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fakelocalskin = {"fakelocalskin", "None", CV_SAVE, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fakelocalskin = {"fakelocalskin", "None", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_killingdead = {"killingdead", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_netsimstat = { "netsimstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL }; //srb2netplus, shows simulation stats
|
||||
|
||||
consvar_t cv_netstat = {"netstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // show bandwidth statistics
|
||||
static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_nettimeout = {"nettimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -512,6 +505,45 @@ consvar_t cv_mute = {"mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange,
|
||||
|
||||
consvar_t cv_sleep = {"cpusleep", "1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t nametagtrans_cons_t[] = {
|
||||
{0, "Never"}, {1, "Far only"}, {2, "Dynamic"}, {3, "Always"}, {4, "HUD Trans."}, {0, NULL}};
|
||||
/*static CV_PossibleValue_t nametagscaling_cons_t[] = {
|
||||
{0, "MIN"}, {320, "MAX"}, {0, NULL}};*/
|
||||
static CV_PossibleValue_t nametagdistance_cons_t[] = {
|
||||
{0, "MIN"}, {640, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t nametagmaxplayer_cons_t[] = {
|
||||
{1, "MIN"}, {MAXPLAYERS, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t nametagsize_cons_t[] = {
|
||||
{0, "Off"}, {1, "Small"}, {2, "Minimal"}, {0, NULL}};
|
||||
static CV_PossibleValue_t nametagrestat_cons_t[] = {
|
||||
{0, "Off"}, {1, "Restat"}, {2, "Always"}, {0, NULL}};
|
||||
|
||||
|
||||
consvar_t cv_nametag = {"kartnametag", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagtrans = {"kartnametagtransparency", "Dynamic", CV_SAVE, nametagtrans_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagfacerank = {"kartnametagfacerank", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagrestat = {"kartnametagrestat", "Restat", CV_SAVE, nametagrestat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagdist = {"kartnametagdist", "320", CV_SAVE, nametagdistance_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagmaxplayers = {"kartnametagmaxplayers", "3", CV_SAVE, nametagmaxplayer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagmaxlenght = {"kartnametagmaxlenght", "12", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
//consvar_t cv_nametagscaling = {"nametagscaling", "160", CV_SAVE, nametagscaling_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showownnametag = {"kartnametagshowown", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_smallnametags = {"kartnametagsmall", "Off", CV_SAVE, nametagsize_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametaghop = {"kartnametaghop", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagscore = {"kartnametagscore", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shownametagfinish = {"kartshownametagfinished", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shownametagspectator = {"kartshownametagspectator", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t driftgaugeoffset_cons_t[] = {
|
||||
{-FRACUNIT*128, "MIN"}, {FRACUNIT*128, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t driftgaugestyle_cons_t[] = {
|
||||
{1, "Default"}, {2, "Small"}, {3, "Big Numbers"}, {4, "Numbers Only"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_driftgauge = {"kartdriftgauge", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftgaugeofs = {"kartdriftgaugeoffset", "-20", CV_FLOAT|CV_SAVE, driftgaugeoffset_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftgaugetrans = {"kartdriftgaugetransparency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftgaugestyle = {"kartdriftgaugestyle", "1", CV_SAVE, driftgaugestyle_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectspin_cons_t[] = {
|
||||
{0, "Off"}, {1, "Slow"}, {2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"}, {7, "7"}, {8, "8"}, {9, "9"}, {10, "Fast"}, {SKINSELECTSPIN_PAIN, "Pain"}, {0, NULL}};
|
||||
consvar_t cv_skinselectspin = {"skinselectspin", "5", CV_SAVE, skinselectspin_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -550,50 +582,6 @@ boolean forceresetplayers = false;
|
||||
boolean deferencoremode = false;
|
||||
UINT8 splitscreen = 0;
|
||||
boolean circuitmap = true; // SRB2kart
|
||||
|
||||
consvar_t cv_simulate = { "sim", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t simulateTics_cons_t[] = { {0, "MIN"}, {MAXSIMULATIONS - 1, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_simulatetics = { "simtics", "MAX", 0, simulateTics_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_simmisstics = { "simmisstics", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
consvar_t cv_jittersmoothing = { "jittersmoothing", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t simulateculldistance_cons_t[] = { {0, "MIN"}, {10000, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_simulateculldistance = { "simcull", "MIN", 0, simulateculldistance_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t siminaccuracy_cons_t[] = { {1, "MIN"}, {10, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_siminaccuracy = { "siminaccuracy", "MIN", 0, siminaccuracy_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netsteadyplayers_cons_t[] = { {0, "MIN"}, {MAXSIMULATIONS - 1, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netsteadyplayers = { "simsteadyplayers", "0", 0, netsteadyplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t nettrails_cons_t[] = { {0, "MIN"}, {10, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_nettrails = { "simtrails", "5", 0, nettrails_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_netslingdelay = { "simslingdelay", "No", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netdelay_cons_t[] = { {0, "MIN"}, {250, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netdelay = { "netdelay", "0", 0, netdelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netjitter_cons_t[] = { {0, "MIN"}, {5, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netjitter = { "netjitter", "0", 0, netjitter_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_netsmoothing = { "netsmoothing", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_netspikes = { "netspikes", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t netvariabletime_cons_t[] = { {-1, "MIN"}, {100, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_netvariabletime = { "netvariabletime", "-1", 0, netvariabletime_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t debugsimulaterewind_cons_t[] = { {0, "MIN"}, {BACKUPTICS - 1, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_debugsimulaterewind = { "debugsimulaterewind", "0", 0, debugsimulaterewind_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
static CV_PossibleValue_t timefudge_cons_t[] = { {0, "MIN"}, {100, "MAX"}, {0, NULL} };
|
||||
consvar_t cv_timefudge = { "timefudge", "0", CV_CALL, timefudge_cons_t, TimeFudge_OnChange, 0, NULL, NULL, 0, 0, NULL };
|
||||
|
||||
consvar_t cv_autoupdatetimefudge = {"autoupdatetimefudge", "No", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
INT32 adminplayers[MAXPLAYERS];
|
||||
|
||||
/// \warning Keep this up-to-date if you add/remove/rename net text commands
|
||||
@@ -728,26 +716,6 @@ void D_RegisterServerCommands(void)
|
||||
|
||||
COM_AddCommand("replaymarker", Command_ReplayMarker);
|
||||
|
||||
COM_AddCommand("autotimefudge", Command_Autotimefudge);
|
||||
|
||||
CV_RegisterVar(&cv_simulate);
|
||||
CV_RegisterVar(&cv_simulatetics);
|
||||
CV_RegisterVar(&cv_simmisstics);
|
||||
CV_RegisterVar(&cv_jittersmoothing);
|
||||
CV_RegisterVar(&cv_simulateculldistance);
|
||||
CV_RegisterVar(&cv_siminaccuracy);
|
||||
CV_RegisterVar(&cv_netdelay);
|
||||
CV_RegisterVar(&cv_netjitter);
|
||||
CV_RegisterVar(&cv_netsmoothing);
|
||||
CV_RegisterVar(&cv_netspikes);
|
||||
CV_RegisterVar(&cv_netsteadyplayers);
|
||||
CV_RegisterVar(&cv_debugsimulaterewind);
|
||||
CV_RegisterVar(&cv_timefudge);
|
||||
CV_RegisterVar(&cv_autoupdatetimefudge);
|
||||
CV_RegisterVar(&cv_nettrails);
|
||||
CV_RegisterVar(&cv_netslingdelay);
|
||||
CV_RegisterVar(&cv_netvariabletime);
|
||||
|
||||
// for master server connection
|
||||
AddMServCommands();
|
||||
|
||||
@@ -816,6 +784,7 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_httpsource);
|
||||
#ifndef NONET
|
||||
CV_RegisterVar(&cv_allownewplayer);
|
||||
CV_RegisterVar(&cv_joinrefusemessage);
|
||||
CV_RegisterVar(&cv_chatlogsize);
|
||||
#ifdef VANILLAJOINNEXTROUND
|
||||
CV_RegisterVar(&cv_joinnextround);
|
||||
@@ -852,83 +821,7 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_recordmultiplayerdemos);
|
||||
CV_RegisterVar(&cv_netdemosyncquality);
|
||||
CV_RegisterVar(&cv_maxdemosize);
|
||||
}
|
||||
|
||||
extern double netUpdateFudge;
|
||||
void Command_Autotimefudge(void)
|
||||
{
|
||||
// you can use SDL_GetPerformanceFrequency() instead of tic_frequency to get more precise timings
|
||||
double startTime = ((double)I_GetPreciseTime() / tic_frequency);
|
||||
double packetTimeFudge[64];
|
||||
int numReceivedPackets = 0;
|
||||
const double numSampleTics = 10;
|
||||
int i;
|
||||
double lastTimeReceivedPacket;
|
||||
|
||||
if (server && netgame)
|
||||
{
|
||||
CONS_Printf("Servers do not need time fudging!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
lastTimeReceivedPacket = (double)I_GetPreciseTime() / tic_frequency;
|
||||
while ((abs((double)I_GetPreciseTime() / tic_frequency - startTime) < numSampleTics) || numReceivedPackets < 10)
|
||||
{
|
||||
I_NetGet();
|
||||
if ((doomcom->remotenode != -1)) // Packet received
|
||||
{
|
||||
packetTimeFudge[numReceivedPackets] = 100 * abs(((double)I_GetPreciseTime() / tic_frequency - lastTimeReceivedPacket) - netUpdateFudge); // gets the time fudge offset (0-100)
|
||||
CONS_Printf("%i: %d\n", numReceivedPackets, packetTimeFudge[numReceivedPackets]);
|
||||
numReceivedPackets++;
|
||||
lastTimeReceivedPacket = (double)I_GetPreciseTime() / tic_frequency;
|
||||
}
|
||||
}
|
||||
|
||||
if (numReceivedPackets > 0)
|
||||
{
|
||||
UINT8 minOffset = 100, maxOffset = 0, averageOffset = 0;
|
||||
UINT8 newTimeFudge;
|
||||
UINT8 estimatedRange;
|
||||
|
||||
|
||||
for (i = 0; i < numReceivedPackets; i++)
|
||||
{
|
||||
if (packetTimeFudge[i] < 0)
|
||||
continue;
|
||||
minOffset = min(minOffset, packetTimeFudge[i]);
|
||||
maxOffset = max(maxOffset, packetTimeFudge[i]);
|
||||
}
|
||||
|
||||
if (maxOffset - minOffset > 50)
|
||||
{
|
||||
// say maxOffset = 90 and minOffset = 20, we want the average to be 30...
|
||||
maxOffset = maxOffset - 100;
|
||||
|
||||
if (minOffset > maxOffset)
|
||||
{
|
||||
int swap = maxOffset;
|
||||
maxOffset = minOffset;
|
||||
minOffset = swap;
|
||||
}
|
||||
}
|
||||
|
||||
estimatedRange = maxOffset - minOffset;
|
||||
averageOffset = (maxOffset + minOffset) / 2;
|
||||
|
||||
CONS_Printf("%i packets received\n Timer fluctuations:\nmin: %d max: %d avg: %d est. range: %d (network update time: %lf)\n", numReceivedPackets, minOffset, maxOffset, averageOffset,
|
||||
estimatedRange, netUpdateFudge);
|
||||
|
||||
if (averageOffset <= 0)
|
||||
{
|
||||
CONS_Printf("Timers are OK, no time fudging required\n");
|
||||
return;
|
||||
}
|
||||
|
||||
newTimeFudge = (cv_timefudge.value + averageOffset + 50) % 100;
|
||||
CONS_Printf("New time fudge: %i%%\n", newTimeFudge);
|
||||
|
||||
CV_SetValue(&cv_timefudge, newTimeFudge);
|
||||
}
|
||||
CV_RegisterVar(&cv_nativekeyboard);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -1003,6 +896,8 @@ void D_RegisterClientCommands(void)
|
||||
// GIF variables
|
||||
CV_RegisterVar(&cv_gif_optimize);
|
||||
CV_RegisterVar(&cv_gif_downscale);
|
||||
CV_RegisterVar(&cv_gif_dynamicdelay);
|
||||
CV_RegisterVar(&cv_gif_localcolortable);
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
CV_RegisterVar(&cv_splats);
|
||||
@@ -1037,7 +932,6 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_rollingdemos);
|
||||
CV_RegisterVar(&cv_netstat);
|
||||
CV_RegisterVar(&cv_netticbuffer);
|
||||
CV_RegisterVar(&cv_netsimstat);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
CV_RegisterVar(&cv_fishcake);
|
||||
@@ -1220,6 +1114,26 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_soundtest);
|
||||
|
||||
CV_RegisterVar(&cv_nametag);
|
||||
CV_RegisterVar(&cv_nametagtrans);
|
||||
CV_RegisterVar(&cv_nametagfacerank);
|
||||
CV_RegisterVar(&cv_nametagmaxplayers);
|
||||
CV_RegisterVar(&cv_nametagmaxlenght);
|
||||
//CV_RegisterVar(&cv_nametagscaling);
|
||||
CV_RegisterVar(&cv_nametagdist);
|
||||
CV_RegisterVar(&cv_showownnametag);
|
||||
CV_RegisterVar(&cv_smallnametags);
|
||||
CV_RegisterVar(&cv_nametagrestat);
|
||||
CV_RegisterVar(&cv_nametaghop);
|
||||
CV_RegisterVar(&cv_nametagscore);
|
||||
CV_RegisterVar(&cv_shownametagfinish);
|
||||
CV_RegisterVar(&cv_shownametagspectator);
|
||||
|
||||
CV_RegisterVar(&cv_driftgauge);
|
||||
CV_RegisterVar(&cv_driftgaugeofs);
|
||||
CV_RegisterVar(&cv_driftgaugetrans);
|
||||
CV_RegisterVar(&cv_driftgaugestyle);
|
||||
|
||||
CV_RegisterVar(&cv_perfstats);
|
||||
CV_RegisterVar(&cv_ps_thinkframe_page);
|
||||
CV_RegisterVar(&cv_ps_samplesize);
|
||||
@@ -1236,8 +1150,8 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_speed);
|
||||
CV_RegisterVar(&cv_opflags);
|
||||
CV_RegisterVar(&cv_mapthingnum);
|
||||
// CV_RegisterVar(&cv_grid);
|
||||
// CV_RegisterVar(&cv_snapto);
|
||||
//CV_RegisterVar(&cv_grid);
|
||||
//CV_RegisterVar(&cv_snapto);
|
||||
|
||||
// add cheat commands
|
||||
COM_AddCommand("noclip", Command_CheatNoClip_f);
|
||||
@@ -1273,6 +1187,8 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_discordasks);
|
||||
#endif
|
||||
|
||||
CV_RegisterVar(&cv_showspecstuff);
|
||||
|
||||
COM_AddCommand("listskins", Command_ListSkins);
|
||||
COM_AddCommand("skinsearch", Command_SkinSearch);
|
||||
}
|
||||
@@ -5016,18 +4932,7 @@ static void Command_Version_f(void)
|
||||
#endif
|
||||
|
||||
// OS
|
||||
// Would be nice to use SDL_GetPlatform for this
|
||||
#if defined (_WIN32) || defined (_WIN64)
|
||||
CONS_Printf("Windows ");
|
||||
#elif defined(__linux__)
|
||||
CONS_Printf("Linux ");
|
||||
#elif defined(MACOSX)
|
||||
CONS_Printf("macOS ");
|
||||
#elif defined(UNIXCOMMON)
|
||||
CONS_Printf("Unix (Common) ");
|
||||
#else
|
||||
CONS_Printf("Other OS ");
|
||||
#endif
|
||||
CONS_Printf("%s ", I_GetSysName());
|
||||
|
||||
// Bitness
|
||||
if (sizeof(void*) == 4)
|
||||
@@ -5129,7 +5034,6 @@ void ItemFinder_OnChange(void)
|
||||
* \sa cv_pointlimit, TimeLimit_OnChange
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
|
||||
static void PointLimit_OnChange(void)
|
||||
{
|
||||
// Don't allow pointlimit in Single Player/Co-Op/Race!
|
||||
@@ -5148,7 +5052,7 @@ static void PointLimit_OnChange(void)
|
||||
cv_pointlimit.value > 1 ? "s" : "");
|
||||
}
|
||||
else if (netgame || multiplayer)
|
||||
CONS_Printf(M_GetText("Point limit disabled\n"));
|
||||
CONS_Printf(M_GetText("Point limit disabled\n"));
|
||||
}
|
||||
|
||||
static void NumLaps_OnChange(void)
|
||||
@@ -5393,12 +5297,6 @@ static void SoundTest_OnChange(void)
|
||||
S_StartSound(NULL, cv_soundtest.value);
|
||||
}
|
||||
|
||||
static void TimeFudge_OnChange(void)
|
||||
{
|
||||
I_SetTime(I_GetPreciseTime(), cv_timefudge.value, true);
|
||||
}
|
||||
|
||||
|
||||
static void AutoBalance_OnChange(void)
|
||||
{
|
||||
autobalance = (INT16)cv_autobalance.value;
|
||||
@@ -5860,8 +5758,8 @@ static void Command_Archivetest_f(void)
|
||||
|
||||
// assign mobjnum
|
||||
i = 1;
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
|
||||
// allocate buffer
|
||||
|
||||
+22
-20
@@ -86,7 +86,6 @@ extern consvar_t cv_teamscramble;
|
||||
extern consvar_t cv_scrambleonchange;
|
||||
|
||||
extern consvar_t cv_netstat;
|
||||
extern consvar_t cv_netsimstat;
|
||||
#ifdef WALLSPLATS
|
||||
extern consvar_t cv_splats;
|
||||
#endif
|
||||
@@ -159,25 +158,6 @@ extern consvar_t cv_pingmeasurement;
|
||||
extern consvar_t cv_pingicon;
|
||||
extern consvar_t cv_pingstyle;
|
||||
|
||||
//netplus stuff
|
||||
extern consvar_t cv_simulate;
|
||||
extern consvar_t cv_simulatetics;
|
||||
extern consvar_t cv_simmisstics;
|
||||
extern consvar_t cv_jittersmoothing;
|
||||
extern consvar_t cv_simulateculldistance;
|
||||
extern consvar_t cv_siminaccuracy;
|
||||
extern consvar_t cv_netdelay;
|
||||
extern consvar_t cv_netjitter;
|
||||
extern consvar_t cv_netsmoothing;
|
||||
extern consvar_t cv_netspikes;
|
||||
extern consvar_t cv_netsteadyplayers;
|
||||
extern consvar_t cv_debugsimulaterewind;
|
||||
extern consvar_t cv_timefudge;
|
||||
extern consvar_t cv_autoupdatetimefudge;
|
||||
extern consvar_t cv_nettrails;
|
||||
extern consvar_t cv_netslingdelay;
|
||||
extern consvar_t cv_netvariabletime;
|
||||
|
||||
//extern consvar_t cv_smallpos;
|
||||
extern consvar_t cv_showminimapnames;
|
||||
extern consvar_t cv_minihead;
|
||||
@@ -196,6 +176,26 @@ extern consvar_t cv_sleep;
|
||||
#define SKINSELECTSPIN_PAIN 25
|
||||
extern consvar_t cv_skinselectspin;
|
||||
|
||||
extern consvar_t cv_nametag;
|
||||
extern consvar_t cv_nametagtrans;
|
||||
extern consvar_t cv_nametagfacerank;
|
||||
extern consvar_t cv_nametagmaxplayers;
|
||||
extern consvar_t cv_nametagmaxlenght;
|
||||
//extern consvar_t cv_nametagscaling;
|
||||
extern consvar_t cv_nametagdist;
|
||||
extern consvar_t cv_showownnametag;
|
||||
extern consvar_t cv_smallnametags;
|
||||
extern consvar_t cv_nametagrestat;
|
||||
extern consvar_t cv_nametaghop;
|
||||
extern consvar_t cv_nametagscore;
|
||||
extern consvar_t cv_shownametagfinish;
|
||||
extern consvar_t cv_shownametagspectator;
|
||||
|
||||
extern consvar_t cv_driftgauge;
|
||||
extern consvar_t cv_driftgaugeofs;
|
||||
extern consvar_t cv_driftgaugetrans;
|
||||
extern consvar_t cv_driftgaugestyle;
|
||||
|
||||
extern consvar_t cv_perfstats;
|
||||
extern consvar_t cv_ps_thinkframe_page;
|
||||
extern consvar_t cv_ps_samplesize;
|
||||
@@ -203,6 +203,8 @@ extern consvar_t cv_ps_descriptor;
|
||||
|
||||
extern consvar_t cv_showtrackaddon;
|
||||
|
||||
extern consvar_t cv_showspecstuff;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SKINMENUTYPE_SCROLL = 0,
|
||||
|
||||
+75
-59
@@ -825,7 +825,6 @@ void SV_FileSendTicker(void)
|
||||
size_t size;
|
||||
filetx_t *f;
|
||||
INT32 packetsent, ram, i, j;
|
||||
INT32 maxpacketsent;
|
||||
|
||||
if (!filestosend) // No file to send
|
||||
return;
|
||||
@@ -1237,10 +1236,13 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
I_Error("Attempted to download files in -nodownload mode");
|
||||
#endif
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
if (!multi_handle)
|
||||
{
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
multi_handle = curl_multi_init();
|
||||
}
|
||||
|
||||
http_handle = curl_easy_init();
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
if (http_handle && multi_handle)
|
||||
{
|
||||
@@ -1296,98 +1298,112 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
|
||||
curl_multi_perform(multi_handle, &curl_runninghandles);
|
||||
curl_starttime = time(NULL);
|
||||
|
||||
curl_running = true;
|
||||
|
||||
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void CURLAbortFile(void)
|
||||
{
|
||||
curl_running = false;
|
||||
}
|
||||
|
||||
void CURLGetFile(void)
|
||||
{
|
||||
CURLMcode mc; /* return code used by curl_multi_wait() */
|
||||
CURLcode easyres; /* Return from easy interface */
|
||||
int numfds;
|
||||
CURLMsg *m; /* for picking up messages with the transfer status */
|
||||
CURL *e;
|
||||
int msgs_left; /* how many messages are left */
|
||||
const char *easy_handle_error;
|
||||
boolean running = true;
|
||||
long response_code = 0;
|
||||
static char *filename;
|
||||
|
||||
if (curl_runninghandles)
|
||||
while (running && curl_running)
|
||||
{
|
||||
curl_multi_perform(multi_handle, &curl_runninghandles);
|
||||
|
||||
/* wait for activity, timeout or "nothing" */
|
||||
mc = curl_multi_wait(multi_handle, NULL, 0, 1000, &numfds);
|
||||
|
||||
if (mc != CURLM_OK)
|
||||
if (curl_runninghandles)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc);
|
||||
return;
|
||||
}
|
||||
curl_curfile->currentsize = curl_dlnow;
|
||||
curl_curfile->totalsize = curl_dltotal;
|
||||
}
|
||||
curl_multi_perform(multi_handle, &curl_runninghandles);
|
||||
|
||||
/* See how the transfers went */
|
||||
while ((m = curl_multi_info_read(multi_handle, &msgs_left)))
|
||||
{
|
||||
if (m && (m->msg == CURLMSG_DONE))
|
||||
{
|
||||
e = m->easy_handle;
|
||||
easyres = m->data.result;
|
||||
filename = Z_StrDup(curl_realname);
|
||||
nameonly(filename);
|
||||
if (easyres != CURLE_OK)
|
||||
/* wait for activity, timeout or "nothing" */
|
||||
mc = curl_multi_wait(multi_handle, NULL, 0, 1000, NULL);
|
||||
|
||||
if (mc != CURLM_OK)
|
||||
{
|
||||
if (easyres == CURLE_HTTP_RETURNED_ERROR)
|
||||
curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code);
|
||||
|
||||
easy_handle_error = (response_code) ? va("HTTP response code %ld", response_code) : curl_easy_strerror(easyres);
|
||||
curl_curfile->status = FS_FALLBACK;
|
||||
curl_curfile->currentsize = curl_origfilesize;
|
||||
curl_curfile->totalsize = curl_origtotalfilesize;
|
||||
curl_failedwebdownload = true;
|
||||
fclose(curl_curfile->file);
|
||||
remove(curl_curfile->filename);
|
||||
CONS_Printf(M_GetText("Failed to download %s (%s)\n"), filename, easy_handle_error);
|
||||
CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose(curl_curfile->file);
|
||||
curl_curfile->currentsize = curl_dlnow;
|
||||
curl_curfile->totalsize = curl_dltotal;
|
||||
}
|
||||
|
||||
if (checkfilemd5(curl_curfile->filename, curl_curfile->md5sum) == FS_MD5SUMBAD)
|
||||
/* See how the transfers went */
|
||||
while ((m = curl_multi_info_read(multi_handle, &msgs_left)))
|
||||
{
|
||||
if (m && (m->msg == CURLMSG_DONE))
|
||||
{
|
||||
running = false;
|
||||
e = m->easy_handle;
|
||||
easyres = m->data.result;
|
||||
|
||||
filename = Z_StrDup(curl_realname);
|
||||
nameonly(filename);
|
||||
|
||||
if (easyres != CURLE_OK)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("HTTP Download of %s finished but is corrupt or has been modified\n"), filename);
|
||||
if (easyres == CURLE_HTTP_RETURNED_ERROR)
|
||||
curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code);
|
||||
|
||||
easy_handle_error = (response_code) ? va("HTTP response code %ld", response_code) : curl_easy_strerror(easyres);
|
||||
curl_curfile->status = FS_FALLBACK;
|
||||
curl_curfile->currentsize = curl_origfilesize;
|
||||
curl_curfile->totalsize = curl_origtotalfilesize;
|
||||
curl_failedwebdownload = true;
|
||||
fclose(curl_curfile->file);
|
||||
remove(curl_curfile->filename);
|
||||
CONS_Printf(M_GetText("Failed to download %s (%s)\n"), filename, easy_handle_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Finished HTTP download of %s\n"), filename);
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += curl_curfile->totalsize;
|
||||
curl_curfile->status = FS_FOUND;
|
||||
fclose(curl_curfile->file);
|
||||
|
||||
if (checkfilemd5(curl_curfile->filename, curl_curfile->md5sum) == FS_MD5SUMBAD)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("HTTP Download of %s finished but is corrupt or has been modified\n"), filename);
|
||||
curl_curfile->status = FS_FALLBACK;
|
||||
curl_failedwebdownload = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Finished HTTP download of %s\n"), filename);
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += curl_curfile->totalsize;
|
||||
curl_curfile->status = FS_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
Z_Free(filename);
|
||||
curl_curfile->file = NULL;
|
||||
curl_transfers--;
|
||||
curl_multi_remove_handle(multi_handle, e);
|
||||
curl_easy_cleanup(e);
|
||||
|
||||
if (!curl_transfers)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Z_Free(filename);
|
||||
curl_curfile->file = NULL;
|
||||
curl_running = false;
|
||||
curl_transfers--;
|
||||
curl_multi_remove_handle(multi_handle, e);
|
||||
curl_easy_cleanup(e);
|
||||
|
||||
if (!curl_transfers)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!curl_transfers)
|
||||
if (!curl_transfers || !curl_running)
|
||||
{
|
||||
curl_multi_cleanup(multi_handle);
|
||||
curl_global_cleanup();
|
||||
multi_handle = NULL;
|
||||
}
|
||||
curl_running = false;
|
||||
}
|
||||
|
||||
HTTP_login *
|
||||
|
||||
@@ -107,6 +107,7 @@ size_t nameonlylength(const char *s);
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
void CURLPrepareFile(const char* url, int dfilenum);
|
||||
void CURLAbortFile(void);
|
||||
void CURLGetFile(void);
|
||||
HTTP_login * CURLGetLogin (const char *url, HTTP_login ***return_prev_next);
|
||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
|
||||
+4
-4
@@ -916,7 +916,7 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
|
||||
if (i && i <= 1035)
|
||||
snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i));
|
||||
else if (i && i <= 1050)
|
||||
strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7);
|
||||
strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 6);
|
||||
else
|
||||
mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
|
||||
mapheaderinfo[num-1]->musname[6] = 0;
|
||||
@@ -941,7 +941,7 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
|
||||
else if (fastcmp(word, "SKYNUM"))
|
||||
mapheaderinfo[num-1]->skynum = (INT16)i;
|
||||
else if (fastcmp(word, "INTERSCREEN"))
|
||||
strncpy(mapheaderinfo[num-1]->interscreen, word2, 8);
|
||||
memcpy(mapheaderinfo[num-1]->interscreen, word2, 8);
|
||||
else if (fastcmp(word, "PRECUTSCENENUM"))
|
||||
mapheaderinfo[num-1]->precutscenenum = (UINT8)i;
|
||||
else if (fastcmp(word, "CUTSCENENUM"))
|
||||
@@ -2703,7 +2703,7 @@ static void readmaincfg(MYFILE *f)
|
||||
// Also save a time attack folder
|
||||
filenamelen = strlen(gamedatafilename)-4; // Strip off the extension
|
||||
filenamelen = min(filenamelen, sizeof (timeattackfolder));
|
||||
strncpy(timeattackfolder, gamedatafilename, filenamelen);
|
||||
memcpy(timeattackfolder, gamedatafilename, filenamelen);
|
||||
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
|
||||
|
||||
strcpy(savegamename, timeattackfolder);
|
||||
@@ -8628,7 +8628,7 @@ static int lib_dummysuper(lua_State *L)
|
||||
return luaL_error(L, "Can't call super() outside of hardcode-replacing A_Action functions being called by state changes!"); // convoluted, I know. @_@;;
|
||||
}
|
||||
|
||||
static inline int lib_getenum(lua_State *L)
|
||||
FUNCINLINE static ATTRINLINE int lib_getenum(lua_State *L)
|
||||
{
|
||||
const int UV_MATHLIB = lua_upvalueindex(1);
|
||||
const int GLIB_PROXY = lua_upvalueindex(2);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ struct discordInfo_s discordInfo;
|
||||
|
||||
discordRequest_t *discordRequestList = NULL;
|
||||
|
||||
static char self_ip[IP_SIZE];
|
||||
static char self_ip[IP_SIZE+1];
|
||||
|
||||
boolean drpc_init = false;
|
||||
|
||||
|
||||
+20
-4
@@ -127,8 +127,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v5.1 "
|
||||
#define VERSIONSTRINGW L"Saturn v5.1"
|
||||
#define VERSIONSTRING "Saturn v5 lugdev Zzz..."
|
||||
#define VERSIONSTRINGW L"Saturn v5 lugdev Zzz..."
|
||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||
// AND appveyor.yml, for the build bots!
|
||||
@@ -468,7 +468,7 @@ void M_StartupLocale(void);
|
||||
// M_GetText function that just returns the string.
|
||||
#define M_GetText(x) (x)
|
||||
#endif
|
||||
void *M_Memcpy(void* dest, const void* src, size_t n);
|
||||
extern void *(*M_Memcpy)(void* dest, const void* src, size_t n) FUNCNONNULL;
|
||||
char *va(const char *format, ...) FUNCPRINTF;
|
||||
char *M_GetToken(const char *inputString);
|
||||
char *sizeu1(size_t num);
|
||||
@@ -516,6 +516,22 @@ extern boolean capslock;
|
||||
// i_system.c, replace getchar() once the keyboard has been appropriated
|
||||
INT32 I_GetKey(void);
|
||||
|
||||
/* http://www.cse.yorku.ca/~oz/hash.html */
|
||||
static inline
|
||||
UINT32 quickncasehash (const char *p, size_t n)
|
||||
{
|
||||
size_t i = 0;
|
||||
UINT32 x = 5381;
|
||||
|
||||
while (i < n && p[i])
|
||||
{
|
||||
x = (x * 33) ^ tolower(p[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
#ifndef min // Double-Check with WATTCP-32's cdefs.h
|
||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
@@ -606,7 +622,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
|
||||
/// Sprite rotation
|
||||
#define ROTSPRITE
|
||||
#define ROTANGLES 72 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||
#define ROTANGLES 180 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||
#define ROTANGDIFF (360 / ROTANGLES)
|
||||
|
||||
#if defined (HAVE_CURL) && ! defined (NONET)
|
||||
|
||||
@@ -505,14 +505,6 @@ extern UINT32 timesBeatenWithEmeralds;
|
||||
extern tic_t gametic;
|
||||
#define localgametic leveltime
|
||||
|
||||
//extern tic_t neededtic;
|
||||
extern tic_t simtic; // current tic at simulation, if applicable (if no simulation happened, this=gametic)
|
||||
extern tic_t targetsimtic; // the target sim tic, if applicable
|
||||
extern tic_t smoothedTic; // current game tic when smoothing is enabled (\todo: could cause problems if game objects care about gametic)
|
||||
extern boolean canSimulate;
|
||||
// extern boolean canPlaySounds;
|
||||
extern tic_t finaltargetsimtic;
|
||||
|
||||
// Player spawn spots.
|
||||
extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
|
||||
extern mapthing_t *bluectfstarts[MAXPLAYERS]; // CTF
|
||||
|
||||
@@ -137,6 +137,11 @@ INT32 I_mkdir(const char *dirname, INT32 unixright)
|
||||
return -1;
|
||||
}
|
||||
|
||||
const CPUInfoFlags *I_CPUInfo(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *I_LocateWad(void)
|
||||
{
|
||||
return NULL;
|
||||
@@ -174,5 +179,11 @@ char *I_ClipboardPaste(void)
|
||||
|
||||
void I_RegisterSysCommands(void) {}
|
||||
|
||||
|
||||
const char *I_GetSysName(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#include "../sdl/dosstr.c"
|
||||
|
||||
+4
-2
@@ -180,7 +180,8 @@ static void F_SkyScroll(INT32 scrollspeed)
|
||||
y = 0;
|
||||
while (x < w)
|
||||
{
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, V_SNAPTOTOP|V_SNAPTOLEFT, pat, NULL);
|
||||
//V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, V_SNAPTOTOP|V_SNAPTOLEFT, pat, NULL);
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT*1.2, V_SNAPTOTOP|V_SNAPTOLEFT, pat, NULL);
|
||||
x += SHORT(pat->width);
|
||||
}
|
||||
|
||||
@@ -188,7 +189,8 @@ static void F_SkyScroll(INT32 scrollspeed)
|
||||
y = BASEVIDHEIGHT - SHORT(pat2->height);
|
||||
while (x < w)
|
||||
{
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTOLEFT, pat2, NULL);
|
||||
//V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTOLEFT, pat2, NULL);
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT*1.2, V_SNAPTOBOTTOM|V_SNAPTOLEFT, pat2, NULL);
|
||||
x += SHORT(pat2->width);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -414,11 +414,13 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||
strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
if (dent->d_type == DT_UNKNOWN)
|
||||
if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode))
|
||||
if (dent->d_type == DT_UNKNOWN && lstat(searchpath,&fsstat) == 0)
|
||||
{
|
||||
if (S_ISDIR(fsstat.st_mode))
|
||||
dent->d_type = DT_DIR;
|
||||
else if (lstat(searchpath,&fsstat) == 0 && S_ISLNK(fsstat.st_mode))
|
||||
else if (S_ISLNK(fsstat.st_mode))
|
||||
dent->d_type = DT_LNK;
|
||||
}
|
||||
|
||||
// Symlinks aren't always directory symlinks. Dunno if this would resolve recursive
|
||||
// symlinks, but i think stat already does that
|
||||
|
||||
+23
-398
@@ -130,14 +130,6 @@ UINT32 totalrings; // for intermission
|
||||
INT16 lastmap; // last level you were at (returning from special stages)
|
||||
tic_t timeinmap; // Ticker for time spent in level (used for levelcard display)
|
||||
|
||||
tic_t simtic; // simulated tic
|
||||
tic_t neededtic;
|
||||
tic_t targetsimtic; // target simulated tic
|
||||
tic_t smoothedTic;
|
||||
boolean canSimulate;
|
||||
tic_t finaltargetsimtic;
|
||||
// boolean canPlaySounds;
|
||||
|
||||
INT16 spstage_start;
|
||||
INT16 sstage_start;
|
||||
INT16 sstage_end;
|
||||
@@ -190,12 +182,8 @@ boolean gamedataloaded = false;
|
||||
// Time attack data for levels
|
||||
// These are dynamically allocated for space reasons now
|
||||
recorddata_t *mainrecords[NUMMAPS] = {NULL};
|
||||
//nightsdata_t *nightsrecords[NUMMAPS] = {NULL};
|
||||
UINT8 mapvisited[NUMMAPS];
|
||||
|
||||
// Temporary holding place for nights data for the current map
|
||||
//nightsdata_t ntemprecords;
|
||||
|
||||
UINT32 bluescore, redscore; // CTF and Team Match team scores
|
||||
|
||||
// ring count... for PERFECT!
|
||||
@@ -394,10 +382,6 @@ static CV_PossibleValue_t deadzone_cons_t[] = {{FRACUNIT/16, "MIN"}, {FRACUNIT,
|
||||
|
||||
// don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler.
|
||||
|
||||
// it automatically becomes compact with 20+ players, but if you like it, I guess you can turn that on!
|
||||
// SRB2Kart: irrelevant for us.
|
||||
//consvar_t cv_compactscoreboard= {"compactscoreboard", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// chat timer thingy
|
||||
static CV_PossibleValue_t chattime_cons_t[] = {{1, "MIN"}, {999, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_chattime = {"chattime", "8", CV_SAVE, chattime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -576,13 +560,6 @@ void G_AllocMainRecordData(INT16 i)
|
||||
memset(mainrecords[i], 0, sizeof(recorddata_t));
|
||||
}
|
||||
|
||||
/*void G_AllocNightsRecordData(INT16 i)
|
||||
{
|
||||
if (!nightsrecords[i])
|
||||
nightsrecords[i] = Z_Malloc(sizeof(nightsdata_t), PU_STATIC, NULL);
|
||||
memset(nightsrecords[i], 0, sizeof(nightsdata_t));
|
||||
}*/
|
||||
|
||||
// MAKE SURE YOU SAVE DATA BEFORE CALLING THIS
|
||||
void G_ClearRecords(void)
|
||||
{
|
||||
@@ -594,11 +571,6 @@ void G_ClearRecords(void)
|
||||
Z_Free(mainrecords[i]);
|
||||
mainrecords[i] = NULL;
|
||||
}
|
||||
/*if (nightsrecords[i])
|
||||
{
|
||||
Z_Free(nightsrecords[i]);
|
||||
nightsrecords[i] = NULL;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,170 +591,6 @@ tic_t G_GetBestTime(INT16 map)
|
||||
return mainrecords[map-1]->time;
|
||||
}
|
||||
|
||||
// Not needed
|
||||
/*tic_t G_GetBestLap(INT16 map)
|
||||
{
|
||||
if (!mainrecords[map-1] || mainrecords[map-1]->lap <= 0)
|
||||
return (tic_t)UINT32_MAX;
|
||||
|
||||
return mainrecords[map-1]->lap;
|
||||
}*/
|
||||
|
||||
/*UINT16 G_GetBestRings(INT16 map)
|
||||
{
|
||||
if (!mainrecords[map-1])
|
||||
return 0;
|
||||
|
||||
return mainrecords[map-1]->rings;
|
||||
}*/
|
||||
|
||||
// No NiGHTS records for SRB2Kart
|
||||
/*UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare)
|
||||
{
|
||||
if (!nightsrecords[map-1])
|
||||
return 0;
|
||||
|
||||
return nightsrecords[map-1]->score[mare];
|
||||
}
|
||||
|
||||
tic_t G_GetBestNightsTime(INT16 map, UINT8 mare)
|
||||
{
|
||||
if (!nightsrecords[map-1] || nightsrecords[map-1]->time[mare] <= 0)
|
||||
return (tic_t)UINT32_MAX;
|
||||
|
||||
return nightsrecords[map-1]->time[mare];
|
||||
}
|
||||
|
||||
UINT8 G_GetBestNightsGrade(INT16 map, UINT8 mare)
|
||||
{
|
||||
if (!nightsrecords[map-1])
|
||||
return 0;
|
||||
|
||||
return nightsrecords[map-1]->grade[mare];
|
||||
}
|
||||
|
||||
// For easy adding of NiGHTS records
|
||||
void G_AddTempNightsRecords(UINT32 pscore, tic_t ptime, UINT8 mare)
|
||||
{
|
||||
ntemprecords.score[mare] = pscore;
|
||||
ntemprecords.grade[mare] = P_GetGrade(pscore, gamemap, mare - 1);
|
||||
ntemprecords.time[mare] = ptime;
|
||||
|
||||
// Update nummares
|
||||
// Note that mare "0" is overall, mare "1" is the first real mare
|
||||
if (ntemprecords.nummares < mare)
|
||||
ntemprecords.nummares = mare;
|
||||
}
|
||||
|
||||
void G_SetNightsRecords(void)
|
||||
{
|
||||
INT32 i;
|
||||
UINT32 totalscore = 0;
|
||||
tic_t totaltime = 0;
|
||||
|
||||
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
|
||||
char *gpath;
|
||||
char lastdemo[256], bestdemo[256];
|
||||
|
||||
if (!ntemprecords.nummares)
|
||||
return;
|
||||
|
||||
// Set overall
|
||||
{
|
||||
UINT8 totalrank = 0, realrank = 0;
|
||||
|
||||
for (i = 1; i <= ntemprecords.nummares; ++i)
|
||||
{
|
||||
totalscore += ntemprecords.score[i];
|
||||
totalrank += ntemprecords.grade[i];
|
||||
totaltime += ntemprecords.time[i];
|
||||
}
|
||||
|
||||
// Determine overall grade
|
||||
realrank = (UINT8)((FixedDiv((fixed_t)totalrank << FRACBITS, ntemprecords.nummares << FRACBITS) + (FRACUNIT/2)) >> FRACBITS);
|
||||
|
||||
// You need ALL rainbow As to get a rainbow A overall
|
||||
if (realrank == GRADE_S && (totalrank / ntemprecords.nummares) != GRADE_S)
|
||||
realrank = GRADE_A;
|
||||
|
||||
ntemprecords.score[0] = totalscore;
|
||||
ntemprecords.grade[0] = realrank;
|
||||
ntemprecords.time[0] = totaltime;
|
||||
}
|
||||
|
||||
// Now take all temp records and put them in the actual records
|
||||
{
|
||||
nightsdata_t *maprecords;
|
||||
|
||||
if (!nightsrecords[gamemap-1])
|
||||
G_AllocNightsRecordData(gamemap-1);
|
||||
maprecords = nightsrecords[gamemap-1];
|
||||
|
||||
if (maprecords->nummares != ntemprecords.nummares)
|
||||
maprecords->nummares = ntemprecords.nummares;
|
||||
|
||||
for (i = 0; i < ntemprecords.nummares + 1; ++i)
|
||||
{
|
||||
if (maprecords->score[i] < ntemprecords.score[i])
|
||||
maprecords->score[i] = ntemprecords.score[i];
|
||||
if (maprecords->grade[i] < ntemprecords.grade[i])
|
||||
maprecords->grade[i] = ntemprecords.grade[i];
|
||||
if (!maprecords->time[i] || maprecords->time[i] > ntemprecords.time[i])
|
||||
maprecords->time[i] = ntemprecords.time[i];
|
||||
}
|
||||
}
|
||||
|
||||
memset(&ntemprecords, 0, sizeof(nightsdata_t));
|
||||
|
||||
// Save demo!
|
||||
bestdemo[255] = '\0';
|
||||
lastdemo[255] = '\0';
|
||||
G_SetDemoTime(totaltime, totalscore);
|
||||
G_CheckDemoStatus();
|
||||
|
||||
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
|
||||
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"%s", srb2home, timeattackfolder), 0755);
|
||||
|
||||
if ((gpath = malloc(glen)) == NULL)
|
||||
I_Error("Out of memory for replay filepath\n");
|
||||
|
||||
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
|
||||
snprintf(lastdemo, 255, "%s-last.lmp", gpath);
|
||||
|
||||
if (FIL_FileExists(lastdemo))
|
||||
{
|
||||
UINT8 *buf;
|
||||
size_t len = FIL_ReadFile(lastdemo, &buf);
|
||||
|
||||
snprintf(bestdemo, 255, "%s-time-best.lmp", gpath);
|
||||
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1)
|
||||
{ // Better time, save this demo.
|
||||
if (FIL_FileExists(bestdemo))
|
||||
remove(bestdemo);
|
||||
FIL_WriteFile(bestdemo, buf, len);
|
||||
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo);
|
||||
}
|
||||
|
||||
snprintf(bestdemo, 255, "%s-score-best.lmp", gpath);
|
||||
if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)))
|
||||
{ // Better score, save this demo.
|
||||
if (FIL_FileExists(bestdemo))
|
||||
remove(bestdemo);
|
||||
FIL_WriteFile(bestdemo, buf, len);
|
||||
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW HIGH SCORE!"), M_GetText("Saved replay as"), bestdemo);
|
||||
}
|
||||
|
||||
//CONS_Printf("%s '%s'\n", M_GetText("Saved replay as"), lastdemo);
|
||||
|
||||
Z_Free(buf);
|
||||
}
|
||||
free(gpath);
|
||||
|
||||
// If the mare count changed, this will update the score display
|
||||
CV_AddValue(&cv_nextmap, 1);
|
||||
CV_AddValue(&cv_nextmap, -1);
|
||||
}*/
|
||||
|
||||
// for consistency among messages: this modifies the game and removes savemoddata.
|
||||
void G_SetGameModified(boolean silent, boolean major)
|
||||
{
|
||||
@@ -840,7 +648,8 @@ const char *G_BuildMapName(INT32 map)
|
||||
map = G_RandMap(G_TOLFlag(cv_newgametype.value), map, false, 0, false, NULL)+1;
|
||||
}
|
||||
|
||||
if (map < 100)
|
||||
|
||||
if (map < 100 && map >= 0) // ...but why use signed integer in first place? idk but this prevents warning (and potential buffer overflow lol)
|
||||
sprintf(&mapname[3], "%.2d", map);
|
||||
else
|
||||
{
|
||||
@@ -2134,31 +1943,6 @@ boolean G_CouldView(INT32 playernum)
|
||||
return false;
|
||||
}
|
||||
|
||||
// SRB2Kart: we have no team-based modes, YET...
|
||||
/*if (G_GametypeHasTeams())
|
||||
{
|
||||
if (players[consoleplayer].ctfteam
|
||||
&& player->ctfteam != players[consoleplayer].ctfteam)
|
||||
return false;
|
||||
}
|
||||
else if (gametype == GT_HIDEANDSEEK)
|
||||
{
|
||||
if (players[consoleplayer].pflags & PF_TAGIT)
|
||||
return false;
|
||||
}
|
||||
// Other Tag-based gametypes?
|
||||
else if (G_TagGametype())
|
||||
{
|
||||
if (!players[consoleplayer].spectator
|
||||
&& (players[consoleplayer].pflags & PF_TAGIT) != (player->pflags & PF_TAGIT))
|
||||
return false;
|
||||
}
|
||||
else if (G_GametypeHasSpectators() && G_BattleGametype())
|
||||
{
|
||||
if (!players[consoleplayer].spectator)
|
||||
return false;
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2866,39 +2650,7 @@ void G_PlayerReborn(INT32 player)
|
||||
p->maxlink = 0;
|
||||
|
||||
// If NiGHTS, find lowest mare to start with.
|
||||
p->mare = 0; /*P_FindLowestMare();
|
||||
|
||||
CONS_Debug(DBG_NIGHTS, M_GetText("Current mare is %d\n"), p->mare);
|
||||
|
||||
if (p->mare == 255)
|
||||
p->mare = 0;*/
|
||||
|
||||
// Check to make sure their color didn't change somehow...
|
||||
/*if (G_GametypeHasTeams())
|
||||
{
|
||||
if (p->ctfteam == 1 && p->skincolor != skincolor_redteam)
|
||||
{
|
||||
if (p == &players[consoleplayer])
|
||||
CV_SetValue(&cv_playercolor, skincolor_redteam);
|
||||
else if (p == &players[displayplayers[1]])
|
||||
CV_SetValue(&cv_playercolor2, skincolor_redteam);
|
||||
else if (p == &players[displayplayers[2]])
|
||||
CV_SetValue(&cv_playercolor3, skincolor_redteam);
|
||||
else if (p == &players[displayplayers[3]])
|
||||
CV_SetValue(&cv_playercolor4, skincolor_redteam);
|
||||
}
|
||||
else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam)
|
||||
{
|
||||
if (p == &players[consoleplayer])
|
||||
CV_SetValue(&cv_playercolor, skincolor_blueteam);
|
||||
else if (p == &players[displayplayers[1]])
|
||||
CV_SetValue(&cv_playercolor2, skincolor_blueteam);
|
||||
else if (p == &players[displayplayers[2]])
|
||||
CV_SetValue(&cv_playercolor3, skincolor_blueteam);
|
||||
else if (p == &players[displayplayers[3]])
|
||||
CV_SetValue(&cv_playercolor4, skincolor_blueteam);
|
||||
}
|
||||
}*/
|
||||
p->mare = 0;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -3202,9 +2954,9 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
|
||||
I_Assert((oldmo != NULL) && (newmo != NULL));
|
||||
|
||||
// scan all thinkers
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -3412,12 +3164,8 @@ INT32 G_GetGametypeByName(const char *gametypestr)
|
||||
//
|
||||
boolean G_IsSpecialStage(INT32 mapnum)
|
||||
{
|
||||
#if 0
|
||||
return (gametype == GT_COOP && modeattacking != ATTACKING_RECORD && mapnum >= sstage_start && mapnum <= sstage_end);
|
||||
#else
|
||||
(void)mapnum;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -3429,17 +3177,7 @@ boolean G_IsSpecialStage(INT32 mapnum)
|
||||
boolean G_GametypeUsesLives(void)
|
||||
{
|
||||
// SRB2kart NEEDS no lives
|
||||
#if 0
|
||||
// Coop, Competitive
|
||||
if ((gametype == GT_COOP || gametype == GT_COMPETITION)
|
||||
&& !modeattacking // No lives in Time Attack
|
||||
//&& !G_IsSpecialStage(gamemap)
|
||||
&& !(maptol & TOL_NIGHTS)) // No lives in NiGHTS
|
||||
return true;
|
||||
return false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -4148,11 +3886,6 @@ void G_LoadGameData(void)
|
||||
//For records
|
||||
tic_t rectime;
|
||||
tic_t reclap;
|
||||
//UINT32 recscore;
|
||||
//UINT16 recrings;
|
||||
|
||||
//UINT8 recmares;
|
||||
//INT32 curmare;
|
||||
|
||||
// Clear things so previously read gamedata doesn't transfer
|
||||
// to new gamedata
|
||||
@@ -4243,43 +3976,15 @@ void G_LoadGameData(void)
|
||||
{
|
||||
rectime = (tic_t)READUINT32(save_p);
|
||||
reclap = (tic_t)READUINT32(save_p);
|
||||
//recscore = READUINT32(save_p);
|
||||
//recrings = READUINT16(save_p);
|
||||
|
||||
/*if (recrings > 10000 || recscore > MAXSCORE)
|
||||
goto datacorrupt;*/
|
||||
|
||||
if (rectime || reclap)
|
||||
{
|
||||
G_AllocMainRecordData((INT16)i);
|
||||
mainrecords[i]->time = rectime;
|
||||
mainrecords[i]->lap = reclap;
|
||||
//mainrecords[i]->score = recscore;
|
||||
//mainrecords[i]->rings = recrings;
|
||||
}
|
||||
}
|
||||
|
||||
// Nights records
|
||||
/*for (i = 0; i < NUMMAPS; ++i)
|
||||
{
|
||||
if ((recmares = READUINT8(save_p)) == 0)
|
||||
continue;
|
||||
|
||||
G_AllocNightsRecordData((INT16)i);
|
||||
|
||||
for (curmare = 0; curmare < (recmares+1); ++curmare)
|
||||
{
|
||||
nightsrecords[i]->score[curmare] = READUINT32(save_p);
|
||||
nightsrecords[i]->grade[curmare] = READUINT8(save_p);
|
||||
nightsrecords[i]->time[curmare] = (tic_t)READUINT32(save_p);
|
||||
|
||||
if (nightsrecords[i]->grade[curmare] > GRADE_S)
|
||||
goto datacorrupt;
|
||||
}
|
||||
|
||||
nightsrecords[i]->nummares = recmares;
|
||||
}*/
|
||||
|
||||
// done
|
||||
Z_Free(savebuffer);
|
||||
save_p = NULL;
|
||||
@@ -4379,7 +4084,6 @@ void G_SaveGameData(boolean force)
|
||||
|
||||
WRITEUINT32(save_p, timesBeaten);
|
||||
WRITEUINT32(save_p, timesBeatenWithEmeralds);
|
||||
//WRITEUINT32(save_p, timesBeatenUltimate);
|
||||
|
||||
// Main records
|
||||
for (i = 0; i < NUMMAPS; i++)
|
||||
@@ -4388,8 +4092,6 @@ void G_SaveGameData(boolean force)
|
||||
{
|
||||
WRITEUINT32(save_p, mainrecords[i]->time);
|
||||
WRITEUINT32(save_p, mainrecords[i]->lap);
|
||||
//WRITEUINT32(save_p, mainrecords[i]->score);
|
||||
//WRITEUINT16(save_p, mainrecords[i]->rings);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4398,25 +4100,6 @@ void G_SaveGameData(boolean force)
|
||||
}
|
||||
}
|
||||
|
||||
// NiGHTS records
|
||||
/*for (i = 0; i < NUMMAPS; i++)
|
||||
{
|
||||
if (!nightsrecords[i] || !nightsrecords[i]->nummares)
|
||||
{
|
||||
WRITEUINT8(save_p, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
WRITEUINT8(save_p, nightsrecords[i]->nummares);
|
||||
|
||||
for (curmare = 0; curmare < (nightsrecords[i]->nummares + 1); ++curmare)
|
||||
{
|
||||
WRITEUINT32(save_p, nightsrecords[i]->score[curmare]);
|
||||
WRITEUINT8(save_p, nightsrecords[i]->grade[curmare]);
|
||||
WRITEUINT32(save_p, nightsrecords[i]->time[curmare]);
|
||||
}
|
||||
}*/
|
||||
|
||||
length = save_p - savebuffer;
|
||||
|
||||
FIL_WriteFile(va(pandf, srb2home, gamedatafilename), savebuffer, length);
|
||||
@@ -4708,28 +4391,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
||||
players[i].playerstate = PST_REBORN;
|
||||
players[i].starpostangle = players[i].starpostnum = players[i].starposttime = 0;
|
||||
players[i].starpostx = players[i].starposty = players[i].starpostz = 0;
|
||||
|
||||
#if 0
|
||||
if (netgame || multiplayer)
|
||||
{
|
||||
players[i].lives = cv_startinglives.value;
|
||||
players[i].continues = 0;
|
||||
}
|
||||
else if (pultmode)
|
||||
{
|
||||
players[i].lives = 1;
|
||||
players[i].continues = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
players[i].lives = 3;
|
||||
players[i].continues = 1;
|
||||
}
|
||||
|
||||
players[i].xtralife = 0;
|
||||
#else
|
||||
players[i].lives = 1; // SRB2Kart
|
||||
#endif
|
||||
|
||||
// The latter two should clear by themselves, but just in case
|
||||
players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);
|
||||
@@ -5029,10 +4691,8 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc)
|
||||
INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
|
||||
{
|
||||
boolean usemapcode = false;
|
||||
INT32 newmapnum;
|
||||
|
||||
INT32 newmapnum = -1;
|
||||
size_t mapnamelen = strlen(mapname);
|
||||
|
||||
char *p;
|
||||
|
||||
if (mapnamelen == 1)
|
||||
@@ -5269,7 +4929,6 @@ void G_ReadDemoExtraData(void)
|
||||
kartspeed = READUINT8(demo_p);
|
||||
kartweight = READUINT8(demo_p);
|
||||
|
||||
|
||||
if (stricmp(skins[players[p].skin].name, name) != 0)
|
||||
FindClosestSkinForStats(p, kartspeed, kartweight);
|
||||
|
||||
@@ -5378,7 +5037,7 @@ void G_ReadDemoExtraData(void)
|
||||
void G_WriteDemoExtraData(void)
|
||||
{
|
||||
INT32 i;
|
||||
char name[16];
|
||||
char name[17];
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
@@ -5411,7 +5070,7 @@ void G_WriteDemoExtraData(void)
|
||||
{
|
||||
// Name
|
||||
memset(name, 0, 16);
|
||||
strncpy(name, player_names[i], 16);
|
||||
memcpy(name, player_names[i], 15); // Keeping 1 null byte for safety, sorry players with name containing more than 15 characters
|
||||
M_Memcpy(demo_p,name,16);
|
||||
demo_p += 16;
|
||||
}
|
||||
@@ -5684,7 +5343,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
|
||||
ziptic_p = demo_p++; // the ziptic, written at the end of this function
|
||||
|
||||
#define MAXMOM (0x7FFF<<8)
|
||||
#define MAXMOM (0x7FFF<<8)
|
||||
|
||||
// GZT_XYZ is only useful if you've moved 256 FRACUNITS or more in a single tic.
|
||||
if (abs(ghost->x-oldghost[playernum].x) > MAXMOM
|
||||
@@ -5739,7 +5398,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
oldghost[playernum].z += oldghost[playernum].momz<<8;
|
||||
}
|
||||
|
||||
#undef MAXMOM
|
||||
#undef MAXMOM
|
||||
|
||||
// Only store the 8 most relevant bits of angle
|
||||
// because exact values aren't too easy to discern to begin with when only 8 angles have different sprites
|
||||
@@ -5961,15 +5620,16 @@ void G_ConsGhostTic(INT32 playernum)
|
||||
demo_p += sizeof(angle_t); // angle, unnecessary for cons.
|
||||
|
||||
mobj = NULL;
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
mobj = (mobj_t *)th;
|
||||
if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z)
|
||||
break;
|
||||
mobj = NULL; // wasn't this one, keep searching.
|
||||
}
|
||||
if (th != &thlist[THINK_MOBJ] && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
|
||||
if (mobj && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
|
||||
{
|
||||
if (demosynced)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
|
||||
@@ -6757,7 +6417,7 @@ void G_RecordMetal(void)
|
||||
void G_BeginRecording(void)
|
||||
{
|
||||
UINT8 i, p;
|
||||
char name[16];
|
||||
char name[17];
|
||||
player_t *player = &players[consoleplayer];
|
||||
|
||||
char *filename;
|
||||
@@ -6829,11 +6489,6 @@ void G_BeginRecording(void)
|
||||
WRITEUINT32(demo_p,UINT32_MAX); // time
|
||||
WRITEUINT32(demo_p,UINT32_MAX); // lap
|
||||
break;
|
||||
/*case ATTACKING_NIGHTS: // 2
|
||||
demotime_p = demo_p;
|
||||
WRITEUINT32(demo_p,UINT32_MAX); // time
|
||||
WRITEUINT32(demo_p,0); // score
|
||||
break;*/
|
||||
default: // 3
|
||||
break;
|
||||
}
|
||||
@@ -6856,7 +6511,7 @@ void G_BeginRecording(void)
|
||||
|
||||
// Name
|
||||
memset(name, 0, 16);
|
||||
strncpy(name, player_names[p], 16);
|
||||
memcpy(name, player_names[p], 15);
|
||||
M_Memcpy(demo_p,name,16);
|
||||
demo_p += 16;
|
||||
|
||||
@@ -6941,7 +6596,7 @@ void G_BeginMetal(void)
|
||||
|
||||
void G_WriteStanding(UINT8 ranking, char *name, INT32 skinnum, UINT8 color, UINT32 val)
|
||||
{
|
||||
char temp[16];
|
||||
char temp[17];
|
||||
|
||||
if (demoinfo_p && *(UINT32 *)demoinfo_p == 0)
|
||||
{
|
||||
@@ -6984,12 +6639,6 @@ void G_SetDemoTime(UINT32 ptime, UINT32 plap)
|
||||
WRITEUINT32(demotime_p, plap);
|
||||
demotime_p = NULL;
|
||||
}
|
||||
/*else if (demoflags & DF_NIGHTSATTACK)
|
||||
{
|
||||
WRITEUINT32(demotime_p, ptime);
|
||||
WRITEUINT32(demotime_p, pscore);
|
||||
demotime_p = NULL;
|
||||
}*/
|
||||
}
|
||||
|
||||
static void G_LoadDemoExtraFiles(UINT8 **pp)
|
||||
@@ -6997,7 +6646,7 @@ static void G_LoadDemoExtraFiles(UINT8 **pp)
|
||||
UINT8 totalfiles;
|
||||
char filename[MAX_WADPATH];
|
||||
UINT8 md5sum[16];
|
||||
filestatus_t ncs;
|
||||
filestatus_t ncs = FS_NOTFOUND;
|
||||
boolean toomany = false;
|
||||
boolean alreadyloaded;
|
||||
UINT8 i, j;
|
||||
@@ -7201,11 +6850,6 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
||||
newtime = READUINT32(p);
|
||||
newlap = READUINT32(p);
|
||||
}
|
||||
/*else if (flags & DF_NIGHTSATTACK)
|
||||
{
|
||||
newtime = READUINT32(p);
|
||||
newscore = READUINT32(p);
|
||||
}*/
|
||||
else // appease compiler
|
||||
return 0;
|
||||
|
||||
@@ -7271,11 +6915,6 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
||||
oldtime = READUINT32(p);
|
||||
oldlap = READUINT32(p);
|
||||
}
|
||||
/*else if (flags & DF_NIGHTSATTACK)
|
||||
{
|
||||
oldtime = READUINT32(p);
|
||||
oldscore = READUINT32(p);
|
||||
}*/
|
||||
else // appease compiler
|
||||
return UINT8_MAX;
|
||||
|
||||
@@ -7418,13 +7057,6 @@ void G_LoadDemoInfo(menudemo_t *pdemo)
|
||||
if (pdemoflags & DF_ENCORE)
|
||||
pdemo->kartspeed |= DF_ENCORE;
|
||||
|
||||
/*// Temporary info until this is actually present in replays.
|
||||
(void)extrainfo_p;
|
||||
sprintf(pdemo->winnername, "transrights420");
|
||||
pdemo->winnerskin = 1;
|
||||
pdemo->winnercolor = SKINCOLOR_MOONSLAM;
|
||||
pdemo->winnertime = 6666;*/
|
||||
|
||||
// Read standings!
|
||||
count = 0;
|
||||
|
||||
@@ -7714,10 +7346,6 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
hu_demotime = READUINT32(demo_p);
|
||||
hu_demolap = READUINT32(demo_p);
|
||||
break;
|
||||
/*case ATTACKING_NIGHTS: // 2
|
||||
hu_demotime = READUINT32(demo_p);
|
||||
hu_demoscore = READUINT32(demo_p);
|
||||
break;*/
|
||||
default: // 3
|
||||
modeattacking = ATTACKING_NONE;
|
||||
break;
|
||||
@@ -7789,7 +7417,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
}
|
||||
|
||||
// net var data
|
||||
CV_LoadNetVars(&demo_p, false);
|
||||
CV_LoadNetVars(&demo_p);
|
||||
|
||||
// Sigh ... it's an empty demo.
|
||||
if (*demo_p == DEMOMARKER)
|
||||
@@ -7833,7 +7461,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
#endif
|
||||
|
||||
// net var data
|
||||
CV_LoadNetVars(&demo_p, false);
|
||||
CV_LoadNetVars(&demo_p);
|
||||
|
||||
// Sigh ... it's an empty demo.
|
||||
if (*demo_p == DEMOMARKER)
|
||||
@@ -8384,9 +8012,6 @@ void G_UpdateStaffGhostName(lumpnum_t l)
|
||||
case ATTACKING_RECORD: // 1
|
||||
p += 8; // demo time, lap
|
||||
break;
|
||||
/*case ATTACKING_NIGHTS: // 2
|
||||
p += 8; // demo time left, score
|
||||
break;*/
|
||||
default: // 3
|
||||
break;
|
||||
}
|
||||
@@ -8463,16 +8088,16 @@ void G_DoPlayMetal(void)
|
||||
metalbuffer = metal_p = W_CacheLumpNum(l, PU_STATIC);
|
||||
|
||||
// find metal sonic
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_METALSONIC_RACE)
|
||||
break;
|
||||
}
|
||||
if (th == &thlist[THINK_MOBJ])
|
||||
if (!mo)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Failed to find bot entity.\n"));
|
||||
Z_Free(metalbuffer);
|
||||
|
||||
@@ -492,6 +492,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
@@ -764,7 +765,6 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
||||
return;
|
||||
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||
|
||||
+12
-1
@@ -253,7 +253,17 @@ enum ETextureFlags
|
||||
TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0
|
||||
};
|
||||
|
||||
typedef struct GLMipmap_s FTextureInfo;
|
||||
struct FTextureInfo
|
||||
{
|
||||
UINT32 width, height;
|
||||
UINT32 downloaded;
|
||||
UINT32 format;
|
||||
|
||||
struct GLMipmap_s *texture;
|
||||
struct FTextureInfo *prev, *next;
|
||||
};
|
||||
typedef struct FTextureInfo FTextureInfo;
|
||||
|
||||
|
||||
struct FLightInfo
|
||||
{
|
||||
@@ -277,6 +287,7 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
HWD_SET_FRAMEBUFFER,
|
||||
HWD_SET_SHADERS,
|
||||
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
|
||||
@@ -36,8 +36,9 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *TexInfo);
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data);
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
@@ -99,6 +100,7 @@ struct hwdriver_s
|
||||
ClearBuffer pfnClearBuffer;
|
||||
SetTexture pfnSetTexture;
|
||||
UpdateTexture pfnUpdateTexture;
|
||||
DeleteTexture pfnDeleteTexture;
|
||||
ReadScreenTexture pfnReadScreenTexture;
|
||||
GClipRect pfnGClipRect;
|
||||
ClearMipMapCache pfnClearMipMapCache;
|
||||
|
||||
+146
-38
@@ -67,6 +67,7 @@ static boolean gr_palette_rendering_state = false;
|
||||
// Commands and console variables
|
||||
// ==========================================================================
|
||||
|
||||
static void CV_grframebuffer_OnChange(void);
|
||||
static void CV_filtermode_ONChange(void);
|
||||
static void CV_anisotropic_ONChange(void);
|
||||
static void CV_screentextures_ONChange(void);
|
||||
@@ -94,6 +95,8 @@ consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL,
|
||||
|
||||
consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grframebuffer = {"gr_framebuffer", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, CV_grframebuffer_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grfofcut = {"gr_fofcut", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_fofzfightfix = {"fofzfightfix", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -119,6 +122,7 @@ consvar_t cv_secbright = {"secbright", "0", CV_SAVE, secbright_cons_t,
|
||||
|
||||
consvar_t cv_grfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grfastsprites = {"gr_fastsprites", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// values for the far clipping plane
|
||||
static float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
|
||||
@@ -156,10 +160,17 @@ consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "On", CV_SAVE, CV_
|
||||
consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Standard", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_grhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#define ONLY_IF_GL_LOADED if (vid.glstate != VID_GL_LIBRARY_LOADED) return;
|
||||
|
||||
static void CV_grframebuffer_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_grframebuffer.value);
|
||||
RefreshSDLSurface();
|
||||
}
|
||||
|
||||
static void CV_filtermode_ONChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
@@ -2143,7 +2154,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
if (rover->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = min(gr_curline->linedef-gr_backsector->lines[0], rover->master->frontsector->linecount);
|
||||
size_t linenum = min((size_t)(gr_curline->linedef-gr_backsector->lines[0]), rover->master->frontsector->linecount);
|
||||
newline = rover->master->frontsector->lines[0] + linenum;
|
||||
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
|
||||
}
|
||||
@@ -2273,7 +2284,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if (rover->flags & FF_TRANSLUCENT && rover->alpha < 256)
|
||||
{
|
||||
blendmode = PF_Translucent;
|
||||
Surf.PolyColor.s.alpha = (UINT8)rover->alpha-1 > 255 ? 255 : rover->alpha-1;
|
||||
Surf.PolyColor.s.alpha = max(0, min(rover->alpha, 255));
|
||||
}
|
||||
|
||||
if (gr_frontsector->numlights)
|
||||
@@ -2315,7 +2326,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
if (rover->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = min(gr_curline->linedef-gr_backsector->lines[0], rover->master->frontsector->linecount);
|
||||
size_t linenum = min((size_t)(gr_curline->linedef-gr_backsector->lines[0]), rover->master->frontsector->linecount);
|
||||
newline = rover->master->frontsector->lines[0] + linenum;
|
||||
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
|
||||
}
|
||||
@@ -2495,7 +2506,8 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
|
||||
}
|
||||
|
||||
// using this check with portals causes weird culling issues on ante-station
|
||||
if (!portalclipline && (afrontsector == viewsector || abacksector == viewsector))
|
||||
//if (!portalclipline && (afrontsector == viewsector || abacksector == viewsector))
|
||||
if (afrontsector == viewsector || abacksector == viewsector)
|
||||
{
|
||||
fixed_t viewf1, viewf2, viewc1, viewc2;
|
||||
if (afrontsector == viewsector)
|
||||
@@ -2529,9 +2541,9 @@ static boolean CheckClip(sector_t * afrontsector, sector_t * abacksector)
|
||||
if (backc1 <= frontf1 && backc2 <= frontf2)
|
||||
{
|
||||
checkforemptylines = false;
|
||||
if (portalclipline)// during portal rendering view position may cause undesired culling and the above code has some wrong side effects
|
||||
return false;
|
||||
else
|
||||
//if (portalclipline)// during portal rendering view position may cause undesired culling and the above code has some wrong side effects
|
||||
//return false;
|
||||
//else
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2846,7 +2858,7 @@ boolean HWR_CheckBBox(fixed_t *bspcoord)
|
||||
// Adds all segs in all polyobjects in the given subsector.
|
||||
// Modified for hardware rendering.
|
||||
//
|
||||
void HWR_AddPolyObjectSegs(void)
|
||||
static inline void HWR_AddPolyObjectSegs(void)
|
||||
{
|
||||
size_t i, j;
|
||||
seg_t gr_fakeline;
|
||||
@@ -3265,10 +3277,8 @@ void HWR_Subsector(size_t num)
|
||||
{
|
||||
HWR_GetFlat(levelflats[gr_frontsector->floorpic].lumpnum, R_NoEncore(gr_frontsector, false));
|
||||
HWR_RenderPlane(sub, &extrasubsectors[num], false,
|
||||
// Hack to make things continue to work around slopes.
|
||||
locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight,
|
||||
// We now return you to your regularly scheduled rendering.
|
||||
PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, floorcolormap);
|
||||
locFloorHeight == cullFloorHeight ? locFloorHeight : gr_frontsector->floorheight,
|
||||
PF_Occlude, floorlightlevel, levelflats[gr_frontsector->floorpic].lumpnum, NULL, 255, floorcolormap);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3384,7 +3394,7 @@ void HWR_Subsector(size_t num)
|
||||
{
|
||||
light = R_GetPlaneLight(gr_frontsector, centerHeight, viewz < topCullHeight ? true : false);
|
||||
HWR_AddTransparentFloor(levelflats[*rover->toppic].lumpnum,
|
||||
&extrasubsectors[num],
|
||||
&extrasubsectors[num],
|
||||
true,
|
||||
*rover->topheight,
|
||||
SOFTLIGHT(*gr_frontsector->lightlist[light].lightlevel),
|
||||
@@ -4426,7 +4436,8 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
|
||||
// Sort vissprites by distance
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
gr_vissprite_t* gr_vsprorder[MAXVISSPRITES];
|
||||
gr_vissprite_t* gr_tvsprorder[MAXVISSPRITES];
|
||||
UINT32 gr_tvisspritecount = 0;
|
||||
|
||||
// For more correct transparency the transparent sprites would need to be
|
||||
// sorted and drawn together with transparent surfaces.
|
||||
@@ -4436,18 +4447,28 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
||||
gr_vissprite_t* spr2 = *(gr_vissprite_t*const*)p2;
|
||||
int idiff;
|
||||
float fdiff;
|
||||
float tz1, tz2;
|
||||
|
||||
int transparency1;
|
||||
int transparency2;
|
||||
|
||||
// make transparent sprites last
|
||||
// "boolean to int"
|
||||
|
||||
int transparency1 = (spr1->mobj->flags2 & MF2_SHADOW) || (spr1->mobj->frame & FF_TRANSMASK);
|
||||
int transparency2 = (spr2->mobj->flags2 & MF2_SHADOW) || (spr2->mobj->frame & FF_TRANSMASK);
|
||||
// check for precip first, because then sprX->mobj is actually a precipmobj_t and does not have flags2 or tracer
|
||||
tz1 = spr1->tz;
|
||||
transparency1 = (!spr1->precip && (spr1->mobj->flags2 & MF2_SHADOW)) || (spr1->mobj->frame & FF_TRANSMASK);
|
||||
tz2 = spr2->tz;
|
||||
transparency2 = (!spr2->precip && (spr2->mobj->flags2 & MF2_SHADOW)) || (spr2->mobj->frame & FF_TRANSMASK);
|
||||
|
||||
// first compare transparency flags, then compare tz, then compare dispoffset
|
||||
|
||||
idiff = transparency1 - transparency2;
|
||||
if (idiff != 0) return idiff;
|
||||
|
||||
fdiff = spr2->tz - spr1->tz;// this order seems correct when checking with apitrace. Back to front.
|
||||
fdiff = tz2 - tz1; // this order seems correct when checking with apitrace. Back to front.
|
||||
if (fabsf(fdiff) < 1.0E-36f)
|
||||
return spr1->dispoffset - spr2->dispoffset;// smallest dispoffset first if sprites are at (almost) same location.
|
||||
return spr1->dispoffset - spr2->dispoffset; // smallest dispoffset first if sprites are at (almost) same location.
|
||||
else if (fdiff > 0)
|
||||
return 1;
|
||||
else
|
||||
@@ -4459,11 +4480,14 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
||||
static void HWR_SortVisSprites(void)
|
||||
{
|
||||
UINT32 i;
|
||||
gr_tvisspritecount = 0;
|
||||
for (i = 0; i < gr_visspritecount; i++)
|
||||
{
|
||||
gr_vsprorder[i] = HWR_GetVisSprite(i);
|
||||
gr_vissprite_t* spr = HWR_GetVisSprite(i);
|
||||
if (!cv_grfastsprites.value || (spr->mobj->flags2 & MF2_SHADOW) || (spr->mobj->frame & FF_TRANSMASK))
|
||||
gr_tvsprorder[gr_tvisspritecount++] = spr;
|
||||
}
|
||||
qsort(gr_vsprorder, gr_visspritecount, sizeof(gr_vissprite_t*), CompareVisSprites);
|
||||
qsort(gr_tvsprorder, gr_tvisspritecount, sizeof(gr_vissprite_t*), CompareVisSprites);
|
||||
}
|
||||
|
||||
// A drawnode is something that points to a 3D floor, 3D side, or masked
|
||||
@@ -4742,9 +4766,88 @@ void HWR_RenderDrawNodes(void)
|
||||
void HWR_DrawSprites(void)
|
||||
{
|
||||
UINT32 i;
|
||||
for (i = 0; i < gr_visspritecount; i++)
|
||||
|
||||
// this is a bit repetitive. one other option would be to create arrays for these three stages
|
||||
// and iterate them with simple for loops.
|
||||
|
||||
// first draw solid sprites that dont have models
|
||||
// separated from solid models to allow batching to work
|
||||
if (cv_grfastsprites.value)
|
||||
{
|
||||
gr_vissprite_t *spr = gr_vsprorder[i];
|
||||
if (cv_grbatching.value)
|
||||
HWR_StartBatching();
|
||||
|
||||
for (i = 0; i < gr_visspritecount; i++)
|
||||
{
|
||||
gr_vissprite_t *spr = HWR_GetVisSprite(i);
|
||||
if ((spr->mobj->flags2 & MF2_SHADOW) || (spr->mobj->frame & FF_TRANSMASK))
|
||||
continue;
|
||||
if (spr->precip)
|
||||
HWR_DrawPrecipitationSprite(spr);
|
||||
else
|
||||
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (!cv_grmdls.value || ((md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) && ((!cv_grfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)))
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cv_grmdls.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_grbatching.value)
|
||||
HWR_RenderBatches();
|
||||
|
||||
// then solid models
|
||||
for (i = 0; i < gr_visspritecount; i++)
|
||||
{
|
||||
gr_vissprite_t *spr = HWR_GetVisSprite(i);
|
||||
if ((spr->mobj->flags2 & MF2_SHADOW) || (spr->mobj->frame & FF_TRANSMASK))
|
||||
continue;
|
||||
if (spr->precip)
|
||||
continue;//HWR_DrawPrecipitationSprite(spr);
|
||||
else
|
||||
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
md2_t *md2;
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
md2 = &md2_localplayermodels[(skin_t *)spr->mobj->localskin - localskins];
|
||||
else
|
||||
md2 = &md2_playermodels [(skin_t *)spr->mobj->localskin - skins];
|
||||
}
|
||||
else
|
||||
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
|
||||
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (!cv_grmdls.value || ((md2->notfound || md2->scale < 0.0f) && ((!cv_grfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
continue;
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cv_grmdls.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
|
||||
continue;
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// then transparent sprites and models, which have been sorted
|
||||
// if !cv_grfastsprites then this also includes everything else
|
||||
for (i = 0; i < gr_tvisspritecount; i++)
|
||||
{
|
||||
gr_vissprite_t *spr = gr_tvsprorder[i];
|
||||
if (spr->precip)
|
||||
HWR_DrawPrecipitationSprite(spr);
|
||||
else
|
||||
@@ -5048,8 +5151,8 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
I_Error("sprframes NULL for sprite %d\n", thing->sprite);
|
||||
#endif
|
||||
|
||||
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
|
||||
camang = R_PointToAngle (interp.x, interp.y);
|
||||
ang = R_PointToAngle(interp.x, interp.y) - interp.angle;
|
||||
camang = R_PointToAngle(interp.x, interp.y);
|
||||
|
||||
if (mirrored)
|
||||
ang = InvAngle(ang);
|
||||
@@ -5473,7 +5576,7 @@ static inline void HWR_ClearView(void)
|
||||
(INT32)(gr_viewwindowx + gr_viewwidth),
|
||||
(INT32)(gr_viewwindowy + gr_viewheight),
|
||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
HWD.pfnClearBuffer(false, true, true, 0);
|
||||
HWD.pfnClearBuffer(false, true, true, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -6043,42 +6146,45 @@ void HWR_TogglePaletteRendering(void)
|
||||
//added by Hurdler: console varibale that are saved
|
||||
void HWR_AddCommands(void)
|
||||
{
|
||||
CV_RegisterVar(&cv_grframebuffer);
|
||||
CV_RegisterVar(&cv_grfiltermode);
|
||||
CV_RegisterVar(&cv_granisotropicmode);
|
||||
CV_RegisterVar(&cv_grsolvetjoin);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grbatching);
|
||||
CV_RegisterVar(&cv_grfofcut);
|
||||
CV_RegisterVar(&cv_fofzfightfix);
|
||||
CV_RegisterVar(&cv_splitwallfix);
|
||||
CV_RegisterVar(&cv_slopepegfix);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grfastsprites);
|
||||
|
||||
CV_RegisterVar(&cv_grscreentextures);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grrenderdistance);
|
||||
|
||||
CV_RegisterVar(&cv_grfakecontrast);
|
||||
CV_RegisterVar(&cv_grslopecontrast);
|
||||
CV_RegisterVar(&cv_grhorizonlines);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grfovchange);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grmdls);
|
||||
CV_RegisterVar(&cv_grfallbackplayermodel);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grspritebillboarding);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grshearing);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grshaders);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grportals);
|
||||
CV_RegisterVar(&cv_nostencil);
|
||||
CV_RegisterVar(&cv_portalline);
|
||||
CV_RegisterVar(&cv_portalonly);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_secbright);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_grpaletterendering);
|
||||
CV_RegisterVar(&cv_grpalettedepth);
|
||||
CV_RegisterVar(&cv_grflashpal);
|
||||
@@ -6105,6 +6211,8 @@ void HWR_Startup(void)
|
||||
HWR_LoadAllCustomShaders();
|
||||
|
||||
HWR_TogglePaletteRendering();
|
||||
|
||||
HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_grframebuffer.value);
|
||||
|
||||
if (msaa)
|
||||
{
|
||||
|
||||
@@ -134,8 +134,6 @@ void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 t
|
||||
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
|
||||
void HWR_DrawSkyBackground(float fpov);
|
||||
|
||||
void HWR_AddPolyObjectSegs(void);
|
||||
|
||||
// hw_main.c: BSP
|
||||
void HWR_RenderBSPNode(INT32 bspnum);
|
||||
void HWR_Subsector(size_t num);
|
||||
@@ -161,6 +159,7 @@ void HWR_SetShaderState(void);
|
||||
|
||||
// Console variables
|
||||
extern consvar_t cv_grshaders;
|
||||
extern consvar_t cv_grframebuffer;
|
||||
extern consvar_t cv_grfofcut;
|
||||
extern consvar_t cv_fofzfightfix;
|
||||
extern consvar_t cv_splitwallfix;
|
||||
@@ -189,6 +188,7 @@ extern consvar_t cv_grscreentextures;
|
||||
extern consvar_t cv_grportals;
|
||||
extern consvar_t cv_nostencil;
|
||||
extern consvar_t cv_secbright;
|
||||
extern consvar_t cv_grfastsprites;
|
||||
|
||||
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
||||
|
||||
|
||||
+13
-13
@@ -243,7 +243,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
||||
|
||||
{
|
||||
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->data);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &grpatch->mipmap->data);
|
||||
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
|
||||
for (i = 0; i < height; i++)
|
||||
row_pointers[i] = PNG_image + i*pitch;
|
||||
@@ -323,7 +323,7 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
||||
|
||||
pw = *w = header.xmax - header.xmin + 1;
|
||||
ph = *h = header.ymax - header.ymin + 1;
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->data);
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &grpatch->mipmap->data);
|
||||
|
||||
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
|
||||
{
|
||||
@@ -712,7 +712,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
grmip->data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->data);
|
||||
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &grmip->data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap->data;
|
||||
@@ -1062,7 +1062,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
if (grmip->downloaded && grmip->data)
|
||||
{
|
||||
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(grmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1084,7 +1084,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(newmip->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
@@ -1260,30 +1260,30 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
|
||||
{
|
||||
INT32 skinnum = TC_DEFAULT;
|
||||
INT32 tcskinnum = TC_DEFAULT;
|
||||
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
|
||||
{
|
||||
if (spr->mobj->type == MT_CYBRAKDEMON)
|
||||
skinnum = TC_ALLWHITE;
|
||||
tcskinnum = TC_ALLWHITE;
|
||||
else if (spr->mobj->type == MT_METALSONIC_BATTLE)
|
||||
skinnum = TC_METALSONIC;
|
||||
tcskinnum = TC_METALSONIC;
|
||||
else
|
||||
skinnum = TC_BOSS;
|
||||
tcskinnum = TC_BOSS;
|
||||
}
|
||||
else if (spr->mobj->color)
|
||||
{
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
if (spr->mobj->colorized)
|
||||
skinnum = TC_RAINBOW;
|
||||
tcskinnum = TC_RAINBOW;
|
||||
else
|
||||
{
|
||||
skinnum = (INT32)((skin_t*)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ) - ( (spr->mobj->skinlocal) ? localskins : skins ));
|
||||
tcskinnum = (INT32)((skin_t*)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ) - ( (spr->mobj->skinlocal) ? localskins : skins ));
|
||||
}
|
||||
}
|
||||
else skinnum = TC_DEFAULT;
|
||||
else tcskinnum = TC_DEFAULT;
|
||||
}
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -161,15 +161,15 @@
|
||||
#define GLSL_WATER_TEXEL \
|
||||
"float water_z = (gl_FragCoord.z / gl_FragCoord.w) / 2.0;\n" \
|
||||
"float a = -pi * (water_z * freq) + (leveltime * speed);\n" \
|
||||
"float sdistort = sin(a) * amp;\n" \
|
||||
"float cdistort = cos(a) * amp;\n" \
|
||||
"float sdistort = sin(a) * amp * 1.5;\n" \
|
||||
"float cdistort = cos(a) * amp * 2.2;\n" \
|
||||
"vec4 texel = texture2D(tex, vec2(gl_TexCoord[0].s - sdistort, gl_TexCoord[0].t - cdistort));\n"
|
||||
|
||||
#define GLSL_WATER_FRAGMENT_SHADER \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
"const float freq = 0.025;\n" \
|
||||
"const float freq = 0.03;\n" \
|
||||
"const float amp = 0.025;\n" \
|
||||
"const float speed = 2.0;\n" \
|
||||
"const float speed = 1.6;\n" \
|
||||
"const float pi = 3.14159;\n" \
|
||||
"#ifdef SRB2_PALETTE_RENDERING\n" \
|
||||
"uniform sampler2D tex;\n" \
|
||||
|
||||
@@ -556,18 +556,12 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = pal[i].s.red;
|
||||
myPaletteData[i].s.green = pal[i].s.green;
|
||||
myPaletteData[i].s.blue = pal[i].s.blue;
|
||||
myPaletteData[i].s.alpha = pal[i].s.alpha;
|
||||
}
|
||||
|
||||
size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
// on a palette change, you have to reload all of the textures
|
||||
Flush();
|
||||
if (memcmp(&myPaletteData, pal, palsize))
|
||||
{
|
||||
memcpy(&myPaletteData, pal, palsize);
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -78,8 +78,9 @@ static GLuint lt_downloaded = 0; // currently bound lighttable texture
|
||||
static GLfloat fov = 90.0f;
|
||||
static FBITFIELD CurrentPolyFlags;
|
||||
|
||||
static FTextureInfo *gr_cachetail = NULL;
|
||||
static FTextureInfo *gr_cachehead = NULL;
|
||||
// Linked list of all textures.
|
||||
static FTextureInfo *TexCacheTail = NULL;
|
||||
static FTextureInfo *TexCacheHead = NULL;
|
||||
|
||||
static RGBA_t *textureBuffer = NULL;
|
||||
static size_t textureBufferSize = 0;
|
||||
@@ -113,6 +114,11 @@ static GLfloat modelMatrix[16];
|
||||
static GLfloat projMatrix[16];
|
||||
static GLint viewport[4];
|
||||
|
||||
static boolean GLFramebuffer_IsFuncAvailible(void);
|
||||
|
||||
|
||||
GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
GLboolean FrameBufferEnabled = GL_FALSE, RenderToFramebuffer = GL_FALSE;
|
||||
|
||||
// Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing
|
||||
// flush all of the stored textures, leaving them unavailable at times such as between levels
|
||||
@@ -425,12 +431,32 @@ typedef void (APIENTRY * PFNglCopyTexImage2D) (GLenum target, GLint level, GLenu
|
||||
static PFNglCopyTexImage2D pglCopyTexImage2D;
|
||||
typedef void (APIENTRY * PFNglCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
static PFNglCopyTexSubImage2D pglCopyTexSubImage2D;
|
||||
#endif
|
||||
|
||||
/* 3.0 functions */
|
||||
#ifdef GL_VERSION_3_0
|
||||
typedef void (APIENTRY * PFNglGenerateMipmap) (GLenum target);
|
||||
static PFNglGenerateMipmap pglGenerateMipmap;
|
||||
|
||||
/* 3.0 functions for framebuffers and renderbuffers */
|
||||
typedef void (APIENTRY * PFNglGenFramebuffers) (GLsizei n, GLuint *ids);
|
||||
static PFNglGenFramebuffers pglGenFramebuffers;
|
||||
typedef void (APIENTRY * PFNglBindFramebuffer) (GLenum target, GLuint framebuffer);
|
||||
static PFNglBindFramebuffer pglBindFramebuffer;
|
||||
typedef void (APIENTRY * PFNglDeleteFramebuffers) (GLsizei n, GLuint *ids);
|
||||
static PFNglDeleteFramebuffers pglDeleteFramebuffers;
|
||||
typedef void (APIENTRY * PFNglFramebufferTexture2D) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
static PFNglFramebufferTexture2D pglFramebufferTexture2D;
|
||||
typedef GLenum (APIENTRY * PFNglCheckFramebufferStatus) (GLenum target);
|
||||
static PFNglCheckFramebufferStatus pglCheckFramebufferStatus;
|
||||
typedef void (APIENTRY * PFNglGenRenderbuffers) (GLsizei n, GLuint *renderbuffers);
|
||||
static PFNglGenRenderbuffers pglGenRenderbuffers;
|
||||
typedef void (APIENTRY * PFNglBindRenderbuffer) (GLenum target, GLuint renderbuffer);
|
||||
static PFNglBindRenderbuffer pglBindRenderbuffer;
|
||||
typedef void (APIENTRY * PFNglDeleteRenderbuffers) (GLsizei n, GLuint *renderbuffers);
|
||||
static PFNglDeleteRenderbuffers pglDeleteRenderbuffers;
|
||||
typedef void (APIENTRY * PFNglRenderbufferStorage) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
static PFNglRenderbufferStorage pglRenderbufferStorage;
|
||||
typedef void (APIENTRY * PFNglFramebufferRenderbuffer) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLenum renderbuffer);
|
||||
static PFNglFramebufferRenderbuffer pglFramebufferRenderbuffer;
|
||||
#endif
|
||||
|
||||
/* 1.2 functions for 3D textures */
|
||||
@@ -716,16 +742,35 @@ void SetupGLFunc4(void)
|
||||
pglUniform3fv = GetGLFunc("glUniform3fv");
|
||||
pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
|
||||
|
||||
#ifdef GL_VERSION_3_0
|
||||
pglGenerateMipmap = GetGLFunc("glGenerateMipmap");
|
||||
#endif
|
||||
|
||||
if (GLFramebuffer_IsFuncAvailible())
|
||||
{
|
||||
pglGenFramebuffers = GetGLFunc("glGenFramebuffers");
|
||||
pglBindFramebuffer = GetGLFunc("glBindFramebuffer");
|
||||
pglDeleteFramebuffers = GetGLFunc("glDeleteFramebuffers");
|
||||
pglFramebufferTexture2D = GetGLFunc("glFramebufferTexture2D");
|
||||
pglCheckFramebufferStatus = GetGLFunc("glCheckFramebufferStatus");
|
||||
pglGenRenderbuffers = GetGLFunc("glGenRenderbuffers");
|
||||
pglBindRenderbuffer = GetGLFunc("glBindRenderbuffer");
|
||||
pglDeleteRenderbuffers = GetGLFunc("glDeleteRenderbuffers");
|
||||
pglRenderbufferStorage = GetGLFunc("glRenderbufferStorage");
|
||||
pglFramebufferRenderbuffer = GetGLFunc("glFramebufferRenderbuffer");
|
||||
}
|
||||
}
|
||||
|
||||
static boolean GLFramebuffer_IsFuncAvailible(void)
|
||||
{
|
||||
return((isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions)) &&
|
||||
(isExtAvailable("GL_ARB_framebuffer_object",gl_extensions)) &&
|
||||
(isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions)));
|
||||
}
|
||||
|
||||
EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
{
|
||||
if (!pglUseProgram)
|
||||
return false;
|
||||
|
||||
|
||||
gl_fallback_shader.vertex_shader = Z_StrDup(GLSL_FALLBACK_VERTEX_SHADER);
|
||||
gl_fallback_shader.fragment_shader = Z_StrDup(GLSL_FALLBACK_FRAGMENT_SHADER);
|
||||
|
||||
@@ -894,13 +939,6 @@ void SetModelView(GLint w, GLint h)
|
||||
{
|
||||
//GL_DBG_Printf("SetModelView(): %dx%d\n", (int)w, (int)h);
|
||||
|
||||
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
|
||||
if (screen_width != w || screen_height != h)
|
||||
FlushScreenTextures();
|
||||
|
||||
screen_width = w;
|
||||
screen_height = h;
|
||||
|
||||
pglViewport(0, 0, w, h);
|
||||
|
||||
pglMatrixMode(GL_PROJECTION);
|
||||
@@ -932,7 +970,7 @@ void SetStates(void)
|
||||
|
||||
pglEnable(GL_STENCIL_TEST);
|
||||
pglEnable(GL_DEPTH_TEST); // check the depth buffer
|
||||
pglDepthMask(GL_TRUE); // enable writing to depth buffer
|
||||
pglDepthMask(GL_TRUE); // enable writing to depth buffer
|
||||
pglClearDepth(1.0f);
|
||||
pglDepthRange(0.0f, 1.0f);
|
||||
pglDepthFunc(GL_LEQUAL);
|
||||
@@ -952,27 +990,180 @@ void SetStates(void)
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||
}
|
||||
|
||||
void GLFramebuffer_Generate(void)
|
||||
{
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
// Generate the framebuffer
|
||||
if (FramebufferObject == 0)
|
||||
pglGenFramebuffers(1, &FramebufferObject);
|
||||
|
||||
if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
|
||||
GLFramebuffer_GenerateAttachments();
|
||||
}
|
||||
|
||||
void GLFramebuffer_Delete(void)
|
||||
{
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
// Unbind the framebuffer
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
if (FramebufferObject)
|
||||
pglDeleteFramebuffers(1, &FramebufferObject);
|
||||
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
FramebufferObject = 0;
|
||||
}
|
||||
|
||||
void GLFramebuffer_GenerateAttachments(void)
|
||||
{
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
// Bind the framebuffer
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, FramebufferObject);
|
||||
|
||||
// Generate the framebuffer texture
|
||||
if (FramebufferTexture == 0)
|
||||
{
|
||||
pglGenTextures(1, &FramebufferTexture);
|
||||
pglBindTexture(GL_TEXTURE_2D, FramebufferTexture);
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, screen_width, screen_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
pglBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
// Attach the framebuffer texture to the framebuffer
|
||||
pglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, FramebufferTexture, 0);
|
||||
}
|
||||
|
||||
// Generate the renderbuffer
|
||||
if (RenderbufferObject == 0)
|
||||
{
|
||||
pglGenRenderbuffers(1, &RenderbufferObject);
|
||||
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, RenderbufferObject);
|
||||
pglRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, screen_width, screen_height);
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, RenderbufferObject);
|
||||
|
||||
// Clear the renderbuffer
|
||||
ClearBuffer(true, true, true, NULL);
|
||||
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
// Unbind the framebuffer
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
void GLFramebuffer_DeleteAttachments(void)
|
||||
{
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
// Unbind the framebuffer
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
if (FramebufferTexture)
|
||||
pglDeleteTextures(1, &FramebufferTexture);
|
||||
|
||||
if (RenderbufferObject)
|
||||
pglDeleteRenderbuffers(1, &RenderbufferObject);
|
||||
|
||||
FramebufferTexture = 0;
|
||||
RenderbufferObject = 0;
|
||||
}
|
||||
|
||||
void GLFramebuffer_Enable(void)
|
||||
{
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
if (FramebufferObject == 0)
|
||||
GLFramebuffer_Generate();
|
||||
else if (FramebufferTexture == 0 || RenderbufferObject == 0)
|
||||
GLFramebuffer_GenerateAttachments();
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, FramebufferObject);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, RenderbufferObject);
|
||||
}
|
||||
|
||||
void GLFramebuffer_Disable(void)
|
||||
{
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
return;
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
FTextureInfo *head = TexCacheHead;
|
||||
|
||||
if (!pTexInfo)
|
||||
return;
|
||||
else if (pTexInfo->downloaded)
|
||||
pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded);
|
||||
|
||||
while (head)
|
||||
{
|
||||
if (head->downloaded == pTexInfo->downloaded)
|
||||
{
|
||||
if (head->next)
|
||||
head->next->prev = head->prev;
|
||||
else // no next -> tail is being deleted -> update TexCacheTail
|
||||
TexCacheTail = head->prev;
|
||||
if (head->prev)
|
||||
head->prev->next = head->next;
|
||||
else // no prev -> head is being deleted -> update TexCacheHead
|
||||
TexCacheHead = head->next;
|
||||
free(head);
|
||||
break;
|
||||
}
|
||||
|
||||
head = head->next;
|
||||
}
|
||||
|
||||
pTexInfo->downloaded = 0;
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// Flush : flush OpenGL textures
|
||||
// : Clear list of downloaded mipmaps
|
||||
// -----------------+
|
||||
void Flush(void)
|
||||
{
|
||||
//GL_DBG_Printf("HWR_Flush()\n");
|
||||
//GL_DBG_Printf ("HWR_Flush()\n");
|
||||
|
||||
while (gr_cachehead)
|
||||
while (TexCacheHead)
|
||||
{
|
||||
// this is not necessary at all, because you have loaded them normally,
|
||||
// and so they already are in your list!
|
||||
if (gr_cachehead->downloaded)
|
||||
pglDeleteTextures(1, (GLuint *)&gr_cachehead->downloaded);
|
||||
gr_cachehead->downloaded = 0;
|
||||
gr_cachehead = gr_cachehead->nextmipmap;
|
||||
}
|
||||
gr_cachetail = gr_cachehead = NULL; //Hurdler: well, gr_cachehead is already NULL
|
||||
FTextureInfo *pTexInfo = TexCacheHead;
|
||||
GLMipmap_t *texture = pTexInfo->texture;
|
||||
|
||||
if (pTexInfo->downloaded)
|
||||
{
|
||||
pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded);
|
||||
pTexInfo->downloaded = 0;
|
||||
}
|
||||
|
||||
if (texture)
|
||||
texture->downloaded = 0;
|
||||
|
||||
TexCacheHead = pTexInfo->next;
|
||||
free(pTexInfo);
|
||||
}
|
||||
|
||||
TexCacheTail = TexCacheHead = NULL; //Hurdler: well, TexCacheHead is already NULL
|
||||
tex_downloaded = 0;
|
||||
|
||||
|
||||
free(textureBuffer);
|
||||
textureBuffer = NULL;
|
||||
textureBufferSize = 0;
|
||||
@@ -1331,7 +1522,7 @@ static void AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
// -----------------+
|
||||
// UpdateTexture : Updates texture data.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
// Upload a texture
|
||||
GLuint num = pTexInfo->downloaded;
|
||||
@@ -1343,7 +1534,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
||||
const GLubyte *pImgData = (const GLubyte *)pTexInfo->data;
|
||||
const GLvoid *ptex = NULL;
|
||||
RGBA_t *tex = NULL;
|
||||
|
||||
|
||||
// Generate a new texture name.
|
||||
if (!num)
|
||||
{
|
||||
@@ -1388,7 +1579,6 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
||||
tex[w*j+i].s.alpha = *pImgData;
|
||||
pImgData++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1455,23 +1645,15 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
||||
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
if (MipMap)
|
||||
{
|
||||
if ((majorGL == 1 && minorGL >= 4) || (majorGL == 2))
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
}
|
||||
#ifdef GL_VERSION_3_0
|
||||
else if (majorGL >= 3)
|
||||
{
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
pglGenerateMipmap(GL_TEXTURE_2D);
|
||||
}
|
||||
#endif
|
||||
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
pglGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
|
||||
if (pTexInfo->flags & TF_TRANSPARENT)
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
|
||||
else
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 16);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
|
||||
//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
|
||||
}
|
||||
else
|
||||
@@ -1487,23 +1669,14 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
||||
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
if (MipMap)
|
||||
{
|
||||
if ((majorGL == 1 && minorGL >= 4) || (majorGL == 2))
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
}
|
||||
#ifdef GL_VERSION_3_0
|
||||
else if (majorGL >= 3)
|
||||
{
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
pglGenerateMipmap(GL_TEXTURE_2D);
|
||||
}
|
||||
#endif
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
pglGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
|
||||
if (pTexInfo->flags & TF_TRANSPARENT)
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
|
||||
else
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 16);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
|
||||
//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
|
||||
}
|
||||
else
|
||||
@@ -1518,24 +1691,15 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
||||
{
|
||||
if (MipMap)
|
||||
{
|
||||
if ((majorGL == 1 && minorGL >= 4) || (majorGL == 2))
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
}
|
||||
#ifdef GL_VERSION_3_0
|
||||
else if (majorGL >= 3)
|
||||
{
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
pglGenerateMipmap(GL_TEXTURE_2D);
|
||||
}
|
||||
#endif
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||
pglGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
||||
// Control the mipmap level of detail
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); // the lower the number, the higer the detail
|
||||
if (pTexInfo->flags & TF_TRANSPARENT)
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
|
||||
else
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 16);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1564,7 +1728,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo)
|
||||
// -----------------+
|
||||
// SetTexture : The mipmap becomes the current texture source
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
if (!pTexInfo)
|
||||
{
|
||||
@@ -1581,15 +1745,25 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
||||
}
|
||||
else
|
||||
{
|
||||
FTextureInfo *newTex = calloc(1, sizeof (*newTex));
|
||||
|
||||
UpdateTexture(pTexInfo);
|
||||
pTexInfo->nextmipmap = NULL;
|
||||
if (gr_cachetail)
|
||||
{ // insertion at the tail
|
||||
gr_cachetail->nextmipmap = pTexInfo;
|
||||
gr_cachetail = pTexInfo;
|
||||
|
||||
newTex->texture = pTexInfo;
|
||||
newTex->downloaded = (UINT32)pTexInfo->downloaded;
|
||||
newTex->width = (UINT32)pTexInfo->width;
|
||||
newTex->height = (UINT32)pTexInfo->height;
|
||||
newTex->format = (UINT32)pTexInfo->format;
|
||||
|
||||
// insertion at the tail
|
||||
if (TexCacheTail)
|
||||
{
|
||||
newTex->prev = TexCacheTail;
|
||||
TexCacheTail->next = newTex;
|
||||
TexCacheTail = newTex;
|
||||
}
|
||||
else // initialization of the linked list
|
||||
gr_cachetail = gr_cachehead = pTexInfo;
|
||||
TexCacheTail = TexCacheHead = newTex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2040,7 +2214,7 @@ static void gld_BuildSky(int row_count, int col_count)
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void RenderDome(INT32 skytexture)
|
||||
static void RenderDome(INT32 skytexnum)
|
||||
{
|
||||
int i, j;
|
||||
int vbosize;
|
||||
@@ -2052,7 +2226,7 @@ static void RenderDome(INT32 skytexture)
|
||||
vbosize = 2 * rows * (columns * 2 + 2) + columns * 2;
|
||||
|
||||
// Build the sky dome! Yes!
|
||||
if (lasttex != skytexture)
|
||||
if (lasttex != skytexnum)
|
||||
{
|
||||
// delete VBO when already exists
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
@@ -2061,7 +2235,7 @@ static void RenderDome(INT32 skytexture)
|
||||
pglDeleteBuffers(1, &vbo->id);
|
||||
}
|
||||
|
||||
lasttex = skytexture;
|
||||
lasttex = skytexnum;
|
||||
gld_BuildSky(rows, columns);
|
||||
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
@@ -2137,6 +2311,13 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
case HWD_SET_SHADERS:
|
||||
gl_allowshaders = Value;
|
||||
break;
|
||||
|
||||
case HWD_SET_FRAMEBUFFER:
|
||||
FrameBufferEnabled = Value ? GL_TRUE : GL_FALSE;
|
||||
|
||||
if (!GLFramebuffer_IsFuncAvailible())
|
||||
FrameBufferEnabled = GL_FALSE;
|
||||
break;
|
||||
|
||||
case HWD_SET_TEXTUREFILTERMODE:
|
||||
switch (Value)
|
||||
@@ -2173,21 +2354,12 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
mag_filter = GL_LINEAR;
|
||||
min_filter = GL_NEAREST;
|
||||
}
|
||||
if (majorGL == 1 && minorGL <= 3)
|
||||
|
||||
if (!pglGenerateMipmap)
|
||||
{
|
||||
MipMap = GL_FALSE;
|
||||
min_filter = GL_LINEAR;
|
||||
}
|
||||
#ifdef GL_VERSION_3_0
|
||||
else
|
||||
{
|
||||
if (!pglGenerateMipmap)
|
||||
{
|
||||
MipMap = GL_FALSE;
|
||||
min_filter = GL_LINEAR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Flush(); //??? if we want to change filter mode by texture, remove this
|
||||
break;
|
||||
@@ -2788,7 +2960,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
{
|
||||
FTextureInfo *tmp = gr_cachehead;
|
||||
FTextureInfo *tmp = TexCacheHead;
|
||||
INT32 res = 0;
|
||||
|
||||
while (tmp)
|
||||
@@ -2805,7 +2977,7 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
|
||||
// Add it up!
|
||||
res += tmp->height*tmp->width*bpp;
|
||||
tmp = tmp->nextmipmap;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -3179,7 +3351,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, int width, int height)
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
|
||||
@@ -104,6 +104,18 @@ static PFNglEnableClientState pglEnableClientState;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void GLFramebuffer_Generate(void);
|
||||
void GLFramebuffer_Delete(void);
|
||||
|
||||
void GLFramebuffer_GenerateAttachments(void);
|
||||
void GLFramebuffer_DeleteAttachments(void);
|
||||
|
||||
void GLFramebuffer_Enable(void);
|
||||
void GLFramebuffer_Disable(void);
|
||||
|
||||
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
|
||||
|
||||
// ==========================================================================
|
||||
// GLOBAL
|
||||
// ==========================================================================
|
||||
|
||||
-374
@@ -1,374 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// John FrostFox (john.frostfox@gmail.com)
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hashtable.c
|
||||
/// \brief Hashtable abstraction implementation
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define HT_NUMLISTS UINT8_MAX
|
||||
|
||||
typedef struct mobjnum_linkedList_s{
|
||||
thinker_t* thinker;
|
||||
struct mobjnum_linkedList_s* prev; //the first element must always be null
|
||||
struct mobjnum_linkedList_s* next; //the last element must always be null
|
||||
}
|
||||
mobjnum_linkedList;
|
||||
|
||||
mobjnum_linkedList mobjnum_Hashtable[HT_NUMLISTS]; //dumb and idiotic, there are up to UINT8_MAX linked lists.
|
||||
//Wish I could just simply make a mobj_t array with UINT64_MAX entries, LOL
|
||||
|
||||
void mobjnum_ht_linkedList_Wipe();
|
||||
/** Initializes simple mobjnum/thinker hashtable linked list.*/
|
||||
void mobjnum_ht_linkedList_Init()
|
||||
{
|
||||
mobjnum_ht_linkedList_Wipe();
|
||||
for (uint8_t i = 0; i < HT_NUMLISTS; i++)
|
||||
{
|
||||
mobjnum_Hashtable[i].thinker = NULL;
|
||||
mobjnum_Hashtable[i].prev = NULL;
|
||||
mobjnum_Hashtable[i].next = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Adds a thinker's address, determines in which list to add automatically
|
||||
*
|
||||
* \param mobj Which mobj's memory address to add
|
||||
*/
|
||||
void mobjnum_ht_linkedList_AddEntry (thinker_t* thinker)
|
||||
{
|
||||
|
||||
mobjnum_linkedList* currentEntry; // = &mobjnum_Hashtable[(UINT8)(mobj->mobjnum % HT_NUMLISTS)];
|
||||
mobjnum_linkedList* next;
|
||||
|
||||
currentEntry = &mobjnum_Hashtable[(UINT8)(((mobj_t*)thinker)->mobjnum % HT_NUMLISTS)];
|
||||
|
||||
if (!currentEntry->next) // check for the first entry
|
||||
{
|
||||
currentEntry->thinker = thinker;
|
||||
// CONS_Printf("next not exists, create\n");
|
||||
currentEntry->next = malloc(sizeof(mobjnum_linkedList));
|
||||
currentEntry->next->thinker = NULL;
|
||||
currentEntry->next->next = NULL;
|
||||
currentEntry->next->prev = currentEntry;
|
||||
return;
|
||||
}
|
||||
|
||||
for (currentEntry = &mobjnum_Hashtable[(UINT8)(((mobj_t*)thinker)->mobjnum % HT_NUMLISTS)]; currentEntry != NULL; currentEntry = next)
|
||||
{
|
||||
if (!currentEntry->thinker)
|
||||
{
|
||||
currentEntry->thinker = thinker;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currentEntry->next)
|
||||
{
|
||||
currentEntry->next = malloc(sizeof(mobjnum_linkedList));
|
||||
currentEntry->next->thinker = thinker;
|
||||
currentEntry->next->next = NULL;
|
||||
currentEntry->next->prev = currentEntry;
|
||||
next = NULL;
|
||||
}
|
||||
else
|
||||
next = currentEntry->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Removes a thinker's address by its mobjnum, determines from which list to remove automatically
|
||||
*
|
||||
* \param mobjnum Which mobj's memory address to remove by itsmobjnum
|
||||
*/
|
||||
// void mobjnum_ht_linkedList_RemoveEntry (uint8_t mobjnumber)
|
||||
// {
|
||||
// mobjnum_linkedList* currentEntry = &mobjnum_Hashtable[(UINT8)(mobjnumber % HT_NUMLISTS)];
|
||||
// if (currentEntry->next == ¤tEntry)
|
||||
// currentEntry->mobj = &mobj;
|
||||
// else
|
||||
// {
|
||||
// currentEntry->next = malloc(sizeof(mobjnum_linkedList));
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
/** Looks for a thinker by its mobjnum.
|
||||
*
|
||||
* \param mobjnumber mobj's mobjnum
|
||||
* \return thinker_t* if an object is found, otherwise NULL. Cast it to mobj_t* to get the mobj.
|
||||
*/
|
||||
thinker_t* mobjnum_ht_linkedList_Find (uint32_t mobjnumber)
|
||||
{
|
||||
// mobjnum_linkedList* currentEntry = &mobjnum_Hashtable[(UINT8)(mobjnumber % HT_NUMLISTS)];
|
||||
|
||||
mobjnum_linkedList* currentEntry; // = &mobjnum_Hashtable[(UINT8)(mobj->mobjnum % HT_NUMLISTS)];
|
||||
mobjnum_linkedList* next;
|
||||
|
||||
if (!mobjnumber)
|
||||
return NULL;
|
||||
|
||||
currentEntry = &mobjnum_Hashtable[(UINT8)(mobjnumber % HT_NUMLISTS)];
|
||||
|
||||
if (!currentEntry->next) // check for the first entry
|
||||
{
|
||||
if (!currentEntry->thinker)
|
||||
return NULL;
|
||||
|
||||
if (((mobj_t *)currentEntry->thinker)->mobjnum == mobjnumber)
|
||||
return currentEntry->thinker;
|
||||
}
|
||||
|
||||
for (currentEntry = &mobjnum_Hashtable[(UINT8)(mobjnumber % HT_NUMLISTS)]; currentEntry != NULL; currentEntry = next)
|
||||
{
|
||||
if (!currentEntry->thinker)
|
||||
return NULL;
|
||||
|
||||
if (((mobj_t *)currentEntry->thinker)->mobjnum == mobjnumber)
|
||||
return currentEntry->thinker;
|
||||
if (currentEntry->next)
|
||||
next = currentEntry->next;
|
||||
else
|
||||
next = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Wipes the entire list by iterating everything it has*/
|
||||
void mobjnum_ht_linkedList_Wipe()
|
||||
{
|
||||
mobjnum_linkedList* currentEntry; // = &mobjnum_Hashtable[(UINT8)(mobj->mobjnum % HT_NUMLISTS)];
|
||||
mobjnum_linkedList* next;
|
||||
|
||||
for (UINT8 i = 0; i < HT_NUMLISTS; i++)
|
||||
{
|
||||
if (!mobjnum_Hashtable[i].next)
|
||||
continue;
|
||||
for (currentEntry = &mobjnum_Hashtable[i]; currentEntry != NULL; currentEntry = next)
|
||||
{
|
||||
// bye!
|
||||
if (currentEntry->next)
|
||||
next = currentEntry->next;
|
||||
else
|
||||
next = NULL;
|
||||
if (currentEntry->next)
|
||||
{
|
||||
currentEntry->next = NULL;
|
||||
}
|
||||
if (currentEntry->thinker)
|
||||
{
|
||||
currentEntry->thinker = NULL;
|
||||
}
|
||||
if (currentEntry->prev) //prevents freeing the first element
|
||||
{
|
||||
currentEntry->prev = NULL;
|
||||
free(currentEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Simple hash table implemented in C.
|
||||
|
||||
// Hash table entry (slot may be filled or empty).
|
||||
typedef struct {
|
||||
const char* key; // key is NULL if this slot is empty
|
||||
void* value;
|
||||
} ht_entry;
|
||||
|
||||
// Hash table structure: create with ht_create, free with ht_destroy.
|
||||
struct hashtable {
|
||||
ht_entry* entries; // hash slots
|
||||
size_t capacity; // size of _entries array
|
||||
size_t length; // number of items in hash table
|
||||
};
|
||||
|
||||
#define INITIAL_CAPACITY 16 // must not be zero
|
||||
|
||||
hashtable* hashtable_Create(void) {
|
||||
// Allocate space for hash table struct.
|
||||
hashtable* table = malloc(sizeof(hashtable));
|
||||
if (table == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
table->length = 0;
|
||||
table->capacity = INITIAL_CAPACITY;
|
||||
|
||||
// Allocate (zero'd) space for entry buckets.
|
||||
table->entries = calloc(table->capacity, sizeof(ht_entry));
|
||||
if (table->entries == NULL) {
|
||||
free(table); // error, free table before we return!
|
||||
return NULL;
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
void hashtable_Destroy(hashtable* table) {
|
||||
// First free allocated keys.
|
||||
for (size_t i = 0; i < table->capacity; i++) {
|
||||
if (table->entries[i].key != NULL) {
|
||||
free((void*)table->entries[i].key);
|
||||
}
|
||||
}
|
||||
|
||||
// Then free entries array and table itself.
|
||||
free(table->entries);
|
||||
free(table);
|
||||
}
|
||||
|
||||
#define FNV_OFFSET 14695981039346656037UL
|
||||
#define FNV_PRIME 1099511628211UL
|
||||
|
||||
// Return 64-bit FNV-1a hash for key (NUL-terminated). See description:
|
||||
// https://en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function
|
||||
static uint64_t hash_key(const char* key) {
|
||||
uint64_t hash = FNV_OFFSET;
|
||||
for (const char* p = key; *p; p++) {
|
||||
hash ^= (uint64_t)(unsigned char)(*p);
|
||||
hash *= FNV_PRIME;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
void* hashtable_Get(hashtable* table, const UINT32* key) {
|
||||
// AND hash with capacity-1 to ensure it's within entries array.
|
||||
uint64_t hash = hash_key(key);
|
||||
size_t index = (size_t)(hash & (uint64_t)(table->capacity - 1));
|
||||
|
||||
// Loop till we find an empty entry.
|
||||
while (table->entries[index].key != NULL) {
|
||||
if (strcmp(key, table->entries[index].key) == 0) {
|
||||
// Found key, return value.
|
||||
return table->entries[index].value;
|
||||
}
|
||||
// Key wasn't in this slot, move to next (linear probing).
|
||||
index++;
|
||||
if (index >= table->capacity) {
|
||||
// At end of entries array, wrap around.
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Internal function to set an entry (without expanding table).
|
||||
static const char* ht_set_entry(ht_entry* entries, size_t capacity,
|
||||
const char* key, void* value, size_t* plength) {
|
||||
// AND hash with capacity-1 to ensure it's within entries array.
|
||||
uint64_t hash = hash_key(key);
|
||||
size_t index = (size_t)(hash & (uint64_t)(capacity - 1));
|
||||
|
||||
// Loop till we find an empty entry.
|
||||
while (entries[index].key != NULL) {
|
||||
if (strcmp(key, entries[index].key) == 0) {
|
||||
// Found key (it already exists), update value.
|
||||
entries[index].value = value;
|
||||
return entries[index].key;
|
||||
}
|
||||
// Key wasn't in this slot, move to next (linear probing).
|
||||
index++;
|
||||
if (index >= capacity) {
|
||||
// At end of entries array, wrap around.
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Didn't find key, allocate+copy if needed, then insert it.
|
||||
if (plength != NULL) {
|
||||
key = strdup(key);
|
||||
if (key == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
(*plength)++;
|
||||
}
|
||||
entries[index].key = (char*)key;
|
||||
entries[index].value = value;
|
||||
return key;
|
||||
}
|
||||
|
||||
// Expand hash table to twice its current size. Return true on success,
|
||||
// false if out of memory.
|
||||
static boolean ht_expand(hashtable* table) {
|
||||
// Allocate new entries array.
|
||||
size_t new_capacity = table->capacity * 2;
|
||||
if (new_capacity < table->capacity) {
|
||||
return false; // overflow (capacity would be too big)
|
||||
}
|
||||
ht_entry* new_entries = calloc(new_capacity, sizeof(ht_entry));
|
||||
if (new_entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Iterate entries, move all non-empty ones to new table's entries.
|
||||
for (size_t i = 0; i < table->capacity; i++) {
|
||||
ht_entry entry = table->entries[i];
|
||||
if (entry.key != NULL) {
|
||||
ht_set_entry(new_entries, new_capacity, entry.key,
|
||||
entry.value, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// Free old entries array and update this table's details.
|
||||
free(table->entries);
|
||||
table->entries = new_entries;
|
||||
table->capacity = new_capacity;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* hashtable_Set(hashtable* table, const UINT32* key, void* value) {
|
||||
assert(value != NULL);
|
||||
if (value == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// If length will exceed half of current capacity, expand it.
|
||||
if (table->length >= table->capacity / 2) {
|
||||
if (!ht_expand(table)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Set entry and update length.
|
||||
return ht_set_entry(table->entries, table->capacity, key, value,
|
||||
&table->length);
|
||||
}
|
||||
|
||||
size_t hashtable_Length(hashtable* table) {
|
||||
return table->length;
|
||||
}
|
||||
|
||||
hashtable_iterator ht_iterator(hashtable* table) {
|
||||
hashtable_iterator it;
|
||||
it._table = table;
|
||||
it._index = 0;
|
||||
return it;
|
||||
}
|
||||
|
||||
boolean hashtable_Next(hashtable_iterator* it) {
|
||||
// Loop till we've hit end of entries array.
|
||||
hashtable* table = it->_table;
|
||||
while (it->_index < table->capacity) {
|
||||
size_t i = it->_index;
|
||||
it->_index++;
|
||||
if (table->entries[i].key != NULL) {
|
||||
// Found next non-empty item, update iterator key and value.
|
||||
ht_entry entry = table->entries[i];
|
||||
it->key = entry.key;
|
||||
it->value = entry.value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// John FrostFox (john.frostfox@gmail.com)
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hashtable.h
|
||||
/// \brief Hashtable abstraction
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "p_mobj.h"
|
||||
#include "d_think.h"
|
||||
|
||||
// extern uint16_t hashHits;
|
||||
// extern uint16_t hashMiss;
|
||||
|
||||
void mobjnum_ht_linkedList_Init();
|
||||
void mobjnum_ht_linkedList_AddEntry (thinker_t* thinker);
|
||||
thinker_t* mobjnum_ht_linkedList_Find (uint32_t mobjnumber);
|
||||
// void mobjnum_ht_linkedList_Wipe();
|
||||
|
||||
// Hash table iterator: create with ht_iterator, iterate with ht_next.
|
||||
typedef struct hashtable hashtable;
|
||||
|
||||
typedef struct {
|
||||
const UINT32* key;
|
||||
void* value;
|
||||
|
||||
hashtable* _table; // reference to hash table being iterated
|
||||
size_t _index; // current index into ht._entries
|
||||
} hashtable_iterator;
|
||||
|
||||
hashtable* hashtable_Create(void); //creates a hashtable and returns the pointer
|
||||
void* hashtable_Get(hashtable* table, const UINT32* key);
|
||||
|
||||
// Set item with given key (NUL-terminated) to value (which must not
|
||||
// be NULL). If not already present in table, key is copied to newly
|
||||
// allocated memory (keys are freed automatically when ht_destroy is
|
||||
// called). Return address of copied key, or NULL if out of memory.
|
||||
// const char* hashtable_Set(hashtable* table, UINT32* key, void* value);
|
||||
const char* hashtable_Set(hashtable* table, const UINT32* key, void* value);
|
||||
|
||||
size_t hashtable_Length(hashtable* table);
|
||||
|
||||
// Free memory allocated for hash table, including allocated keys.
|
||||
void hashtable_Destroy(hashtable* table);
|
||||
|
||||
// Return new hash table iterator (for use with ht_next).
|
||||
hashtable_iterator hashtable_Iterator(hashtable_iterator* table);
|
||||
|
||||
// Move iterator to next item in hash table, update iterator's key
|
||||
// and value to current item, and return true. If there are no more
|
||||
// items, return false. Don't call ht_set during iteration.
|
||||
boolean hashtable_Next(hashtable_iterator* it);
|
||||
+2
-1
@@ -339,7 +339,8 @@ HMS_unlist (void)
|
||||
if (! hms)
|
||||
return 0;
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
+49
-171
@@ -124,6 +124,9 @@ static patch_t *songcreditbg;
|
||||
// -------
|
||||
static void HU_DrawRankings(void);
|
||||
|
||||
|
||||
consvar_t cv_showspecstuff = {"showspecstuff", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
//======================================================================
|
||||
// KEYBOARD LAYOUTS FOR ENTERING TEXT
|
||||
//======================================================================
|
||||
@@ -549,7 +552,8 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
const char *newmsg;
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
strncpy(nodenum, msg+3, 3);
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
@@ -565,15 +569,15 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
}
|
||||
}
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
if (spc != 0)
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
@@ -1225,7 +1229,8 @@ static void HU_queueChatChar(INT32 c)
|
||||
return;
|
||||
}
|
||||
|
||||
strncpy(nodenum, msg+3, 3);
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
@@ -1936,7 +1941,8 @@ static void HU_DrawChat(void)
|
||||
|
||||
|
||||
nodenum = (char*) malloc(3);
|
||||
strncpy(nodenum, w_chat+3, 3);
|
||||
memcpy(nodenum, w_chat+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
n = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
// special cases:
|
||||
@@ -1989,8 +1995,6 @@ static void HU_DrawChat(void)
|
||||
|
||||
|
||||
// For anyone who, for some godforsaken reason, likes oldchat.
|
||||
|
||||
|
||||
static void HU_DrawChat_Old(void)
|
||||
{
|
||||
INT32 t = 0, c = 0, y = HU_INPUTY;
|
||||
@@ -2061,164 +2065,6 @@ static void HU_DrawChat_Old(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// draw the Crosshair, at the exact center of the view.
|
||||
//
|
||||
// Crosshairs are pre-cached at HU_Init
|
||||
|
||||
/*static inline void HU_DrawCrosshair(void)
|
||||
{
|
||||
INT32 i, x, y;
|
||||
|
||||
i = cv_crosshair.value & 3;
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
if ((netgame || multiplayer) && players[displayplayers[0]].spectator)
|
||||
return;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
{
|
||||
x = (INT32)gr_basewindowcenterx;
|
||||
y = (INT32)gr_basewindowcentery;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
x = viewwindowx + (viewwidth>>1);
|
||||
y = viewwindowy + (viewheight>>1);
|
||||
}
|
||||
|
||||
V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
|
||||
}
|
||||
|
||||
static inline void HU_DrawCrosshair2(void)
|
||||
{
|
||||
INT32 i, x, y;
|
||||
|
||||
i = cv_crosshair2.value & 3;
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
if ((netgame || multiplayer) && players[displayplayers[1]].spectator)
|
||||
return;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
{
|
||||
x = (INT32)gr_basewindowcenterx;
|
||||
y = (INT32)gr_basewindowcentery;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
x = viewwindowx + (viewwidth>>1);
|
||||
y = viewwindowy + (viewheight>>1);
|
||||
}
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
if (splitscreen > 1)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
x += (INT32)gr_viewwidth;
|
||||
else
|
||||
#endif
|
||||
x += viewwidth;
|
||||
else
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
y += (INT32)gr_viewheight;
|
||||
else
|
||||
#endif
|
||||
y += viewheight;
|
||||
}
|
||||
|
||||
V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void HU_DrawCrosshair3(void)
|
||||
{
|
||||
INT32 i, x, y;
|
||||
|
||||
i = cv_crosshair3.value & 3;
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
if ((netgame || multiplayer) && players[displayplayers[2]].spectator)
|
||||
return;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
{
|
||||
x = (INT32)gr_basewindowcenterx;
|
||||
y = (INT32)gr_basewindowcentery;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
x = viewwindowx + (viewwidth>>1);
|
||||
y = viewwindowy + (viewheight>>1);
|
||||
}
|
||||
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
y += (INT32)gr_viewheight;
|
||||
else
|
||||
#endif
|
||||
y += viewheight;
|
||||
|
||||
V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void HU_DrawCrosshair4(void)
|
||||
{
|
||||
INT32 i, x, y;
|
||||
|
||||
i = cv_crosshair4.value & 3;
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
if ((netgame || multiplayer) && players[displayplayers[3]].spectator)
|
||||
return;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
{
|
||||
x = (INT32)gr_basewindowcenterx;
|
||||
y = (INT32)gr_basewindowcentery;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
x = viewwindowx + (viewwidth>>1);
|
||||
y = viewwindowy + (viewheight>>1);
|
||||
}
|
||||
|
||||
if (splitscreen > 2)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
{
|
||||
x += (INT32)gr_viewwidth;
|
||||
y += (INT32)gr_viewheight;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
x += viewwidth;
|
||||
y += viewheight;
|
||||
}
|
||||
|
||||
V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
|
||||
}
|
||||
}*/
|
||||
|
||||
static void HU_DrawCEcho(void)
|
||||
{
|
||||
INT32 i = 0;
|
||||
@@ -2576,7 +2422,7 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
|
||||
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
|
||||
SINT8 i = 0;
|
||||
SINT8 yoffset = 6;
|
||||
INT32 dx;
|
||||
//INT32 dx;
|
||||
|
||||
gfxnum = Ping_gfx_num(lag);
|
||||
|
||||
@@ -2676,6 +2522,7 @@ static inline void HU_DrawSpectatorTicker(void)
|
||||
length += dupadjust;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && players[i].spectator)
|
||||
{
|
||||
char *pos;
|
||||
@@ -2717,11 +2564,39 @@ static inline void HU_DrawSpectatorTicker(void)
|
||||
V_DrawString(templength - duptweak, height, V_TRANSLUCENT|V_ALLOWLOWERCASE, current);
|
||||
}
|
||||
|
||||
if (cv_showspecstuff.value)
|
||||
{
|
||||
if (players[i].mo)
|
||||
{
|
||||
player_t *p;
|
||||
p = &players[i];
|
||||
|
||||
if (players[i].mo->color)
|
||||
{
|
||||
const UINT8 *colormap;
|
||||
if (players[i].mo->colorized)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, players[i].mo->color, GTC_CACHE);
|
||||
else
|
||||
colormap = R_GetTranslationColormap(players[i].skin, players[i].mo->color, GTC_CACHE);
|
||||
|
||||
if (cv_highresportrait.value)
|
||||
V_DrawSmallMappedPatch((templength - duptweak), height+10, V_TRANSLUCENT, R_GetSkinFaceWant(p), colormap);
|
||||
else
|
||||
V_DrawMappedPatch((templength - duptweak), height+10, V_TRANSLUCENT, R_GetSkinFaceRank(p), colormap);
|
||||
}
|
||||
}
|
||||
|
||||
if (netgame && i != serverplayer)
|
||||
HU_drawPing((templength - duptweak)+8, height-20, playerpingtable[i], V_TRANSLUCENT);
|
||||
}
|
||||
|
||||
if ((length += len) >= dupadjust+8)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// HU_DrawRankings
|
||||
//
|
||||
@@ -2923,7 +2798,10 @@ void HU_DoCEcho(const char *msg)
|
||||
|
||||
I_OutputMsg("%s\n", msg); // print to log
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation" // This is fine, we set null byte later
|
||||
strncpy(cechotext, msg, sizeof(cechotext));
|
||||
#pragma GCC diagnostic pop
|
||||
strncat(cechotext, "\\", sizeof(cechotext) - strlen(cechotext) - 1);
|
||||
cechotext[sizeof(cechotext) - 1] = '\0';
|
||||
cechotimer = cechoduration;
|
||||
|
||||
+39
-2
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
#define MAX_QUIT_FUNCS 16
|
||||
|
||||
extern double tic_frequency;
|
||||
|
||||
/** \brief Graphic system had started up
|
||||
*/
|
||||
@@ -59,7 +58,6 @@ UINT64 I_GetPrecisePrecision(void);
|
||||
*/
|
||||
double I_GetFrameTime(void);
|
||||
|
||||
|
||||
/** \brief Sleeps for the given duration in milliseconds. Depending on the
|
||||
operating system's scheduler, the calling thread may give up its
|
||||
time slice for a longer duration. The implementation should give a
|
||||
@@ -298,6 +296,40 @@ char *I_GetUserName(void);
|
||||
*/
|
||||
INT32 I_mkdir(const char *dirname, INT32 unixright);
|
||||
|
||||
typedef struct {
|
||||
int FPU : 1; ///< FPU availabile
|
||||
int CPUID : 1; ///< CPUID instruction
|
||||
int RDTSC : 1; ///< RDTSC instruction
|
||||
int MMX : 1; ///< MMX features
|
||||
int MMXExt : 1; ///< MMX Ext. features
|
||||
int CMOV : 1; ///< Pentium Pro's "cmov"
|
||||
int AMD3DNow : 1; ///< 3DNow features
|
||||
int AMD3DNowExt: 1; ///< 3DNow! Ext. features
|
||||
int SSE : 1; ///< SSE features
|
||||
int SSE2 : 1; ///< SSE2 features
|
||||
int SSE3 : 1; ///< SSE3 features
|
||||
int IA64 : 1; ///< Running on IA64
|
||||
int AMD64 : 1; ///< Running on AMD64
|
||||
int AltiVec : 1; ///< AltiVec features
|
||||
int FPPE : 1; ///< floating-point precision error
|
||||
int PFC : 1; ///< TBD?
|
||||
int cmpxchg : 1; ///< ?
|
||||
int cmpxchg16b : 1; ///< ?
|
||||
int cmp8xchg16 : 1; ///< ?
|
||||
int FPE : 1; ///< FPU Emu
|
||||
int DEP : 1; ///< Data excution prevent
|
||||
int PPCMM64 : 1; ///< PowerPC Movemem 64bit ok?
|
||||
int ALPHAbyte : 1; ///< ?
|
||||
int PAE : 1; ///< Physical Address Extension
|
||||
int CPUs : 8;
|
||||
} CPUInfoFlags;
|
||||
|
||||
|
||||
/** \brief Info about CPU
|
||||
\return CPUInfo in bits
|
||||
*/
|
||||
const CPUInfoFlags *I_CPUInfo(void);
|
||||
|
||||
/** \brief Find main WAD
|
||||
\return path to main WAD
|
||||
*/
|
||||
@@ -337,4 +369,9 @@ const char *I_ClipboardPaste(void);
|
||||
|
||||
void I_RegisterSysCommands(void);
|
||||
|
||||
|
||||
/** \brief Returns the system name.
|
||||
*/
|
||||
const char *I_GetSysName(void);
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -27,7 +27,7 @@ static CV_PossibleValue_t timescale_cons_t[] = {{FRACUNIT/20, "MIN"}, {20*FRACUN
|
||||
consvar_t cv_timescale = {"timescale", "1.0", CV_NETVAR|CV_CHEAT|CV_FLOAT, timescale_cons_t, NULL, FRACUNIT, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static precise_t enterprecise, oldenterprecise;
|
||||
fixed_t entertic, oldentertics;
|
||||
static fixed_t entertic, oldentertics;
|
||||
static double tictimer;
|
||||
|
||||
tic_t I_GetTime(void)
|
||||
|
||||
@@ -29,7 +29,6 @@ typedef struct timestate_s {
|
||||
|
||||
extern timestate_t g_time;
|
||||
extern consvar_t cv_timescale;
|
||||
extern fixed_t entertic, oldentertics;
|
||||
|
||||
/** \brief Called by D_SRB2Loop, returns current time in game tics.
|
||||
*/
|
||||
|
||||
@@ -137,4 +137,6 @@ void I_EndRead(void);
|
||||
|
||||
UINT32 I_GetRefreshRate(void);
|
||||
|
||||
void RefreshSDLSurface(void);
|
||||
|
||||
#endif
|
||||
+689
-135
File diff suppressed because it is too large.
Load diff
@@ -13,6 +13,10 @@
|
||||
#ifndef __KEYS_H__
|
||||
#define __KEYS_H__
|
||||
|
||||
#include "console.h"
|
||||
|
||||
extern consvar_t cv_nativekeyboard;
|
||||
|
||||
// These are the key codes as posted by the keyboard handler,
|
||||
// ascii codes are 0->127,
|
||||
// scancodes are 0x80 + 0->127
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "console.h"
|
||||
#include "k_kart.h" // SRB2Kart
|
||||
#include "d_netcmd.h" // IsPlayerAdmin
|
||||
#include "m_misc.h" // M_MapNumber
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
@@ -153,6 +154,23 @@ static int lib_isPlayerAdmin(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// M_MISC
|
||||
//////////////
|
||||
|
||||
static int lib_mMapNumber(lua_State *L)
|
||||
{
|
||||
const char *arg = luaL_checkstring(L, 1);
|
||||
size_t len = strlen(arg);
|
||||
if (len == 2 || len == 5) {
|
||||
char first = arg[len-2];
|
||||
char second = arg[len-1];
|
||||
lua_pushinteger(L, M_MapNumber(first, second));
|
||||
} else {
|
||||
lua_pushinteger(L, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// M_RANDOM
|
||||
//////////////
|
||||
|
||||
@@ -780,6 +798,17 @@ static int lib_pSetObjectMomZ(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pIsLocalPlayer(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
//NOHUD
|
||||
//INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushboolean(L, P_IsLocalPlayer(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pRestoreMusic(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
@@ -957,6 +986,19 @@ static int lib_pHomingAttack(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pResetCamera(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
camera_t *cam = *((camera_t **)luaL_checkudata(L, 2, META_CAMERA));
|
||||
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!cam)
|
||||
return LUA_ErrInvalid(L, "camera_t");
|
||||
P_ResetCamera(player, cam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*static int lib_pSuperReady(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
@@ -1145,6 +1187,17 @@ static int lib_pFloorzAtPos(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pCeilingzAtPos(lua_State *L)
|
||||
{
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
fixed_t z = luaL_checkfixed(L, 3);
|
||||
fixed_t height = luaL_checkfixed(L, 4);
|
||||
//HUDSAFE
|
||||
lua_pushfixed(L, P_CeilingzAtPos(x, y, z, height));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pDoSpring(lua_State *L)
|
||||
{
|
||||
mobj_t *spring = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
@@ -1634,6 +1687,17 @@ static int lib_pGetZAt(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pButteredSlope(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
//INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_ButteredSlope(mobj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// R_DEFS
|
||||
////////////
|
||||
|
||||
@@ -1686,6 +1750,20 @@ static int lib_rPointInSubsector(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_rIsPointInSubsector(lua_State *L)
|
||||
{
|
||||
fixed_t x = luaL_checkfixed(L, 1);
|
||||
fixed_t y = luaL_checkfixed(L, 2);
|
||||
subsector_t *sub = R_IsPointInSubsector(x, y);
|
||||
//HUDSAFE
|
||||
//INLEVEL
|
||||
if (sub)
|
||||
LUA_PushUserdata(L, sub, META_SUBSECTOR);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// R_THINGS
|
||||
////////////
|
||||
|
||||
@@ -3007,6 +3085,9 @@ static luaL_Reg lib[] = {
|
||||
{"EvalMath", lib_evalMath},
|
||||
{"IsPlayerAdmin", lib_isPlayerAdmin},
|
||||
|
||||
// m_misc
|
||||
{"M_MapNumber",lib_mMapNumber},
|
||||
|
||||
// m_random
|
||||
{"P_RandomFixed",lib_pRandomFixed},
|
||||
{"P_RandomByte",lib_pRandomByte},
|
||||
@@ -3067,6 +3148,7 @@ static luaL_Reg lib[] = {
|
||||
{"P_InSpaceSector",lib_pInSpaceSector},
|
||||
{"P_InQuicksand",lib_pInQuicksand},
|
||||
{"P_SetObjectMomZ",lib_pSetObjectMomZ},
|
||||
{"P_IsLocalPlayer",lib_pIsLocalPlayer},
|
||||
{"P_RestoreMusic",lib_pRestoreMusic},
|
||||
{"P_SpawnShieldOrb",lib_pSpawnShieldOrb},
|
||||
{"P_SpawnGhostMobj",lib_pSpawnGhostMobj},
|
||||
@@ -3083,6 +3165,7 @@ static luaL_Reg lib[] = {
|
||||
{"P_LookForEnemies",lib_pLookForEnemies},
|
||||
{"P_NukeEnemies",lib_pNukeEnemies},
|
||||
{"P_HomingAttack",lib_pHomingAttack},
|
||||
{"P_ResetCamera",lib_pResetCamera},
|
||||
//{"P_SuperReady",lib_pSuperReady},
|
||||
{"P_Telekinesis",lib_pTelekinesis},
|
||||
|
||||
@@ -3099,6 +3182,7 @@ static luaL_Reg lib[] = {
|
||||
{"P_CheckHoopPosition",lib_pCheckHoopPosition},
|
||||
{"P_RadiusAttack",lib_pRadiusAttack},
|
||||
{"P_FloorzAtPos",lib_pFloorzAtPos},
|
||||
{"P_CeilingzAtPos",lib_pCeilingzAtPos},
|
||||
{"P_DoSpring",lib_pDoSpring},
|
||||
|
||||
// p_inter
|
||||
@@ -3137,6 +3221,7 @@ static luaL_Reg lib[] = {
|
||||
|
||||
// p_slopes
|
||||
{"P_GetZAt",lib_pGetZAt},
|
||||
{"P_ButteredSlope",lib_pButteredSlope},
|
||||
|
||||
// r_defs
|
||||
{"R_PointToAngle",lib_rPointToAngle},
|
||||
@@ -3144,6 +3229,7 @@ static luaL_Reg lib[] = {
|
||||
{"R_PointToDist",lib_rPointToDist},
|
||||
{"R_PointToDist2",lib_rPointToDist2},
|
||||
{"R_PointInSubsector",lib_rPointInSubsector},
|
||||
{"R_IsPointInSubsector",lib_rIsPointInSubsector},
|
||||
|
||||
// r_things (sprite)
|
||||
{"R_Char2Frame",lib_rChar2Frame},
|
||||
|
||||
@@ -53,12 +53,10 @@ static UINT8 lib_searchBlockmap_Objects(lua_State *L, INT32 x, INT32 y, mobj_t *
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
blockfuncerror = true;
|
||||
P_SetTarget(&bnext, NULL);
|
||||
return 0; // *shrugs*
|
||||
}
|
||||
if (!lua_isnil(gL, -1))
|
||||
{ // if nil, continue
|
||||
P_SetTarget(&bnext, NULL);
|
||||
if (lua_toboolean(gL, -1))
|
||||
return 2; // stop whole search
|
||||
else
|
||||
|
||||
+52
-9
@@ -17,6 +17,11 @@
|
||||
#include "byteptr.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "d_netfil.h"
|
||||
|
||||
#include "m_menu.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_hud.h" // hud_running errors
|
||||
@@ -186,8 +191,8 @@ static int lib_comAddCommand(lua_State *L)
|
||||
const char *luaname = luaL_checkstring(L, 1);
|
||||
|
||||
// must store in all lowercase
|
||||
char *name = Z_StrDup(luaname);
|
||||
strlwr(name);
|
||||
char *comname = Z_StrDup(luaname);
|
||||
strlwr(comname);
|
||||
|
||||
luaL_checktype(L, 2, LUA_TFUNCTION);
|
||||
NOHUD
|
||||
@@ -220,25 +225,26 @@ static int lib_comAddCommand(lua_State *L)
|
||||
|
||||
lua_pushvalue(L, 3);
|
||||
lua_rawseti(L, -2, 2);
|
||||
lua_setfield(L, -2, name);
|
||||
lua_setfield(L, -2, comname);
|
||||
|
||||
// Try to add the Lua command
|
||||
com_return = COM_AddLuaCommand(name);
|
||||
com_return = COM_AddLuaCommand(comname);
|
||||
|
||||
if (com_return < 0)
|
||||
{ // failed to add -- free the lowercased name and return error
|
||||
Z_Free(name);
|
||||
Z_Free(comname);
|
||||
return luaL_error(L, "Couldn't add a new console command \"%s\"", luaname);
|
||||
}
|
||||
else if (com_return == 1)
|
||||
{ // command existed already -- free our name as the old string will continue to be used
|
||||
CONS_Printf("Replaced command \"%s\"\n", name);
|
||||
Z_Free(name);
|
||||
CONS_Printf("Replaced command \"%s\"\n", comname);
|
||||
Z_Free(comname);
|
||||
}
|
||||
else
|
||||
{ // new command was added -- do NOT free the string as it will forever be used by the console
|
||||
CONS_Printf("Added command \"%s\"\n", name);
|
||||
CONS_Printf("Added command \"%s\"\n", comname);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -314,12 +320,17 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
const char *k;
|
||||
lua_Integer i;
|
||||
consvar_t *cvar;
|
||||
|
||||
const char* category = NULL;
|
||||
const char* menu_name = NULL;
|
||||
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one.
|
||||
NOHUD
|
||||
cvar = lua_newuserdata(L, sizeof(consvar_t));
|
||||
luaL_getmetatable(L, META_CVAR);
|
||||
lua_setmetatable(L, -2);
|
||||
boolean hasminmax = false;
|
||||
|
||||
#define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e);
|
||||
#define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1)))
|
||||
@@ -385,13 +396,17 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
if (lua_type(L, 5) != LUA_TSTRING
|
||||
|| lua_type(L, 6) != LUA_TNUMBER)
|
||||
FIELDERROR("PossibleValue", "custom PossibleValue table requires a format of string=integer, i.e. {MIN=0, MAX=9999}");
|
||||
cvpv[i].strvalue = Z_StrDup(lua_tostring(L, 5));
|
||||
char *strvalue = Z_StrDup(lua_tostring(L, 5));
|
||||
if (fasticmp(strvalue, "MIN"))
|
||||
hasminmax = true;
|
||||
cvpv[i].strvalue = strvalue;
|
||||
cvpv[i].value = (INT32)lua_tonumber(L, 6);
|
||||
i++;
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
cvpv[i].value = 0;
|
||||
cvpv[i].strvalue = NULL;
|
||||
hasminmax = false;
|
||||
cvar->PossibleValue = cvpv;
|
||||
} else
|
||||
FIELDERROR("PossibleValue", va("%s or CV_PossibleValue_t expected, got %s", lua_typename(L, LUA_TTABLE), luaL_typename(L, -1)))
|
||||
@@ -405,6 +420,18 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
lua_pop(L, 1);
|
||||
cvar->func = Lua_OnChange;
|
||||
}
|
||||
else if (((i == 5 && !(cvar->flags & CV_CALL))
|
||||
|| (cvar->flags & CV_CALL && i == 7))
|
||||
|| (k && fasticmp(k, "category")))
|
||||
{
|
||||
category = lua_isnoneornil(L, 4) ? NULL : lua_tostring(L, 4);
|
||||
}
|
||||
else if (((i == 6 && !(cvar->flags & CV_CALL))
|
||||
|| (cvar->flags & CV_CALL && i == 8))
|
||||
|| (k && fasticmp(k, "menuname")))
|
||||
{
|
||||
menu_name = lua_isnoneornil(L, 4) ? NULL : lua_tostring(L, 4);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
#undef FIELDERROR
|
||||
@@ -429,6 +456,22 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
if (cvar->flags & CV_MODIFIED)
|
||||
return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");
|
||||
|
||||
if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)))
|
||||
{
|
||||
if (!category)
|
||||
{
|
||||
char *temp = strdup(wadfiles[numwadfiles - 1]->filename);
|
||||
nameonly(temp);
|
||||
|
||||
category = temp;
|
||||
}
|
||||
|
||||
if (menu_name && menu_name[0] != '\0')
|
||||
M_SlotCvarIntoModMenu(cvar, category, menu_name, hasminmax);
|
||||
else
|
||||
M_SlotCvarIntoModMenu(cvar, category, cvar->name, hasminmax);
|
||||
}
|
||||
|
||||
// return cvar userdata
|
||||
return 1;
|
||||
}
|
||||
|
||||
+21
-11
@@ -475,12 +475,14 @@ void LUAh_ThinkFrame(void)
|
||||
// variables used by perf stats
|
||||
int hook_index = 0;
|
||||
precise_t time_taken = 0;
|
||||
|
||||
if (!gL || !(hooksAvailable[hook_ThinkFrame/8] & (1<<(hook_ThinkFrame%8))))
|
||||
return;
|
||||
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type == hook_ThinkFrame)
|
||||
{
|
||||
if (cv_perfstats.value == 3)
|
||||
@@ -505,8 +507,9 @@ void LUAh_ThinkFrame(void)
|
||||
hook_index++;
|
||||
}
|
||||
}
|
||||
|
||||
lua_pop(gL, 1); // Pop error handler
|
||||
}
|
||||
|
||||
lua_pop(gL, 1); // Pop error handler
|
||||
}
|
||||
|
||||
// Hook for frame (at end of tick, ie after overlays, precipitation, specials)
|
||||
@@ -518,13 +521,13 @@ void LUAh_PostThinkFrame(void)
|
||||
precise_t time_taken = 0;
|
||||
if (!gL || !(hooksAvailable[hook_PostThinkFrame/8] & (1<<(hook_PostThinkFrame%8))))
|
||||
return;
|
||||
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type == hook_PostThinkFrame)
|
||||
{
|
||||
{
|
||||
if (cv_perfstats.value == 5)
|
||||
time_taken = I_GetPreciseTime();
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
@@ -548,6 +551,7 @@ void LUAh_PostThinkFrame(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lua_pop(gL, 1); // Pop error handler
|
||||
}
|
||||
|
||||
@@ -555,12 +559,14 @@ void LUAh_PostThinkFrame(void)
|
||||
void LUAh_IntermissionThinker(void)
|
||||
{
|
||||
hook_p hookp;
|
||||
|
||||
if (!gL || !(hooksAvailable[hook_IntermissionThinker/8] & (1<<(hook_IntermissionThinker%8))))
|
||||
return;
|
||||
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type == hook_IntermissionThinker)
|
||||
{
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
@@ -572,20 +578,23 @@ void LUAh_IntermissionThinker(void)
|
||||
hookp->error = true;
|
||||
}
|
||||
}
|
||||
|
||||
lua_pop(gL, 1); // Pop error handler
|
||||
}
|
||||
|
||||
lua_pop(gL, 1); // Pop error handler
|
||||
}
|
||||
|
||||
// Hook for Y_VoteTicker
|
||||
void LUAh_VoteThinker(void)
|
||||
{
|
||||
hook_p hookp;
|
||||
|
||||
if (!gL || !(hooksAvailable[hook_VoteThinker/8] & (1<<(hook_VoteThinker%8))))
|
||||
return;
|
||||
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type == hook_VoteThinker)
|
||||
{
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
@@ -597,8 +606,9 @@ void LUAh_VoteThinker(void)
|
||||
hookp->error = true;
|
||||
}
|
||||
}
|
||||
|
||||
lua_pop(gL, 1); // Pop error handler
|
||||
}
|
||||
|
||||
lua_pop(gL, 1); // Pop error handler
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ enum hud {
|
||||
hud_wanted,
|
||||
hud_speedometer,
|
||||
hud_statdisplay,
|
||||
hud_nametags,
|
||||
hud_driftgauge,
|
||||
hud_freeplay,
|
||||
hud_rankings, // Tab rankings
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ static const char *const hud_disable_options[] = {
|
||||
"wanted",
|
||||
"speedometer",
|
||||
"statdisplay",
|
||||
"nametags",
|
||||
"driftgauge",
|
||||
"freeplay",
|
||||
"rankings",
|
||||
NULL};
|
||||
@@ -138,6 +140,7 @@ enum cameraf {
|
||||
camera_x,
|
||||
camera_y,
|
||||
camera_z,
|
||||
camera_reset,
|
||||
camera_angle,
|
||||
camera_subsector,
|
||||
camera_floorz,
|
||||
@@ -157,6 +160,7 @@ static const char *const camera_opt[] = {
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"reset",
|
||||
"angle",
|
||||
"subsector",
|
||||
"floorz",
|
||||
@@ -347,6 +351,9 @@ static int camera_get(lua_State *L)
|
||||
case camera_z:
|
||||
lua_pushinteger(L, cam->z);
|
||||
break;
|
||||
case camera_reset:
|
||||
lua_pushboolean(L, cam->reset);
|
||||
break;
|
||||
case camera_angle:
|
||||
lua_pushinteger(L, cam->angle);
|
||||
break;
|
||||
|
||||
@@ -267,6 +267,8 @@ static int lib_iterateSectorThinglist(lua_State *L)
|
||||
if (!lua_isnil(L, 1))
|
||||
{
|
||||
thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
if (P_MobjWasRemoved(thing))
|
||||
return luaL_error(L, "current entry in thinglist was removed; avoid calling P_RemoveMobj on entries!");
|
||||
thing = thing->snext;
|
||||
}
|
||||
else
|
||||
|
||||
+15
-23
@@ -26,8 +26,6 @@
|
||||
#include "d_netfil.h" // for LUA_DumpFile
|
||||
#endif
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_glib.h"
|
||||
@@ -495,9 +493,9 @@ void LUA_InvalidateLevel(void)
|
||||
size_t i;
|
||||
if (!gL)
|
||||
return;
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
for (th = thlist[i].next; th && th != &thlist[i]; th = th->next)
|
||||
LUA_InvalidateUserdata(th);
|
||||
|
||||
for (th = thinkercap.next; th && th != &thinkercap; th = th->next)
|
||||
LUA_InvalidateUserdata(th);
|
||||
|
||||
LUA_InvalidateMapthings();
|
||||
|
||||
@@ -1586,17 +1584,16 @@ void LUA_Archive(void)
|
||||
ArchiveExtVars(&players[i], "player");
|
||||
}
|
||||
|
||||
//if (gamestate == GS_LEVEL)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
// archive function will determine when to skip mobjs,
|
||||
// and write mobjnum in otherwise.
|
||||
ArchiveExtVars(th, "mobj");
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
// archive function will determine when to skip mobjs,
|
||||
// and write mobjnum in otherwise.
|
||||
ArchiveExtVars(th, "mobj");
|
||||
}
|
||||
}
|
||||
|
||||
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
|
||||
|
||||
LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
|
||||
@@ -1624,15 +1621,10 @@ void LUA_UnArchive(void)
|
||||
|
||||
do {
|
||||
mobjnum = READUINT32(save_p); // read a mobjnum
|
||||
th = mobjnum_ht_linkedList_Find(mobjnum);
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj
|
||||
continue;
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
}
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker
|
||||
&& ((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||
|
||||
LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#define META_ITERATIONSTATE "iteration state"
|
||||
|
||||
/*static const char *const iter_opt[] = {
|
||||
static const char *const iter_opt[] = {
|
||||
"all",
|
||||
"mobj",
|
||||
NULL};
|
||||
@@ -25,7 +25,7 @@
|
||||
static const actionf_p1 iter_funcs[] = {
|
||||
NULL,
|
||||
(actionf_p1)P_MobjThinker
|
||||
};*/
|
||||
};
|
||||
|
||||
struct iterationState {
|
||||
actionf_p1 filter;
|
||||
@@ -57,7 +57,7 @@ static int lib_iterateThinkers(lua_State *L)
|
||||
lua_settop(L, 2);
|
||||
|
||||
if (lua_isnil(L, 2))
|
||||
th = &thlist[THINK_MOBJ];
|
||||
th = &thinkercap;
|
||||
else if (lua_isuserdata(L, 2))
|
||||
{
|
||||
if (lua_islightuserdata(L, 2))
|
||||
@@ -87,11 +87,11 @@ static int lib_iterateThinkers(lua_State *L)
|
||||
if (!next)
|
||||
return luaL_error(L, "next thinker invalidated during iteration");
|
||||
|
||||
for (; next != &thlist[THINK_MOBJ]; next = next->next)
|
||||
for (; next != &thinkercap; next = next->next)
|
||||
if (!it->filter || next->function.acp1 == it->filter)
|
||||
{
|
||||
push_thinker(next);
|
||||
if (next->next != &thlist[THINK_MOBJ])
|
||||
if (next->next != &thinkercap)
|
||||
{
|
||||
push_thinker(next->next);
|
||||
it->next = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
@@ -110,7 +110,7 @@ static int lib_startIterate(lua_State *L)
|
||||
luaL_getmetatable(L, META_ITERATIONSTATE);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
it->filter = (actionf_p1)P_MobjThinker; //iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)];
|
||||
it->filter = iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)];
|
||||
it->next = LUA_REFNIL;
|
||||
return 2;
|
||||
}
|
||||
@@ -128,6 +128,6 @@ int LUA_ThinkerLib(lua_State *L)
|
||||
lua_pushcfunction(L, lib_iterateThinkers);
|
||||
lua_pushcclosure(L, lib_startIterate, 1);
|
||||
lua_setfield(L, -2, "iterate");
|
||||
lua_setglobal(L, "mobjs");
|
||||
lua_setglobal(L, "thinkers");
|
||||
return 0;
|
||||
}
|
||||
+120
-26
@@ -18,6 +18,9 @@
|
||||
#include "z_zone.h"
|
||||
#include "v_video.h"
|
||||
#include "i_video.h"
|
||||
#include "i_system.h" // I_GetPreciseTime
|
||||
#include "doomstat.h" // singletics
|
||||
#include "st_stuff.h" // st_palette
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
@@ -26,19 +29,34 @@
|
||||
// GIFs are always little-endian
|
||||
#include "byteptr.h"
|
||||
|
||||
CV_PossibleValue_t gif_dynamicdelay_cons_t[] = {
|
||||
{0, "Off"},
|
||||
{1, "On"},
|
||||
{2, "Accurate, experimental"},
|
||||
{0, NULL}};
|
||||
|
||||
consvar_t cv_gif_optimize = {"gif_optimize", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_gif_downscale = {"gif_downscale", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_gif_dynamicdelay = {"gif_dynamicdelay", "On", CV_SAVE, gif_dynamicdelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_gif_localcolortable = {"gif_localcolortable", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifdef HAVE_ANIGIF
|
||||
static boolean gif_optimize = false; // So nobody can do something dumb
|
||||
static boolean gif_downscale = false; // like changing cvars mid output
|
||||
static UINT8 gif_dynamicdelay = (UINT8)0; // and messing something up
|
||||
|
||||
// Palette handling
|
||||
static boolean gif_localcolortable = false;
|
||||
static RGBA_t *gif_headerpalette = NULL;
|
||||
static RGBA_t *gif_framepalette = NULL;
|
||||
|
||||
static FILE *gif_out = NULL;
|
||||
static INT32 gif_frames = 0;
|
||||
static precise_t gif_prevframetime = 0;
|
||||
static UINT32 gif_delayus = 0; // "us" is microseconds
|
||||
static UINT8 gif_writeover = 0;
|
||||
|
||||
|
||||
|
||||
// OPTIMIZE gif output
|
||||
// ---
|
||||
|
||||
@@ -390,18 +408,47 @@ const UINT8 gifhead_base[6] = {0x47,0x49,0x46,0x38,0x39,0x61}; // GIF89a
|
||||
const UINT8 gifhead_nsid[19] = {0x21,0xFF,0x0B, // extension block + size
|
||||
0x4E,0x45,0x54,0x53,0x43,0x41,0x50,0x45,0x32,0x2E,0x30, // NETSCAPE2.0
|
||||
0x03,0x01,0xFF,0xFF,0x00}; // sub-block, repetitions
|
||||
|
||||
//
|
||||
// GIF_getpalette
|
||||
// determine the palette for the current frame.
|
||||
//
|
||||
static RGBA_t *GIF_getpalette(size_t palnum)
|
||||
{
|
||||
// In hardware mode, always returns the local palette
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && !HWR_ShouldUsePaletteRendering())
|
||||
return pLocalPalette;
|
||||
else
|
||||
#endif
|
||||
return (&pLocalPalette[palnum*256]);
|
||||
}
|
||||
|
||||
//
|
||||
// GIF_palwrite
|
||||
// writes the gif palette.
|
||||
// used both for the header and local color tables.
|
||||
//
|
||||
static UINT8 *GIF_palwrite(UINT8 *p, RGBA_t *pal)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
WRITEUINT8(p, pal[i].s.red);
|
||||
WRITEUINT8(p, pal[i].s.green);
|
||||
WRITEUINT8(p, pal[i].s.blue);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
//
|
||||
// GIF_headwrite
|
||||
// writes the gif header to the currently open output file.
|
||||
// NOTE that this code does not accomodate for palette changes.
|
||||
//
|
||||
static void GIF_headwrite(void)
|
||||
{
|
||||
UINT8 *gifhead = Z_Malloc(800, PU_STATIC, NULL);
|
||||
UINT8 *p = gifhead;
|
||||
RGBA_t *c;
|
||||
INT32 i;
|
||||
UINT16 rwidth, rheight;
|
||||
|
||||
if (!gif_out)
|
||||
@@ -422,22 +469,17 @@ static void GIF_headwrite(void)
|
||||
rwidth = vid.width;
|
||||
rheight = vid.height;
|
||||
}
|
||||
|
||||
WRITEUINT16(p, rwidth);
|
||||
WRITEUINT16(p, rheight);
|
||||
|
||||
// colors, aspect, etc
|
||||
WRITEUINT8(p, 0xF7);
|
||||
WRITEUINT8(p, 0xF7); // (0xF7 = 1111 0111)
|
||||
WRITEUINT8(p, 0x00);
|
||||
WRITEUINT8(p, 0x00);
|
||||
|
||||
// write color table
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
c = &pLocalPalette[i];
|
||||
WRITEUINT8(p, c->s.red);
|
||||
WRITEUINT8(p, c->s.green);
|
||||
WRITEUINT8(p, c->s.blue);
|
||||
}
|
||||
p = GIF_palwrite(p, gif_headerpalette);
|
||||
|
||||
// write extension block
|
||||
WRITEMEM(p, gifhead_nsid, sizeof(gifhead_nsid));
|
||||
@@ -468,7 +510,7 @@ static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr)
|
||||
size_t src, dest;
|
||||
int x, y;
|
||||
|
||||
InitColorLUT();
|
||||
InitColorLUT(gif_framepalette);
|
||||
|
||||
for (x = 0; x < vid.width; x += scrbuf_downscaleamt)
|
||||
{
|
||||
@@ -495,6 +537,7 @@ static void GIF_framewrite(void)
|
||||
UINT8 *p;
|
||||
UINT8 *movie_screen = screens[2];
|
||||
INT32 blitx, blity, blitw, blith;
|
||||
boolean palchanged;
|
||||
|
||||
if (!gifframe_data)
|
||||
gifframe_data = Z_Malloc(gifframe_size, PU_STATIC, NULL);
|
||||
@@ -502,9 +545,19 @@ static void GIF_framewrite(void)
|
||||
|
||||
if (!gif_out)
|
||||
return;
|
||||
|
||||
// Lactozilla: Compare the header's palette with the current frame's palette and see if it changed.
|
||||
if (gif_localcolortable)
|
||||
{
|
||||
gif_framepalette = GIF_getpalette(max(st_palette, 0));
|
||||
palchanged = memcmp(gif_headerpalette, gif_framepalette, sizeof(RGBA_t) * 256);
|
||||
}
|
||||
else
|
||||
palchanged = false;
|
||||
|
||||
// Compare image data (for optimizing GIF)
|
||||
if (gif_optimize && gif_frames > 0)
|
||||
// If the palette has changed, the entire frame is considered to be different.
|
||||
if (gif_optimize && gif_frames > 0 && (!palchanged))
|
||||
{
|
||||
// before blit movie_screen points to last frame, cur_screen points to this frame
|
||||
UINT8 *cur_screen = screens[0];
|
||||
@@ -548,11 +601,39 @@ static void GIF_framewrite(void)
|
||||
|
||||
// screen regions are handled in GIF_lzw
|
||||
{
|
||||
int d1 = (int)((100.0f/NEWTICRATE)*(gif_frames+1));
|
||||
int d2 = (int)((100.0f/NEWTICRATE)*(gif_frames));
|
||||
UINT16 delay = d1-d2;
|
||||
UINT16 delay = 0;
|
||||
INT32 startline;
|
||||
|
||||
if (gif_dynamicdelay ==(UINT8) 2 && !singletics)
|
||||
{
|
||||
// golden's attempt at creating a "dynamic delay"
|
||||
UINT16 mingifdelay = 10; // minimum gif delay in milliseconds (keep at 10 because gifs can't get more precise).
|
||||
gif_delayus += (I_GetPreciseTime() - gif_prevframetime) / (I_GetPrecisePrecision() / 1000000); // increase delay by how much time was spent between last measurement
|
||||
|
||||
if (gif_delayus/1000 >= mingifdelay) // delay is big enough to be able to effect gif frame delay?
|
||||
{
|
||||
int frames = (gif_delayus/1000) / mingifdelay; // get amount of frames to delay.
|
||||
delay = frames; // set the delay to delay that amount of frames.
|
||||
gif_delayus -= frames*(mingifdelay*1000); // remove frames by the amount of milliseconds they take. don't reset to 0, the microseconds help consistency.
|
||||
}
|
||||
}
|
||||
else if (gif_dynamicdelay ==(UINT8) 1 && !singletics)
|
||||
{
|
||||
float delayf = ceil(100.0f/NEWTICRATE);
|
||||
|
||||
delay = (UINT16)((I_GetPreciseTime() - gif_prevframetime)) / (I_GetPrecisePrecision() / 1000000) /10/1000;
|
||||
|
||||
if (delay < (UINT16)(delayf))
|
||||
delay = (UINT16)(delayf);
|
||||
}
|
||||
else
|
||||
{
|
||||
// the original code
|
||||
int d1 = (int)((100.0f/NEWTICRATE)*(gif_frames+1));
|
||||
int d2 = (int)((100.0f/NEWTICRATE)*(gif_frames));
|
||||
delay = d1-d2;
|
||||
}
|
||||
|
||||
WRITEMEM(p, gifframe_gchead, 4);
|
||||
|
||||
WRITEUINT16(p, delay);
|
||||
@@ -573,7 +654,20 @@ static void GIF_framewrite(void)
|
||||
WRITEUINT16(p, (UINT16)(blity / scrbuf_downscaleamt));
|
||||
WRITEUINT16(p, (UINT16)(blitw / scrbuf_downscaleamt));
|
||||
WRITEUINT16(p, (UINT16)(blith / scrbuf_downscaleamt));
|
||||
WRITEUINT8(p, 0); // no local table of colors
|
||||
|
||||
if (!gif_localcolortable)
|
||||
WRITEUINT8(p, 0); // no local table of colors
|
||||
else
|
||||
{
|
||||
if (palchanged)
|
||||
{
|
||||
// The palettes are different, so write the Local Color Table!
|
||||
WRITEUINT8(p, 0x87); // (0x87 = 1000 0111)
|
||||
p = GIF_palwrite(p, gif_framepalette);
|
||||
}
|
||||
else
|
||||
WRITEUINT8(p, 0); // They are equal, no Local Color Table needed.
|
||||
}
|
||||
|
||||
scrbuf_pos = movie_screen + blitx + (blity * vid.width);
|
||||
scrbuf_writeend = scrbuf_pos + (blitw - 1) + ((blith - 1) * vid.width);
|
||||
@@ -617,6 +711,7 @@ static void GIF_framewrite(void)
|
||||
}
|
||||
fwrite(gifframe_data, 1, (p - gifframe_data), gif_out);
|
||||
++gif_frames;
|
||||
gif_prevframetime = I_GetPreciseTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -631,22 +726,21 @@ static void GIF_framewrite(void)
|
||||
//
|
||||
INT32 GIF_open(const char *filename)
|
||||
{
|
||||
#if 0
|
||||
if (rendermode != render_soft)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n"));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
gif_out = fopen(filename, "wb");
|
||||
if (!gif_out)
|
||||
return 0;
|
||||
|
||||
gif_optimize = (!!cv_gif_optimize.value);
|
||||
gif_downscale = (!!cv_gif_downscale.value);
|
||||
gif_dynamicdelay = (UINT8)cv_gif_dynamicdelay.value;
|
||||
|
||||
gif_localcolortable = (!!cv_gif_localcolortable.value);
|
||||
gif_headerpalette = GIF_getpalette(0);
|
||||
|
||||
GIF_headwrite();
|
||||
gif_frames = 0;
|
||||
gif_prevframetime = I_GetPreciseTime();
|
||||
gif_delayus = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -27,6 +27,6 @@ void GIF_frame(void);
|
||||
INT32 GIF_close(void);
|
||||
#endif
|
||||
|
||||
extern consvar_t cv_gif_optimize, cv_gif_downscale;
|
||||
extern consvar_t cv_gif_optimize, cv_gif_downscale, cv_gif_dynamicdelay, cv_gif_localcolortable;
|
||||
|
||||
#endif
|
||||
+4
-5
@@ -902,16 +902,15 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
||||
thinker_t *th;
|
||||
mobj_t *mo;
|
||||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
// get offset from mt, which points to old mapthings, then add new location
|
||||
if (!mo->spawnpoint)
|
||||
continue;
|
||||
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||
if (mo->spawnpoint)
|
||||
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -179,9 +179,7 @@ fixed_t FV2_Distance(const vector2_t *p1, const vector2_t *p2)
|
||||
|
||||
fixed_t FV2_Magnitude(const vector2_t *a_normal)
|
||||
{
|
||||
fixed_t xs = FixedMul(a_normal->x, a_normal->x);
|
||||
fixed_t ys = FixedMul(a_normal->y, a_normal->y);
|
||||
return FixedSqrt(xs + ys);
|
||||
return FixedHypot(a_normal->x, a_normal->y); // Much less prone to overflowing
|
||||
}
|
||||
|
||||
// Also returns the magnitude
|
||||
|
||||
+325
-509
File diff suppressed because it is too large.
Load diff
+13
-8
@@ -147,6 +147,8 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
|
||||
|
||||
#define MAXSTRINGLENGTH 32
|
||||
|
||||
#define MAXMENUCCVARS 999
|
||||
|
||||
#define MAXTOOLTIPS 255
|
||||
|
||||
typedef union
|
||||
@@ -171,7 +173,7 @@ typedef struct menuitem_s
|
||||
void *itemaction;
|
||||
|
||||
// hotkey in menu or y of the item
|
||||
UINT8 alphaKey;
|
||||
UINT16 alphaKey;
|
||||
} menuitem_t;
|
||||
|
||||
extern menuitem_t PlayerMenu[MAXSKINS];
|
||||
@@ -289,6 +291,8 @@ void M_PopupMasterServerRules(void);
|
||||
void M_PopupMasterServerConnectError(void);
|
||||
#endif
|
||||
|
||||
void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name, boolean minmax);
|
||||
|
||||
// These defines make it a little easier to make menus
|
||||
#define DEFAULTMENUSTYLE(header, source, prev, x, y)\
|
||||
{\
|
||||
@@ -300,7 +304,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#define DEFAULTSCROLLSTYLE(header, source, prev, x, y)\
|
||||
@@ -313,9 +317,10 @@ void M_PopupMasterServerConnectError(void);
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
|
||||
#define PAUSEMENUSTYLE(source, x, y)\
|
||||
{\
|
||||
NULL,\
|
||||
@@ -326,7 +331,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
x, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#define CENTERMENUSTYLE(header, source, prev, y)\
|
||||
@@ -339,7 +344,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
BASEVIDWIDTH/2, y,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#define MAPICONMENUSTYLE(header, source, prev)\
|
||||
@@ -352,7 +357,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
24,40,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#define CONTROLMENUSTYLE(source, prev)\
|
||||
@@ -365,7 +370,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
26, 40,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#define IMAGEDEF(source)\
|
||||
@@ -378,7 +383,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
0, 0,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
#endif //__X_MENU__
|
||||
+426
-4
@@ -19,6 +19,7 @@
|
||||
// (if libpng is compiled with setjmp error handling)
|
||||
#pragma GCC diagnostic ignored "-Wclobbered"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
@@ -64,6 +65,8 @@ typedef off_t off64_t;
|
||||
#define PRIdS "u"
|
||||
#elif defined(_WIN32) && !defined(__MINGW64__)
|
||||
#define PRIdS "Iu"
|
||||
#elif defined(_WIN32) && defined(__MINGW64__)
|
||||
#define PRIdS PRIuPTR
|
||||
#else
|
||||
#define PRIdS "zu"
|
||||
#endif
|
||||
@@ -995,7 +998,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal)
|
||||
png_init_io(apng_ptr, apng_FILE);
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
png_set_user_limits(apng_ptr, MAXPNGWIDTH, MAXPNGHEIGHT);
|
||||
png_set_user_limits(apng_ptr, MAXVIDWIDTH, MAXVIDHEIGHT);
|
||||
#endif
|
||||
|
||||
//png_set_filter(apng_ptr, 0, PNG_ALL_FILTERS);
|
||||
@@ -1140,7 +1143,7 @@ void M_SaveFrame(void)
|
||||
// paranoia: should be unnecessary without singletics
|
||||
static tic_t oldtic = 0;
|
||||
|
||||
if (oldtic == I_GetTime())
|
||||
if (oldtic == I_GetTime() && !singletics)
|
||||
return;
|
||||
else
|
||||
oldtic = I_GetTime();
|
||||
@@ -1304,7 +1307,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const
|
||||
png_init_io(png_ptr, png_FILE);
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
png_set_user_limits(png_ptr, MAXPNGWIDTH, MAXPNGHEIGHT);
|
||||
png_set_user_limits(png_ptr, MAXVIDWIDTH, MAXVIDHEIGHT);
|
||||
#endif
|
||||
|
||||
//png_set_filter(png_ptr, 0, PNG_ALL_FILTERS);
|
||||
@@ -1936,11 +1939,430 @@ char *sizeu5(size_t num)
|
||||
return sizeu5_buf;
|
||||
}
|
||||
|
||||
void *M_Memcpy(void *dest, const void *src, size_t n)
|
||||
#if defined (__GNUC__) && defined (__i386__) // from libkwave, under GPL
|
||||
// Alam: note libkwave memcpy code comes from mplayer's libvo/aclib_template.c, r699
|
||||
|
||||
/* for small memory blocks (<256 bytes) this version is faster */
|
||||
#define small_memcpy(dest,src,n)\
|
||||
{\
|
||||
register unsigned long int dummy;\
|
||||
__asm__ __volatile__(\
|
||||
"cld\n\t"\
|
||||
"rep; movsb"\
|
||||
:"=&D"(dest), "=&S"(src), "=&c"(dummy)\
|
||||
:"0" (dest), "1" (src),"2" (n)\
|
||||
: "memory", "cc");\
|
||||
}
|
||||
/* linux kernel __memcpy (from: /include/asm/string.h) */
|
||||
ATTRINLINE static FUNCINLINE void *__memcpy (void *dest, const void * src, size_t n)
|
||||
{
|
||||
int d0, d1, d2;
|
||||
|
||||
if ( n < 4 )
|
||||
{
|
||||
small_memcpy(dest, src, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"rep ; movsl;"
|
||||
"testb $2,%b4;"
|
||||
"je 1f;"
|
||||
"movsw;"
|
||||
"1:\ttestb $1,%b4;"
|
||||
"je 2f;"
|
||||
"movsb;"
|
||||
"2:"
|
||||
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
|
||||
:"0" (n/4), "q" (n),"1" ((long) dest),"2" ((long) src)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define SSE_MMREG_SIZE 16
|
||||
#define MMX_MMREG_SIZE 8
|
||||
|
||||
#define MMX1_MIN_LEN 0x800 /* 2K blocks */
|
||||
#define MIN_LEN 0x40 /* 64-byte blocks */
|
||||
|
||||
/* SSE note: i tried to move 128 bytes a time instead of 64 but it
|
||||
didn't make any measureable difference. i'm using 64 for the sake of
|
||||
simplicity. [MF] */
|
||||
static /*FUNCTARGET("sse2")*/ void *sse_cpy(void * dest, const void * src, size_t n)
|
||||
{
|
||||
void *retval = dest;
|
||||
size_t i;
|
||||
|
||||
/* PREFETCH has effect even for MOVSB instruction ;) */
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta (%0);"
|
||||
"prefetchnta 32(%0);"
|
||||
"prefetchnta 64(%0);"
|
||||
"prefetchnta 96(%0);"
|
||||
"prefetchnta 128(%0);"
|
||||
"prefetchnta 160(%0);"
|
||||
"prefetchnta 192(%0);"
|
||||
"prefetchnta 224(%0);"
|
||||
"prefetchnta 256(%0);"
|
||||
"prefetchnta 288(%0);"
|
||||
: : "r" (src) );
|
||||
|
||||
if (n >= MIN_LEN)
|
||||
{
|
||||
register unsigned long int delta;
|
||||
/* Align destinition to MMREG_SIZE -boundary */
|
||||
delta = ((unsigned long int)dest)&(SSE_MMREG_SIZE-1);
|
||||
if (delta)
|
||||
{
|
||||
delta=SSE_MMREG_SIZE-delta;
|
||||
n -= delta;
|
||||
small_memcpy(dest, src, delta);
|
||||
}
|
||||
i = n >> 6; /* n/64 */
|
||||
n&=63;
|
||||
if (((unsigned long)src) & 15)
|
||||
/* if SRC is misaligned */
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta 320(%0);"
|
||||
"prefetchnta 352(%0);"
|
||||
"movups (%0), %%xmm0;"
|
||||
"movups 16(%0), %%xmm1;"
|
||||
"movups 32(%0), %%xmm2;"
|
||||
"movups 48(%0), %%xmm3;"
|
||||
"movntps %%xmm0, (%1);"
|
||||
"movntps %%xmm1, 16(%1);"
|
||||
"movntps %%xmm2, 32(%1);"
|
||||
"movntps %%xmm3, 48(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = (const unsigned char *)src + 64;
|
||||
dest = (unsigned char *)dest + 64;
|
||||
}
|
||||
else
|
||||
/*
|
||||
Only if SRC is aligned on 16-byte boundary.
|
||||
It allows to use movaps instead of movups, which required data
|
||||
to be aligned or a general-protection exception (#GP) is generated.
|
||||
*/
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta 320(%0);"
|
||||
"prefetchnta 352(%0);"
|
||||
"movaps (%0), %%xmm0;"
|
||||
"movaps 16(%0), %%xmm1;"
|
||||
"movaps 32(%0), %%xmm2;"
|
||||
"movaps 48(%0), %%xmm3;"
|
||||
"movntps %%xmm0, (%1);"
|
||||
"movntps %%xmm1, 16(%1);"
|
||||
"movntps %%xmm2, 32(%1);"
|
||||
"movntps %%xmm3, 48(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = ((const unsigned char *)src) + 64;
|
||||
dest = ((unsigned char *)dest) + 64;
|
||||
}
|
||||
/* since movntq is weakly-ordered, a "sfence"
|
||||
* is needed to become ordered again. */
|
||||
__asm__ __volatile__ ("sfence":::"memory");
|
||||
/* enables to use FPU */
|
||||
__asm__ __volatile__ ("emms":::"memory");
|
||||
}
|
||||
/*
|
||||
* Now do the tail of the block
|
||||
*/
|
||||
if (n) __memcpy(dest, src, n);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static FUNCTARGET("mmx") void *mmx2_cpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
void *retval = dest;
|
||||
size_t i;
|
||||
|
||||
/* PREFETCH has effect even for MOVSB instruction ;) */
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta (%0);"
|
||||
"prefetchnta 32(%0);"
|
||||
"prefetchnta 64(%0);"
|
||||
"prefetchnta 96(%0);"
|
||||
"prefetchnta 128(%0);"
|
||||
"prefetchnta 160(%0);"
|
||||
"prefetchnta 192(%0);"
|
||||
"prefetchnta 224(%0);"
|
||||
"prefetchnta 256(%0);"
|
||||
"prefetchnta 288(%0);"
|
||||
: : "r" (src));
|
||||
|
||||
if (n >= MIN_LEN)
|
||||
{
|
||||
register unsigned long int delta;
|
||||
/* Align destinition to MMREG_SIZE -boundary */
|
||||
delta = ((unsigned long int)dest)&(MMX_MMREG_SIZE-1);
|
||||
if (delta)
|
||||
{
|
||||
delta=MMX_MMREG_SIZE-delta;
|
||||
n -= delta;
|
||||
small_memcpy(dest, src, delta);
|
||||
}
|
||||
i = n >> 6; /* n/64 */
|
||||
n&=63;
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"prefetchnta 320(%0);"
|
||||
"prefetchnta 352(%0);"
|
||||
"movq (%0), %%mm0;"
|
||||
"movq 8(%0), %%mm1;"
|
||||
"movq 16(%0), %%mm2;"
|
||||
"movq 24(%0), %%mm3;"
|
||||
"movq 32(%0), %%mm4;"
|
||||
"movq 40(%0), %%mm5;"
|
||||
"movq 48(%0), %%mm6;"
|
||||
"movq 56(%0), %%mm7;"
|
||||
"movntq %%mm0, (%1);"
|
||||
"movntq %%mm1, 8(%1);"
|
||||
"movntq %%mm2, 16(%1);"
|
||||
"movntq %%mm3, 24(%1);"
|
||||
"movntq %%mm4, 32(%1);"
|
||||
"movntq %%mm5, 40(%1);"
|
||||
"movntq %%mm6, 48(%1);"
|
||||
"movntq %%mm7, 56(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = ((const unsigned char *)src) + 64;
|
||||
dest = ((unsigned char *)dest) + 64;
|
||||
}
|
||||
/* since movntq is weakly-ordered, a "sfence"
|
||||
* is needed to become ordered again. */
|
||||
__asm__ __volatile__ ("sfence":::"memory");
|
||||
__asm__ __volatile__ ("emms":::"memory");
|
||||
}
|
||||
/*
|
||||
* Now do the tail of the block
|
||||
*/
|
||||
if (n) __memcpy(dest, src, n);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static FUNCTARGET("mmx") void *mmx1_cpy(void *dest, const void *src, size_t n) //3DNOW
|
||||
{
|
||||
void *retval = dest;
|
||||
size_t i;
|
||||
|
||||
/* PREFETCH has effect even for MOVSB instruction ;) */
|
||||
__asm__ __volatile__ (
|
||||
"prefetch (%0);"
|
||||
"prefetch 32(%0);"
|
||||
"prefetch 64(%0);"
|
||||
"prefetch 96(%0);"
|
||||
"prefetch 128(%0);"
|
||||
"prefetch 160(%0);"
|
||||
"prefetch 192(%0);"
|
||||
"prefetch 224(%0);"
|
||||
"prefetch 256(%0);"
|
||||
"prefetch 288(%0);"
|
||||
: : "r" (src));
|
||||
|
||||
if (n >= MMX1_MIN_LEN)
|
||||
{
|
||||
register unsigned long int delta;
|
||||
/* Align destinition to MMREG_SIZE -boundary */
|
||||
delta = ((unsigned long int)dest)&(MMX_MMREG_SIZE-1);
|
||||
if (delta)
|
||||
{
|
||||
delta=MMX_MMREG_SIZE-delta;
|
||||
n -= delta;
|
||||
small_memcpy(dest, src, delta);
|
||||
}
|
||||
i = n >> 6; /* n/64 */
|
||||
n&=63;
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"prefetch 320(%0);"
|
||||
"prefetch 352(%0);"
|
||||
"movq (%0), %%mm0;"
|
||||
"movq 8(%0), %%mm1;"
|
||||
"movq 16(%0), %%mm2;"
|
||||
"movq 24(%0), %%mm3;"
|
||||
"movq 32(%0), %%mm4;"
|
||||
"movq 40(%0), %%mm5;"
|
||||
"movq 48(%0), %%mm6;"
|
||||
"movq 56(%0), %%mm7;"
|
||||
"movq %%mm0, (%1);"
|
||||
"movq %%mm1, 8(%1);"
|
||||
"movq %%mm2, 16(%1);"
|
||||
"movq %%mm3, 24(%1);"
|
||||
"movq %%mm4, 32(%1);"
|
||||
"movq %%mm5, 40(%1);"
|
||||
"movq %%mm6, 48(%1);"
|
||||
"movq %%mm7, 56(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = ((const unsigned char *)src) + 64;
|
||||
dest = ((unsigned char *)dest) + 64;
|
||||
}
|
||||
__asm__ __volatile__ ("femms":::"memory"); // same as mmx_cpy() but with a femms
|
||||
}
|
||||
/*
|
||||
* Now do the tail of the block
|
||||
*/
|
||||
if (n) __memcpy(dest, src, n);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Alam: why? memcpy may be __cdecl/_System and our code may be not the same type
|
||||
static void *cpu_cpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
if (src == NULL)
|
||||
{
|
||||
CONS_Debug(DBG_MEMORY, "Memcpy from 0x0?!: %p %p %s\n", dest, src, sizeu1(n));
|
||||
return dest;
|
||||
}
|
||||
|
||||
if(dest == NULL)
|
||||
{
|
||||
CONS_Debug(DBG_MEMORY, "Memcpy to 0x0?!: %p %p %s\n", dest, src, sizeu1(n));
|
||||
return dest;
|
||||
}
|
||||
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
static /*FUNCTARGET("mmx")*/ void *mmx_cpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
#if defined (_MSC_VER) && defined (_X86_)
|
||||
_asm
|
||||
{
|
||||
mov ecx, [n]
|
||||
mov esi, [src]
|
||||
mov edi, [dest]
|
||||
shr ecx, 6 // mit mmx: 64bytes per iteration
|
||||
jz lower_64 // if lower than 64 bytes
|
||||
loop_64: // MMX transfers multiples of 64bytes
|
||||
movq mm0, 0[ESI] // read sources
|
||||
movq mm1, 8[ESI]
|
||||
movq mm2, 16[ESI]
|
||||
movq mm3, 24[ESI]
|
||||
movq mm4, 32[ESI]
|
||||
movq mm5, 40[ESI]
|
||||
movq mm6, 48[ESI]
|
||||
movq mm7, 56[ESI]
|
||||
|
||||
movq 0[EDI], mm0 // write destination
|
||||
movq 8[EDI], mm1
|
||||
movq 16[EDI], mm2
|
||||
movq 24[EDI], mm3
|
||||
movq 32[EDI], mm4
|
||||
movq 40[EDI], mm5
|
||||
movq 48[EDI], mm6
|
||||
movq 56[EDI], mm7
|
||||
|
||||
add esi, 64
|
||||
add edi, 64
|
||||
dec ecx
|
||||
jnz loop_64
|
||||
emms // close mmx operation
|
||||
lower_64:// transfer rest of buffer
|
||||
mov ebx,esi
|
||||
sub ebx,src
|
||||
mov ecx,[n]
|
||||
sub ecx,ebx
|
||||
shr ecx, 3 // multiples of 8 bytes
|
||||
jz lower_8
|
||||
loop_8:
|
||||
movq mm0, [esi] // read source
|
||||
movq [edi], mm0 // write destination
|
||||
add esi, 8
|
||||
add edi, 8
|
||||
dec ecx
|
||||
jnz loop_8
|
||||
emms // close mmx operation
|
||||
lower_8:
|
||||
mov ebx,esi
|
||||
sub ebx,src
|
||||
mov ecx,[n]
|
||||
sub ecx,ebx
|
||||
rep movsb
|
||||
mov eax, [dest] // return dest
|
||||
}
|
||||
#elif defined (__GNUC__) && defined (__i386__)
|
||||
void *retval = dest;
|
||||
size_t i;
|
||||
|
||||
if (n >= MMX1_MIN_LEN)
|
||||
{
|
||||
register unsigned long int delta;
|
||||
/* Align destinition to MMREG_SIZE -boundary */
|
||||
delta = ((unsigned long int)dest)&(MMX_MMREG_SIZE-1);
|
||||
if (delta)
|
||||
{
|
||||
delta=MMX_MMREG_SIZE-delta;
|
||||
n -= delta;
|
||||
small_memcpy(dest, src, delta);
|
||||
}
|
||||
i = n >> 6; /* n/64 */
|
||||
n&=63;
|
||||
for (; i>0; i--)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"movq (%0), %%mm0;"
|
||||
"movq 8(%0), %%mm1;"
|
||||
"movq 16(%0), %%mm2;"
|
||||
"movq 24(%0), %%mm3;"
|
||||
"movq 32(%0), %%mm4;"
|
||||
"movq 40(%0), %%mm5;"
|
||||
"movq 48(%0), %%mm6;"
|
||||
"movq 56(%0), %%mm7;"
|
||||
"movq %%mm0, (%1);"
|
||||
"movq %%mm1, 8(%1);"
|
||||
"movq %%mm2, 16(%1);"
|
||||
"movq %%mm3, 24(%1);"
|
||||
"movq %%mm4, 32(%1);"
|
||||
"movq %%mm5, 40(%1);"
|
||||
"movq %%mm6, 48(%1);"
|
||||
"movq %%mm7, 56(%1);"
|
||||
:: "r" (src), "r" (dest) : "memory");
|
||||
src = ((const unsigned char *)src) + 64;
|
||||
dest = ((unsigned char *)dest) + 64;
|
||||
}
|
||||
__asm__ __volatile__ ("emms":::"memory");
|
||||
}
|
||||
/*
|
||||
* Now do the tail of the block
|
||||
*/
|
||||
if (n) __memcpy(dest, src, n);
|
||||
return retval;
|
||||
#else
|
||||
return cpu_cpy(dest, src, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *(*M_Memcpy)(void* dest, const void* src, size_t n) = cpu_cpy;
|
||||
|
||||
/** Memcpy that uses MMX, 3DNow, MMXExt or even SSE
|
||||
* Do not use on overlapped memory, use memmove for that
|
||||
*/
|
||||
void M_SetupMemcpy(void)
|
||||
{
|
||||
#if defined (__GNUC__) && defined (__i386__)
|
||||
if (R_SSE2)
|
||||
M_Memcpy = sse_cpy;
|
||||
else if (R_MMXExt)
|
||||
M_Memcpy = mmx2_cpy;
|
||||
else if (R_3DNow)
|
||||
M_Memcpy = mmx1_cpy;
|
||||
else
|
||||
#endif
|
||||
if (R_MMX)
|
||||
M_Memcpy = mmx_cpy;
|
||||
#if 0
|
||||
M_Memcpy = cpu_cpy;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Return the appropriate message for a file error or end of file.
|
||||
*/
|
||||
const char *M_FileError(FILE *fp)
|
||||
|
||||
@@ -94,6 +94,8 @@ TMatrix *RotateZMatrix(angle_t rad);
|
||||
// s1 = s2+s3+s1 (1024 lenghtmax)
|
||||
void strcatbf(char *s1, const char *s2, const char *s3);
|
||||
|
||||
void M_SetupMemcpy(void);
|
||||
|
||||
const char *M_FileError(FILE *handle);
|
||||
|
||||
// counting bits, for weapon ammo code, usually
|
||||
|
||||
+29
-4
@@ -564,7 +564,6 @@ static void PS_UpdateFrameStats(void)
|
||||
// Update thinker counters by iterating the thinker lists.
|
||||
static void PS_CountThinkers(void)
|
||||
{
|
||||
int i;
|
||||
thinker_t *thinker;
|
||||
|
||||
ps_thinkercount.value.i = 0;
|
||||
@@ -575,14 +574,38 @@ static void PS_CountThinkers(void)
|
||||
ps_otherthcount.value.i = 0;
|
||||
ps_precipcount.value.i = 0;
|
||||
ps_removecount.value.i = 0;
|
||||
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
for (thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next)
|
||||
{
|
||||
ps_thinkercount.value.i++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
ps_removecount.value.i++;
|
||||
else if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
mobj_t *mobj = (mobj_t*)thinker;
|
||||
ps_mobjcount.value.i++;
|
||||
if (mobj->flags & MF_NOTHINK)
|
||||
ps_nothinkcount.value.i++;
|
||||
else if (mobj->flags & MF_SCENERY)
|
||||
ps_scenerycount.value.i++;
|
||||
else
|
||||
ps_regularcount.value.i++;
|
||||
}
|
||||
else if (thinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
|
||||
ps_precipcount.value.i++;
|
||||
else
|
||||
ps_otherthcount.value.i++;
|
||||
}
|
||||
/*for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
||||
{
|
||||
ps_thinkercount.value.i++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
ps_removecount.value.i++;
|
||||
else if (i == THINK_POLYOBJ)
|
||||
ps_polythcount.value.i++;
|
||||
else if (i == THINK_MAIN)
|
||||
ps_mainthcount.value.i++;
|
||||
else if (i == THINK_MOBJ)
|
||||
{
|
||||
if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
@@ -597,10 +620,12 @@ static void PS_CountThinkers(void)
|
||||
ps_regularcount.value.i++;
|
||||
}
|
||||
}
|
||||
else if (i == THINK_DYNSLOPE)
|
||||
ps_dynslopethcount.value.i++;
|
||||
else if (i == THINK_PRECIP)
|
||||
ps_precipcount.value.i++;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// Update all metrics that are calculated on every tick.
|
||||
|
||||
+2
-2
@@ -410,7 +410,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(THINK_MAIN, &ceiling->thinker);
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
sec->ceilingdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
@@ -633,7 +633,7 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type)
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(THINK_MAIN, &ceiling->thinker);
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
sec->ceilingdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_CrushCeiling;
|
||||
ceiling->sector = sec;
|
||||
|
||||
+32
-40
@@ -2629,9 +2629,9 @@ void A_BossDeath(mobj_t *mo)
|
||||
|
||||
// scan the remaining thinkers to see
|
||||
// if all bosses are dead
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -2685,12 +2685,12 @@ bossjustdie:
|
||||
|
||||
P_SetTarget(&mo->target, NULL);
|
||||
|
||||
// Flee! Flee! Find a point to escape to! If none, just shoot upward!
|
||||
// scan the thinkers to find the runaway point
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
// Flee! Flee! Find a point to escape to! If none, just shoot upward!
|
||||
// scan the thinkers to find the runaway point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
@@ -5294,9 +5294,9 @@ void A_RingExplode(mobj_t *actor)
|
||||
|
||||
S_StartSound(actor, sfx_prloop);
|
||||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -6862,24 +6862,14 @@ void A_Boss3Path(mobj_t *actor)
|
||||
// scan the thinkers
|
||||
// to find a point that matches
|
||||
// the number
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && mo2->spawnpoint->angle == actor->threshold)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type != MT_BOSS3WAYPOINT)
|
||||
continue;
|
||||
if (!mo2->spawnpoint)
|
||||
continue;
|
||||
if (mo2->spawnpoint->angle != actor->threshold)
|
||||
continue;
|
||||
if (mo2->spawnpoint->extrainfo != actor->cusval)
|
||||
continue;
|
||||
|
||||
P_SetTarget(&actor->target, mo2);
|
||||
break;
|
||||
}
|
||||
@@ -7309,9 +7299,9 @@ void A_FindTarget(mobj_t *actor)
|
||||
CONS_Debug(DBG_GAMELOGIC, "A_FindTarget called from object type %d, var1: %d, var2: %d\n", actor->type, locvar1, locvar2);
|
||||
|
||||
// scan the thinkers
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -7373,9 +7363,9 @@ void A_FindTracer(mobj_t *actor)
|
||||
CONS_Debug(DBG_GAMELOGIC, "A_FindTracer called from object type %d, var1: %d, var2: %d\n", actor->type, locvar1, locvar2);
|
||||
|
||||
// scan the thinkers
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -7915,9 +7905,9 @@ void A_RemoteAction(mobj_t *actor)
|
||||
fixed_t dist1 = 0, dist2 = 0;
|
||||
|
||||
// scan the thinkers
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -8693,9 +8683,9 @@ void A_MementosTPParticles(mobj_t *actor)
|
||||
// Doesn't seem like much given the small amount of mobjs this map has but heh.
|
||||
if (!actor->target)
|
||||
{
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -8792,9 +8782,9 @@ void A_ReaperThinker(mobj_t *actor)
|
||||
}
|
||||
|
||||
// We have no target and oughta find one, so let's scan through thinkers for a waypoint of angle 0, or something.
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -8858,9 +8848,9 @@ void A_ReaperThinker(mobj_t *actor)
|
||||
P_SetTarget(&actor->target, NULL); // remove target so we can default back to first waypoint if things go ham.
|
||||
|
||||
// If we reach close to a waypoint, then we should go to the NEXT one.
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -8908,6 +8898,8 @@ void A_FlameParticle(mobj_t *actor)
|
||||
par->momz = actor->scale<<1;
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
// Function: A_OrbitNights
|
||||
//
|
||||
// Description: Used by Chaos Emeralds to orbit around Nights (aka Super Sonic.)
|
||||
@@ -9031,9 +9023,9 @@ void A_SetObjectTypeState(mobj_t *actor)
|
||||
if (LUA_CallAction("A_SetObjectTypeState", actor))
|
||||
return;
|
||||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -9653,9 +9645,9 @@ void A_CheckThingCount(mobj_t *actor)
|
||||
if (LUA_CallAction("A_CheckThingCount", actor))
|
||||
return;
|
||||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
+32
-22
@@ -1977,25 +1977,20 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
||||
// scan the thinkers to find players!
|
||||
if (!rover || (rover->flags & FF_EXISTS))
|
||||
{
|
||||
UINT8 i;
|
||||
// scan the players to find victims!
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
// scan the thinkers to find players!
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
if (players[i].spectator)
|
||||
continue;
|
||||
if (!players[i].mo)
|
||||
continue;
|
||||
if (!players[i].mo->health)
|
||||
continue;
|
||||
if (players[i].mo->z > thwomp->sector->ceilingheight)
|
||||
continue;
|
||||
if (P_AproxDistance(thwompx - players[i].mo->x, thwompy - players[i].mo->y) > 96 * FRACUNIT)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
thwomp->direction = -1;
|
||||
break;
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator
|
||||
&& mo->z <= thwomp->sector->ceilingheight
|
||||
&& P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT)
|
||||
{
|
||||
thwomp->direction = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@@ -2011,6 +2006,20 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
||||
#undef ceilingwasheight
|
||||
}
|
||||
|
||||
|
||||
static void T_UpdateMobjPlaneZ(sector_t *sec)
|
||||
{
|
||||
msecnode_t *node = sec->touching_thinglist; // things touching this sector
|
||||
mobj_t *mo;
|
||||
while (node)
|
||||
{
|
||||
mo = node->m_thing;
|
||||
mo->floorz = P_FloorzAtPos(mo->x, mo->y, mo->z, mo->height);
|
||||
mo->ceilingz = P_CeilingzAtPos(mo->x, mo->y, mo->z, mo->height);
|
||||
node = node->m_thinglist_next;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// T_NoEnemiesThinker
|
||||
//
|
||||
@@ -2683,7 +2692,7 @@ INT32 EV_DoFloor(line_t *line, floor_e floortype)
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
dofloor = Z_Calloc(sizeof (*dofloor), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(THINK_MAIN, &dofloor->thinker);
|
||||
P_AddThinker(&dofloor->thinker);
|
||||
|
||||
// make sure another floor thinker won't get started over this one
|
||||
sec->floordata = dofloor;
|
||||
@@ -2907,7 +2916,7 @@ INT32 EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed)
|
||||
// create and initialize new elevator thinker
|
||||
rtn = 1;
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(THINK_MAIN, &elevator->thinker);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
sec->floordata = elevator;
|
||||
sec->ceilingdata = elevator;
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_MoveElevator;
|
||||
@@ -3077,6 +3086,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
||||
// no longer exists (can't collide with again)
|
||||
rover->flags &= ~FF_EXISTS;
|
||||
rover->master->frontsector->moved = true;
|
||||
T_UpdateMobjPlaneZ(sec); // prevent objects from floating
|
||||
sec->moved = true;
|
||||
}
|
||||
|
||||
@@ -3093,7 +3103,7 @@ INT32 EV_BounceSector(sector_t *sec, fixed_t momz, line_t *sourceline)
|
||||
return 0;
|
||||
|
||||
bouncer = Z_Calloc(sizeof (*bouncer), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(THINK_MAIN, &bouncer->thinker);
|
||||
P_AddThinker(&bouncer->thinker);
|
||||
sec->ceilingdata = bouncer;
|
||||
bouncer->thinker.function.acp1 = (actionf_p1)T_BounceCheese;
|
||||
|
||||
@@ -3131,7 +3141,7 @@ INT32 EV_DoContinuousFall(sector_t *sec, sector_t *backsector, fixed_t spd, bool
|
||||
|
||||
// create and initialize new thinker
|
||||
faller = Z_Calloc(sizeof (*faller), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(THINK_MAIN, &faller->thinker);
|
||||
P_AddThinker(&faller->thinker);
|
||||
faller->thinker.function.acp1 = (actionf_p1)T_ContinuousFalling;
|
||||
|
||||
// set up the fields
|
||||
@@ -3184,7 +3194,7 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(THINK_MAIN, &elevator->thinker);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_StartCrumble;
|
||||
|
||||
// Does this crumbler return?
|
||||
@@ -3262,7 +3272,7 @@ INT32 EV_MarioBlock(sector_t *sec, sector_t *roversector, fixed_t topheight, mob
|
||||
// create and initialize new elevator thinker
|
||||
|
||||
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(THINK_MAIN, &block->thinker);
|
||||
P_AddThinker(&block->thinker);
|
||||
sec->floordata = block;
|
||||
sec->ceilingdata = block;
|
||||
block->thinker.function.acp1 = (actionf_p1)T_MarioBlock;
|
||||
|
||||
+13
-9
@@ -27,7 +27,6 @@
|
||||
#include "m_misc.h"
|
||||
#include "v_video.h" // video flags for CEchos
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "p_local.h"
|
||||
|
||||
// CTF player names
|
||||
#define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : ""
|
||||
@@ -910,7 +909,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
if (player->powers[pw_super])
|
||||
return;
|
||||
|
||||
player->gotflag |= flagflag; // >:(
|
||||
player->gotflag |= flagflag;
|
||||
CONS_Printf(M_GetText("%s picked up the %c%s%c!\n"), plname, flagcolor, flagtext, 0x80);
|
||||
(*flagmobj) = NULL;
|
||||
// code for dealing with abilities is handled elsewhere now
|
||||
@@ -982,9 +981,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
count = 1;
|
||||
|
||||
// scan the remaining thinkers
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -1032,9 +1031,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
// Now we RE-scan all the thinkers to find close objects to pull
|
||||
// in from the paraloop. Isn't this just so efficient?
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -1401,9 +1400,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
EV_DoElevator(&junk, bridgeFall, false);
|
||||
|
||||
// scan the remaining thinkers to find koopa
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
@@ -2559,7 +2558,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
|
||||
// scan the thinkers to make sure all the old pinch dummies are gone on death
|
||||
// this can happen if the boss was hurt earlier than expected
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
@@ -3123,6 +3122,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
UINT8 shouldForce = LUAh_ShouldDamage(target, inflictor, source, damage);
|
||||
if (P_MobjWasRemoved(target))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
if (P_MobjWasRemoved(source))
|
||||
source = NULL;
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
@@ -3373,6 +3374,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
P_SetMobjState(target, target->info->painstate);
|
||||
break;
|
||||
}
|
||||
|
||||
if (P_MobjWasRemoved(target))
|
||||
return false;
|
||||
|
||||
if (!P_MobjWasRemoved(target))
|
||||
{
|
||||
|
||||
+5
-5
@@ -76,7 +76,7 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxse
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
flick = Z_Calloc(sizeof (*flick), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(THINK_MAIN, &flick->thinker);
|
||||
P_AddThinker(&flick->thinker);
|
||||
|
||||
flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
|
||||
flick->sector = maxsector;
|
||||
@@ -155,7 +155,7 @@ void P_SpawnLightningFlash(sector_t *sector)
|
||||
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
P_AddThinker(&flash->thinker);
|
||||
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LightningFlash;
|
||||
flash->sector = sector;
|
||||
@@ -214,7 +214,7 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector,
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
P_AddThinker(&flash->thinker);
|
||||
|
||||
flash->sector = maxsector;
|
||||
flash->darktime = darktime;
|
||||
@@ -289,7 +289,7 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector,
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
g = Z_Calloc(sizeof (*g), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(THINK_MAIN, &g->thinker);
|
||||
P_AddThinker(&g->thinker);
|
||||
|
||||
g->sector = maxsector;
|
||||
g->minlight = minsector->lightlevel;
|
||||
@@ -350,7 +350,7 @@ void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed)
|
||||
ll->thinker.function.acp1 = (actionf_p1)T_LightFade;
|
||||
sector->lightingdata = ll; // set it to the lightlevel_t
|
||||
|
||||
P_AddThinker(THINK_MAIN, &ll->thinker); // add thinker
|
||||
P_AddThinker(&ll->thinker); // add thinker
|
||||
|
||||
ll->sector = sector;
|
||||
ll->destlevel = destvalue;
|
||||
|
||||
+9
-15
@@ -60,21 +60,15 @@
|
||||
#define mariomode (maptol & TOL_MARIO)
|
||||
#define twodlevel (maptol & TOL_2D)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
THINK_POLYOBJ,
|
||||
THINK_MAIN,
|
||||
THINK_MOBJ,
|
||||
#ifdef ESLOPE
|
||||
THINK_DYNSLOPE,
|
||||
#endif
|
||||
THINK_PRECIP,
|
||||
NUM_THINKERLISTS
|
||||
} thinklistnum_t; /**< Thinker lists. */
|
||||
extern thinker_t thlist[];
|
||||
//
|
||||
// P_TICK
|
||||
//
|
||||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(const thinklistnum_t n, thinker_t *thinker);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
void P_RemoveThinker(thinker_t *thinker);
|
||||
|
||||
//
|
||||
@@ -251,7 +245,7 @@ void P_PrecipitationEffects(void);
|
||||
|
||||
void P_RemoveMobj(mobj_t *th);
|
||||
boolean P_MobjWasRemoved(mobj_t *th);
|
||||
void P_RemoveSavegameMobj(mobj_t *th, boolean preserveLevel);
|
||||
void P_RemoveSavegameMobj(mobj_t *th);
|
||||
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
|
||||
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
|
||||
//void P_RunShields(void);
|
||||
@@ -296,7 +290,6 @@ void P_ColorTeamMissile(mobj_t *missile, player_t *source);
|
||||
SINT8 P_MobjFlip(mobj_t *mobj);
|
||||
fixed_t P_GetMobjGravity(mobj_t *mo);
|
||||
FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
|
||||
FUNCMATH boolean P_IsProjectile(mobjtype_t type);
|
||||
|
||||
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled);
|
||||
|
||||
@@ -378,6 +371,7 @@ void P_Initsecnode(void);
|
||||
void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist);
|
||||
|
||||
fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
|
||||
fixed_t P_CeilingzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
|
||||
boolean PIT_PushableMoved(mobj_t *thing);
|
||||
|
||||
boolean P_DoSpring(mobj_t *spring, mobj_t *object);
|
||||
|
||||
+213
-73
@@ -595,6 +595,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
== P_PointOnLineSide(thing->x - thing->radius, thing->y + thing->radius, &junk)))
|
||||
return true; // the line doesn't cross between either pair of opposite corners
|
||||
}
|
||||
else
|
||||
if (abs(R_PointToDist2(thing->x, thing->y, tmx, tmy)) >= blockdist)
|
||||
return true; // didn't hit it, but came very close
|
||||
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
|
||||
@@ -1918,10 +1921,18 @@ static boolean PIT_CheckLine(line_t *ld)
|
||||
|| tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
return true;
|
||||
|
||||
if (P_BoxOnLineSide(tmbbox, ld) != -1)
|
||||
return true;
|
||||
if (tmthing->player)
|
||||
{
|
||||
if (P_CircleOnLineSide(tmx, tmy, tmthing->radius, ld) != -1)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (P_BoxOnLineSide(tmbbox, ld) != -1)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag.
|
||||
if (tmthing->flags & MF_PAPERCOLLISION) // Caution! Turning whilst up against a wall will get you stuck. You probably shouldn't give the player this flag.
|
||||
{
|
||||
fixed_t cosradius, sinradius;
|
||||
cosradius = FixedMul(tmthing->radius, FINECOSINE(tmthing->angle>>ANGLETOFINESHIFT));
|
||||
@@ -2679,8 +2690,22 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
fixed_t startingonground = P_IsObjectOnGround(thing);
|
||||
floatok = false;
|
||||
|
||||
if (radius < MAXRADIUS/2)
|
||||
radius = MAXRADIUS/2;
|
||||
// This makes sure that there are no freezes from computing extremely small movements.
|
||||
// Originally was MAXRADIUS/2, but that can cause some bad inconsistencies for small players.
|
||||
radius = max(radius, thing->scale);
|
||||
|
||||
// And we also have to prevent Big Large (tm) movements, as those can skip too far
|
||||
// across slopes and cause us to fail step up checks on them when we otherwise shouldn't.
|
||||
radius = min(radius, 16 * thing->scale);
|
||||
|
||||
// (This whole "step" system is flawed; it was OK before, but the addition of slopes has
|
||||
// exposed the problems with doing it like this. The right thing to do would be to use
|
||||
// raycasting for physics to fix colliding in weird order, double-checking collisions,
|
||||
// randomly colliding with slopes instead of going up them, etc. I don't feel like porting
|
||||
// that from RR, as its both a huge sweeping change and still incomplete at the time of
|
||||
// writing. Clamping radius to make our steps more precise will work just fine as long
|
||||
// as you keep all of your crazy intentions to poke any of the other deep-rooted movement
|
||||
// code to yourself. -- Sal 6/5/2023)
|
||||
|
||||
do {
|
||||
if (thing->flags & MF_NOCLIP) {
|
||||
@@ -3215,6 +3240,85 @@ isblocking:
|
||||
//
|
||||
// PTR_SlideTraverse
|
||||
//
|
||||
static boolean PTR_SlideTraversePlayer(line_t *li)
|
||||
{
|
||||
fixed_t mmomx, mmomy, x, y, dist;
|
||||
vertex_t closestpoint;
|
||||
|
||||
// Kludgy redo of previous work, should optimize later
|
||||
if (slidemo->player)
|
||||
{
|
||||
mmomx = slidemo->player->rmomx = slidemo->momx - slidemo->player->cmomx;
|
||||
mmomy = slidemo->player->rmomy = slidemo->momy - slidemo->player->cmomy;
|
||||
}
|
||||
else
|
||||
{
|
||||
mmomx = slidemo->momx;
|
||||
mmomy = slidemo->momy;
|
||||
}
|
||||
|
||||
x = slidemo->x + mmomx;
|
||||
y = slidemo->y + mmomy;
|
||||
|
||||
// if (P_CircleOnLineSide(x, y, slidemo->radius, li) != -1)
|
||||
// return true; // Not inside the line, non-blocking
|
||||
|
||||
// one-sided linedefs are always solid to sliding movement.
|
||||
// one-sided linedef
|
||||
if (!li->backsector)
|
||||
{
|
||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
||||
return true; // don't hit the back side
|
||||
goto isblocking;
|
||||
}
|
||||
|
||||
if (!(slidemo->flags & MF_MISSILE))
|
||||
{
|
||||
if (li->flags & ML_IMPASSIBLE)
|
||||
goto isblocking;
|
||||
|
||||
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
|
||||
goto isblocking;
|
||||
}
|
||||
|
||||
// set openrange, opentop, openbottom
|
||||
P_LineOpening(li, slidemo);
|
||||
|
||||
if (openrange < slidemo->height)
|
||||
goto isblocking; // doesn't fit
|
||||
|
||||
if (opentop - slidemo->z < slidemo->height)
|
||||
goto isblocking; // mobj is too high
|
||||
|
||||
if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, mapobjectscale))
|
||||
goto isblocking; // too big a step up
|
||||
|
||||
// this line doesn't block movement
|
||||
return true;
|
||||
|
||||
// the line does block movement,
|
||||
// see if it is closer than best so far
|
||||
isblocking:
|
||||
if (li->polyobj && slidemo->player)
|
||||
{
|
||||
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
|
||||
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
|
||||
}
|
||||
|
||||
P_ClosestPointOnLineWithinLine(x, y, li, &closestpoint);
|
||||
dist = abs(R_PointToDist2(closestpoint.x, closestpoint.y, x, y));
|
||||
|
||||
if (dist < bestslidefrac)
|
||||
{
|
||||
secondslidefrac = bestslidefrac;
|
||||
secondslideline = bestslideline;
|
||||
bestslidefrac = dist;
|
||||
bestslideline = li;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean PTR_SlideTraverse(intercept_t *in)
|
||||
{
|
||||
line_t *li;
|
||||
@@ -3386,7 +3490,10 @@ stairstep:
|
||||
//
|
||||
void P_SlideMove(mobj_t *mo, boolean forceslide)
|
||||
{
|
||||
fixed_t leadx, leady, trailx, traily, newx, newy;
|
||||
fixed_t leadx, leady, trailx, traily;
|
||||
fixed_t newx, newy;
|
||||
fixed_t mmomx, mmomy;
|
||||
fixed_t maxslidefrac;
|
||||
INT16 hitcount = 0;
|
||||
boolean success = false;
|
||||
|
||||
@@ -3429,38 +3536,55 @@ retry:
|
||||
if (++hitcount == 3)
|
||||
goto stairstep; // don't loop forever
|
||||
|
||||
// trace along the three leading corners
|
||||
if (mo->momx > 0)
|
||||
if (mo->player)
|
||||
{
|
||||
leadx = mo->x + mo->radius;
|
||||
trailx = mo->x - mo->radius;
|
||||
mmomx = mo->player->rmomx = mo->momx - mo->player->cmomx;
|
||||
mmomy = mo->player->rmomy = mo->momy - mo->player->cmomy;
|
||||
}
|
||||
else
|
||||
{
|
||||
leadx = mo->x - mo->radius;
|
||||
trailx = mo->x + mo->radius;
|
||||
if (mo->momx > 0)
|
||||
{
|
||||
leadx = mo->x + mo->radius;
|
||||
trailx = mo->x - mo->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
leadx = mo->x - mo->radius;
|
||||
trailx = mo->x + mo->radius;
|
||||
}
|
||||
|
||||
if (mo->momy > 0)
|
||||
{
|
||||
leady = mo->y + mo->radius;
|
||||
traily = mo->y - mo->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
leady = mo->y - mo->radius;
|
||||
traily = mo->y + mo->radius;
|
||||
}
|
||||
}
|
||||
|
||||
if (mo->momy > 0)
|
||||
if (mo->player)
|
||||
{
|
||||
leady = mo->y + mo->radius;
|
||||
traily = mo->y - mo->radius;
|
||||
maxslidefrac = mo->radius + FixedHypot(mmomx, mmomy);
|
||||
bestslidefrac = maxslidefrac;
|
||||
|
||||
P_RadiusLinesCheck(mo->radius, mo->x + mmomx, mo->y + mmomy, PTR_SlideTraversePlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
leady = mo->y - mo->radius;
|
||||
traily = mo->y + mo->radius;
|
||||
bestslidefrac = FRACUNIT+1;
|
||||
|
||||
P_PathTraverse(leadx, leady, leadx + mo->momx, leady + mo->momy,
|
||||
PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_PathTraverse(trailx, leady, trailx + mo->momx, leady + mo->momy,
|
||||
PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_PathTraverse(leadx, traily, leadx + mo->momx, traily + mo->momy,
|
||||
PT_ADDLINES, PTR_SlideTraverse);
|
||||
}
|
||||
|
||||
bestslidefrac = FRACUNIT+1;
|
||||
|
||||
P_PathTraverse(leadx, leady, leadx + mo->momx, leady + mo->momy,
|
||||
PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_PathTraverse(trailx, leady, trailx + mo->momx, leady + mo->momy,
|
||||
PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_PathTraverse(leadx, traily, leadx + mo->momx, traily + mo->momy,
|
||||
PT_ADDLINES, PTR_SlideTraverse);
|
||||
|
||||
// Some walls are bouncy even if you're not
|
||||
if (!forceslide && bestslideline && !(bestslideline->flags & ML_BOUNCY)) // SRB2kart - All walls are bouncy unless specified otherwise
|
||||
{
|
||||
@@ -3469,7 +3593,7 @@ retry:
|
||||
}
|
||||
|
||||
// move up to the wall
|
||||
if (bestslidefrac == FRACUNIT+1)
|
||||
if ((mo->player && bestslidefrac == maxslidefrac) || (!mo->player && bestslidefrac == FRACUNIT+1))
|
||||
{
|
||||
// the move must have hit the middle, so stairstep
|
||||
stairstep:
|
||||
@@ -3554,10 +3678,9 @@ stairstep:
|
||||
|
||||
void P_BouncePlayerMove(mobj_t *mo)
|
||||
{
|
||||
fixed_t leadx, leady;
|
||||
fixed_t trailx, traily;
|
||||
fixed_t mmomx = 0, mmomy = 0;
|
||||
fixed_t oldmomx = mo->momx, oldmomy = mo->momy;
|
||||
fixed_t maxslidefrac;
|
||||
|
||||
if (!mo->player)
|
||||
return;
|
||||
@@ -3577,38 +3700,14 @@ void P_BouncePlayerMove(mobj_t *mo)
|
||||
mo->player->kartstuff[k_driftcharge] = 0;
|
||||
mo->player->kartstuff[k_pogospring] = 0;
|
||||
|
||||
// trace along the three leading corners
|
||||
if (mo->momx > 0)
|
||||
{
|
||||
leadx = mo->x + mo->radius;
|
||||
trailx = mo->x - mo->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
leadx = mo->x - mo->radius;
|
||||
trailx = mo->x + mo->radius;
|
||||
}
|
||||
maxslidefrac = mo->radius + FixedHypot(mmomx, mmomy);
|
||||
bestslidefrac = maxslidefrac;
|
||||
|
||||
if (mo->momy > 0)
|
||||
{
|
||||
leady = mo->y + mo->radius;
|
||||
traily = mo->y - mo->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
leady = mo->y - mo->radius;
|
||||
traily = mo->y + mo->radius;
|
||||
}
|
||||
|
||||
bestslidefrac = FRACUNIT + 1;
|
||||
|
||||
P_PathTraverse(leadx, leady, leadx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_PathTraverse(trailx, leady, trailx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_RadiusLinesCheck(mo->radius, mo->x + mmomx, mo->y + mmomy, PTR_SlideTraversePlayer);
|
||||
|
||||
// Now continue along the wall.
|
||||
// First calculate remainder.
|
||||
bestslidefrac = FRACUNIT - bestslidefrac;
|
||||
bestslidefrac = maxslidefrac - bestslidefrac;
|
||||
|
||||
if (bestslidefrac > FRACUNIT)
|
||||
bestslidefrac = FRACUNIT;
|
||||
@@ -3710,13 +3809,13 @@ retry:
|
||||
}
|
||||
|
||||
bestslidefrac = FRACUNIT + 1;
|
||||
|
||||
|
||||
P_PathTraverse(leadx, leady, leadx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_PathTraverse(trailx, leady, trailx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse);
|
||||
P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse);
|
||||
|
||||
// move up to the wall
|
||||
if (bestslidefrac == FRACUNIT + 1)
|
||||
if (bestslidefrac == FRACUNIT+1)
|
||||
{
|
||||
// the move must have hit the middle, so bounce straight back
|
||||
bounceback:
|
||||
@@ -3945,7 +4044,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||
thinker_t *think;
|
||||
elevator_t *crumbler;
|
||||
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)T_StartCrumble)
|
||||
continue;
|
||||
@@ -4390,7 +4489,7 @@ static inline boolean PIT_GetSectors(line_t *ld)
|
||||
tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
return true;
|
||||
|
||||
if (P_BoxOnLineSide(tmbbox, ld) != -1)
|
||||
if (P_CircleOnLineSide(tmx, tmy, tmthing->radius, ld) != -1)
|
||||
return true;
|
||||
|
||||
if (ld->polyobj) // line belongs to a polyobject, don't add it
|
||||
@@ -4453,7 +4552,6 @@ static inline boolean PIT_GetPrecipSectors(line_t *ld)
|
||||
|
||||
// P_CreateSecNodeList alters/creates the sector_list that shows what sectors
|
||||
// the object resides in.
|
||||
|
||||
void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
{
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
@@ -4543,6 +4641,7 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing,fixed_t x,fixed_t y)
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
mprecipsecnode_t *node = precipsector_list;
|
||||
precipmobj_t *saved_tmthing = tmprecipthing; /* cph - see comment at func end */
|
||||
fixed_t saved_tmx = tmx, saved_tmy = tmy; /* ditto */
|
||||
|
||||
// First, clear out the existing m_thing fields. As each node is
|
||||
// added or verified as needed, m_thing will be set properly. When
|
||||
@@ -4556,6 +4655,9 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing,fixed_t x,fixed_t y)
|
||||
}
|
||||
|
||||
tmprecipthing = thing;
|
||||
|
||||
tmx = x;
|
||||
tmy = y;
|
||||
|
||||
preciptmbbox[BOXTOP] = y + 2*FRACUNIT;
|
||||
preciptmbbox[BOXBOTTOM] = y - 2*FRACUNIT;
|
||||
@@ -4602,6 +4704,7 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing,fixed_t x,fixed_t y)
|
||||
* Fun. We restore its previous value unless we're in a Boom/MBF demo.
|
||||
*/
|
||||
tmprecipthing = saved_tmthing;
|
||||
tmx = saved_tmx, tmy = saved_tmy;
|
||||
}
|
||||
|
||||
/* cphipps 2004/08/30 -
|
||||
@@ -4623,10 +4726,7 @@ void P_MapEnd(void)
|
||||
fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||
{
|
||||
sector_t *sec = R_PointInSubsector(x, y)->sector;
|
||||
fixed_t floorz = sec->floorheight;
|
||||
|
||||
if (sec->f_slope)
|
||||
floorz = P_GetZAt(sec->f_slope, x, y);
|
||||
fixed_t floorz = P_GetSectorFloorZAt(sec, x, y);
|
||||
|
||||
// Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002
|
||||
if (sec->ffloors)
|
||||
@@ -4643,13 +4743,8 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||
if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE)))
|
||||
continue;
|
||||
|
||||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, x, y);
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, x, y);
|
||||
topheight = P_GetFFloorTopZAt (rover, x, y);
|
||||
bottomheight = P_GetFFloorBottomZAt(rover, x, y);
|
||||
|
||||
if (rover->flags & FF_QUICKSAND)
|
||||
{
|
||||
@@ -4670,3 +4765,48 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||
|
||||
return floorz;
|
||||
}
|
||||
|
||||
// P_CeilingZAtPos
|
||||
// Returns the ceilingz of the XYZ position
|
||||
fixed_t P_CeilingzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||
{
|
||||
sector_t *sec = R_PointInSubsector(x, y)->sector;
|
||||
fixed_t ceilingz = P_GetSectorCeilingZAt(sec, x, y);
|
||||
|
||||
if (sec->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t delta1, delta2, thingtop = z + height;
|
||||
|
||||
for (rover = sec->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t topheight, bottomheight;
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE)))
|
||||
continue;
|
||||
|
||||
topheight = P_GetFFloorTopZAt (rover, x, y);
|
||||
bottomheight = P_GetFFloorBottomZAt(rover, x, y);
|
||||
|
||||
if (rover->flags & FF_QUICKSAND)
|
||||
{
|
||||
if (thingtop > bottomheight && topheight > z)
|
||||
{
|
||||
if (ceilingz > thingtop)
|
||||
ceilingz = thingtop;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
delta1 = z - (bottomheight + ((topheight - bottomheight)/2));
|
||||
delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2));
|
||||
if (bottomheight < ceilingz && abs(delta1) > abs(delta2))
|
||||
ceilingz = bottomheight;
|
||||
}
|
||||
}
|
||||
|
||||
return ceilingz;
|
||||
}
|
||||
|
||||
+50
-7
@@ -26,6 +26,7 @@
|
||||
//
|
||||
// P_ClosestPointOnLine
|
||||
// Finds the closest point on a given line to the supplied point
|
||||
// Considers line length to be infinite, and can return results outside of the actual line
|
||||
//
|
||||
void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result)
|
||||
{
|
||||
@@ -65,6 +66,29 @@ void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// P_ClosestPointOnLineWithinLine
|
||||
// Finds the closest point on a given line to the supplied point
|
||||
// Like P_ClosestPointOnLine, except the result is constrained within the actual line
|
||||
//
|
||||
void P_ClosestPointOnLineWithinLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result)
|
||||
{
|
||||
fixed_t maxx, maxy, minx, miny;
|
||||
|
||||
P_ClosestPointOnLine(x, y, line, result);
|
||||
|
||||
// Determine max and min bounds of the line
|
||||
maxx = max(line->v1->x, line->v2->x);
|
||||
maxy = max(line->v1->y, line->v2->y);
|
||||
minx = min(line->v1->x, line->v2->x);
|
||||
miny = min(line->v1->y, line->v2->y);
|
||||
|
||||
// Constrain result to line by ensuring x and y don't go beyond the maximums
|
||||
result->x = min(max(result->x, minx),maxx);
|
||||
result->y = min(max(result->y, miny),maxy);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// P_ClosestPointOnLine3D
|
||||
// Finds the closest point on a given line to the supplied point IN 3D!!!
|
||||
@@ -167,7 +191,7 @@ INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line)
|
||||
|
||||
//
|
||||
// P_BoxOnLineSide
|
||||
// Considers the line to be infinite
|
||||
// Clips line, not infinite, prevents false positive collisions
|
||||
// Returns side 0 or 1, -1 if box crosses the line.
|
||||
//
|
||||
INT32 P_BoxOnLineSide(fixed_t *tmbox, line_t *ld)
|
||||
@@ -216,6 +240,23 @@ INT32 P_BoxOnLineSide(fixed_t *tmbox, line_t *ld)
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_CircleOnLineSide
|
||||
// Considers the line to be infinite
|
||||
// Returns side 0 or 1, -1 if circle crosses the line.
|
||||
// Man, circles are easier than boxes
|
||||
//
|
||||
INT32 P_CircleOnLineSide(fixed_t x, fixed_t y, fixed_t radius, line_t *ld)
|
||||
{
|
||||
vertex_t closestpoint;
|
||||
P_ClosestPointOnLineWithinLine(x, y, ld, &closestpoint);
|
||||
|
||||
if (abs(R_PointToDist2(closestpoint.x, closestpoint.y, x, y)) < radius)
|
||||
return -1; // Inside circle
|
||||
else
|
||||
return P_PointOnLineSide(x, y, ld); // Not inside so just return this instead
|
||||
}
|
||||
|
||||
//
|
||||
// P_PointOnDivlineSide
|
||||
// Returns 0 or 1.
|
||||
@@ -1324,7 +1365,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
|
||||
}
|
||||
}
|
||||
// Go through the sorted list
|
||||
return P_TraverseIntercepts(trav, FRACUNIT);
|
||||
return P_TraverseIntercepts(trav, 256*FRACUNIT);
|
||||
}
|
||||
|
||||
|
||||
@@ -1337,13 +1378,12 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
|
||||
// returns FALSE if the loop exited early after a false return
|
||||
// value from your user function
|
||||
|
||||
//abandoned, maybe I'll need it someday..
|
||||
/*
|
||||
boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y,
|
||||
boolean (*func)(line_t *))
|
||||
{
|
||||
INT32 xl, xh, yl, yh;
|
||||
INT32 bx, by;
|
||||
boolean blockval = true;
|
||||
|
||||
tmbbox[BOXTOP] = y + radius;
|
||||
tmbbox[BOXBOTTOM] = y - radius;
|
||||
@@ -1355,11 +1395,14 @@ boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y,
|
||||
xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
|
||||
yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
|
||||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
validcount++;
|
||||
|
||||
for (bx = xl; bx <= xh; bx++)
|
||||
for (by = yl; by <= yh; by++)
|
||||
if (!P_BlockLinesIterator(bx, by, func))
|
||||
return false;
|
||||
return true;
|
||||
blockval = false;
|
||||
return blockval;
|
||||
}
|
||||
*/
|
||||
+3
-2
@@ -43,12 +43,14 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
|
||||
|
||||
#define P_AproxDistance(dx, dy) FixedHypot(dx, dy)
|
||||
void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result);
|
||||
void P_ClosestPointOnLineWithinLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result);
|
||||
void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result);
|
||||
INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line);
|
||||
void P_MakeDivline(line_t *li, divline_t *dl);
|
||||
void P_CameraLineOpening(line_t *plinedef);
|
||||
fixed_t P_InterceptVector(divline_t *v2, divline_t *v1);
|
||||
INT32 P_BoxOnLineSide(fixed_t *tmbox, line_t *ld);
|
||||
INT32 P_CircleOnLineSide(fixed_t x, fixed_t y, fixed_t radius, line_t *ld);
|
||||
void P_UnsetPrecipThingPosition(precipmobj_t *thing);
|
||||
void P_SetPrecipitationThingPosition(precipmobj_t *thing);
|
||||
void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
|
||||
@@ -72,6 +74,5 @@ extern fixed_t tmbbox[4]; // p_map.c
|
||||
|
||||
// call your user function for each line of the blockmap in the
|
||||
// bbox defined by the radius
|
||||
//boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y,
|
||||
// boolean (*func)(line_t *));
|
||||
boolean P_RadiusLinesCheck(fixed_t radius, fixed_t x, fixed_t y, boolean (*func)(line_t *));
|
||||
#endif // __P_MAPUTL__
|
||||
+164
-845
File diff suppressed because it is too large.
Load diff
@@ -378,7 +378,6 @@ typedef struct mobj_s
|
||||
fixed_t waterbottom; // bottom of the water FOF the mobj is in
|
||||
|
||||
UINT32 mobjnum; // A unique number for this mobj. Used for restoring pointers on save games.
|
||||
UINT32 localmobjnum; // A unique number for this mobj stored locally for association when restoring savestates
|
||||
|
||||
fixed_t scale;
|
||||
fixed_t old_scale; // interpolation
|
||||
@@ -412,8 +411,6 @@ typedef struct mobj_s
|
||||
boolean salty_jump;
|
||||
boolean init_salty;
|
||||
|
||||
boolean isculled; // Whether the mobj is being culled during simulations
|
||||
|
||||
// WARNING: New fields must be added separately to savegame and Lua.
|
||||
} mobj_t;
|
||||
|
||||
@@ -529,9 +526,6 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
||||
void P_XYMovement(mobj_t *mo);
|
||||
void P_EmeraldManager(void);
|
||||
|
||||
extern INT32 modulothing;
|
||||
extern UINT32 globalmobjnum;
|
||||
|
||||
#define MAXHUNTEMERALDS 64
|
||||
extern mapthing_t *huntemeralds[MAXHUNTEMERALDS];
|
||||
extern INT32 numhuntemeralds;
|
||||
|
||||
+188
-167
@@ -142,6 +142,16 @@ FUNCINLINE static ATTRINLINE void Polyobj_vecSub2(vertex_t *dst, vertex_t *v1, v
|
||||
dst->y = v1->y - v2->y;
|
||||
}
|
||||
|
||||
// Add the polyobject's thinker to the thinker list
|
||||
// Unlike P_AddThinker, this adds it to the front of the list instead of the back, so that carrying physics can work right. -Red
|
||||
FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th)
|
||||
{
|
||||
thinkercap.next->prev = th;
|
||||
th->next = thinkercap.next;
|
||||
th->prev = &thinkercap;
|
||||
thinkercap.next = th;
|
||||
}
|
||||
|
||||
//
|
||||
// P_PointInsidePolyobj
|
||||
//
|
||||
@@ -169,7 +179,7 @@ boolean P_MobjTouchingPolyobj(polyobj_t *po, mobj_t *mo)
|
||||
{
|
||||
fixed_t mbbox[4];
|
||||
size_t i;
|
||||
|
||||
|
||||
mbbox[BOXTOP] = mo->y + mo->radius;
|
||||
mbbox[BOXBOTTOM] = mo->y - mo->radius;
|
||||
mbbox[BOXRIGHT] = mo->x + mo->radius;
|
||||
@@ -177,8 +187,16 @@ boolean P_MobjTouchingPolyobj(polyobj_t *po, mobj_t *mo)
|
||||
|
||||
for (i = 0; i < po->numLines; i++)
|
||||
{
|
||||
if (P_BoxOnLineSide(mbbox, po->lines[i]) == -1)
|
||||
return true;
|
||||
if (mo->player)
|
||||
{
|
||||
if (P_CircleOnLineSide(mo->x, mo->y, mo->radius, po->lines[i]) == -1)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (P_BoxOnLineSide(mbbox, po->lines[i]) == -1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -193,7 +211,7 @@ boolean P_MobjInsidePolyobj(polyobj_t *po, mobj_t *mo)
|
||||
{
|
||||
fixed_t mbbox[4];
|
||||
size_t i;
|
||||
|
||||
|
||||
mbbox[BOXTOP] = mo->y + mo->radius;
|
||||
mbbox[BOXBOTTOM] = mo->y - mo->radius;
|
||||
mbbox[BOXRIGHT] = mo->x + mo->radius;
|
||||
@@ -201,8 +219,16 @@ boolean P_MobjInsidePolyobj(polyobj_t *po, mobj_t *mo)
|
||||
|
||||
for (i = 0; i < po->numLines; i++)
|
||||
{
|
||||
if (P_BoxOnLineSide(mbbox, po->lines[i]) == 0)
|
||||
return false;
|
||||
if (mo->player)
|
||||
{
|
||||
if (P_CircleOnLineSide(mo->x, mo->y, mo->radius, po->lines[i]) == 0)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (P_BoxOnLineSide(mbbox, po->lines[i]) == 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1502,31 +1528,31 @@ void Polyobj_InitLevel(void)
|
||||
|
||||
// run down the thinker list, count the number of spawn points, and save
|
||||
// the mobj_t pointers on a queue for use below.
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mobj_t *mo = (mobj_t *)th;
|
||||
|
||||
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
|
||||
mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
++numPolyObjects;
|
||||
mobj_t *mo = (mobj_t *)th;
|
||||
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &spawnqueue);
|
||||
}
|
||||
else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM)
|
||||
{
|
||||
++numAnchors;
|
||||
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
|
||||
mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM)
|
||||
{
|
||||
++numPolyObjects;
|
||||
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &anchorqueue);
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &spawnqueue);
|
||||
}
|
||||
else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM)
|
||||
{
|
||||
++numAnchors;
|
||||
|
||||
qitem = malloc(sizeof(mobjqitem_t));
|
||||
memset(qitem, 0, sizeof(mobjqitem_t));
|
||||
qitem->mo = mo;
|
||||
M_QueueInsert(&(qitem->mqitem), &anchorqueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1546,11 +1572,6 @@ void Polyobj_InitLevel(void)
|
||||
qitem = (mobjqitem_t *)M_QueueIterator(&spawnqueue);
|
||||
|
||||
Polyobj_spawnPolyObj(i, qitem->mo, qitem->mo->spawnpoint->angle);
|
||||
|
||||
PolyObjects[i].origx = qitem->mo->x;
|
||||
PolyObjects[i].origy = qitem->mo->y;
|
||||
PolyObjects[i].origz = qitem->mo->z;
|
||||
PolyObjects[i].origangle = qitem->mo->spawnpoint->angle;
|
||||
}
|
||||
|
||||
// move polyobjects to spawn points
|
||||
@@ -1642,7 +1663,7 @@ void T_PolyObjRotate(polyrotate_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjRotate: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1727,7 +1748,7 @@ void T_PolyObjMove(polymove_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjMove: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1800,7 +1821,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjWaypoint: thinker with invalid id %d removed.", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1811,9 +1832,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
|
||||
// Find out target first.
|
||||
// We redo this each tic to make savegame compatibility easier.
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
@@ -1892,9 +1913,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
CONS_Debug(DBG_POLYOBJ, "Looking for next waypoint...\n");
|
||||
|
||||
// Find next waypoint
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
@@ -1902,85 +1923,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!waypoint && th->wrap) // If specified, wrap waypoints
|
||||
{
|
||||
if (!th->continuous)
|
||||
{
|
||||
th->wrap = 0;
|
||||
th->stophere = true;
|
||||
}
|
||||
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (waypoint == NULL)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!waypoint && th->comeback) // Come back to the start
|
||||
{
|
||||
th->direction = -th->direction;
|
||||
|
||||
if (!th->continuous)
|
||||
th->comeback = false;
|
||||
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
@@ -1999,6 +1943,83 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!waypoint && th->wrap) // If specified, wrap waypoints
|
||||
{
|
||||
if (!th->continuous)
|
||||
{
|
||||
th->wrap = 0;
|
||||
th->stophere = true;
|
||||
}
|
||||
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (waypoint == NULL)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!waypoint && th->comeback) // Come back to the start
|
||||
{
|
||||
th->direction = -th->direction;
|
||||
|
||||
if (!th->continuous)
|
||||
th->comeback = false;
|
||||
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (waypoint)
|
||||
@@ -2074,7 +2095,7 @@ void T_PolyDoorSlide(polyslidedoor_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSlide: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2179,7 +2200,7 @@ void T_PolyDoorSwing(polyswingdoor_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSwing: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2277,8 +2298,8 @@ void T_PolyObjDisplace(polydisplace_t *th)
|
||||
I_Error("T_PolyDoorSwing: thinker has invalid id %d\n", th->polyObjNum);
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjDisplace: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSwing: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2336,7 +2357,7 @@ INT32 EV_DoPolyObjRotate(polyrotdata_t *prdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polyrotate_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjRotate;
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2404,7 +2425,7 @@ INT32 EV_DoPolyObjMove(polymovedata_t *pmdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjMove;
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2470,7 +2491,7 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polywaypoint_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjWaypoint;
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2488,9 +2509,9 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
th->stophere = false;
|
||||
|
||||
// Find the first waypoint we need to use
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
@@ -2498,31 +2519,31 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
last = mo2;
|
||||
else
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
{
|
||||
if (first == NULL)
|
||||
first = mo2;
|
||||
else if (mo2->health > first->health)
|
||||
first = mo2;
|
||||
if (mo2->health == 0)
|
||||
last = mo2;
|
||||
else
|
||||
{
|
||||
if (first == NULL)
|
||||
first = mo2;
|
||||
else if (mo2->health > first->health)
|
||||
first = mo2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
first = mo2;
|
||||
else
|
||||
else // waypoint 0
|
||||
{
|
||||
if (last == NULL)
|
||||
last = mo2;
|
||||
else if (mo2->health > last->health)
|
||||
last = mo2;
|
||||
if (mo2->health == 0)
|
||||
first = mo2;
|
||||
else
|
||||
{
|
||||
if (last == NULL)
|
||||
last = mo2;
|
||||
else if (mo2->health > last->health)
|
||||
last = mo2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2559,9 +2580,9 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
|
||||
// Find the actual target movement waypoint
|
||||
target = first;
|
||||
/*for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
/*for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
@@ -2569,23 +2590,23 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
if (mo2->threshold == th->sequence)
|
||||
{
|
||||
if (mo2->health == first->health - 1)
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
if (mo2->health == first->health - 1)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == first->health + 1)
|
||||
else // waypoint 0
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
if (mo2->health == first->health + 1)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@@ -2636,7 +2657,7 @@ static void Polyobj_doSlideDoor(polyobj_t *po, polydoordata_t *doordata)
|
||||
// allocate and add a new slide door thinker
|
||||
th = Z_Malloc(sizeof(polyslidedoor_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyDoorSlide;
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
|
||||
// point the polyobject to this thinker
|
||||
po->thinker = &th->thinker;
|
||||
@@ -2687,7 +2708,7 @@ static void Polyobj_doSwingDoor(polyobj_t *po, polydoordata_t *doordata)
|
||||
// allocate and add a new swing door thinker
|
||||
th = Z_Malloc(sizeof(polyswingdoor_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyDoorSwing;
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
|
||||
// point the polyobject to this thinker
|
||||
po->thinker = &th->thinker;
|
||||
@@ -2772,7 +2793,7 @@ INT32 EV_DoPolyObjDisplace(polydisplacedata_t *prdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polydisplace_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjDisplace;
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2812,7 +2833,7 @@ void T_PolyObjFlag(polymove_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjFlag: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2876,7 +2897,7 @@ INT32 EV_DoPolyObjFlag(line_t *pfdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjFlag;
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
|
||||
@@ -103,10 +103,6 @@ typedef struct polyobj_s
|
||||
|
||||
// these are saved for netgames, so do not let Lua touch these!
|
||||
INT32 spawnflags; // Flags the polyobject originally spawned with
|
||||
INT32 spawntrans; // Translucency the polyobject originally spawned with
|
||||
|
||||
fixed_t origx, origy, origz;
|
||||
INT16 origangle;
|
||||
} polyobj_t;
|
||||
|
||||
//
|
||||
|
||||
+464
-1559
File diff suppressed because it is too large.
Load diff
+10
-18
@@ -18,6 +18,16 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(void);
|
||||
void P_SaveNetGame(void);
|
||||
boolean P_LoadGame(INT16 mapoverride);
|
||||
boolean P_LoadNetGame(void);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 skincolor;
|
||||
@@ -30,24 +40,6 @@ typedef struct
|
||||
UINT16 emeralds;
|
||||
} savedata_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8* buffer;
|
||||
} savestate_t;
|
||||
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(void);
|
||||
void P_SaveNetGame(void);
|
||||
void P_SaveGameState(savestate_t* savestate);
|
||||
boolean P_LoadGame(INT16 mapoverride);
|
||||
boolean P_LoadNetGame(boolean preserveLevel);
|
||||
boolean P_LoadGameState(const savestate_t* savestate);
|
||||
void P_GameStateFreeMemory(savestate_t* savestate);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
extern savedata_t savedata;
|
||||
extern UINT8 *save_p;
|
||||
|
||||
|
||||
+36
-30
@@ -382,7 +382,7 @@ UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade)
|
||||
* \sa ML_VERTEXES
|
||||
*/
|
||||
|
||||
static inline void P_LoadRawVertexes(UINT8 *data, size_t i)
|
||||
FUNCINLINE static ATTRINLINE void P_LoadRawVertexes(UINT8 *data, size_t i)
|
||||
{
|
||||
mapvertex_t *ml;
|
||||
vertex_t *li;
|
||||
@@ -506,7 +506,7 @@ static void P_LoadSegs(lumpnum_t lumpnum)
|
||||
* \param lump Lump number of the SSECTORS resource.
|
||||
* \sa ::ML_SSECTORS
|
||||
*/
|
||||
static inline void P_LoadRawSubsectors(void *data, size_t i)
|
||||
FUNCINLINE static ATTRINLINE void P_LoadRawSubsectors(void *data, size_t i)
|
||||
{
|
||||
mapsubsector_t *ms;
|
||||
subsector_t *ss;
|
||||
@@ -553,17 +553,18 @@ levelflat_t *levelflats;
|
||||
size_t P_PrecacheLevelFlats(void)
|
||||
{
|
||||
lumpnum_t lump;
|
||||
size_t i, flatmemory = 0;
|
||||
size_t i, flatmem = 0;
|
||||
|
||||
//SoM: 4/18/2000: New flat code to make use of levelflats.
|
||||
for (i = 0; i < numlevelflats; i++)
|
||||
{
|
||||
lump = levelflats[i].lumpnum;
|
||||
if (devparm)
|
||||
flatmemory += W_LumpLength(lump);
|
||||
flatmem += W_LumpLength(lump);
|
||||
R_GetFlat(lump);
|
||||
}
|
||||
return flatmemory;
|
||||
|
||||
return flatmem;
|
||||
}
|
||||
|
||||
// help function for P_LoadSectors, find a flat in the active wad files,
|
||||
@@ -825,10 +826,10 @@ void P_ReloadRings(void)
|
||||
mapthing_t *hoopsToRespawn[4096];
|
||||
mapthing_t *mt = mapthings;
|
||||
|
||||
// scan the thinkers to find rings/spheres/hoops to unset
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
// scan the thinkers to find rings/wings/hoops to unset
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
@@ -2391,13 +2392,18 @@ static void P_LevelInitStuff(void)
|
||||
void P_LoadThingsOnly(void)
|
||||
{
|
||||
// Search through all the thinkers.
|
||||
mobj_t *mo;
|
||||
thinker_t *think;
|
||||
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
P_RemoveMobj((mobj_t *)think);
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo)
|
||||
P_RemoveMobj(mo);
|
||||
}
|
||||
|
||||
P_LevelInitStuff();
|
||||
@@ -2709,11 +2715,6 @@ static boolean P_CanSave(void)
|
||||
*/
|
||||
boolean P_SetupLevel(boolean skipprecip)
|
||||
{
|
||||
if (issimulation)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// use gamemap to get map number.
|
||||
// 99% of the things already did, so.
|
||||
// Map header should always be in place at this point
|
||||
@@ -2732,10 +2733,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
CON_Drawer(); // let the user know what we are going to do
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
|
||||
// Reset the palette
|
||||
if (rendermode != render_none)
|
||||
V_SetPaletteLump("PLAYPAL");
|
||||
|
||||
// Initialize sector node list.
|
||||
P_Initsecnode();
|
||||
|
||||
@@ -3311,6 +3308,13 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
LUAh_MapLoad();
|
||||
}
|
||||
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
R_ResetViewInterpolation(0);
|
||||
R_ResetViewInterpolation(0);
|
||||
R_UpdateMobjInterpolators();
|
||||
}
|
||||
|
||||
G_AddMapToBuffer(gamemap-1);
|
||||
|
||||
return true;
|
||||
@@ -3387,7 +3391,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
boolean mapsadded = false;
|
||||
lumpinfo_t *lumpinfo;
|
||||
|
||||
if ((numlumps = W_InitFile(wadfilename, 0, &wadnum, local)) == INT16_MAX)
|
||||
if ((numlumps = W_InitFile(wadfilename, local)) == INT16_MAX)
|
||||
{
|
||||
refreshdirmenu |= REFRESHDIR_NOTLOADED;
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
|
||||
@@ -3446,6 +3450,8 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
if (!devparm && digmreplaces)
|
||||
CONS_Printf(M_GetText("%s digital musics replaced\n"), sizeu1(digmreplaces));
|
||||
|
||||
R_LoadTexturesPwad(wadnum);
|
||||
|
||||
//
|
||||
// search for sprite replacements
|
||||
//
|
||||
@@ -3533,26 +3539,26 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
|
||||
ST_LoadGraphics();
|
||||
ST_ReloadSkinFaceGraphics();
|
||||
|
||||
if (!partadd_important)
|
||||
partadd_stage = -1; // everything done
|
||||
else if (fullsetup)
|
||||
if (fullsetup)
|
||||
++partadd_stage; // run next stage too
|
||||
}
|
||||
|
||||
if (partadd_stage == 1)
|
||||
{
|
||||
// Reload all textures, unconditionally for better or worse.
|
||||
R_LoadTextures();
|
||||
//R_LoadTextures();
|
||||
|
||||
if (fullsetup)
|
||||
// Reload ANIMATED / ANIMDEFS
|
||||
P_InitPicAnims();
|
||||
|
||||
if (!partadd_important)
|
||||
partadd_stage = -1; // everything done
|
||||
else if (fullsetup)
|
||||
++partadd_stage;
|
||||
}
|
||||
|
||||
if (partadd_stage == 2)
|
||||
{
|
||||
// Reload ANIMATED / ANIMDEFS
|
||||
P_InitPicAnims();
|
||||
|
||||
// reload status bar (warning should have valid player!)
|
||||
if (gamestate == GS_LEVEL)
|
||||
ST_Start();
|
||||
|
||||
Loaded 100 of 143 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user