mirror of https://github.com/GTAmodding/re3.git
Compare commits
1051 Commits
82322293fe
...
33abd1b4e7
Author | SHA1 | Date |
---|---|---|
Sergeanur | 33abd1b4e7 | |
Sergeanur | a16fcd8d6a | |
Sergeanur | 6a12033942 | |
Sergeanur | a04a84e00b | |
Sergeanur | abe6c22f56 | |
Sergeanur | 232a45c9ac | |
Sergeanur | 29383a6a11 | |
Sergeanur | 669c8c8988 | |
Nikolay | 9bd80324d1 | |
Fire-Head | 4b747e567a | |
Sergeanur | 27ddca26c2 | |
Nikolay Korolev | b67a087448 | |
Sergeanur | 6df0cb1ddb | |
Sergeanur | 320624edc8 | |
Nikolay Korolev | 8cbdf27228 | |
Sergeanur | 145af411ab | |
Sergeanur | 07a1339704 | |
Sergeanur | 0df6fbb30a | |
Nikolay Korolev | a1c241af37 | |
Nikolay Korolev | c5c887cc11 | |
Nikolay Korolev | 453f8c05a4 | |
Sergeanur | 47c23ba917 | |
Sergeanur | a404689e50 | |
Sergeanur | c6f9bbce8e | |
Sergeanur | 07778c81bc | |
Sergeanur | 5b0c8fb3e2 | |
Sergeanur | 355c260bf2 | |
Sergeanur | 764762f236 | |
Sergeanur | eeacbfeb6a | |
Sergeanur | 9a7b469f4e | |
Sergeanur | 2be8fcfa64 | |
Nikolay | e865e65955 | |
Nikolay | 8ef1e29a5c | |
Nikolay | 2a69f34f93 | |
Nikolay | 6d1d60f699 | |
Nikolay Korolev | 7a80acf6a1 | |
Nikolay Korolev | b2daa0e502 | |
Nikolay Korolev | 915888d275 | |
Sergeanur | a94812b28d | |
Sergeanur | 8de1ffb84d | |
Nikolay Korolev | b7db2a12d4 | |
Nikolay Korolev | cc9398df14 | |
Nikolay Korolev | 9187873396 | |
Nikolay Korolev | d750a1101b | |
Sergeanur | f87f14b432 | |
Sergeanur | e1286fcb04 | |
Sergeanur | 800ab92960 | |
Sergeanur | c8492ab5e0 | |
aap | 5f7de20cde | |
Sergeanur | d4a2113a8a | |
Sergeanur | a5ec7a45db | |
Sergeanur | abbfb09a64 | |
Sergeanur | 38f4ea7aa3 | |
erorcun | e9a61ca38c | |
aap | b89dd7f0e3 | |
Sergeanur | ef0ba763b9 | |
Sergeanur | ceb65eafa5 | |
Nikolay Korolev | 381d0b4e3e | |
Sergeanur | 3cbf84f98b | |
Nikolay Korolev | 5cb1c8580d | |
erorcun | 6110f74ad6 | |
erorcun | 09f693b9b9 | |
erorcun | 285fee01f2 | |
erorcun | d81890f6a8 | |
erorcun | c52aebe8e7 | |
Sergeanur | e500b77cd3 | |
erorcun | f86bdb2cdb | |
erorcun | d4ce6bcde0 | |
erorcun | e33b56b49a | |
Sergeanur | 3779a39f1f | |
Sergeanur | e0be6beb18 | |
Sergeanur | 7c80093efa | |
Sergeanur | b683c047dc | |
Sergeanur | fe51abd534 | |
erorcun | 80b7d52eeb | |
erorcun | 0256790e1c | |
Nikolay Korolev | 6b958b957e | |
Nikolay Korolev | fe1e1ec8c7 | |
Nikolay Korolev | 8b7f469ae1 | |
Nikolay Korolev | 7d5b1e6c2e | |
Nikolay Korolev | 811729ab41 | |
Nikolay Korolev | 11f2d941f1 | |
Nikolay Korolev | aa104bb0aa | |
Sergeanur | 071dbc3086 | |
Sergeanur | 6ad85725d9 | |
Sergeanur | 239367663b | |
Sergeanur | 9c40489589 | |
Sergeanur | a401f926d3 | |
Sergeanur | ef0b5f857d | |
Sergeanur | c168786b42 | |
aap | aed313d81c | |
aap | c8623cfe09 | |
aap | 0e5ffb8c34 | |
withmorten | 2d41405e29 | |
withmorten | 32fe837dca | |
withmorten | 5ceb3aedeb | |
withmorten | 843b43001a | |
withmorten | d3e7ab933d | |
Sergeanur | a9798d0645 | |
Sergeanur | 136b25133d | |
Sergeanur | 71e0895dc6 | |
Sergeanur | 51ba90dd52 | |
Sergeanur | eda2c05448 | |
Sergeanur | 2120d4d3ce | |
Sergeanur | 01c70dfb76 | |
Sergeanur | 296e7ed9ad | |
Sergeanur | a13089cd2e | |
Sergeanur | 597802ff2e | |
Sergeanur | 5c562c3adc | |
withmorten | dff327df40 | |
Adrian Graber | ba07534d99 | |
aap | c707f92d0a | |
aap | a9604a88c2 | |
aap | d4175c5315 | |
aap | 6b4b11d80e | |
aap | dc4ee41b70 | |
Sergeanur | 16ff379ebe | |
aap | e2014cfd92 | |
aap | 2c4a3b5f5e | |
Sergeanur | 2526503743 | |
aap | 7374fbf54c | |
erorcun | e0ecbeee39 | |
erorcun | 79856dac25 | |
erorcun | 8641e9d0bb | |
erorcun | e73e965d5b | |
erorcun | 4e40c6f2ed | |
Sergeanur | 0c55f331cf | |
Sergeanur | 176cadff05 | |
Sergeanur | 076b324539 | |
Sergeanur | cd0a765f66 | |
Sergeanur | 2633295ada | |
Sergeanur | dc28d52d08 | |
Sergeanur | 76f2191476 | |
Sergeanur | bcb5b4f94d | |
Sergeanur | d7e764d519 | |
Sergeanur | d6fbf9fbe7 | |
Sergeanur | c7e05c74b9 | |
Sergeanur | ab03fbb6c8 | |
Sergeanur | 9ed94f310a | |
aap | 77f692c669 | |
aap | 97aeb85d84 | |
aap | f4894952fc | |
aap | 2f92ccecb1 | |
Nikolay Korolev | 8e2ed40f66 | |
Nikolay Korolev | 9ba2f7d43c | |
Nikolay Korolev | 7d1cfe50af | |
Nikolay Korolev | dec09bde1c | |
erorcun | 9deabc7b60 | |
Nikolay Korolev | 495a447c8a | |
Nikolay Korolev | 25075decb2 | |
Nikolay Korolev | 1b178a55d7 | |
Nikolay Korolev | e30e1ccccd | |
Nikolay Korolev | 6bdfb0d386 | |
Nikolay Korolev | 26e5a7eed1 | |
Nikolay Korolev | 4b4aefe339 | |
Nikolay Korolev | 042284de8b | |
Nikolay Korolev | c48f6e9bda | |
erorcun | 435b8fe52e | |
Nikolay Korolev | 3441714a13 | |
Nikolay Korolev | 5fe04940be | |
Sergeanur | 854ee12d9d | |
Sergeanur | 5ddd0649e3 | |
Sergeanur | 886650a887 | |
erorcun | 747ae04279 | |
erorcun | f4e723e690 | |
erorcun | 0db14d718c | |
erorcun | fd52285074 | |
Nikolay Korolev | eadf0496bf | |
erorcun | 4a5f7464c1 | |
Nikolay Korolev | 39d2c427e5 | |
Nikolay Korolev | 958e2f36bb | |
Nikolay Korolev | ba859dc3b5 | |
erorcun | 3a95c77c9e | |
erorcun | df89e5091e | |
withmorten | 81c6c5e47a | |
withmorten | b7c7c883d7 | |
Sergeanur | 4141caa4d6 | |
Sergeanur | 0a2df3ca4c | |
Sergeanur | 8759c2edf0 | |
Sergeanur | 92c5cf1877 | |
Sergeanur | 43fbf297c8 | |
Sergeanur | 033d89a9ab | |
Sergeanur | f1545daeae | |
Sergeanur | ec22576e49 | |
Sergeanur | 9a1b826021 | |
Sergeanur | 4f8993e19b | |
Sergeanur | 2ef43e8d1a | |
Sergeanur | ce78081a7f | |
Sergeanur | 6c2d179aad | |
Nikolay Korolev | b99edf9a6b | |
Nikolay Korolev | cb35f78511 | |
Sergeanur | 2eb0390dc9 | |
Sergeanur | f131f70761 | |
Sergeanur | 68c37d2d88 | |
Sergeanur | 80dc23621e | |
Sergeanur | b289bb4edb | |
Sergeanur | 2c79080e1b | |
Sergeanur | 75f812cfcd | |
Sergeanur | 463fdab6a4 | |
Sergeanur | d7a28c4d2b | |
Sergeanur | 0544beb00d | |
Sergeanur | 1f98f01dcb | |
Sergeanur | 8ea411e4c5 | |
withmorten | ab5965cc8d | |
withmorten | 858f913fac | |
Nikolay Korolev | e042ba6f24 | |
Nikolay Korolev | 4b7dc08bf5 | |
Nikolay Korolev | c851d9a6ba | |
Nikolay Korolev | 3869369703 | |
Nikolay Korolev | 2ee32abf84 | |
Nikolay Korolev | c5af250959 | |
Barracuda6 | 42ad9c4378 | |
Sergeanur | 26a9ac91ee | |
Sergeanur | 76a22c0d13 | |
Sergeanur | f887d515fa | |
Nikolay Korolev | 729ef37040 | |
Nikolay Korolev | e17504a36a | |
Nikolay Korolev | 4673f509f6 | |
Nikolay Korolev | 35dd465c19 | |
Nikolay Korolev | 7b9d8c5a1f | |
Nikolay Korolev | 8d9508bda4 | |
Nikolay Korolev | bd96584433 | |
Nikolay Korolev | 68db861c45 | |
Nikolay Korolev | 873840a6a5 | |
Nikolay Korolev | 947f67dfb7 | |
Nikolay Korolev | 478bdcc1ca | |
Nikolay Korolev | 63046894b0 | |
Nikolay Korolev | 74f00c3c63 | |
Nikolay Korolev | 668311a444 | |
Nikolay Korolev | 15f770531c | |
Nikolay Korolev | 88b4c7b50b | |
Nikolay Korolev | 9cc1201892 | |
Nikolay Korolev | e6b1a0691b | |
Nikolay Korolev | 0c4ab5b609 | |
Nikolay Korolev | 2672504e8a | |
Nikolay Korolev | a7e86e0510 | |
Nikolay Korolev | 827f0ffbb6 | |
Nikolay Korolev | 883e8390c9 | |
Nikolay Korolev | c69edce800 | |
Nikolay Korolev | 747705d430 | |
Nikolay | e947081622 | |
aap | 621f941ff7 | |
aap | 1cfd4f741e | |
aap | bec1cbc1cb | |
aap | 4f461bd7be | |
Nikolay Korolev | 80d00fe31a | |
Nikolay Korolev | 6fbb7da82d | |
Nikolay Korolev | 5a22896197 | |
Nikolay Korolev | 8bcbee4ea7 | |
Nikolay Korolev | 5999ddc76d | |
aap | 0338d4c393 | |
aap | 4a047f56bc | |
aap | 09748d094a | |
erorcun | ae1deb2209 | |
Sergeanur | cb5586e658 | |
Sergeanur | 865ce46fdb | |
Nikolay Korolev | 2b99f2634b | |
Nikolay Korolev | 6d7dec96af | |
erorcun | 418bf3ab69 | |
erorcun | 192190769d | |
Nikolay Korolev | 1479093d33 | |
Nikolay Korolev | 70080f1fdb | |
erorcun | 0542b1bd4d | |
erorcun | e80cbf8bb2 | |
Sergeanur | a481b900b9 | |
Magnus Larsen | d923cd2f24 | |
Sergeanur | 835fa4e74b | |
aap | bf035b8167 | |
Sergeanur | 232b5a04ba | |
Sergeanur | 9d25e7f315 | |
Sergeanur | e8dcc8432d | |
aap | 3f3e258d77 | |
aap | 3c5bae164f | |
aap | 30061396e8 | |
Sergeanur | b77d93ba4a | |
Sergeanur | 7bacf3b6f4 | |
Sergeanur | cce97588fe | |
Sergeanur | 6cea1de9e6 | |
Sergeanur | 81673ab304 | |
Sergeanur | 04126cd18a | |
Sergeanur | 2aa37813d2 | |
Sergeanur | 92679555b9 | |
Sergeanur | 8960ffaf0b | |
Sergeanur | 7adc85995f | |
Sergeanur | 61176acbad | |
Sergeanur | 98003d0d41 | |
Sergeanur | 49ee711c75 | |
Sergeanur | 029e315f0a | |
Sergeanur | 16f892b667 | |
Sergeanur | f82c3c8ea7 | |
Sergeanur | 9dbaa7a77f | |
Sergeanur | d0666a8702 | |
Sergeanur | 16e2e3d091 | |
Sergeanur | fbb42085bd | |
Sergeanur | 7aa8d7c073 | |
Nikolay Korolev | c4f5cbce5e | |
Nikolay Korolev | c26a57fb9f | |
Sergeanur | ad2ccdb44a | |
Sergeanur | 782d38c6b7 | |
Sergeanur | 5240dce018 | |
erorcun | 1eedf7f0ae | |
Sergeanur | ec7d702185 | |
Sergeanur | 6dc8c5bd92 | |
Magnus Larsen | 55e83982c3 | |
Magnus Larsen | 388dd5cb00 | |
Nikolay Korolev | 0461a36a4e | |
Nikolay Korolev | 9e374491c5 | |
withmorten | d77ed4608f | |
Sergeanur | c0488b3190 | |
Sergeanur | 1180f32d9c | |
Sergeanur | 371f1be9b3 | |
Sergeanur | 250727c9ca | |
Sergeanur | f7a2c265b3 | |
Sergeanur | f19a1aebd4 | |
Sergeanur | bc3734cae3 | |
Sergeanur | cafc0f3c10 | |
Sergeanur | 123f2fda9b | |
Sergeanur | 1aac4d802f | |
Sergeanur | f73dfa12e6 | |
Sergeanur | 6a94299eac | |
Sergeanur | ed9c911a0e | |
Sergeanur | a064b3a687 | |
Sergeanur | a510a03b8a | |
Sergeanur | c234cb4663 | |
Nikolay Korolev | c7d3b88cb7 | |
Nikolay Korolev | bf4b39781b | |
Sergeanur | d83b8cf940 | |
Sergeanur | 5032d24ad8 | |
Sergeanur | 601f63f4fb | |
Nikolay Korolev | 1619d2395e | |
Nikolay Korolev | b69222e017 | |
Nikolay | d86637daea | |
Nikolay Korolev | dc729009ac | |
Sergeanur | bf757fc960 | |
Nikolay Korolev | a7e673c2ec | |
Sergeanur | 3adf37a3a9 | |
Sergeanur | aec797671e | |
Davi | bd3c3849fe | |
Sergeanur | cc13e31264 | |
Sergeanur | 1d1f10d68c | |
Sergeanur | 5e34b1efcf | |
Sergeanur | 953e4fc4ff | |
Sergeanur | bbbe9b2632 | |
Sergeanur | a1444b992f | |
withmorten | 76558e9313 | |
withmorten | a437d2bc26 | |
Sergeanur | 7a034142c9 | |
Sergeanur | d0404cbdb7 | |
Sergeanur | c937bdbfea | |
Nikolay Korolev | cb7f18f268 | |
Nikolay Korolev | 0a23afebb7 | |
withmorten | 8018e40ebf | |
withmorten | ec5a07b049 | |
withmorten | c8cb1ed013 | |
Sergeanur | 026a2b3f1f | |
Sergeanur | 780cd225e9 | |
Sergeanur | 2ce36a48b9 | |
Sergeanur | 3377709c4b | |
Sergeanur | 17fca82401 | |
Sergeanur | 02c4ada807 | |
Sergeanur | 4f78733836 | |
Nikolay Korolev | 81aece7117 | |
Magnus Larsen | fb5a207abc | |
erorcun | d2e594db2b | |
Magnus Larsen | 894495689f | |
Adrian Graber | 7f544f9049 | |
Adrian Graber | 6665b16ba2 | |
Adrian Graber | 207378c947 | |
Adrian Graber | a7b38e1b34 | |
Adrian Graber | 5cab196718 | |
Adrian Graber | 3bde84f6c8 | |
Adrian Graber | a99a04ed49 | |
Adrian Graber | b09b489ae7 | |
Anonymous Maarten | a247d53367 | |
Adrian Graber | ca5d3c8811 | |
Adrian Graber | 02ec56e8f7 | |
Adrian Graber | 6da20aa723 | |
Adrian Graber | 28f266302f | |
withmorten | 523b23339c | |
Sergeanur | c982700a69 | |
withmorten | 6f0f9d7d69 | |
withmorten | b69cee3801 | |
withmorten | a4b92fe9be | |
withmorten | 6c097398d1 | |
Nikolay Korolev | 91d958bf27 | |
Nikolay Korolev | bef07b6353 | |
withmorten | 2f7ae611ed | |
withmorten | f50026828a | |
Sergeanur | 55d30a11ec | |
withmorten | ac3905123e | |
Sergeanur | 3f5fdc39a5 | |
Sergeanur | b4364c3672 | |
erorcun | 3515363df5 | |
withmorten | 6f52ad190e | |
withmorten | c0cbf8045f | |
erorcun | 02e84b4b97 | |
erorcun | a8fd3f828a | |
erorcun | 291213ed40 | |
erorcun | 2a6f9c2757 | |
Sergeanur | dc29e7c044 | |
Sergeanur | 11434f96cc | |
Nikolay Korolev | 776d46aacb | |
withmorten | f686065769 | |
withmorten | 3194fdb2c1 | |
withmorten | 58de524d70 | |
withmorten | d7ceb4870c | |
withmorten | 8a114514d9 | |
erorcun | 9f0a96ac89 | |
erorcun | e9baf31ad8 | |
erorcun | d82dbf91ef | |
erorcun | db4ae18e5d | |
erorcun | 5458632c40 | |
erorcun | ab73c2f539 | |
Magnus Larsen | 12efd1209b | |
Magnus Larsen | 33c45e4ae0 | |
withmorten | 011aafa043 | |
withmorten | 6f103a3b82 | |
withmorten | 61c2398b67 | |
withmorten | 71f28c8cf5 | |
Sergeanur | 6a2ce20313 | |
withmorten | 41f3d4d9d7 | |
Sergeanur | 71d1b46417 | |
withmorten | df8ef2d58d | |
Sergeanur | 4981fe3091 | |
withmorten | 4eb9a149e4 | |
withmorten | f09da45823 | |
Sergeanur | ddf2b09e55 | |
Sergeanur | d824a321b9 | |
withmorten | 026cd10f3f | |
withmorten | 9a68f94c54 | |
withmorten | a7ab4cc23a | |
withmorten | 5b390ade40 | |
IgorPolyakov | f184c43b9b | |
withmorten | ffe199290b | |
withmorten | 37b6d491e7 | |
withmorten | 0b269571d7 | |
withmorten | e2ae17d994 | |
Sergeanur | d781db6c0f | |
Sergeanur | 7a1ff3b2ad | |
Sergeanur | 72f6780905 | |
Sergeanur | 47f153fe76 | |
withmorten | 79c010f082 | |
withmorten | f9a2f1daf7 | |
withmorten | e6544a6983 | |
withmorten | dadc56ccf9 | |
mssx86 | 37a43ebf45 | |
mssx86 | c5e896c420 | |
erorcun | 164623d58e | |
erorcun | 386b113603 | |
withmorten | 0b27a3dc23 | |
withmorten | 8916fe1820 | |
erorcun | 74fd58513b | |
erorcun | ab7513cc85 | |
Adrian Graber | 2029ac3d62 | |
Adrian Graber | 6edb8d9610 | |
Nikolay Korolev | 62425b5866 | |
withmorten | 10d7b303a5 | |
withmorten | 52e4cd19ce | |
withmorten | 70876d3cde | |
erorcun | 3750124dcc | |
erorcun | 1d51734d0b | |
Sergeanur | 5d5e0f62e8 | |
erorcun | ec45ba68cd | |
Sergeanur | 77f31105de | |
Sergeanur | 3ed4cdf109 | |
erorcun | 3136ce6451 | |
withmorten | a92dcaa0b1 | |
withmorten | 060c1181bc | |
withmorten | be6e273930 | |
erorcun | 1c0878f65b | |
withmorten | 43631ba203 | |
withmorten | f9f854c4a8 | |
withmorten | 63d9d9c148 | |
erorcun | 51042e15aa | |
erorcun | a8549e86a7 | |
erorcun | 424a6d90bd | |
erorcun | 70fa7fc239 | |
erorcun | 4eea98c66b | |
Nikolay Korolev | 10cc444482 | |
Sergeanur | 987e09515b | |
Sergeanur | 9ea3549743 | |
Sergeanur | ae4bfef590 | |
Sergeanur | 7df71c9673 | |
Sergeanur | 8e6e46a919 | |
withmorten | 65219365db | |
withmorten | f7816c577f | |
Sergeanur | 3988fec6e7 | |
mssx86 | de64bbe875 | |
mssx86 | b8e80a67ea | |
withmorten | 2d38eb923d | |
withmorten | 2071abd295 | |
Sergeanur | dd790b00e5 | |
Sergeanur | cb72fee941 | |
Sergeanur | a3964dfd4a | |
Sergeanur | 138abb91f6 | |
Sergeanur | a73a2c9179 | |
Sergeanur | b1c9340fd3 | |
withmorten | abe57fefa0 | |
withmorten | 3383d8c6e7 | |
Sergeanur | d31a7e24a8 | |
erorcun | cac1c5bd42 | |
erorcun | 9f0daee186 | |
withmorten | de4699a97e | |
erorcun | fdbd414299 | |
erorcun | 22e8e0eff8 | |
withmorten | d17d437de3 | |
withmorten | cb3b3855b8 | |
Sergeanur | 1c5a864598 | |
Sergeanur | eaebaa6db3 | |
Sergeanur | f8297df9c5 | |
Sergeanur | 3e9c983f5c | |
erorcun | cc235be3aa | |
erorcun | 53a4b6936b | |
erorcun | 091a65996e | |
Nikolay Korolev | 73e112a217 | |
Sergeanur | 879761af2c | |
Sergeanur | c7243aa2e9 | |
erorcun | 3587cb029e | |
Sergeanur | 883d8172b0 | |
erorcun | a923728877 | |
erorcun | 05a29c7e6c | |
Leandro Guedes | ab38b0089e | |
withmorten | 4819d195d8 | |
withmorten | f3a931e1c9 | |
Sergeanur | 090fa619b4 | |
Leandro Guedes | 2c92accb8e | |
erorcun | 9c8ef3cca0 | |
erorcun | 107c4df69c | |
Nikolay Korolev | 636f67ca3f | |
Sergeanur | d4ba7c387b | |
Sergeanur | 831737ecc8 | |
withmorten | 9ab4f1a2d9 | |
withmorten | 171d9fd036 | |
withmorten | d8f5e86ede | |
withmorten | 036eff2c48 | |
withmorten | 85d60b36da | |
withmorten | fff899ec16 | |
Sergeanur | 225530ef04 | |
Sergeanur | 6cb8c11285 | |
Sergeanur | 3092b9a46e | |
erorcun | 9b5caa190e | |
erorcun | af7573ddbe | |
kusst | ebd980bf14 | |
withmorten | c869602b6d | |
withmorten | 4bab6d5356 | |
Sergeanur | 2b67aba94c | |
erorcun | 9382e86d38 | |
erorcun | 0b057f34c9 | |
erorcun | 6152f02333 | |
Nikolay Korolev | 8a5afd0db2 | |
withmorten | 4e3fc35401 | |
withmorten | 84fb48825d | |
Sergeanur | 940d6bf6d3 | |
withmorten | 5341840943 | |
withmorten | a83ecc123d | |
Sergeanur | a3ae267e83 | |
Sergeanur | f46461331c | |
Sergeanur | 1f082a85cb | |
Sergeanur | 4660491243 | |
Sergeanur | 7e7a2b74cd | |
Sergeanur | e671fe682d | |
Sergeanur | e5aa150557 | |
Sergeanur | 14c71f39ff | |
Sergeanur | 1254c1202a | |
Sergeanur | 74867af2e7 | |
Sergeanur | 3ebc475494 | |
Sergeanur | 27df328ec2 | |
majestic | 4351198bf5 | |
Sergeanur | 7c3457257b | |
Sergeanur | ba23408007 | |
Sergeanur | eaaba8646b | |
Sergeanur | 0910188058 | |
Sergeanur | 3cc9eb1c1c | |
Sergeanur | db1c7de125 | |
Sergeanur | 7a351f18ba | |
Sergeanur | 776e8ff2ee | |
Sergeanur | 3aac4ea62a | |
Sergeanur | 1558788df1 | |
aap | 29d47da61e | |
aap | e014bb5359 | |
Sergeanur | fb03ee45b5 | |
Sergeanur | 60bb16d26c | |
Sergeanur | b5bc3a9000 | |
majestic | f34365dfc0 | |
Sergeanur | 1fa0116f5f | |
Sergeanur | c7821635fd | |
Sergeanur | 0c3ee871f4 | |
Sergeanur | 714cd47db9 | |
Sergeanur | 008f8a1e19 | |
Sergeanur | 499b16678f | |
Sergeanur | 0682cdedbd | |
Sergeanur | 1471c82a20 | |
Sergeanur | b8cf8c53e7 | |
Sergeanur | 5156626582 | |
majestic | fe65f20a30 | |
Sergeanur | 4b8b0a6d74 | |
Sergeanur | 0f0cb40151 | |
Sergeanur | 2b8ae07ec6 | |
Sergeanur | 1b5dbc4b41 | |
Sergeanur | 6426963807 | |
Sergeanur | 23755fdfb4 | |
Sergeanur | 793e1223de | |
Sergeanur | fad64667a7 | |
Sergeanur | 6e4a2947ea | |
Sergeanur | f2c8522daa | |
aap | 93e9929925 | |
Sergeanur | be019c6126 | |
Sergeanur | 02655313e9 | |
Sergeanur | 59ed4d0029 | |
majestic | 42e655b4cc | |
Sergeanur | 5bcdb933a7 | |
Sergeanur | bd94c16e78 | |
erorcun | 618d689dff | |
Sergeanur | 5c1af537af | |
Sergeanur | a446dbefaa | |
Sergeanur | 2592da2273 | |
Sergeanur | b90784da90 | |
Sergeanur | f741101e44 | |
Sergeanur | cacec36dd1 | |
Sergeanur | f2390deaa9 | |
Sergeanur | 8fc99387f5 | |
Sergeanur | 939d0c59a3 | |
Sergeanur | edc25a689f | |
Sergeanur | 68b5270fe4 | |
Sergeanur | a11bf19b93 | |
Sergeanur | 2ad3a75be5 | |
aap | 50058371ef | |
Sergeanur | ce0a097392 | |
Sergeanur | 1e084dfab7 | |
Sergeanur | 5a55d3a949 | |
Sergeanur | 7a2dbd9112 | |
Sergeanur | c9804510d1 | |
Sergeanur | c37f4c3c1a | |
Sergeanur | 319bf9d8d2 | |
Sergeanur | 786e101acf | |
Sergeanur | 596e12b897 | |
Sergeanur | 4a9d890ae9 | |
Sergeanur | 873c4fc81e | |
Sergeanur | f518676b76 | |
Sergeanur | 0f6583560d | |
Sergeanur | 6537dfe7f1 | |
aap | f2b59f5097 | |
erorcun | 8ae4859398 | |
aap | c4f231deb4 | |
aap | c58d98a39e | |
aap | 77ca9c593f | |
erorcun | 8488dc791a | |
Sergeanur | 19dd95a1cb | |
Sergeanur | 3596897961 | |
Sergeanur | 288c3dfc8f | |
Sergeanur | 0c41734c20 | |
Sergeanur | bd70540b53 | |
Sergeanur | 3a7cb9c5ce | |
Sergeanur | 247974afd3 | |
Sergeanur | 8a728faeb6 | |
Sergeanur | fdb6428c6b | |
Sergeanur | 2fc431d1bb | |
Sergeanur | 4e79d53661 | |
Sergeanur | fc1bfcbc21 | |
Sergeanur | 8f54093de1 | |
Sergeanur | 4da733145e | |
Sergeanur | 3dda658e42 | |
Sergeanur | 1817727a66 | |
Sergeanur | 519218572a | |
erorcun | f6f8a24335 | |
erorcun | 62b8f0f553 | |
aap | ceb22d71dd | |
erorcun | 97008905b6 | |
aap | 6122f6980b | |
aap | 7c42ed6edb | |
aap | ce604c77ba | |
aap | df1ad8e122 | |
aap | 82245789ed | |
aap | 931bc690cd | |
aap | d2b5a422e4 | |
aap | 087174c6a6 | |
erorcun | a311f643f9 | |
Sergeanur | 9fce8636b0 | |
Sergeanur | c5303c2ea4 | |
Sergeanur | 49b3bf5f2e | |
Sergeanur | 478f6e07d4 | |
Sergeanur | f6910d35f7 | |
Sergeanur | 5bdbb5f802 | |
Sergeanur | b01d6be3f4 | |
Sergeanur | 59c9ae29cf | |
Sergeanur | 82ebd8aae1 | |
Haydn Trigg | d506f8588c | |
withmorten | a3f1601fd1 | |
erorcun | 1d336d851d | |
Haydn Trigg | 620155ac8d | |
erorcun | 71cf666bbd | |
erorcun | 040c6f9027 | |
erorcun | 14dcd8f04c | |
aap | b88cf7b939 | |
aap | 9a7fa47857 | |
withmorten | 111ccf5d34 | |
withmorten | 0b1d3669bc | |
withmorten | 8128e8e817 | |
withmorten | 60bc816af5 | |
withmorten | 73fce903b8 | |
erorcun | 3d5f0ef318 | |
erorcun | b52356f6b5 | |
erorcun | 139c6bfcf3 | |
RuesanG | c274c05ce3 | |
RuesanG | 53631f97db | |
RuesanG | 006254fc9c | |
erorcun | bf7280b55b | |
erorcun | dfa0c8bf19 | |
withmorten | 4eea06e620 | |
withmorten | 781617d484 | |
withmorten | 48cec4a786 | |
erorcun | 946be081b0 | |
aap | 11bc8ea602 | |
aap | 6245a17e16 | |
nick7 | 1402b9ed72 | |
aap | 3457ff48ce | |
aap | 253021866c | |
aap | 146ad3b4a1 | |
aap | e8b435a624 | |
aap | 996772faf2 | |
aap | 9db87fc636 | |
aap | bb8b823c30 | |
aap | 9bdc4aace2 | |
aap | 1a429bb3c4 | |
Sergeanur | cba1f85026 | |
aap | a4412e8d63 | |
aap | c3af33f97d | |
Fire-Head | 68cc5fe965 | |
withmorten | 6227aee863 | |
Sergeanur | ee6b7152c7 | |
withmorten | 53e3bc6092 | |
withmorten | 7db2df33e8 | |
aap | b4c96bca93 | |
aap | c488ce166e | |
erorcun | 4d8f340827 | |
erorcun | eccf87acc7 | |
Adrian Graber | 19b39f49fa | |
Steve Wills | e482ab6292 | |
Steve Wills | 20d9498fdb | |
erorcun | 1a64053da5 | |
erorcun | 5ee4931fb6 | |
erorcun | 49fd99119d | |
erorcun | 179b11151e | |
erorcun | 3baccc9d3e | |
aap | edc77d7f00 | |
withmorten | fec39e87c0 | |
withmorten | a826091dc9 | |
Fire-Head | a3eae736e7 | |
Steve Wills | a666de46aa | |
erorcun | e35c56ceb3 | |
erorcun | be55085303 | |
Fire-Head | 0b6e46b1e4 | |
withmorten | b2b243e803 | |
aap | 475a4d71d8 | |
withmorten | 0dd5be788f | |
withmorten | 4e8f42f6f6 | |
withmorten | 9f575a70c1 | |
Sergeanur | f372420dc0 | |
withmorten | 2183e25081 | |
withmorten | 8d27dba4cd | |
Sergeanur | 02ac7c309e | |
Sergeanur | 4907c56231 | |
withmorten | 42952743ba | |
aap | 04345643a0 | |
aap | 80aabfe0aa | |
aap | 9c7d83ebc1 | |
aap | 465f156e03 | |
aap | d0fbba19d1 | |
aap | f407c5a25f | |
aap | c1a274d91c | |
aap | 0f8614221b | |
Fire-Head | 291cdd4bfb | |
aap | 2ce946584e | |
aap | 78cc2aa9cc | |
aap | 9553478d9c | |
erorcun | 6689b0be02 | |
erorcun | a44d7d86cb | |
erorcun | 8659b9d77c | |
Filip Gawin | 1b8d03f3aa | |
Sergeanur | bf1db80e4f | |
Sergeanur | e7a4a3516f | |
Sergeanur | 2c194df591 | |
Sergeanur | 6580ddd6cb | |
Sergeanur | a3a5e5b824 | |
Sergeanur | 788ab8d3a8 | |
erorcun | 9e1c048e20 | |
aap | a1903e025c | |
aap | f3bfdd7857 | |
withmorten | c7dae2aca6 | |
withmorten | 69138fc08b | |
Sergeanur | a6b56e6b7a | |
Sergeanur | c9f804486d | |
Nikolay Korolev | 3b0c958600 | |
withmorten | 1d8d2bd7b7 | |
erorcun | a6d402e8fd | |
aap | 25703b04a2 | |
Sergeanur | 62f28cc4ac | |
erorcun | d460c3863e | |
erorcun | 0eb1913713 | |
Nikolay Korolev | 6db96753d2 | |
Nikolay Korolev | 9b9ffc4b13 | |
erorcun | d224f8b7ee | |
aap | 6662e60b63 | |
erorcun | c7ba01b034 | |
withmorten | 2bd8be5872 | |
aap | 5385d004ec | |
withmorten | bf299e5c17 | |
withmorten | 7aaaaa953b | |
IlDucci | ad87a6d185 | |
IlDucci | e653f4f7dd | |
IlDucci | 95208bc3dd | |
withmorten | 263a766d8e | |
Sergeanur | 61618389e1 | |
withmorten | e6d86bfab5 | |
withmorten | f7959d5646 | |
Sergeanur | e077a6bf28 | |
erorcun | c002dd6cba | |
withmorten | f2cd511d9c | |
Sergeanur | 3f8bf89e72 | |
Sergeanur | 91c3bdfa15 | |
withmorten | bd368b29b1 | |
withmorten | 2e8429858e | |
withmorten | 862f83cc40 | |
withmorten | ac339f4724 | |
Nikolay Korolev | aeccd8c166 | |
Nikolay Korolev | f6326606b7 | |
erorcun | f541520040 | |
erorcun | 7ff899bd22 | |
erorcun | f42f785c78 | |
erorcun | 1667ffdd8f | |
Sergeanur | a7e11d134f | |
Sergeanur | adf07aab47 | |
Sergeanur | 91612eb45a | |
Sergeanur | b47a23ab79 | |
Sergeanur | e28188edd9 | |
withmorten | b65f8a3fe2 | |
IlDucci | 8d4c134f80 | |
Sergeanur | 4afa7b86ae | |
Filip Gawin | 3d4791f291 | |
Filip Gawin | 7a3b80a9b7 | |
shfil | 5de4e88d7a | |
Adrian Graber | b60baf46f6 | |
Adrian Graber | d76b58cc72 | |
withmorten | da378077f7 | |
erorcun | f61a91c97d | |
erorcun | d52b917c54 | |
withmorten | f7fc919d98 | |
erorcun | 2e7405b76c | |
shfil | 3dfffdf351 | |
shfil | 1a7810efe1 | |
shfil | 6700c5fd46 | |
shfil | f05cfe2627 | |
shfil | 69cb133c57 | |
Nikolay Korolev | 7c38e2db24 | |
aap | 64a4ed6db6 | |
aap | ebb615d080 | |
erorcun | 2d0562412e | |
erorcun | a74f597d45 | |
erorcun | 2b269ff1c0 | |
erorcun | e9054f2980 | |
GaryOderNichts | d2cf090ace | |
erorcun | 93ffe6123d | |
erorcun | 8846f50cb7 | |
erorcun | 843dd9b5e1 | |
Sergeanur | 0f623c2354 | |
Sergeanur | f27e1ec818 | |
Sergeanur | d3cd707db7 | |
IlDucci | 7afb8ff679 | |
Sergeanur | b4e0c97469 | |
erorcun | cb34060f00 | |
aap | 4564f7aeea | |
shfil | 1d3b4d1e9a | |
erorcun | 5336620f5c | |
erorcun | a0bf47cfd2 | |
withmorten | d7c00841d6 | |
shfil | 3e6bb267f3 | |
withmorten | 5183d7cf0f | |
withmorten | db6b7b473d | |
Nikolay Korolev | 6bdc0365ee | |
Nikolay Korolev | 921ca7712e | |
Nikolay Korolev | 35258b9b9c | |
withmorten | 2650fa9a92 | |
withmorten | 6f4e2ab491 | |
withmorten | 5988c0e95a | |
erorcun | fd461ca702 | |
erorcun | 0ea72af60c | |
erorcun | 6118ed89bb | |
erorcun | 226e3b83da | |
withmorten | f6c846d27a | |
withmorten | 3b4e79f073 | |
withmorten | 2e5898490c | |
withmorten | d58f090198 | |
Filip Gawin | e9adf8162b | |
Filip Gawin | a034661bc9 | |
Filip Gawin | 609cad506f | |
withmorten | 950a3e82c1 | |
aap | d77846bb16 | |
withmorten | 497e0b801f | |
withmorten | a511d79bf0 | |
aap | 69500eed56 | |
aap | c67273e92a | |
withmorten | ef24783bff | |
withmorten | 034df61f3c | |
aap | 3c221d9466 | |
aap | 6df52f06b6 | |
withmorten | f2596b3759 | |
withmorten | ac0f759b27 | |
Nikolay Korolev | 8e825fa629 | |
Sergeanur | c54f5c4b4f | |
Sergeanur | 9b193a47a2 | |
aap | 505438cd90 | |
aap | bb66028e74 | |
Sergeanur | a9b8d30ce0 | |
Sergeanur | e6ef164441 | |
withmorten | 25d3066eae | |
Nikolay Korolev | ef59c623fd | |
Nikolay Korolev | 8c1f4ba65d | |
Sergeanur | 91093305d6 | |
aap | 7687ce84ed | |
withmorten | da29203219 | |
withmorten | a6faa0384b | |
erorcun | deaaf3d22f | |
erorcun | 448e41ecaa | |
erorcun | 5a47379bf5 | |
aap | 357b67e3f5 | |
Sergeanur | caa7d3177c | |
shfil | a06bd7f735 | |
shfil | 260591cc54 | |
Nikolay Korolev | ad908f5dde | |
erorcun | a844cbbc3d | |
erorcun | 011a9cc775 | |
erorcun | 7f15e11b1b | |
withmorten | e8727cf4a1 | |
aap | 6aab948be2 | |
aap | 083aa700e9 | |
aap | 7c3e43aa2e | |
erorcun | d88a3cf558 | |
shfil | b9dc81d600 | |
erorcun | 57201187de | |
Filip Gawin | 4097c20bdd | |
aap | fb1bd1a5bd | |
erorcun | 4837969e09 | |
shfil | ef0b2291a0 | |
shfil | 29172e9ee2 | |
shfil | 66b8c870f4 | |
withmorten | 6103677914 | |
withmorten | 005ddf26c1 | |
withmorten | c210e1bae6 | |
shfil | 4fe64d1b0d | |
shfil | 461e9fe5c2 | |
aap | ad1d0ffc5a | |
withmorten | 4a96c7c9f2 | |
Filip Gawin | 3ae4c00562 | |
Filip Gawin | 13d5c5e7e6 | |
Filip Gawin | 8929e55bff | |
Filip Gawin | 11ecab3ca1 | |
aap | 48ce6151f9 | |
aap | fe1d82c9c3 | |
Sergeanur | be1e09aad4 | |
Fire-Head | 06fbbaa43f | |
Nikolay Korolev | 31dd135075 | |
Nikolay Korolev | 08e5c8e010 | |
Anonymous Maarten | 3519cbd3e5 | |
Anonymous Maarten | 6b8374f391 | |
Anonymous Maarten | 96e2ba19f8 | |
Anonymous Maarten | a78e4a3366 | |
Anonymous Maarten | b375e20c75 | |
Anonymous Maarten | d9f6a05b7e | |
Anonymous Maarten | 64b585efa1 | |
Anonymous Maarten | 54b88cdfbe | |
Anonymous Maarten | e9adfd8663 | |
Anonymous Maarten | 8d0b4ede68 | |
Anonymous Maarten | 9707eeb8cb | |
Anonymous Maarten | 2f48d0c828 | |
Anonymous Maarten | 2ff9270279 | |
Anonymous Maarten | 8a157eee0a | |
erorcun | 8aaa3c4884 | |
withmorten | 59825a5268 | |
aap | cc2cebffb6 | |
aap | 4bb6740bf4 | |
aap | 9693184cea | |
aap | 822f0bd40b | |
Fire-Head | 02f6ed7da3 | |
Fire-Head | 39a121351d | |
Fire-Head | 00d23c61d9 | |
Sergeanur | 8eed6ae179 | |
Fire_Head | 6e42c791cf | |
Fire-Head | 368d2f3279 | |
Nikolay | c594d89dc5 | |
aap | 223b49e3be | |
aap | ec61964bce | |
Sergeanur | d8a04c9e43 | |
Sergeanur | ef13866af6 | |
Nikolay Korolev | 168d3d7ddb | |
Nikolay Korolev | 2173ceae95 | |
Nikolay Korolev | 416a898943 | |
Sergeanur | 02a28996f4 | |
Filip Gawin | 36996af82b | |
Filip Gawin | 145bd243e8 | |
Filip Gawin | 4cb00d3801 | |
Fire-Head | 148383ff53 | |
Sergeanur | 493f6cb578 | |
aap | a6409fb445 | |
Sergeanur | d94e8e8faf | |
Sergeanur | fd4c2172f5 | |
erorcun | 2e734a4750 | |
aap | e6ef2f12de | |
Fire-Head | 11de714d9d | |
Sergeanur | 042e21115e | |
Sergeanur | 63e9f6d826 | |
Sergeanur | 150f5302b7 | |
Sergeanur | 047f9c49ec | |
aap | 0f43523a16 | |
Samilop Iter | 8d782a1027 | |
Samilop Iter | c2ff171364 | |
erorcun | 3b1400eaed | |
erorcun | 2860f6e4a9 | |
Filip Gawin | bbbfe65870 | |
IlDucci | ab788a5316 | |
IlDucci | f1660d8e05 | |
IlDucci | eac0d0c99a | |
IlDucci | 52df1e65de | |
IlDucci | bb5d2c501c | |
Nikolay Korolev | 213a8eb905 | |
erorcun | ee05c7fe42 | |
erorcun | 28ec412369 | |
Sergeanur | 941e70a701 | |
aap | 0d05be4e31 | |
aap | 78fed0dfe7 | |
erorcun | cdb65e9ced | |
erorcun | 482ff4562f | |
Sergeanur | 38bca2332d | |
Sergeanur | c587203ebe | |
aap | 716e322246 | |
shfil | 3a0d99d24c | |
Filip Gawin | d3b11c2b8c | |
shfil | e6914355dd | |
Filip Gawin | b3581bc0b4 | |
Sergeanur | c9a7fd9435 | |
Fire-Head | bc7161754f | |
Fire-Head | 7a360b1181 | |
Fire-Head | 8fadca196b | |
Fire-Head | 30236a804d | |
Fire-Head | 24eb7c98f2 | |
Fire_Head | 89e2709304 | |
Fire-Head | 7b9e58f7c6 | |
Fire-Head | 737d41e184 | |
Fire-Head | 97f83c9fb2 | |
Fire-Head | 224e805fe4 | |
Cirno | 9e8faebcd6 | |
Cirno | bc4d3a32eb |
|
@ -23,11 +23,11 @@ jobs:
|
|||
# - os: 'windows-latest'
|
||||
# platform: 'd3d9'
|
||||
# audio: 'miles'
|
||||
- os: 'ubuntu-latest'
|
||||
- os: 'ubuntu-18.04'
|
||||
platform: 'gl3'
|
||||
gl3_gfxlib: 'glfw'
|
||||
audio: 'openal'
|
||||
# - os: 'ubuntu-latest'
|
||||
# - os: 'ubuntu-18.04'
|
||||
# platform: 'gl3'
|
||||
# gl3_gfxlib: 'sdl2'
|
||||
# audio: 'openal'
|
||||
|
@ -63,8 +63,9 @@ jobs:
|
|||
python -m pip install conan
|
||||
conan config init
|
||||
conan config set log.print_run_commands=True
|
||||
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
|
||||
conan remote add madebr_ps2dev https://api.bintray.com/conan/madebr/ps2dev
|
||||
conan config set general.revisions_enabled=1
|
||||
conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan
|
||||
# conan remote add madebr_ps2dev https://api.bintray.com/conan/madebr/ps2dev
|
||||
- name: "Add os=playstation2 + gcc.version=3.2 to .conan/settings.yml"
|
||||
shell: python
|
||||
run: |
|
||||
|
@ -85,7 +86,7 @@ jobs:
|
|||
fi
|
||||
- name: "Export Playstation 2 CMake toolchain conan recipe"
|
||||
run: |
|
||||
conan export vendor/librw/cmake/ps2toolchain ps2dev-cmaketoolchain/master@
|
||||
conan export vendor/librw/cmake/ps2/cmaketoolchain ps2dev-cmaketoolchain/master@
|
||||
- name: "Export librw conan recipe"
|
||||
run: |
|
||||
conan export vendor/librw librw/master@
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
name: reLCS cmake devkitA64 (Nintendo Switch)
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
release:
|
||||
types: published
|
||||
jobs:
|
||||
build-nintendo-switch:
|
||||
runs-on: ubuntu-latest
|
||||
container: devkitpro/devkita64:latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'true'
|
||||
- name: "Build files"
|
||||
run: |
|
||||
/opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake -S. -Bbuild -DREVC_AUDIO=OAL -DLIBRW_PLATFORM=GL3 -DLIBRW_GL3_GFXLIB=GLFW -DREVC_WITH_OPUS=False -DREVC_VENDORED_LIBRW=True -DREVC_INSTALL=True
|
||||
cmake --build build --parallel
|
||||
- name: "Create binary package (cpack)"
|
||||
working-directory: ./build
|
||||
run: |
|
||||
cpack
|
||||
- name: "Archive binary package (github artifacts)"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: "switch-gl3"
|
||||
path: build/*.tar.xz
|
||||
if-no-files-found: error
|
|
@ -34,7 +34,7 @@ jobs:
|
|||
7z x ${{env.GLFW_FILE}}
|
||||
- name: Configure build
|
||||
run: |
|
||||
./premake5 vs2019 --with-librw --glfwdir64=${{env.GLFW_BASE}}
|
||||
./premake5 vs2019 --with-librw --no-full-paths --glfwdir64=${{env.GLFW_BASE}}
|
||||
- name: Build
|
||||
run: |
|
||||
msbuild -m build/reLCS.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}}
|
||||
|
|
|
@ -34,7 +34,7 @@ jobs:
|
|||
7z x ${{env.GLFW_FILE}}
|
||||
- name: Configure build
|
||||
run: |
|
||||
./premake5 vs2019 --with-librw --glfwdir32=${{env.GLFW_BASE}}
|
||||
./premake5 vs2019 --with-librw --no-full-paths --glfwdir32=${{env.GLFW_BASE}}
|
||||
- name: Build
|
||||
run: |
|
||||
msbuild -m build/reLCS.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}}
|
||||
|
|
|
@ -355,6 +355,7 @@ vendor/glfw-3.3.2.bin.WIN64/
|
|||
|
||||
sdk/
|
||||
|
||||
codewarrior/reVC.mcp
|
||||
codewarrior/reVC_Data/
|
||||
codewarrior/Release/
|
||||
codewarrior/Debug/
|
||||
|
|
|
@ -26,6 +26,24 @@
|
|||
"compilerArgs": ["-ggdb"],
|
||||
"cStandard": "gnu11",
|
||||
"cppStandard": "gnu++14"
|
||||
},
|
||||
{
|
||||
"name": "devkitPro aarch64 (Nintendo Switch)",
|
||||
"compilerPath": "${env:DEVKITPRO}/devkitA64/bin/aarch64-none-elf-g++",
|
||||
"includePath": [
|
||||
"${default}",
|
||||
"${env:DEVKITPRO}/portlibs/switch/include",
|
||||
"${env:DEVKITPRO}/libnx/include"
|
||||
],
|
||||
"intelliSenseMode": "gcc-arm64",
|
||||
"cStandard": "gnu11",
|
||||
"cppStandard": "gnu++11",
|
||||
"defines": [
|
||||
"__SWITCH__",
|
||||
"LIBRW",
|
||||
"RW_GL3",
|
||||
"AUDIO_OAL"
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
|
|
|
@ -2,8 +2,13 @@
|
|||
"C_Cpp.default.cStandard": "gnu11",
|
||||
"C_Cpp.default.cppStandard": "gnu++14",
|
||||
"C_Cpp.default.includePath": [
|
||||
"src",
|
||||
"src/animation",
|
||||
"src/audio",
|
||||
"src/audio/eax",
|
||||
"src/audio/oal",
|
||||
"src/buildings",
|
||||
"src/collision",
|
||||
"src/control",
|
||||
"src/core",
|
||||
"src/entities",
|
||||
|
@ -13,9 +18,10 @@
|
|||
"src/modelinfo",
|
||||
"src/objects",
|
||||
"src/peds",
|
||||
"src/render",
|
||||
"src/renderer",
|
||||
"src/rw",
|
||||
"src/save",
|
||||
"src/save/glfw",
|
||||
"src/skel",
|
||||
"src/text",
|
||||
"src/vehicles",
|
||||
|
|
|
@ -1,15 +1,27 @@
|
|||
cmake_minimum_required(VERSION 3.8)
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
set(EXECUTABLE reLCS)
|
||||
set(PROJECT RELCS)
|
||||
|
||||
project(${EXECUTABLE} C CXX)
|
||||
set(${PROJECT}_AUTHOR "${PROJECT} Team")
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1 "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
|
||||
message(STATUS "Building ${CMAKE_PROJECT_NAME} GIT SHA1: ${GIT_SHA1}")
|
||||
|
||||
|
||||
if(NINTENDO_SWITCH)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/nx")
|
||||
include(NXFunctions)
|
||||
endif()
|
||||
|
||||
if(NOT COMMAND reVC_platform_target)
|
||||
function(reVC_platform_target)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(${PROJECT}_AUDIOS "OAL" "MSS")
|
||||
else()
|
||||
|
@ -66,6 +78,8 @@ if(${PROJECT}_INSTALL)
|
|||
set(os "-apple")
|
||||
elseif(UNIX)
|
||||
set(os "-linux")
|
||||
elseif(NINTENDO_SWITCH)
|
||||
set(os "-switch")
|
||||
else()
|
||||
set(compiler "-UNK")
|
||||
message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# reLCS
|
||||
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dlcs&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=lcs)
|
||||
<a href="https://discord.gg/ERYg58ttcE"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
|
||||
<a href="https://discord.gg/RFNbjsUMGg"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
|
||||
|
||||
## Intro
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2016 Blizzard Entertainment and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Premake nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,305 @@
|
|||
---
|
||||
-- Autoconfiguration.
|
||||
-- Copyright (c) 2016 Blizzard Entertainment
|
||||
-- Enhanced by re3
|
||||
---
|
||||
local p = premake
|
||||
local autoconf = p.modules.autoconf
|
||||
autoconf.cache = {}
|
||||
autoconf.parameters = ""
|
||||
|
||||
|
||||
---
|
||||
-- register autoconfigure api.
|
||||
---
|
||||
p.api.register {
|
||||
name = "autoconfigure",
|
||||
scope = "config",
|
||||
kind = "table"
|
||||
}
|
||||
|
||||
---
|
||||
-- Check for a particular include file.
|
||||
--
|
||||
-- @cfg : Current config.
|
||||
-- @variable : The variable to store the result, such as 'HAVE_STDINT_H'.
|
||||
-- @filename : The header file to check for.
|
||||
---
|
||||
function check_include(cfg, variable, filename)
|
||||
local res = autoconf.cache_compile(cfg, variable, function ()
|
||||
p.outln('#include <' .. filename .. '>')
|
||||
p.outln('int main(void) { return 0; }')
|
||||
end)
|
||||
|
||||
if res.value then
|
||||
autoconf.set_value(cfg, variable, 1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Check for size of a particular type.
|
||||
--
|
||||
-- @cfg : Current config.
|
||||
-- @variable : The variable to use, such as 'SIZEOF_SIZE_T', this method will also add "'HAVE_' .. variable".
|
||||
-- @type : The type to check.
|
||||
-- @headers : An optional array of header files to include.
|
||||
-- @defines : An optional array of defines to define.
|
||||
---
|
||||
function check_type_size(cfg, variable, type, headers, defines)
|
||||
check_include(cfg, 'HAVE_SYS_TYPES_H', 'sys/types.h')
|
||||
check_include(cfg, 'HAVE_STDINT_H', 'stdint.h')
|
||||
check_include(cfg, 'HAVE_STDDEF_H', 'stddef.h')
|
||||
|
||||
local res = autoconf.cache_compile(cfg, variable .. cfg.platform,
|
||||
function ()
|
||||
if cfg.autoconf['HAVE_SYS_TYPES_H'] then
|
||||
p.outln('#include <sys/types.h>')
|
||||
end
|
||||
|
||||
if cfg.autoconf['HAVE_STDINT_H'] then
|
||||
p.outln('#include <stdint.h>')
|
||||
end
|
||||
|
||||
if cfg.autoconf['HAVE_STDDEF_H'] then
|
||||
p.outln('#include <stddef.h>')
|
||||
end
|
||||
|
||||
autoconf.include_defines(defines)
|
||||
autoconf.include_headers(headers)
|
||||
p.outln("")
|
||||
p.outln("#define SIZE (sizeof(" .. type .. "))")
|
||||
p.outln("char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',")
|
||||
p.outln(" ('0' + ((SIZE / 10000)%10)),")
|
||||
p.outln(" ('0' + ((SIZE / 1000)%10)),")
|
||||
p.outln(" ('0' + ((SIZE / 100)%10)),")
|
||||
p.outln(" ('0' + ((SIZE / 10)%10)),")
|
||||
p.outln(" ('0' + (SIZE %10)),")
|
||||
p.outln(" ']', '\\0'};")
|
||||
p.outln("")
|
||||
p.outln("int main(int argc, char *argv[]) {")
|
||||
p.outln(" int require = 0;")
|
||||
p.outln(" require += info_size[argc];")
|
||||
p.outln(" (void)argv;")
|
||||
p.outln(" return require;")
|
||||
p.outln("}")
|
||||
end,
|
||||
function (e)
|
||||
-- if the compile step succeeded, we should have a binary with 'INFO:size[*****]'
|
||||
-- somewhere in there.
|
||||
local content = io.readfile(e.binary)
|
||||
if content then
|
||||
local size = string.find(content, 'INFO:size')
|
||||
if size then
|
||||
e.size = tonumber(string.sub(content, size+10, size+14))
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if res.size then
|
||||
autoconf.set_value(cfg, 'HAVE_' .. variable, 1)
|
||||
autoconf.set_value(cfg, variable, res.size)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Check if the given struct or class has the specified member variable
|
||||
--
|
||||
-- @cfg : current config.
|
||||
-- @variable : variable to store the result.
|
||||
-- @type : the name of the struct or class you are interested in
|
||||
-- @member : the member which existence you want to check
|
||||
-- @headers : an optional array of header files to include.
|
||||
-- @defines : An optional array of defines to define.
|
||||
---
|
||||
function check_struct_has_member(cfg, variable, type, member, headers, defines)
|
||||
local res = autoconf.cache_compile(cfg, variable, function ()
|
||||
autoconf.include_defines(defines)
|
||||
autoconf.include_headers(headers)
|
||||
p.outln('int main(void) {')
|
||||
p.outln(' (void)sizeof(((' .. type .. '*)0)->' .. member ..');')
|
||||
p.outln(' return 0;')
|
||||
p.outln('}')
|
||||
end)
|
||||
|
||||
if res.value then
|
||||
autoconf.set_value(cfg, variable, 1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Check if a symbol exists as a function, variable, or macro
|
||||
--
|
||||
-- @cfg : current config.
|
||||
-- @variable : variable to store the result.
|
||||
-- @symbol : The symbol to check for.
|
||||
-- @headers : an optional array of header files to include.
|
||||
-- @defines : An optional array of defines to define.
|
||||
---
|
||||
function check_symbol_exists(cfg, variable, symbol, headers, defines)
|
||||
local h = headers
|
||||
local res = autoconf.cache_compile(cfg, variable, function ()
|
||||
autoconf.include_defines(defines)
|
||||
autoconf.include_headers(headers)
|
||||
p.outln('int main(int argc, char** argv) {')
|
||||
p.outln(' (void)argv;')
|
||||
p.outln('#ifndef ' .. symbol)
|
||||
p.outln(' return ((int*)(&' .. symbol .. '))[argc];')
|
||||
p.outln('#else')
|
||||
p.outln(' (void)argc;')
|
||||
p.outln(' return 0;')
|
||||
p.outln('#endif')
|
||||
p.outln('}')
|
||||
end)
|
||||
|
||||
if res.value then
|
||||
autoconf.set_value(cfg, variable, 1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- try compiling a piece of c/c++
|
||||
---
|
||||
function autoconf.try_compile(cfg, cpp)
|
||||
local ts = autoconf.toolset(cfg)
|
||||
if ts then
|
||||
return ts.try_compile(cfg, cpp, autoconf.parameters)
|
||||
else
|
||||
p.warnOnce('autoconf', 'no toolset found, autoconf always failing.')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function autoconf.cache_compile(cfg, entry, func, post)
|
||||
if not autoconf.cache[entry] then
|
||||
local cpp = p.capture(func)
|
||||
local res = autoconf.try_compile(cfg, cpp)
|
||||
if res then
|
||||
local e = { binary = res, value = true }
|
||||
if post then
|
||||
post(e)
|
||||
end
|
||||
autoconf.cache[entry] = e
|
||||
else
|
||||
autoconf.cache[entry] = { }
|
||||
end
|
||||
end
|
||||
return autoconf.cache[entry]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- get the current configured toolset, or the default.
|
||||
---
|
||||
function autoconf.toolset(cfg)
|
||||
local ts = p.config.toolset(cfg)
|
||||
if not ts then
|
||||
local tools = {
|
||||
-- Actually we always return nil on msc. see msc.lua
|
||||
['vs2010'] = p.tools.msc,
|
||||
['vs2012'] = p.tools.msc,
|
||||
['vs2013'] = p.tools.msc,
|
||||
['vs2015'] = p.tools.msc,
|
||||
['vs2017'] = p.tools.msc,
|
||||
['vs2019'] = p.tools.msc,
|
||||
['gmake'] = premake.tools.gcc,
|
||||
['gmake2'] = premake.tools.gcc,
|
||||
['codelite'] = premake.tools.gcc,
|
||||
['xcode4'] = premake.tools.clang,
|
||||
}
|
||||
ts = tools[_ACTION]
|
||||
end
|
||||
return ts
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- store the value of the variable in the configuration
|
||||
---
|
||||
function autoconf.set_value(cfg, variable, value)
|
||||
cfg.autoconf[variable] = value
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- write the cfg.autoconf table to the file
|
||||
---
|
||||
function autoconf.writefile(cfg, filename)
|
||||
if cfg.autoconf then
|
||||
local file = io.open(filename, "w+")
|
||||
for variable, value in pairs(cfg.autoconf) do
|
||||
file:write('#define ' .. variable .. ' ' .. tostring(value) .. (_eol or '\n'))
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Utility method to add a table of headers.
|
||||
---
|
||||
function autoconf.include_headers(headers)
|
||||
if headers ~= nil then
|
||||
if type(headers) == "table" then
|
||||
for _, v in ipairs(headers) do
|
||||
p.outln('#include <' .. v .. '>')
|
||||
end
|
||||
else
|
||||
p.outln('#include <' .. headers .. '>')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function autoconf.include_defines(defines)
|
||||
if defines ~= nil then
|
||||
if type(defines) == "table" then
|
||||
for _, v in ipairs(defines) do
|
||||
p.outln('#define ' .. v)
|
||||
end
|
||||
else
|
||||
p.outln('#define ' .. defines)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---
|
||||
-- attach ourselfs to the running action.
|
||||
---
|
||||
p.override(p.action, 'call', function (base, name)
|
||||
local a = p.action.get(name)
|
||||
|
||||
-- store the old callback.
|
||||
local onBaseProject = a.onProject or a.onproject
|
||||
|
||||
-- override it with our own.
|
||||
a.onProject = function(prj)
|
||||
-- go through each configuration, and call the setup configuration methods.
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
cfg.autoconf = {}
|
||||
if cfg.autoconfigure then
|
||||
verbosef('Running auto config steps for "%s/%s".', prj.name, cfg.name)
|
||||
for file, func in pairs(cfg.autoconfigure) do
|
||||
func(cfg)
|
||||
|
||||
if not (file ~= "dontWrite") then
|
||||
os.mkdir(cfg.objdir)
|
||||
local filename = path.join(cfg.objdir, file)
|
||||
autoconf.writefile(cfg, filename)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- then call the old onProject.
|
||||
if onBaseProject then
|
||||
onBaseProject(prj)
|
||||
end
|
||||
end
|
||||
|
||||
-- now call the original action.call methods
|
||||
base(name)
|
||||
end)
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
-- Autoconfiguration.
|
||||
-- Copyright (c) 2016 Blizzard Entertainment
|
||||
---
|
||||
local p = premake
|
||||
|
||||
if not premake.modules.autoconf then
|
||||
p.modules.autoconf = {}
|
||||
p.modules.autoconf._VERSION = p._VERSION
|
||||
|
||||
verbosef('Loading autoconf module...')
|
||||
include('api.lua')
|
||||
include('msc.lua')
|
||||
include('clang.lua')
|
||||
include('gcc.lua')
|
||||
end
|
||||
|
||||
return p.modules.autoconf
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
-- Autoconfiguration.
|
||||
-- Copyright (c) 2016 Blizzard Entertainment
|
||||
---
|
||||
local p = premake
|
||||
local clang = p.tools.clang
|
||||
|
||||
function clang.try_compile(cfg, text, parameters)
|
||||
-- write the text to a temporary file.
|
||||
local cppFile = path.join(cfg.objdir, "temp.cpp")
|
||||
if not io.writefile(cppFile, text) then
|
||||
return nil
|
||||
end
|
||||
|
||||
if parameters == nil then
|
||||
parameters = ""
|
||||
end
|
||||
|
||||
local outFile = path.join(cfg.objdir, "temp.out")
|
||||
|
||||
-- compile that text file.
|
||||
if os.execute('clang "' .. cppFile .. '" ' .. parameters .. ' -o "' .. outFile ..'" &> /dev/null') then
|
||||
return outFile
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
-- Autoconfiguration.
|
||||
-- Copyright (c) 2016 Blizzard Entertainment
|
||||
---
|
||||
local p = premake
|
||||
local gcc = p.tools.gcc
|
||||
|
||||
function gcc.try_compile(cfg, text, parameters)
|
||||
-- write the text to a temporary file.
|
||||
local cppFile = path.join(cfg.objdir, "temp.cpp")
|
||||
if not io.writefile(cppFile, text) then
|
||||
return nil
|
||||
end
|
||||
|
||||
if parameters == nil then
|
||||
parameters = ""
|
||||
end
|
||||
|
||||
local outFile = path.join(cfg.objdir, "temp.out")
|
||||
|
||||
-- compile that text file.
|
||||
if os.execute('gcc "' .. cppFile .. '" ' .. parameters .. ' -o "' .. outFile ..'" &> /dev/null') then
|
||||
return outFile
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,62 @@
|
|||
---
|
||||
-- Autoconfiguration.
|
||||
-- Copyright (c) 2016 Blizzard Entertainment
|
||||
---
|
||||
local p = premake
|
||||
local msc = p.tools.msc
|
||||
|
||||
-- "parameters" is unused, matter of fact this file is unused - re3
|
||||
function msc.try_compile(cfg, text, parameters)
|
||||
|
||||
return nil
|
||||
--[[
|
||||
-- write the text to a temporary file.
|
||||
local cppFile = path.join(cfg.objdir, "temp.cpp")
|
||||
if not io.writefile(cppFile, text) then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- write out a batch file.
|
||||
local batch = p.capture(function ()
|
||||
p.outln('@echo off')
|
||||
p.outln('SET mypath=%~dp0')
|
||||
p.outln('pushd %mypath%')
|
||||
|
||||
local map = {
|
||||
vs2010 = 'VS100COMNTOOLS',
|
||||
vs2012 = 'VS110COMNTOOLS',
|
||||
vs2013 = 'VS120COMNTOOLS',
|
||||
vs2015 = 'VS140COMNTOOLS',
|
||||
vs2017 = 'VS141COMNTOOLS',
|
||||
vs2019 = 'VS142COMNTOOLS',
|
||||
}
|
||||
|
||||
local a = map[_ACTION]
|
||||
if a then
|
||||
a = path.translate(os.getenv(a), '/')
|
||||
a = path.join(a, '../../VC/vcvarsall.bat')
|
||||
|
||||
if cfg.platform == 'x86' then
|
||||
p.outln('call "' .. a .. '" > NUL')
|
||||
else
|
||||
p.outln('call "' .. a .. '" amd64 > NUL')
|
||||
end
|
||||
|
||||
p.outln('cl.exe /nologo temp.cpp > NUL')
|
||||
else
|
||||
error('Unsupported Visual Studio version: ' .. _ACTION)
|
||||
end
|
||||
end)
|
||||
|
||||
local batchFile = path.join(cfg.objdir, "compile.bat")
|
||||
if not io.writefile(batchFile, batch) then
|
||||
return nil
|
||||
end
|
||||
|
||||
if os.execute(batchFile) then
|
||||
return path.join(cfg.objdir, "temp.exe")
|
||||
else
|
||||
return nil
|
||||
end
|
||||
--]]
|
||||
end
|
|
@ -28,7 +28,7 @@ find_package_handle_standard_args(MilesSDK DEFAULT_MSG MilesSDK_LIBRARIES MilesS
|
|||
if(NOT TARGET MilesSDK::MilesSDK)
|
||||
add_library(MilesSDK::MilesSDK UNKNOWN IMPORTED)
|
||||
set_target_properties(MilesSDK::MilesSDK PROPERTIES
|
||||
IMPORTED_LOCATION "${MilesSDK_LIBRARIES}
|
||||
IMPORTED_LOCATION "${MilesSDK_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MilesSDK_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -18,7 +18,7 @@ find_path(mpg123_INCLUDE_DIR mpg123.h
|
|||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0
|
||||
find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0 libmpg123-0
|
||||
HINTS ${PKG_MPG123_LIBRARIES}
|
||||
PATHS "${mpg123_DIR}"
|
||||
PATH_SUFFIXES lib
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
if(NOT COMMAND nx_generate_nacp)
|
||||
message(FATAL_ERROR "The `nx_generate_nacp` cmake command is not available. Please use an appropriate Nintendo Switch toolchain.")
|
||||
endif()
|
||||
|
||||
if(NOT COMMAND nx_create_nro)
|
||||
message(FATAL_ERROR "The `nx_create_nro` cmake command is not available. Please use an appropriate Nintendo Switch toolchain.")
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
||||
|
||||
function(reVC_platform_target TARGET)
|
||||
cmake_parse_arguments(RPT "INSTALL" "" "" ${ARGN})
|
||||
|
||||
get_target_property(TARGET_TYPE "${TARGET}" TYPE)
|
||||
if(TARGET_TYPE STREQUAL "EXECUTABLE")
|
||||
nx_generate_nacp(${TARGET}.nacp
|
||||
NAME "${TARGET}"
|
||||
AUTHOR "${${PROJECT}_AUTHOR}"
|
||||
VERSION "1.0.0-${GIT_SHA1}"
|
||||
)
|
||||
|
||||
nx_create_nro(${TARGET}
|
||||
NACP ${TARGET}.nacp
|
||||
ICON "${PROJECT_SOURCE_DIR}/res/images/logo_256.jpg"
|
||||
)
|
||||
|
||||
if(${PROJECT}_INSTALL AND RPT_INSTALL)
|
||||
get_target_property(TARGET_OUTPUT_NAME ${TARGET} OUTPUT_NAME)
|
||||
if(NOT TARGET_OUTPUT_NAME)
|
||||
set(TARGET_OUTPUT_NAME "${TARGET}")
|
||||
endif()
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_OUTPUT_NAME}.nro"
|
||||
DESTINATION "."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
156
premake5.lua
156
premake5.lua
|
@ -28,10 +28,22 @@ newoption {
|
|||
}
|
||||
|
||||
newoption {
|
||||
trigger = "lto",
|
||||
description = "Use link time optimization"
|
||||
trigger = "with-lto",
|
||||
description = "Build with link time optimization"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "no-git-hash",
|
||||
description = "Don't print git commit hash into binary"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "no-full-paths",
|
||||
description = "Don't print full paths into binary"
|
||||
}
|
||||
|
||||
require("autoconf")
|
||||
|
||||
if(_OPTIONS["with-librw"]) then
|
||||
Librw = "vendor/librw"
|
||||
else
|
||||
|
@ -58,7 +70,7 @@ end
|
|||
|
||||
workspace "reLCS"
|
||||
language "C++"
|
||||
configurations { "Debug", "Release", "Vanilla" }
|
||||
configurations { "Debug", "Release" }
|
||||
startproject "reLCS"
|
||||
location "build"
|
||||
symbols "Full"
|
||||
|
@ -77,6 +89,7 @@ workspace "reLCS"
|
|||
end
|
||||
|
||||
filter { "system:windows" }
|
||||
configurations { "Vanilla" }
|
||||
platforms {
|
||||
"win-x86-RW34_d3d8-mss",
|
||||
"win-x86-librw_d3d9-mss",
|
||||
|
@ -103,7 +116,7 @@ workspace "reLCS"
|
|||
"bsd-arm-librw_gl3_glfw-oal",
|
||||
"bsd-arm64-librw_gl3_glfw-oal"
|
||||
}
|
||||
|
||||
|
||||
filter { "system:macosx" }
|
||||
platforms {
|
||||
"macosx-arm64-librw_gl3_glfw-oal",
|
||||
|
@ -112,64 +125,67 @@ workspace "reLCS"
|
|||
|
||||
filter "configurations:Debug"
|
||||
defines { "DEBUG" }
|
||||
|
||||
|
||||
filter "configurations:not Debug"
|
||||
defines { "NDEBUG" }
|
||||
optimize "Speed"
|
||||
if(_OPTIONS["lto"]) then
|
||||
if(_OPTIONS["with-lto"]) then
|
||||
flags { "LinkTimeOptimization" }
|
||||
end
|
||||
|
||||
filter "configurations:Vanilla"
|
||||
defines { "VANILLA_DEFINES" }
|
||||
|
||||
filter { "platforms:win*" }
|
||||
system "windows"
|
||||
|
||||
filter { "platforms:linux*" }
|
||||
system "linux"
|
||||
|
||||
|
||||
filter { "platforms:bsd*" }
|
||||
system "bsd"
|
||||
|
||||
filter { "platforms:macosx*" }
|
||||
system "macosx"
|
||||
|
||||
|
||||
filter { "platforms:*x86*" }
|
||||
architecture "x86"
|
||||
|
||||
|
||||
filter { "platforms:*amd64*" }
|
||||
architecture "amd64"
|
||||
|
||||
filter { "platforms:*arm*" }
|
||||
architecture "ARM"
|
||||
|
||||
filter { "platforms:macosx-arm64-*" }
|
||||
|
||||
filter { "platforms:macosx-arm64-*", "files:**.cpp"}
|
||||
buildoptions { "-target", "arm64-apple-macos11", "-std=gnu++14" }
|
||||
|
||||
filter { "platforms:macosx-amd64-*" }
|
||||
filter { "platforms:macosx-arm64-*", "files:**.c"}
|
||||
buildoptions { "-target", "arm64-apple-macos11" }
|
||||
|
||||
filter { "platforms:macosx-amd64-*", "files:**.cpp"}
|
||||
buildoptions { "-target", "x86_64-apple-macos10.12", "-std=gnu++14" }
|
||||
|
||||
filter { "platforms:macosx-amd64-*", "files:**.c"}
|
||||
buildoptions { "-target", "x86_64-apple-macos10.12" }
|
||||
|
||||
filter { "platforms:*librw_d3d9*" }
|
||||
defines { "RW_D3D9" }
|
||||
if(not _OPTIONS["with-librw"]) then
|
||||
libdirs { path.join(Librw, "lib/win-%{getarch(cfg.architecture)}-d3d9/%{cfg.buildcfg}") }
|
||||
end
|
||||
|
||||
|
||||
filter "platforms:*librw_gl3_glfw*"
|
||||
defines { "RW_GL3" }
|
||||
if(not _OPTIONS["with-librw"]) then
|
||||
libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") }
|
||||
end
|
||||
|
||||
|
||||
filter "platforms:*x86-librw_gl3_glfw*"
|
||||
includedirs { path.join(_OPTIONS["glfwdir32"], "include") }
|
||||
|
||||
|
||||
filter "platforms:*amd64-librw_gl3_glfw*"
|
||||
includedirs { path.join(_OPTIONS["glfwdir64"], "include") }
|
||||
|
||||
filter {}
|
||||
|
||||
|
||||
function setpaths (gamepath, exepath)
|
||||
if (gamepath) then
|
||||
postbuildcommands {
|
||||
|
@ -191,9 +207,9 @@ project "librw"
|
|||
targetname "rw"
|
||||
targetdir(path.join(Librw, "lib/%{cfg.platform}/%{cfg.buildcfg}"))
|
||||
files { path.join(Librw, "src/*.*") }
|
||||
files { path.join(Librw, "src/*/*.*") }
|
||||
files { path.join(Librw, "src/*/*.*") }
|
||||
files { path.join(Librw, "src/gl/*/*.*") }
|
||||
|
||||
|
||||
filter { "platforms:*x86*" }
|
||||
architecture "x86"
|
||||
|
||||
|
@ -209,16 +225,22 @@ project "librw"
|
|||
includedirs { "/usr/local/include" }
|
||||
libdirs { "/usr/local/lib" }
|
||||
|
||||
filter "platforms:macosx*"
|
||||
-- Support MacPorts and Homebrew
|
||||
-- Support MacPorts and Homebrew
|
||||
filter "platforms:macosx-arm64-*"
|
||||
includedirs { "/opt/local/include" }
|
||||
includedirs {"/opt/homebrew/include" }
|
||||
libdirs { "/opt/local/lib" }
|
||||
libdirs { "/opt/homebrew/lib" }
|
||||
|
||||
filter "platforms:macosx-amd64-*"
|
||||
includedirs { "/opt/local/include" }
|
||||
includedirs {"/usr/local/include" }
|
||||
libdirs { "/opt/local/lib" }
|
||||
libdirs { "/usr/local/lib" }
|
||||
|
||||
|
||||
filter "platforms:*gl3_glfw*"
|
||||
staticruntime "off"
|
||||
|
||||
|
||||
filter "platforms:*RW34*"
|
||||
flags { "ExcludeFromBuild" }
|
||||
filter {}
|
||||
|
@ -253,7 +275,7 @@ project "reLCS"
|
|||
files { addSrcFiles("src/modelinfo") }
|
||||
files { addSrcFiles("src/objects") }
|
||||
files { addSrcFiles("src/peds") }
|
||||
files { addSrcFiles("src/render") }
|
||||
files { addSrcFiles("src/renderer") }
|
||||
files { addSrcFiles("src/rw") }
|
||||
files { addSrcFiles("src/save") }
|
||||
files { addSrcFiles("src/skel") }
|
||||
|
@ -262,7 +284,11 @@ project "reLCS"
|
|||
files { addSrcFiles("src/vehicles") }
|
||||
files { addSrcFiles("src/weapons") }
|
||||
files { addSrcFiles("src/extras") }
|
||||
files { "src/extras/GitSHA1.cpp" } -- this won't be in repo in first build
|
||||
if(not _OPTIONS["no-git-hash"]) then
|
||||
files { "src/extras/GitSHA1.cpp" } -- this won't be in repo in first build
|
||||
else
|
||||
removefiles { "src/extras/GitSHA1.cpp" } -- but it will be everytime after
|
||||
end
|
||||
|
||||
includedirs { "src" }
|
||||
includedirs { "src/animation" }
|
||||
|
@ -280,7 +306,7 @@ project "reLCS"
|
|||
includedirs { "src/modelinfo" }
|
||||
includedirs { "src/objects" }
|
||||
includedirs { "src/peds" }
|
||||
includedirs { "src/render" }
|
||||
includedirs { "src/renderer" }
|
||||
includedirs { "src/rw" }
|
||||
includedirs { "src/save/" }
|
||||
includedirs { "src/skel/" }
|
||||
|
@ -289,18 +315,25 @@ project "reLCS"
|
|||
includedirs { "src/vehicles" }
|
||||
includedirs { "src/weapons" }
|
||||
includedirs { "src/extras" }
|
||||
|
||||
|
||||
if(not _OPTIONS["no-git-hash"]) then
|
||||
defines { "USE_OUR_VERSIONING" }
|
||||
end
|
||||
|
||||
if _OPTIONS["with-opus"] then
|
||||
includedirs { "vendor/ogg/include" }
|
||||
includedirs { "vendor/opus/include" }
|
||||
includedirs { "vendor/opusfile/include" }
|
||||
end
|
||||
|
||||
filter "configurations:Vanilla"
|
||||
defines { "VANILLA_DEFINES" }
|
||||
|
||||
filter "platforms:*mss"
|
||||
defines { "AUDIO_MSS" }
|
||||
includedirs { "vendor/milessdk/include" }
|
||||
libdirs { "vendor/milessdk/lib" }
|
||||
|
||||
|
||||
if _OPTIONS["with-opus"] then
|
||||
filter "platforms:win*"
|
||||
libdirs { "vendor/ogg/win32/VS2015/Win32/%{cfg.buildcfg}" }
|
||||
|
@ -309,7 +342,7 @@ project "reLCS"
|
|||
filter {}
|
||||
defines { "AUDIO_OPUS" }
|
||||
end
|
||||
|
||||
|
||||
filter "platforms:*oal"
|
||||
defines { "AUDIO_OAL" }
|
||||
|
||||
|
@ -317,7 +350,7 @@ project "reLCS"
|
|||
if(os.getenv("GTA_LCS_RE_DIR")) then
|
||||
setpaths(os.getenv("GTA_LCS_RE_DIR") .. "/", "%(cfg.buildtarget.name)")
|
||||
end
|
||||
|
||||
|
||||
filter "platforms:win*"
|
||||
files { addSrcFiles("src/skel/win") }
|
||||
includedirs { "src/skel/win" }
|
||||
|
@ -325,28 +358,49 @@ project "reLCS"
|
|||
linkoptions "/SAFESEH:NO"
|
||||
characterset ("MBCS")
|
||||
targetextension ".exe"
|
||||
if(_OPTIONS["no-full-paths"]) then
|
||||
usefullpaths "off"
|
||||
linkoptions "/PDBALTPATH:%_PDB%"
|
||||
end
|
||||
if(_OPTIONS["with-librw"]) then
|
||||
-- external librw is dynamic
|
||||
staticruntime "on"
|
||||
end
|
||||
prebuildcommands { '"%{prj.location}..\\printHash.bat" "%{prj.location}..\\src\\extras\\GitSHA1.cpp"' }
|
||||
if(not _OPTIONS["no-git-hash"]) then
|
||||
prebuildcommands { '"%{prj.location}..\\printHash.bat" "%{prj.location}..\\src\\extras\\GitSHA1.cpp"' }
|
||||
end
|
||||
|
||||
filter "platforms:not win*"
|
||||
prebuildcommands { '"%{prj.location}/../printHash.sh" "%{prj.location}/../src/extras/GitSHA1.cpp"' }
|
||||
if(not _OPTIONS["no-git-hash"]) then
|
||||
prebuildcommands { '"%{prj.location}/../printHash.sh" "%{prj.location}/../src/extras/GitSHA1.cpp"' }
|
||||
end
|
||||
|
||||
filter "platforms:win*glfw*"
|
||||
staticruntime "off"
|
||||
|
||||
filter "platforms:*glfw*"
|
||||
premake.modules.autoconf.parameters = "-lglfw -lX11"
|
||||
autoconfigure {
|
||||
-- iterates all configs and runs on them
|
||||
["dontWrite"] = function (cfg)
|
||||
check_symbol_exists(cfg, "haveX11", "glfwGetX11Display", { "X11/Xlib.h", "X11/XKBlib.h", "GLFW/glfw3.h", "GLFW/glfw3native.h" }, "GLFW_EXPOSE_NATIVE_X11")
|
||||
if cfg.autoconf["haveX11"] ~= nil and cfg.autoconf["haveX11"] == 1 then
|
||||
table.insert(cfg.links, "X11")
|
||||
table.insert(cfg.defines, "GET_KEYBOARD_INPUT_FROM_X11")
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
filter "platforms:win*oal"
|
||||
includedirs { "vendor/openal-soft/include" }
|
||||
includedirs { "vendor/libsndfile/include" }
|
||||
includedirs { "vendor/mpg123/include" }
|
||||
|
||||
|
||||
filter "platforms:win-x86*oal"
|
||||
libdirs { "vendor/mpg123/lib/Win32" }
|
||||
libdirs { "vendor/libsndfile/lib/Win32" }
|
||||
libdirs { "vendor/openal-soft/libs/Win32" }
|
||||
|
||||
|
||||
filter "platforms:win-amd64*oal"
|
||||
libdirs { "vendor/mpg123/lib/Win64" }
|
||||
libdirs { "vendor/libsndfile/lib/Win64" }
|
||||
|
@ -360,9 +414,15 @@ project "reLCS"
|
|||
|
||||
filter "platforms:macosx*oal"
|
||||
links { "openal", "mpg123", "sndfile", "pthread" }
|
||||
|
||||
filter "platforms:macosx-arm64-*oal"
|
||||
includedirs { "/opt/homebrew/opt/openal-soft/include" }
|
||||
libdirs { "/opt/homebrew/opt/openal-soft/lib" }
|
||||
|
||||
filter "platforms:macosx-amd64-*oal"
|
||||
includedirs { "/usr/local/opt/openal-soft/include" }
|
||||
libdirs { "/usr/local/opt/openal-soft/lib" }
|
||||
|
||||
|
||||
if _OPTIONS["with-opus"] then
|
||||
filter {}
|
||||
links { "libogg" }
|
||||
|
@ -376,7 +436,7 @@ project "reLCS"
|
|||
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtanim", "rtcharse", "rpanisot" }
|
||||
defines { "RWLIBS" }
|
||||
linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
|
||||
|
||||
|
||||
filter "platforms:*librw*"
|
||||
defines { "LIBRW" }
|
||||
files { addSrcFiles("src/fakerw") }
|
||||
|
@ -390,31 +450,39 @@ project "reLCS"
|
|||
filter "platforms:*d3d9*"
|
||||
defines { "USE_D3D9" }
|
||||
links { "d3d9" }
|
||||
|
||||
|
||||
filter "platforms:*x86*d3d*"
|
||||
includedirs { "sdk/dx8sdk/include" }
|
||||
libdirs { "sdk/dx8sdk/lib" }
|
||||
|
||||
|
||||
filter "platforms:win-x86*gl3_glfw*"
|
||||
libdirs { path.join(_OPTIONS["glfwdir32"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) }
|
||||
links { "opengl32", "glfw3" }
|
||||
|
||||
|
||||
filter "platforms:win-amd64*gl3_glfw*"
|
||||
libdirs { path.join(_OPTIONS["glfwdir64"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) }
|
||||
links { "opengl32", "glfw3" }
|
||||
|
||||
filter "platforms:linux*gl3_glfw*"
|
||||
links { "GL", "glfw" }
|
||||
|
||||
|
||||
filter "platforms:bsd*gl3_glfw*"
|
||||
links { "GL", "glfw", "sysinfo" }
|
||||
includedirs { "/usr/local/include" }
|
||||
libdirs { "/usr/local/lib" }
|
||||
|
||||
filter "platforms:macosx*gl3_glfw*"
|
||||
filter "platforms:macosx-arm64-*gl3_glfw*"
|
||||
links { "glfw" }
|
||||
linkoptions { "-framework OpenGL" }
|
||||
includedirs { "/opt/local/include" }
|
||||
includedirs { "/usr/local/include" }
|
||||
includedirs {"/opt/homebrew/include" }
|
||||
libdirs { "/opt/local/lib" }
|
||||
libdirs { "/opt/homebrew/lib" }
|
||||
|
||||
filter "platforms:macosx-amd64-*gl3_glfw*"
|
||||
links { "glfw" }
|
||||
linkoptions { "-framework OpenGL" }
|
||||
includedirs { "/opt/local/include" }
|
||||
includedirs {"/usr/local/include" }
|
||||
libdirs { "/opt/local/lib" }
|
||||
libdirs { "/usr/local/lib" }
|
||||
|
|
20
printHash.sh
20
printHash.sh
|
@ -1,12 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
if [ -z "${1}" ]
|
||||
then
|
||||
printf "%s\n" "Input the path to the file for writing the commit hash to."
|
||||
else
|
||||
printf "%s" "#define GIT_SHA1 \"" > $1
|
||||
|
||||
> $1
|
||||
if (command -v "git" >/dev/null) then
|
||||
git rev-parse --short HEAD | tr -d '\n' >> $1
|
||||
fi
|
||||
|
||||
echo -n "#define GIT_SHA1 \"" > $1
|
||||
|
||||
if (command -v "git" >/dev/null) then
|
||||
git rev-parse --short HEAD | tr -d '\n' >> $1
|
||||
printf "%s\n" "\"" >> $1
|
||||
printf "%s\n" "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1
|
||||
fi
|
||||
|
||||
echo "\"" >> $1
|
||||
echo "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -50,12 +50,17 @@ if(LIBRW_PLATFORM_D3D9)
|
|||
endif()
|
||||
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE CMAKE_BUILD)
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE USE_OUR_VERSIONING)
|
||||
|
||||
if(${PROJECT}_AUDIO STREQUAL "OAL")
|
||||
find_package(OpenAL REQUIRED)
|
||||
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
|
||||
if(TARGET OpenAL::OpenAL)
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE OpenAL::OpenAL)
|
||||
else()
|
||||
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
|
||||
endif()
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
|
||||
elseif(${PROJECT}_AUDIO STREQUAL "MSS")
|
||||
find_package(MilesSDK REQUIRED)
|
||||
|
@ -121,13 +126,35 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||
)
|
||||
endif()
|
||||
|
||||
if(NINTENDO_SWITCH)
|
||||
set(${PROJECT}_C_CXX_EXTENSIONS ON)
|
||||
else()
|
||||
set(${PROJECT}_C_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
|
||||
if(LIBRW_PLATFORM_GL3 AND LIBRW_GL3_GFXLIB STREQUAL "GLFW")
|
||||
include(CheckSymbolExists)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES glfw)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -DGLFW_EXPOSE_NATIVE_X11)
|
||||
check_symbol_exists(glfwGetX11Display "GLFW/glfw3.h;GLFW/glfw3native.h" GLFW_HAS_X11)
|
||||
unset(CMAKE_REQUIRED_DEFINITIONS)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
if (GLFW_HAS_X11)
|
||||
find_package(X11 REQUIRED)
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE X11::X11)
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE GET_KEYBOARD_INPUT_FROM_X11)
|
||||
endif (GLFW_HAS_X11)
|
||||
endif()
|
||||
|
||||
set_target_properties(${EXECUTABLE}
|
||||
PROPERTIES
|
||||
C_STANDARD 11
|
||||
C_EXTENSIONS OFF
|
||||
C_EXTENSIONS ${${PROJECT}_C_CXX_EXTENSIONS}
|
||||
C_STANDARD_REQUIRED ON
|
||||
CXX_STANDARD 11
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_EXTENSIONS ${${PROJECT}_C_CXX_EXTENSIONS}
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
|
||||
|
@ -141,3 +168,5 @@ if(${PROJECT}_INSTALL)
|
|||
install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
reVC_platform_target(${EXECUTABLE} INSTALL)
|
||||
|
|
|
@ -132,7 +132,7 @@ GetModelFromName(const char *name)
|
|||
}
|
||||
|
||||
uint32 hashKey = CKeyGen::GetUppercaseKey(name);
|
||||
for (i = 0; i < MODELINFOSIZE; i++) {
|
||||
for (i = 0; i < CModelInfo::GetNumModelInfos(); i++) {
|
||||
mi = CModelInfo::GetModelInfo(i);
|
||||
if (mi && mi->GetRwObject()
|
||||
&& RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
|
||||
|
|
|
@ -230,3 +230,9 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::Remove()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
void UpdateTimeStep(float timeDelta, float relSpeed);
|
||||
bool UpdateTime(float timeDelta, float relSpeed);
|
||||
bool UpdateBlend(float timeDelta);
|
||||
void Remove();
|
||||
|
||||
void SetRun(void) { flags |= ASSOC_RUNNING; }
|
||||
|
||||
|
|
|
@ -8,29 +8,46 @@
|
|||
#include "SurfaceTable.h"
|
||||
#include "sampman.h"
|
||||
|
||||
const int CollisionSoundIntensity = 60;
|
||||
|
||||
cAudioCollisionManager::cAudioCollisionManager()
|
||||
void
|
||||
cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
|
||||
float velocity)
|
||||
{
|
||||
m_sQueue.m_pEntity1 = nil;
|
||||
m_sQueue.m_pEntity2 = nil;
|
||||
m_sQueue.m_bSurface1 = SURFACE_DEFAULT;
|
||||
m_sQueue.m_bSurface2 = SURFACE_DEFAULT;
|
||||
m_sQueue.m_fIntensity2 = 0.0f;
|
||||
m_sQueue.m_fIntensity1 = 0.0f;
|
||||
m_sQueue.m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
float distSquared;
|
||||
CVector v1;
|
||||
CVector v2;
|
||||
|
||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_bIsPaused ||
|
||||
(velocity < 0.0016f && collisionPower < 0.01f))
|
||||
return;
|
||||
|
||||
m_bCollisionsInQueue = 0;
|
||||
if(entity1->IsBuilding()) {
|
||||
v1 = v2 = entity2->GetPosition();
|
||||
} else if(entity2->IsBuilding()) {
|
||||
v1 = v2 = entity1->GetPosition();
|
||||
} else {
|
||||
v1 = entity1->GetPosition();
|
||||
v2 = entity2->GetPosition();
|
||||
}
|
||||
CVector pos = (v1 + v2) * 0.5f;
|
||||
distSquared = GetDistanceSquared(pos);
|
||||
if(distSquared < SQR(COLLISION_MAX_DIST)) {
|
||||
m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
|
||||
m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
|
||||
m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
|
||||
m_sCollisionManager.m_sQueue.m_bSurface2 = surface2;
|
||||
m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower;
|
||||
m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity;
|
||||
m_sCollisionManager.m_sQueue.m_vecPosition = pos;
|
||||
m_sCollisionManager.m_sQueue.m_fDistance = distSquared;
|
||||
m_sCollisionManager.AddCollisionToRequestedQueue();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioCollisionManager::AddCollisionToRequestedQueue()
|
||||
{
|
||||
int32 collisionsIndex;
|
||||
int32 i;
|
||||
uint32 collisionsIndex;
|
||||
uint32 i;
|
||||
|
||||
|
||||
if (m_bCollisionsInQueue < NUMAUDIOCOLLISIONS)
|
||||
|
@ -55,139 +72,72 @@ cAudioCollisionManager::AddCollisionToRequestedQueue()
|
|||
m_bIndicesTable[i] = collisionsIndex;
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const
|
||||
{
|
||||
return GetCollisionRatio(c, 0.0f, 0.02f, 0.02f);
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionOneShotRatio(int32 a, float b) const
|
||||
{
|
||||
float result;
|
||||
|
||||
switch(a) {
|
||||
case SURFACE_DEFAULT:
|
||||
case SURFACE_TARMAC:
|
||||
case SURFACE_PAVEMENT:
|
||||
case SURFACE_STEEP_CLIFF:
|
||||
case SURFACE_TRANSPARENT_STONE:
|
||||
case SURFACE_CONCRETE_BEACH: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break;
|
||||
case SURFACE_GRASS:
|
||||
case SURFACE_GRAVEL:
|
||||
case SURFACE_MUD_DRY:
|
||||
case SURFACE_CARDBOARDBOX: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
|
||||
case SURFACE_CAR: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break;
|
||||
case SURFACE_GLASS:
|
||||
case SURFACE_METAL_CHAIN_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
|
||||
case SURFACE_TRANSPARENT_CLOTH:
|
||||
case SURFACE_THICK_METAL_PLATE: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break;
|
||||
case SURFACE_GARAGE_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break;
|
||||
case SURFACE_CAR_PANEL: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break;
|
||||
case SURFACE_SCAFFOLD_POLE:
|
||||
case SURFACE_METAL_GATE:
|
||||
case SURFACE_LAMP_POST: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
|
||||
case SURFACE_FIRE_HYDRANT: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break;
|
||||
case SURFACE_GIRDER: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break;
|
||||
case SURFACE_PED: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break;
|
||||
case SURFACE_SAND:
|
||||
case SURFACE_WATER:
|
||||
case SURFACE_RUBBER:
|
||||
case SURFACE_WHEELBASE:
|
||||
case SURFACE_SAND_BEACH: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
|
||||
case SURFACE_WOOD_CRATES: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break;
|
||||
case SURFACE_WOOD_BENCH: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break;
|
||||
case SURFACE_WOOD_SOLID: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break;
|
||||
case SURFACE_PLASTIC: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break;
|
||||
case SURFACE_HEDGE: result = GetCollisionRatio(b, 0.f, 0.5f, 0.5f); break;
|
||||
case SURFACE_CONTAINER: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break;
|
||||
case SURFACE_NEWS_VENDOR: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break;
|
||||
default: result = 0.f; break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionRatio(float a, float b, float c, float d) const
|
||||
{
|
||||
float e;
|
||||
e = a;
|
||||
if(a <= b) return 0.0f;
|
||||
if(c <= a) e = c;
|
||||
return (e - b) / d;
|
||||
}
|
||||
|
||||
uint32
|
||||
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
|
||||
{
|
||||
uint8 surface1 = audioCollision.m_bSurface1;
|
||||
uint8 surface2 = audioCollision.m_bSurface2;
|
||||
int32 vol;
|
||||
float ratio;
|
||||
|
||||
if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
|
||||
surface2 == SURFACE_HEDGE) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
|
||||
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
|
||||
vol = 50.f * ratio;
|
||||
} else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
|
||||
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
|
||||
vol = 30.f * ratio;
|
||||
} else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY || surface2 == SURFACE_MUD_DRY ||
|
||||
surface1 == SURFACE_SAND || surface2 == SURFACE_SAND || surface1 == SURFACE_SAND_BEACH || surface2 == SURFACE_SAND_BEACH) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
|
||||
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
|
||||
vol = 50.f * ratio;
|
||||
} else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
|
||||
return 0;
|
||||
} else {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
|
||||
m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
|
||||
vol = 40.f * ratio;
|
||||
}
|
||||
if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
|
||||
return vol;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
|
||||
cAudioManager::ServiceCollisions()
|
||||
{
|
||||
bool distCalculated = false;
|
||||
if(col.m_fIntensity2 > 0.0016f) {
|
||||
uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
|
||||
if(emittingVol) {
|
||||
CalculateDistance(distCalculated, m_sQueueSample.m_fDistance);
|
||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
||||
if(m_sQueueSample.m_nVolume) {
|
||||
m_sQueueSample.m_nCounter = counter;
|
||||
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_bIs2D = false;
|
||||
m_sQueueSample.m_nReleasingVolumeModificator = 7;
|
||||
m_sQueueSample.m_nLoopCount = 0;
|
||||
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
||||
m_sQueueSample.m_nLoopStart =
|
||||
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
|
||||
m_sQueueSample.m_nLoopEnd =
|
||||
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
|
||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
|
||||
m_sQueueSample.m_bReleasingSoundFlag = false;
|
||||
m_sQueueSample.m_nReleasingVolumeDivider = 5;
|
||||
m_sQueueSample.m_bReverbFlag = true;
|
||||
m_sQueueSample.m_bRequireReflection = false;
|
||||
AddSampleToRequestedQueue();
|
||||
int i, j;
|
||||
bool8 abRepeatedCollision1[NUMAUDIOCOLLISIONS];
|
||||
bool8 abRepeatedCollision2[NUMAUDIOCOLLISIONS];
|
||||
|
||||
m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
|
||||
|
||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
abRepeatedCollision1[i] = abRepeatedCollision2[i] = FALSE;
|
||||
|
||||
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
||||
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
||||
int index = m_sCollisionManager.m_bIndicesTable[i];
|
||||
if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
|
||||
) {
|
||||
abRepeatedCollision1[index] = TRUE;
|
||||
abRepeatedCollision2[j] = TRUE;
|
||||
m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
|
||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < NUMAUDIOCOLLISIONS; i++) {
|
||||
if (!abRepeatedCollision2[i]) {
|
||||
m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = SURFACE_DEFAULT;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fIntensity2 = 0.0f;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fIntensity1 = 0.0f;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fDistance = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
||||
int index = m_sCollisionManager.m_bIndicesTable[i];
|
||||
if (!abRepeatedCollision1[index]) {
|
||||
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
||||
if (!abRepeatedCollision2[j]) {
|
||||
m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_bSurface1 = m_sCollisionManager.m_asCollisions1[index].m_bSurface1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_bSurface2 = m_sCollisionManager.m_asCollisions1[index].m_bSurface2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
|
||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
m_sCollisionManager.m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||
m_sCollisionManager.m_bCollisionsInQueue = 0;
|
||||
}
|
||||
static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
|
||||
|
||||
static const uint32 gOneShotCol[] = {SFX_COL_TARMAC_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_GRAVEL_1,
|
||||
|
@ -226,11 +176,10 @@ static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
|
|||
void
|
||||
cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
||||
{
|
||||
uint16 s1;
|
||||
uint16 s2;
|
||||
|
||||
int16 s1;
|
||||
int16 s2;
|
||||
|
||||
int32 emittingVol;
|
||||
uint32 emittingVol;
|
||||
float ratio;
|
||||
|
||||
static uint16 counter = 28;
|
||||
|
@ -249,12 +198,12 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
|||
s1 = SURFACE_CAR_PANEL;
|
||||
ratio = Min(1.f, 2.f * ratio);
|
||||
}
|
||||
emittingVol = 40.f * ratio;
|
||||
emittingVol = 40 * ratio;
|
||||
if(emittingVol) {
|
||||
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
|
||||
m_sQueueSample.m_nVolume =
|
||||
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
||||
if(m_sQueueSample.m_nVolume) {
|
||||
ComputeVolume(emittingVol, COLLISION_MAX_DIST, m_sQueueSample.m_fDistance);
|
||||
if(m_sQueueSample.m_nVolume > 0) {
|
||||
m_sQueueSample.m_nSampleIndex = gOneShotCol[s1];
|
||||
switch(m_sQueueSample.m_nSampleIndex) {
|
||||
case SFX_COL_TARMAC_1:
|
||||
|
@ -311,17 +260,16 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
|||
if(counter >= 255) counter = 28;
|
||||
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_bIs2D = false;
|
||||
m_sQueueSample.m_nReleasingVolumeModificator = 11;
|
||||
m_sQueueSample.m_bIs2D = FALSE;
|
||||
m_sQueueSample.m_nPriority = 11;
|
||||
m_sQueueSample.m_nLoopCount = 1;
|
||||
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
||||
m_sQueueSample.m_nLoopStart = 0;
|
||||
m_sQueueSample.m_nLoopEnd = -1;
|
||||
SET_EMITTING_VOLUME(emittingVol);
|
||||
RESET_LOOP_OFFSETS
|
||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
|
||||
m_sQueueSample.m_bReleasingSoundFlag = true;
|
||||
m_sQueueSample.m_bReverbFlag = true;
|
||||
m_sQueueSample.m_bRequireReflection = false;
|
||||
m_sQueueSample.m_MaxDistance = COLLISION_MAX_DIST;
|
||||
m_sQueueSample.m_bStatic = TRUE;
|
||||
SET_SOUND_REVERB(TRUE);
|
||||
SET_SOUND_REFLECTION(FALSE);
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
}
|
||||
|
@ -329,101 +277,129 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
|||
}
|
||||
|
||||
void
|
||||
cAudioManager::ServiceCollisions()
|
||||
cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
|
||||
{
|
||||
int i, j;
|
||||
bool abRepeatedCollision1[NUMAUDIOCOLLISIONS];
|
||||
bool abRepeatedCollision2[NUMAUDIOCOLLISIONS];
|
||||
|
||||
m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
|
||||
|
||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
abRepeatedCollision1[i] = abRepeatedCollision2[i] = false;
|
||||
|
||||
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
||||
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
||||
int index = m_sCollisionManager.m_bIndicesTable[i];
|
||||
if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
|
||||
) {
|
||||
abRepeatedCollision1[index] = true;
|
||||
abRepeatedCollision2[j] = true;
|
||||
m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
|
||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||
break;
|
||||
bool8 distCalculated = FALSE;
|
||||
if(col.m_fIntensity2 > 0.0016f) {
|
||||
uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
|
||||
if(emittingVol) {
|
||||
CalculateDistance(distCalculated, m_sQueueSample.m_fDistance);
|
||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, COLLISION_MAX_DIST, m_sQueueSample.m_fDistance);
|
||||
if(m_sQueueSample.m_nVolume > 0) {
|
||||
m_sQueueSample.m_nCounter = counter;
|
||||
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_bIs2D = FALSE;
|
||||
m_sQueueSample.m_nPriority = 7;
|
||||
m_sQueueSample.m_nLoopCount = 0;
|
||||
SET_EMITTING_VOLUME(emittingVol);
|
||||
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
|
||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||
m_sQueueSample.m_MaxDistance = COLLISION_MAX_DIST;
|
||||
m_sQueueSample.m_bStatic = FALSE;
|
||||
m_sQueueSample.m_nFramesToPlay = 5;
|
||||
SET_SOUND_REVERB(TRUE);
|
||||
SET_SOUND_REFLECTION(FALSE);
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < NUMAUDIOCOLLISIONS; i++) {
|
||||
if (!abRepeatedCollision2[i]) {
|
||||
m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = SURFACE_DEFAULT;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fIntensity2 = 0.0f;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fIntensity1 = 0.0f;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fDistance = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
||||
int index = m_sCollisionManager.m_bIndicesTable[i];
|
||||
if (!abRepeatedCollision1[index]) {
|
||||
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
||||
if (!abRepeatedCollision2[j]) {
|
||||
m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_bSurface1 = m_sCollisionManager.m_asCollisions1[index].m_bSurface1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_bSurface2 = m_sCollisionManager.m_asCollisions1[index].m_bSurface2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
|
||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
m_sCollisionManager.m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||
m_sCollisionManager.m_bCollisionsInQueue = 0;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
|
||||
float velocity)
|
||||
uint32
|
||||
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
|
||||
{
|
||||
float distSquared;
|
||||
CVector v1;
|
||||
CVector v2;
|
||||
uint8 surface1 = audioCollision.m_bSurface1;
|
||||
uint8 surface2 = audioCollision.m_bSurface2;
|
||||
int32 vol;
|
||||
float ratio;
|
||||
|
||||
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
|
||||
(velocity < 0.0016f && collisionPower < 0.01f))
|
||||
return;
|
||||
|
||||
if(entity1->IsBuilding()) {
|
||||
v1 = v2 = entity2->GetPosition();
|
||||
} else if(entity2->IsBuilding()) {
|
||||
v1 = v2 = entity1->GetPosition();
|
||||
if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
|
||||
surface2 == SURFACE_HEDGE) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
|
||||
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
|
||||
vol = 50.f * ratio;
|
||||
} else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
|
||||
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
|
||||
vol = 30.f * ratio;
|
||||
} else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY || surface2 == SURFACE_MUD_DRY ||
|
||||
surface1 == SURFACE_SAND || surface2 == SURFACE_SAND || surface1 == SURFACE_SAND_BEACH || surface2 == SURFACE_SAND_BEACH) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
|
||||
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
|
||||
vol = 50.f * ratio;
|
||||
} else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
|
||||
return 0;
|
||||
} else {
|
||||
v1 = entity1->GetPosition();
|
||||
v2 = entity2->GetPosition();
|
||||
}
|
||||
CVector pos = (v1 + v2) * 0.5f;
|
||||
distSquared = GetDistanceSquared(pos);
|
||||
if(distSquared < SQR(CollisionSoundIntensity)) {
|
||||
m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
|
||||
m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
|
||||
m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
|
||||
m_sCollisionManager.m_sQueue.m_bSurface2 = surface2;
|
||||
m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower;
|
||||
m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity;
|
||||
m_sCollisionManager.m_sQueue.m_vecPosition = pos;
|
||||
m_sCollisionManager.m_sQueue.m_fDistance = distSquared;
|
||||
m_sCollisionManager.AddCollisionToRequestedQueue();
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
|
||||
m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
|
||||
vol = 40.f * ratio;
|
||||
}
|
||||
if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
|
||||
return vol;
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionOneShotRatio(uint32 a, float b)
|
||||
{
|
||||
switch(a) {
|
||||
case SURFACE_DEFAULT:
|
||||
case SURFACE_TARMAC:
|
||||
case SURFACE_PAVEMENT:
|
||||
case SURFACE_STEEP_CLIFF:
|
||||
case SURFACE_TRANSPARENT_STONE:
|
||||
case SURFACE_CONCRETE_BEACH: return GetCollisionRatio(b, 10.f, 60.f, 50.f);
|
||||
case SURFACE_GRASS:
|
||||
case SURFACE_GRAVEL:
|
||||
case SURFACE_MUD_DRY:
|
||||
case SURFACE_CARDBOARDBOX: return GetCollisionRatio(b, 0.f, 2.f, 2.f);
|
||||
case SURFACE_CAR: return GetCollisionRatio(b, 6.f, 50.f, 44.f);
|
||||
case SURFACE_GLASS:
|
||||
case SURFACE_METAL_CHAIN_FENCE: return GetCollisionRatio(b, 0.1f, 10.f, 9.9f);
|
||||
case SURFACE_TRANSPARENT_CLOTH:
|
||||
case SURFACE_THICK_METAL_PLATE: return GetCollisionRatio(b, 30.f, 130.f, 100.f);
|
||||
case SURFACE_GARAGE_DOOR: return GetCollisionRatio(b, 20.f, 100.f, 80.f);
|
||||
case SURFACE_CAR_PANEL: return GetCollisionRatio(b, 0.f, 4.f, 4.f);
|
||||
case SURFACE_SCAFFOLD_POLE:
|
||||
case SURFACE_METAL_GATE:
|
||||
case SURFACE_LAMP_POST: return GetCollisionRatio(b, 1.f, 10.f, 9.f);
|
||||
case SURFACE_FIRE_HYDRANT: return GetCollisionRatio(b, 1.f, 15.f, 14.f);
|
||||
case SURFACE_GIRDER: return GetCollisionRatio(b, 8.f, 50.f, 42.f);
|
||||
case SURFACE_PED: return GetCollisionRatio(b, 0.f, 20.f, 20.f);
|
||||
case SURFACE_SAND:
|
||||
case SURFACE_WATER:
|
||||
case SURFACE_RUBBER:
|
||||
case SURFACE_WHEELBASE:
|
||||
case SURFACE_SAND_BEACH: return GetCollisionRatio(b, 0.f, 10.f, 10.f);
|
||||
case SURFACE_WOOD_CRATES: return GetCollisionRatio(b, 1.f, 4.f, 3.f);
|
||||
case SURFACE_WOOD_BENCH: return GetCollisionRatio(b, 0.1f, 5.f, 4.9f);
|
||||
case SURFACE_WOOD_SOLID: return GetCollisionRatio(b, 0.1f, 40.f, 39.9f);
|
||||
case SURFACE_PLASTIC: return GetCollisionRatio(b, 0.1f, 4.f, 3.9f);
|
||||
case SURFACE_HEDGE: return GetCollisionRatio(b, 0.f, 0.5f, 0.5f);
|
||||
case SURFACE_CONTAINER: return GetCollisionRatio(b, 4.f, 40.f, 36.f);
|
||||
case SURFACE_NEWS_VENDOR: return GetCollisionRatio(b, 0.f, 5.f, 5.f);
|
||||
default: break;
|
||||
}
|
||||
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c)
|
||||
{
|
||||
return GetCollisionRatio(c, 0.0f, 0.02f, 0.02f);
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionRatio(float a, float b, float c, float d)
|
||||
{
|
||||
float e;
|
||||
e = a;
|
||||
if(a <= b) return 0.0f;
|
||||
if(c <= a) e = c;
|
||||
return (e - b) / d;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#define NUMAUDIOCOLLISIONS 10
|
||||
#define NUMAUDIOCOLLISIONS 14
|
||||
|
||||
class CEntity;
|
||||
|
||||
|
@ -17,7 +17,18 @@ public:
|
|||
float m_fDistance;
|
||||
int32 m_nBaseVolume;
|
||||
|
||||
// no methods
|
||||
cAudioCollision() { Reset(); }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_pEntity1 = nil;
|
||||
m_pEntity2 = nil;
|
||||
m_bSurface1 = 0;
|
||||
m_bSurface2 = 0;
|
||||
m_fIntensity1 = m_fIntensity2 = 0.0f;
|
||||
m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_fDistance = 0.0f;
|
||||
}
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cAudioCollision, 40);
|
||||
|
@ -31,7 +42,15 @@ public:
|
|||
uint8 m_bCollisionsInQueue;
|
||||
cAudioCollision m_sQueue;
|
||||
|
||||
cAudioCollisionManager();
|
||||
cAudioCollisionManager()
|
||||
{
|
||||
m_sQueue.Reset();
|
||||
|
||||
for(int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||
|
||||
m_bCollisionsInQueue = 0;
|
||||
}
|
||||
void AddCollisionToRequestedQueue();
|
||||
};
|
||||
|
||||
|
|
15187
src/audio/AudioLogic.cpp
15187
src/audio/AudioLogic.cpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -3,6 +3,7 @@
|
|||
#include "AudioScriptObject.h"
|
||||
#include "Pools.h"
|
||||
#include "DMAudio.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
cAudioScriptObject::cAudioScriptObject()
|
||||
{
|
||||
|
@ -23,25 +24,25 @@ cAudioScriptObject::Reset()
|
|||
}
|
||||
|
||||
void *
|
||||
cAudioScriptObject::operator new(size_t sz)
|
||||
cAudioScriptObject::operator new(size_t sz) throw()
|
||||
{
|
||||
return CPools::GetAudioScriptObjectPool()->New();
|
||||
}
|
||||
|
||||
void *
|
||||
cAudioScriptObject::operator new(size_t sz, int handle)
|
||||
cAudioScriptObject::operator new(size_t sz, int handle) throw()
|
||||
{
|
||||
return CPools::GetAudioScriptObjectPool()->New(handle);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioScriptObject::operator delete(void *p, size_t sz)
|
||||
cAudioScriptObject::operator delete(void *p, size_t sz) throw()
|
||||
{
|
||||
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioScriptObject::operator delete(void *p, int handle)
|
||||
cAudioScriptObject::operator delete(void *p, int handle) throw()
|
||||
{
|
||||
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
||||
}
|
||||
|
@ -53,12 +54,14 @@ cAudioScriptObject::LoadAllAudioScriptObjects(uint8 *buf, uint32 size)
|
|||
|
||||
CheckSaveHeader(buf, 'A', 'U', 'D', '\0', size - SAVE_HEADER_SIZE);
|
||||
|
||||
int32 pool_size = ReadSaveBuf<int32>(buf);
|
||||
int32 pool_size;
|
||||
ReadSaveBuf(&pool_size, buf);
|
||||
for (int32 i = 0; i < pool_size; i++) {
|
||||
int handle = ReadSaveBuf<int32>(buf);
|
||||
int32 handle;
|
||||
ReadSaveBuf(&handle, buf);
|
||||
cAudioScriptObject *p = new(handle) cAudioScriptObject;
|
||||
assert(p != nil);
|
||||
*p = ReadSaveBuf<cAudioScriptObject>(buf);
|
||||
ReadSaveBuf(p, buf);
|
||||
p->AudioEntity = DMAudio.CreateLoopingScriptObject(p);
|
||||
}
|
||||
|
||||
|
@ -90,6 +93,8 @@ cAudioScriptObject::SaveAllAudioScriptObjects(uint8 *buf, uint32 *size)
|
|||
void
|
||||
PlayOneShotScriptObject(uint8 id, CVector const &pos)
|
||||
{
|
||||
if (!DMAudio.IsAudioInitialised()) return;
|
||||
|
||||
cAudioScriptObject *audioScriptObject = new cAudioScriptObject();
|
||||
audioScriptObject->Posn = pos;
|
||||
audioScriptObject->AudioId = id;
|
||||
|
|
|
@ -12,10 +12,10 @@ public:
|
|||
|
||||
void Reset(); /// ok
|
||||
|
||||
static void* operator new(size_t);
|
||||
static void* operator new(size_t, int);
|
||||
static void operator delete(void*, size_t);
|
||||
static void operator delete(void*, int);
|
||||
static void* operator new(size_t) throw();
|
||||
static void* operator new(size_t, int) throw();
|
||||
static void operator delete(void*, size_t) throw();
|
||||
static void operator delete(void*, int) throw();
|
||||
|
||||
static void LoadAllAudioScriptObjects(uint8 *buf, uint32 size);
|
||||
static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size);
|
||||
|
|
|
@ -38,8 +38,14 @@ cDMAudio::DestroyEntity(int32 audioEntity)
|
|||
AudioManager.DestroyEntity(audioEntity);
|
||||
}
|
||||
|
||||
bool8
|
||||
cDMAudio::GetEntityStatus(int32 audioEntity)
|
||||
{
|
||||
return AudioManager.GetEntityStatus(audioEntity);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetEntityStatus(int32 audioEntity, uint8 status)
|
||||
cDMAudio::SetEntityStatus(int32 audioEntity, bool8 status)
|
||||
{
|
||||
AudioManager.SetEntityStatus(audioEntity, status);
|
||||
}
|
||||
|
@ -57,9 +63,9 @@ cDMAudio::DestroyAllGameCreatedEntities(void)
|
|||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetMonoMode(uint8 mono)
|
||||
cDMAudio::SetOutputMode(bool8 surround)
|
||||
{
|
||||
AudioManager.SetMonoMode(mono);
|
||||
AudioManager.SetOutputMode(surround);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -142,7 +148,7 @@ cDMAudio::SetSpeakerConfig(int32 config)
|
|||
AudioManager.SetSpeakerConfig(config);
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cDMAudio::IsMP3RadioChannelAvailable(void)
|
||||
{
|
||||
return AudioManager.IsMP3RadioChannelAvailable();
|
||||
|
@ -161,12 +167,14 @@ cDMAudio::ReacquireDigitalHandle(void)
|
|||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetDynamicAcousticModelingStatus(uint8 status)
|
||||
cDMAudio::SetDynamicAcousticModelingStatus(bool8 status)
|
||||
{
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
AudioManager.SetDynamicAcousticModelingStatus(status);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cDMAudio::CheckForAnAudioFileOnCD(void)
|
||||
{
|
||||
return AudioManager.CheckForAnAudioFileOnCD();
|
||||
|
@ -178,12 +186,18 @@ cDMAudio::GetCDAudioDriveLetter(void)
|
|||
return AudioManager.GetCDAudioDriveLetter();
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cDMAudio::IsAudioInitialised(void)
|
||||
{
|
||||
return AudioManager.IsAudioInitialised();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ResetPoliceRadio()
|
||||
{
|
||||
AudioManager.ResetPoliceRadio();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
|
||||
{
|
||||
|
@ -196,7 +210,7 @@ cDMAudio::CreateLoopingScriptObject(cAudioScriptObject *scriptObject)
|
|||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
||||
|
||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||
AudioManager.SetEntityStatus(audioEntity, true);
|
||||
AudioManager.SetEntityStatus(audioEntity, TRUE);
|
||||
|
||||
return audioEntity;
|
||||
}
|
||||
|
@ -214,7 +228,7 @@ cDMAudio::CreateOneShotScriptObject(cAudioScriptObject *scriptObject)
|
|||
|
||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||
{
|
||||
AudioManager.SetEntityStatus(audioEntity, true);
|
||||
AudioManager.SetEntityStatus(audioEntity, TRUE);
|
||||
AudioManager.PlayOneShot(audioEntity, scriptObject->AudioId, 0.0f);
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +258,7 @@ cDMAudio::PlayRadioAnnouncement(uint32 announcement)
|
|||
}
|
||||
|
||||
void
|
||||
cDMAudio::PlayFrontEndTrack(uint32 track, uint8 frontendFlag)
|
||||
cDMAudio::PlayFrontEndTrack(uint32 track, bool8 frontendFlag)
|
||||
{
|
||||
MusicManager.PlayFrontEndTrack(track, frontendFlag);
|
||||
}
|
||||
|
@ -309,7 +323,13 @@ cDMAudio::PlayLoadedMissionAudio(uint8 slot)
|
|||
AudioManager.PlayLoadedMissionAudio(slot);
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cDMAudio::IsMissionAudioSamplePlaying(uint8 slot)
|
||||
{
|
||||
return AudioManager.IsMissionAudioSamplePlaying(slot);
|
||||
}
|
||||
|
||||
bool8
|
||||
cDMAudio::IsMissionAudioSampleFinished(uint8 slot)
|
||||
{
|
||||
return AudioManager.IsMissionAudioSampleFinished(slot);
|
||||
|
@ -321,6 +341,12 @@ cDMAudio::ClearMissionAudio(uint8 slot)
|
|||
AudioManager.ClearMissionAudio(slot);
|
||||
}
|
||||
|
||||
const char *
|
||||
cDMAudio::GetMissionAudioLoadedLabel(uint8 slot)
|
||||
{
|
||||
return AudioManager.GetMissionAudioLoadedLabel(slot);
|
||||
}
|
||||
|
||||
uint8
|
||||
cDMAudio::GetRadioInCar(void)
|
||||
{
|
||||
|
@ -340,7 +366,7 @@ cDMAudio::SetRadioChannel(uint32 radio, int32 pos)
|
|||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetStartingTrackPositions(uint8 isStartGame)
|
||||
cDMAudio::SetStartingTrackPositions(bool8 isStartGame)
|
||||
{
|
||||
MusicManager.SetStartingTrackPositions(isStartGame);
|
||||
}
|
||||
|
@ -364,7 +390,7 @@ cDMAudio::GetRadioPosition(uint32 station)
|
|||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetPedTalkingStatus(CPed *ped, uint8 status)
|
||||
cDMAudio::SetPedTalkingStatus(CPed *ped, bool8 status)
|
||||
{
|
||||
return AudioManager.SetPedTalkingStatus(ped, status);
|
||||
}
|
||||
|
@ -376,7 +402,7 @@ cDMAudio::SetPlayersMood(uint8 mood, uint32 time)
|
|||
}
|
||||
|
||||
void
|
||||
cDMAudio::ShutUpPlayerTalking(uint8 state)
|
||||
cDMAudio::ShutUpPlayerTalking(bool8 state)
|
||||
{
|
||||
AudioManager.m_bIsPlayerShutUp = state;
|
||||
}
|
|
@ -25,11 +25,12 @@ public:
|
|||
|
||||
int32 CreateEntity(eAudioType type, void *UID);
|
||||
void DestroyEntity(int32 audioEntity);
|
||||
void SetEntityStatus(int32 audioEntity, uint8 status);
|
||||
bool8 GetEntityStatus(int32 audioEntity);
|
||||
void SetEntityStatus(int32 audioEntity, bool8 status);
|
||||
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
|
||||
void DestroyAllGameCreatedEntities(void);
|
||||
|
||||
void SetMonoMode(uint8 mono);
|
||||
void SetOutputMode(bool8 surround);
|
||||
void SetMP3BoostVolume(uint8 volume);
|
||||
void SetEffectsMasterVolume(uint8 volume);
|
||||
void SetMusicMasterVolume(uint8 volume);
|
||||
|
@ -46,18 +47,19 @@ public:
|
|||
|
||||
void SetSpeakerConfig(int32 config);
|
||||
|
||||
bool IsMP3RadioChannelAvailable(void);
|
||||
bool8 IsMP3RadioChannelAvailable(void);
|
||||
|
||||
void ReleaseDigitalHandle(void);
|
||||
void ReacquireDigitalHandle(void);
|
||||
|
||||
void SetDynamicAcousticModelingStatus(uint8 status);
|
||||
void SetDynamicAcousticModelingStatus(bool8 status);
|
||||
|
||||
bool CheckForAnAudioFileOnCD(void);
|
||||
bool8 CheckForAnAudioFileOnCD(void);
|
||||
|
||||
char GetCDAudioDriveLetter(void);
|
||||
bool IsAudioInitialised(void);
|
||||
|
||||
bool8 IsAudioInitialised(void);
|
||||
|
||||
void ResetPoliceRadio();
|
||||
void ReportCrime(eCrimeType crime, CVector const &pos);
|
||||
|
||||
int32 CreateLoopingScriptObject(cAudioScriptObject *scriptObject);
|
||||
|
@ -70,7 +72,7 @@ public:
|
|||
|
||||
void PlayFrontEndSound(uint16 frontend, uint32 volume);
|
||||
void PlayRadioAnnouncement(uint32 announcement);
|
||||
void PlayFrontEndTrack(uint32 track, uint8 frontendFlag);
|
||||
void PlayFrontEndTrack(uint32 track, bool8 frontendFlag);
|
||||
void StopFrontEndTrack(void);
|
||||
|
||||
void ResetTimers(uint32 time);
|
||||
|
@ -85,19 +87,21 @@ public:
|
|||
uint8 GetMissionAudioLoadingStatus(uint8 slot);
|
||||
void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
|
||||
void PlayLoadedMissionAudio(uint8 slot);
|
||||
bool IsMissionAudioSampleFinished(uint8 slot);
|
||||
bool8 IsMissionAudioSamplePlaying(uint8 slot);
|
||||
bool8 IsMissionAudioSampleFinished(uint8 slot);
|
||||
void ClearMissionAudio(uint8 slot);
|
||||
const char *GetMissionAudioLoadedLabel(uint8 slot);
|
||||
|
||||
uint8 GetRadioInCar(void);
|
||||
void SetRadioInCar(uint32 radio);
|
||||
void SetRadioChannel(uint32 radio, int32 pos);
|
||||
|
||||
void SetStartingTrackPositions(uint8 isStartGame);
|
||||
void SetStartingTrackPositions(bool8 isStartGame);
|
||||
float *GetListenTimeArray();
|
||||
uint32 GetFavouriteRadioStation();
|
||||
int32 GetRadioPosition(uint32 station);
|
||||
void SetPedTalkingStatus(class CPed *ped, uint8 status);
|
||||
void SetPedTalkingStatus(class CPed *ped, bool8 status);
|
||||
void SetPlayersMood(uint8 mood, uint32 time);
|
||||
void ShutUpPlayerTalking(uint8 state);
|
||||
void ShutUpPlayerTalking(bool8 state);
|
||||
};
|
||||
extern cDMAudio DMAudio;
|
||||
|
|
|
@ -28,7 +28,7 @@ static_assert(false, "R*'s radio implementation is quite buggy, RADIO_SCROLL_TO_
|
|||
cMusicManager MusicManager;
|
||||
int32 gNumRetunePresses;
|
||||
int32 gRetuneCounter;
|
||||
bool g_bAnnouncementReadPosAlready;
|
||||
bool8 g_bAnnouncementReadPosAlready;
|
||||
uint8 RadioStaticCounter = 5;
|
||||
uint32 RadioStaticTimer;
|
||||
|
||||
|
@ -50,13 +50,13 @@ uint32 NewGameRadioTimers[10] =
|
|||
|
||||
cMusicManager::cMusicManager()
|
||||
{
|
||||
m_bIsInitialised = false;
|
||||
m_bDisabled = false;
|
||||
m_bIsInitialised = FALSE;
|
||||
m_bDisabled = FALSE;
|
||||
m_nFrontendTrack = NO_TRACK;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
m_nUpcomingMusicMode = MUSICMODE_DISABLED;
|
||||
m_nMusicMode = MUSICMODE_DISABLED;
|
||||
m_bSetNextStation = false;
|
||||
m_bSetNextStation = FALSE;
|
||||
|
||||
for (int i = 0; i < NUM_RADIOS; i++)
|
||||
aListenTimeArray[i] = 0.0f;
|
||||
|
@ -66,7 +66,7 @@ cMusicManager::cMusicManager()
|
|||
m_nCurrentVolume = 0;
|
||||
m_nMaxVolume = 0;
|
||||
m_nAnnouncement = NO_TRACK;
|
||||
m_bAnnouncementInProgress = false;
|
||||
m_bAnnouncementInProgress = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -74,38 +74,38 @@ cMusicManager::ResetMusicAfterReload()
|
|||
{
|
||||
float afRadioTime[NUM_RADIOS];
|
||||
|
||||
m_bRadioSetByScript = false;
|
||||
m_bRadioSetByScript = FALSE;
|
||||
m_nRadioStationScript = WILDSTYLE;
|
||||
m_nRadioPosition = -1;
|
||||
m_nAnnouncement = NO_TRACK;
|
||||
m_bAnnouncementInProgress = false;
|
||||
m_bSetNextStation = false;
|
||||
m_bAnnouncementInProgress = FALSE;
|
||||
m_bSetNextStation = FALSE;
|
||||
RadioStaticTimer = 0;
|
||||
gNumRetunePresses = 0;
|
||||
gRetuneCounter = 0;
|
||||
m_nFrontendTrack = NO_TRACK;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
m_FrontendLoopFlag = false;
|
||||
m_bTrackChangeStarted = false;
|
||||
m_FrontendLoopFlag = FALSE;
|
||||
m_bTrackChangeStarted = FALSE;
|
||||
m_nNextTrack = NO_TRACK;
|
||||
m_nNextLoopFlag = false;
|
||||
m_bVerifyNextTrackStartedToPlay = false;
|
||||
m_bGameplayAllowsRadio = false;
|
||||
m_bRadioStreamReady = false;
|
||||
m_nNextLoopFlag = FALSE;
|
||||
m_bVerifyNextTrackStartedToPlay = FALSE;
|
||||
m_bGameplayAllowsRadio = FALSE;
|
||||
m_bRadioStreamReady = FALSE;
|
||||
nFramesSinceCutsceneEnded = -1;
|
||||
m_bUserResumedGame = false;
|
||||
m_bMusicModeChangeStarted = false;
|
||||
m_bEarlyFrontendTrack = false;
|
||||
m_bUserResumedGame = FALSE;
|
||||
m_bMusicModeChangeStarted = FALSE;
|
||||
m_bEarlyFrontendTrack = FALSE;
|
||||
m_nVolumeLatency = 0;
|
||||
m_nCurrentVolume = 0;
|
||||
m_nMaxVolume = 0;
|
||||
|
||||
bool bRadioWasEverListened = false;
|
||||
bool8 bRadioWasEverListened = FALSE;
|
||||
|
||||
for (int i = 0; i < NUM_RADIOS; i++) {
|
||||
afRadioTime[i] = CStats::GetFavoriteRadioStationList(i);
|
||||
if (!bRadioWasEverListened && afRadioTime[i] != 0.0f)
|
||||
bRadioWasEverListened = true;
|
||||
bRadioWasEverListened = TRUE;
|
||||
}
|
||||
|
||||
if (!bRadioWasEverListened) return;
|
||||
|
@ -125,30 +125,30 @@ cMusicManager::ResetMusicAfterReload()
|
|||
}
|
||||
|
||||
void
|
||||
cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer)
|
||||
cMusicManager::SetStartingTrackPositions(bool8 isNewGameTimer)
|
||||
{
|
||||
int pos;
|
||||
|
||||
if (IsInitialised()) {
|
||||
time_t timevalue = time(0);
|
||||
if (timevalue == -1) {
|
||||
pos = AudioManager.GetRandomNumber(0);
|
||||
pos = AudioManager.m_anRandomTable[0];
|
||||
} else {
|
||||
tm* pTm = localtime(&timevalue);
|
||||
if (pTm->tm_sec == 0)
|
||||
pTm->tm_sec = AudioManager.GetRandomNumber(0);
|
||||
pTm->tm_sec = AudioManager.m_anRandomTable[0];
|
||||
if (pTm->tm_min == 0)
|
||||
pTm->tm_min = AudioManager.GetRandomNumber(1);
|
||||
pTm->tm_min = AudioManager.m_anRandomTable[1];
|
||||
if (pTm->tm_hour == 0)
|
||||
pTm->tm_hour = AudioManager.GetRandomNumber(2);
|
||||
pTm->tm_hour = AudioManager.m_anRandomTable[2];
|
||||
if (pTm->tm_mday == 0)
|
||||
pTm->tm_mday = AudioManager.GetRandomNumber(3);
|
||||
pTm->tm_mday = AudioManager.m_anRandomTable[3];
|
||||
if (pTm->tm_mon == 0)
|
||||
pTm->tm_mon = AudioManager.GetRandomNumber(4);
|
||||
pTm->tm_mon = AudioManager.m_anRandomTable[4];
|
||||
if (pTm->tm_year == 0)
|
||||
pTm->tm_year = AudioManager.GetRandomNumber(3);
|
||||
pTm->tm_year = AudioManager.m_anRandomTable[3];
|
||||
if (pTm->tm_wday == 0)
|
||||
pTm->tm_wday = AudioManager.GetRandomNumber(2);
|
||||
pTm->tm_wday = AudioManager.m_anRandomTable[2];
|
||||
pos = pTm->tm_yday
|
||||
* pTm->tm_wday
|
||||
* pTm->tm_year
|
||||
|
@ -174,15 +174,15 @@ cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cMusicManager::Initialise()
|
||||
{
|
||||
if (!IsInitialised()) {
|
||||
m_bIsInitialised = true;
|
||||
SetStartingTrackPositions(false);
|
||||
m_bResetTimers = false;
|
||||
m_bIsInitialised = TRUE;
|
||||
SetStartingTrackPositions(FALSE);
|
||||
m_bResetTimers = FALSE;
|
||||
m_nResetTime = 0;
|
||||
m_bRadioSetByScript = false;
|
||||
m_bRadioSetByScript = FALSE;
|
||||
m_nRadioStationScript = WILDSTYLE;
|
||||
m_nRadioPosition = -1;
|
||||
m_nRadioInCar = NO_TRACK;
|
||||
|
@ -192,18 +192,18 @@ cMusicManager::Initialise()
|
|||
m_nPlayingTrack = NO_TRACK;
|
||||
m_nUpcomingMusicMode = MUSICMODE_DISABLED;
|
||||
m_nMusicMode = MUSICMODE_DISABLED;
|
||||
m_FrontendLoopFlag = false;
|
||||
m_bTrackChangeStarted = false;
|
||||
m_FrontendLoopFlag = FALSE;
|
||||
m_bTrackChangeStarted = FALSE;
|
||||
m_nNextTrack = NO_TRACK;
|
||||
m_nNextLoopFlag = false;
|
||||
m_bVerifyNextTrackStartedToPlay = false;
|
||||
m_bGameplayAllowsRadio = false;
|
||||
m_bRadioStreamReady = false;
|
||||
m_nNextLoopFlag = FALSE;
|
||||
m_bVerifyNextTrackStartedToPlay = FALSE;
|
||||
m_bGameplayAllowsRadio = FALSE;
|
||||
m_bRadioStreamReady = FALSE;
|
||||
nFramesSinceCutsceneEnded = -1;
|
||||
m_bUserResumedGame = false;
|
||||
m_bMusicModeChangeStarted = false;
|
||||
m_bUserResumedGame = FALSE;
|
||||
m_bMusicModeChangeStarted = FALSE;
|
||||
m_nMusicModeToBeSet = MUSICMODE_DISABLED;
|
||||
m_bEarlyFrontendTrack = false;
|
||||
m_bEarlyFrontendTrack = FALSE;
|
||||
m_nVolumeLatency = 0;
|
||||
m_nCurrentVolume = 0;
|
||||
m_nMaxVolume = 0;
|
||||
|
@ -216,11 +216,11 @@ cMusicManager::Terminate()
|
|||
{
|
||||
if (!IsInitialised()) return;
|
||||
|
||||
if (SampleManager.IsStreamPlaying(0)) {
|
||||
SampleManager.StopStreamedFile(0);
|
||||
if (SampleManager.IsStreamPlaying()) {
|
||||
SampleManager.StopStreamedFile();
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
}
|
||||
m_bIsInitialised = false;
|
||||
m_bIsInitialised = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -230,29 +230,29 @@ cMusicManager::SetRadioChannelByScript(uint32 station, int32 pos)
|
|||
if (station == STREAMED_SOUND_RADIO_MP3_PLAYER)
|
||||
station = STREAMED_SOUND_CITY_AMBIENT;
|
||||
if (station <= STREAMED_SOUND_RADIO_POLICE) {
|
||||
m_bRadioSetByScript = true;
|
||||
m_bRadioSetByScript = TRUE;
|
||||
m_nRadioStationScript = station;
|
||||
m_nRadioPosition = pos == -1 ? -1 : pos % m_aTracks[station].m_nLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cMusicManager::PlayerInCar()
|
||||
{
|
||||
CVehicle *vehicle = AudioManager.FindVehicleOfPlayer();
|
||||
if(!vehicle)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
int32 State = FindPlayerPed()->m_nPedState;
|
||||
|
||||
if(State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
if (vehicle->GetStatus() == STATUS_WRECKED)
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
uint32
|
||||
|
@ -263,7 +263,7 @@ cMusicManager::GetRadioInCar(void)
|
|||
CVehicle* veh = AudioManager.FindVehicleOfPlayer();
|
||||
if (veh != nil) {
|
||||
if (UsesPoliceRadio(veh) || UsesTaxiRadio(veh)) {
|
||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
|
||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_bIsPaused))
|
||||
return STREAMED_SOUND_RADIO_POLICE;
|
||||
return m_nRadioInCar;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ cMusicManager::GetRadioInCar(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
|
||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_bIsPaused))
|
||||
return RADIO_OFF;
|
||||
return m_nRadioInCar;
|
||||
}
|
||||
|
@ -310,31 +310,42 @@ cMusicManager::ChangeMusicMode(uint8 mode)
|
|||
|
||||
switch (mode)
|
||||
{
|
||||
case MUSICMODE_FRONTEND: m_nUpcomingMusicMode = MUSICMODE_FRONTEND; break;
|
||||
case MUSICMODE_FRONTEND:
|
||||
m_nUpcomingMusicMode = MUSICMODE_FRONTEND;
|
||||
|
||||
#ifdef PAUSE_RADIO_IN_FRONTEND
|
||||
// rewind those streams we weren't listening right now
|
||||
for( uint32 i = STREAMED_SOUND_RADIO_HEAD; i < STREAMED_SOUND_CUTSCENE_BIKER; i++ ) {
|
||||
m_aTracks[i].m_nPosition = GetTrackStartPos(i);
|
||||
m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
case MUSICMODE_GAME: m_nUpcomingMusicMode = MUSICMODE_GAME; break;
|
||||
case MUSICMODE_CUTSCENE:
|
||||
m_nUpcomingMusicMode = MUSICMODE_CUTSCENE;
|
||||
if (SampleManager.IsStreamPlaying(0)) {
|
||||
if (SampleManager.IsStreamPlaying()) {
|
||||
if (m_nPlayingTrack != NO_TRACK) {
|
||||
RecordRadioStats();
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition();
|
||||
m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
}
|
||||
}
|
||||
SampleManager.StopStreamedFile(0);
|
||||
while (SampleManager.IsStreamPlaying(0))
|
||||
SampleManager.StopStreamedFile(0);
|
||||
SampleManager.StopStreamedFile();
|
||||
while (SampleManager.IsStreamPlaying())
|
||||
SampleManager.StopStreamedFile();
|
||||
m_nMusicMode = m_nUpcomingMusicMode;
|
||||
m_bMusicModeChangeStarted = false;
|
||||
m_bTrackChangeStarted = false;
|
||||
m_bMusicModeChangeStarted = FALSE;
|
||||
m_bTrackChangeStarted = FALSE;
|
||||
m_nNextTrack = NO_TRACK;
|
||||
m_nNextLoopFlag = false;
|
||||
m_bVerifyNextTrackStartedToPlay = false;
|
||||
m_nNextLoopFlag = FALSE;
|
||||
m_bVerifyNextTrackStartedToPlay = FALSE;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
m_nFrontendTrack = NO_TRACK;
|
||||
m_bAnnouncementInProgress = false;
|
||||
m_bAnnouncementInProgress = FALSE;
|
||||
m_nAnnouncement = NO_TRACK;
|
||||
g_bAnnouncementReadPosAlready = false;
|
||||
g_bAnnouncementReadPosAlready = FALSE;
|
||||
break;
|
||||
case MUSICMODE_DISABLE: m_nUpcomingMusicMode = MUSICMODE_DISABLED; break;
|
||||
default: return;
|
||||
|
@ -342,9 +353,9 @@ cMusicManager::ChangeMusicMode(uint8 mode)
|
|||
}
|
||||
|
||||
void
|
||||
cMusicManager::ResetTimers(int32 time)
|
||||
cMusicManager::ResetTimers(uint32 time)
|
||||
{
|
||||
m_bResetTimers = true;
|
||||
m_bResetTimers = TRUE;
|
||||
m_nResetTime = time;
|
||||
}
|
||||
|
||||
|
@ -352,56 +363,56 @@ void
|
|||
cMusicManager::Service()
|
||||
{
|
||||
if (m_bResetTimers) {
|
||||
m_bResetTimers = false;
|
||||
m_bResetTimers = FALSE;
|
||||
m_nLastTrackServiceTime = m_nResetTime;
|
||||
}
|
||||
|
||||
static bool bRadioStatsRecorded = false;
|
||||
static bool8 bRadioStatsRecorded = FALSE;
|
||||
|
||||
if (!m_bIsInitialised || m_bDisabled) return;
|
||||
|
||||
if (!m_bMusicModeChangeStarted)
|
||||
m_nMusicModeToBeSet = m_nUpcomingMusicMode;
|
||||
if (m_nMusicModeToBeSet == m_nMusicMode) {
|
||||
if (!AudioManager.m_nUserPause || AudioManager.m_nPreviousUserPause || m_nMusicMode != MUSICMODE_FRONTEND)
|
||||
if (!AudioManager.m_bIsPaused || AudioManager.m_bWasPaused || m_nMusicMode != MUSICMODE_FRONTEND)
|
||||
{
|
||||
switch (m_nMusicMode)
|
||||
{
|
||||
case MUSICMODE_FRONTEND: ServiceFrontEndMode(); break;
|
||||
case MUSICMODE_GAME: ServiceGameMode(); break;
|
||||
case MUSICMODE_CUTSCENE: SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0); break;
|
||||
case MUSICMODE_CUTSCENE: SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_nMusicMode = MUSICMODE_DISABLED;
|
||||
} else {
|
||||
m_bMusicModeChangeStarted = true;
|
||||
if (!m_bUserResumedGame && !AudioManager.m_nUserPause && AudioManager.m_nPreviousUserPause)
|
||||
m_bUserResumedGame = true;
|
||||
m_bMusicModeChangeStarted = TRUE;
|
||||
if (!m_bUserResumedGame && !AudioManager.m_bIsPaused && AudioManager.m_bWasPaused)
|
||||
m_bUserResumedGame = TRUE;
|
||||
if (AudioManager.m_FrameCounter % 4 == 0) {
|
||||
gNumRetunePresses = 0;
|
||||
gRetuneCounter = 0;
|
||||
m_bSetNextStation = false;
|
||||
if (SampleManager.IsStreamPlaying(0)) {
|
||||
m_bSetNextStation = FALSE;
|
||||
if (SampleManager.IsStreamPlaying()) {
|
||||
if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded)
|
||||
{
|
||||
RecordRadioStats();
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition();
|
||||
m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
bRadioStatsRecorded = true;
|
||||
bRadioStatsRecorded = TRUE;
|
||||
}
|
||||
SampleManager.StopStreamedFile(0);
|
||||
SampleManager.StopStreamedFile();
|
||||
} else {
|
||||
bRadioStatsRecorded = false;
|
||||
bRadioStatsRecorded = FALSE;
|
||||
m_nMusicMode = m_nMusicModeToBeSet;
|
||||
m_bMusicModeChangeStarted = false;
|
||||
m_bTrackChangeStarted = false;
|
||||
m_bMusicModeChangeStarted = FALSE;
|
||||
m_bTrackChangeStarted = FALSE;
|
||||
m_nNextTrack = NO_TRACK;
|
||||
m_nNextLoopFlag = false;
|
||||
m_bVerifyNextTrackStartedToPlay = false;
|
||||
m_nNextLoopFlag = FALSE;
|
||||
m_bVerifyNextTrackStartedToPlay = FALSE;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
if (m_bEarlyFrontendTrack)
|
||||
m_bEarlyFrontendTrack = false;
|
||||
m_bEarlyFrontendTrack = FALSE;
|
||||
else
|
||||
m_nFrontendTrack = NO_TRACK;
|
||||
}
|
||||
|
@ -412,15 +423,21 @@ cMusicManager::Service()
|
|||
void
|
||||
cMusicManager::ServiceFrontEndMode()
|
||||
{
|
||||
static bool bRadioStatsRecorded = false;
|
||||
static bool8 bRadioStatsRecorded = FALSE;
|
||||
|
||||
#ifdef PAUSE_RADIO_IN_FRONTEND
|
||||
// pause radio
|
||||
for( uint32 i = STREAMED_SOUND_RADIO_HEAD; i < STREAMED_SOUND_CUTSCENE_BIKER; i++ )
|
||||
m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
#endif
|
||||
|
||||
if (m_bAnnouncementInProgress) {
|
||||
SampleManager.StopStreamedFile(0);
|
||||
if (SampleManager.IsStreamPlaying(0))
|
||||
SampleManager.StopStreamedFile();
|
||||
if (SampleManager.IsStreamPlaying())
|
||||
return;
|
||||
g_bAnnouncementReadPosAlready = false;
|
||||
g_bAnnouncementReadPosAlready = FALSE;
|
||||
m_nAnnouncement = NO_TRACK;
|
||||
m_bAnnouncementInProgress = false;
|
||||
m_bAnnouncementInProgress = FALSE;
|
||||
m_nNextTrack = NO_TRACK;
|
||||
m_nFrontendTrack = NO_TRACK;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
|
@ -434,50 +451,50 @@ cMusicManager::ServiceFrontEndMode()
|
|||
}
|
||||
|
||||
if (m_nNextTrack == m_nPlayingTrack) {
|
||||
if (SampleManager.IsStreamPlaying(0)) {
|
||||
if (SampleManager.IsStreamPlaying()) {
|
||||
if (m_nVolumeLatency > 0) m_nVolumeLatency--;
|
||||
else {
|
||||
if (m_nCurrentVolume < m_nMaxVolume)
|
||||
m_nCurrentVolume = Min(m_nMaxVolume, m_nCurrentVolume + 6);
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE);
|
||||
}
|
||||
} else {
|
||||
if (m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER)
|
||||
SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0, 0);
|
||||
else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && AudioManager.m_nUserPause == 0)
|
||||
SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0);
|
||||
else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && !AudioManager.m_bIsPaused)
|
||||
ChangeMusicMode(MUSICMODE_GAME);
|
||||
}
|
||||
} else {
|
||||
m_bTrackChangeStarted = true;
|
||||
if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying(0)) {
|
||||
bRadioStatsRecorded = false;
|
||||
if (SampleManager.IsStreamPlaying(0) || m_nNextTrack == NO_TRACK) {
|
||||
m_bTrackChangeStarted = TRUE;
|
||||
if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying()) {
|
||||
bRadioStatsRecorded = FALSE;
|
||||
if (SampleManager.IsStreamPlaying() || m_nNextTrack == NO_TRACK) {
|
||||
m_nPlayingTrack = m_nNextTrack;
|
||||
m_bVerifyNextTrackStartedToPlay = false;
|
||||
m_bTrackChangeStarted = false;
|
||||
m_bVerifyNextTrackStartedToPlay = FALSE;
|
||||
m_bTrackChangeStarted = FALSE;
|
||||
} else {
|
||||
uint32 trackStartPos = (m_nNextTrack > STREAMED_SOUND_RADIO_POLICE) ? 0 : GetTrackStartPos(m_nNextTrack);
|
||||
if (m_nNextTrack != NO_TRACK) {
|
||||
SampleManager.SetStreamedFileLoopFlag(m_nNextLoopFlag, 0);
|
||||
SampleManager.StartStreamedFile(m_nNextTrack, trackStartPos, 0);
|
||||
SampleManager.SetStreamedFileLoopFlag(m_nNextLoopFlag);
|
||||
SampleManager.StartStreamedFile(m_nNextTrack, trackStartPos);
|
||||
m_nVolumeLatency = 3;
|
||||
m_nCurrentVolume = 0;
|
||||
m_nMaxVolume = 100;
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE);
|
||||
if (m_nNextTrack < STREAMED_SOUND_CITY_AMBIENT)
|
||||
m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
m_bVerifyNextTrackStartedToPlay = true;
|
||||
m_bVerifyNextTrackStartedToPlay = TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded) {
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition();
|
||||
m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
RecordRadioStats();
|
||||
bRadioStatsRecorded = true;
|
||||
bRadioStatsRecorded = TRUE;
|
||||
}
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
|
||||
SampleManager.StopStreamedFile(0);
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE);
|
||||
SampleManager.StopStreamedFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +505,7 @@ cMusicManager::ServiceGameMode()
|
|||
CPed *ped = FindPlayerPed();
|
||||
CVehicle *vehicle = AudioManager.FindVehicleOfPlayer();
|
||||
m_bRadioStreamReady = m_bGameplayAllowsRadio;
|
||||
m_bGameplayAllowsRadio = false;
|
||||
m_bGameplayAllowsRadio = FALSE;
|
||||
|
||||
switch (CGame::currArea)
|
||||
{
|
||||
|
@ -499,14 +516,14 @@ cMusicManager::ServiceGameMode()
|
|||
case AREA_BLOOD:
|
||||
case AREA_OVALRING:
|
||||
case AREA_MALIBU_CLUB:
|
||||
m_bGameplayAllowsRadio = false;
|
||||
m_bGameplayAllowsRadio = FALSE;
|
||||
break;
|
||||
default:
|
||||
if (SampleManager.GetMusicVolume()) {
|
||||
if (PlayerInCar())
|
||||
m_bGameplayAllowsRadio = true;
|
||||
m_bGameplayAllowsRadio = TRUE;
|
||||
} else
|
||||
m_bGameplayAllowsRadio = false;
|
||||
m_bGameplayAllowsRadio = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -514,7 +531,7 @@ cMusicManager::ServiceGameMode()
|
|||
nFramesSinceCutsceneEnded = -1;
|
||||
gNumRetunePresses = 0;
|
||||
gRetuneCounter = 0;
|
||||
m_bSetNextStation = false;
|
||||
m_bSetNextStation = FALSE;
|
||||
} else if (ped) {
|
||||
if(!ped->DyingOrDead() && vehicle) {
|
||||
#ifdef GTA_PC
|
||||
|
@ -544,7 +561,7 @@ cMusicManager::ServiceGameMode()
|
|||
}
|
||||
}
|
||||
#ifdef RADIO_SCROLL_TO_PREV_STATION
|
||||
else if(CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown()) {
|
||||
else if(!CPad::GetPad(0)->ArePlayerControlsDisabled() && (CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown())) {
|
||||
if(!UsesPoliceRadio(vehicle) && !UsesTaxiRadio(vehicle)) {
|
||||
int scrollNext = ControlsManager.GetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, MOUSE);
|
||||
int scrollPrev = scrollNext == rsMOUSEWHEELUPBUTTON ? rsMOUSEWHEELDOWNBUTTON
|
||||
|
@ -567,11 +584,11 @@ cMusicManager::ServiceGameMode()
|
|||
|
||||
if (m_bUserResumedGame)
|
||||
{
|
||||
m_bRadioStreamReady = false;
|
||||
m_bUserResumedGame = false;
|
||||
m_bRadioStreamReady = FALSE;
|
||||
m_bUserResumedGame = FALSE;
|
||||
}
|
||||
if (m_nPlayingTrack == NO_TRACK && m_nFrontendTrack == NO_TRACK)
|
||||
m_bRadioStreamReady = false;
|
||||
m_bRadioStreamReady = FALSE;
|
||||
|
||||
if (m_bGameplayAllowsRadio)
|
||||
{
|
||||
|
@ -594,7 +611,7 @@ cMusicManager::ServiceGameMode()
|
|||
m_aTracks[m_nFrontendTrack].m_nPosition = m_nRadioPosition;
|
||||
m_aTracks[m_nFrontendTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
}
|
||||
m_bRadioSetByScript = false;
|
||||
m_bRadioSetByScript = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -605,7 +622,7 @@ cMusicManager::ServiceGameMode()
|
|||
if (m_nAnnouncement < NO_TRACK) {
|
||||
if ((m_bAnnouncementInProgress || m_nFrontendTrack == m_nPlayingTrack) && ServiceAnnouncement()) {
|
||||
if (m_bAnnouncementInProgress) {
|
||||
m_bSetNextStation = false;
|
||||
m_bSetNextStation = FALSE;
|
||||
gNumRetunePresses = 0;
|
||||
gRetuneCounter = 0;
|
||||
return;
|
||||
|
@ -613,7 +630,7 @@ cMusicManager::ServiceGameMode()
|
|||
if(m_nAnnouncement == NO_TRACK) {
|
||||
m_nNextTrack = NO_TRACK;
|
||||
m_nFrontendTrack = GetCarTuning();
|
||||
m_bSetNextStation = false;
|
||||
m_bSetNextStation = FALSE;
|
||||
gRetuneCounter = 0;
|
||||
gNumRetunePresses = 0;
|
||||
}
|
||||
|
@ -622,9 +639,9 @@ cMusicManager::ServiceGameMode()
|
|||
if (!m_bAnnouncementInProgress
|
||||
&& m_nAnnouncement == NO_TRACK
|
||||
&& m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER
|
||||
&& !SampleManager.IsStreamPlaying(0))
|
||||
&& !SampleManager.IsStreamPlaying())
|
||||
{
|
||||
SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0, 0);
|
||||
SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0);
|
||||
}
|
||||
|
||||
if (!m_bRadioSetByScript)
|
||||
|
@ -635,7 +652,7 @@ cMusicManager::ServiceGameMode()
|
|||
if(gRetuneCounter > 1)
|
||||
gRetuneCounter--;
|
||||
else if(gRetuneCounter == 1) {
|
||||
m_bSetNextStation = true;
|
||||
m_bSetNextStation = TRUE;
|
||||
gRetuneCounter = 0;
|
||||
}
|
||||
}
|
||||
|
@ -644,7 +661,7 @@ cMusicManager::ServiceGameMode()
|
|||
{
|
||||
if (--gRetuneCounter == 0)
|
||||
{
|
||||
m_bSetNextStation = true;
|
||||
m_bSetNextStation = TRUE;
|
||||
gRetuneCounter = 0;
|
||||
}
|
||||
}
|
||||
|
@ -694,7 +711,7 @@ cMusicManager::ServiceGameMode()
|
|||
SetUpCorrectAmbienceTrack();
|
||||
ServiceTrack(vehicle, ped);
|
||||
if (m_bSetNextStation)
|
||||
m_bSetNextStation = false;
|
||||
m_bSetNextStation = FALSE;
|
||||
return;
|
||||
}
|
||||
if (UsesPoliceRadio(vehicle))
|
||||
|
@ -713,24 +730,24 @@ cMusicManager::ServiceGameMode()
|
|||
|
||||
gRetuneCounter = 0;
|
||||
gNumRetunePresses = 0;
|
||||
m_bSetNextStation = false;
|
||||
m_bRadioSetByScript = false;
|
||||
m_bSetNextStation = FALSE;
|
||||
m_bRadioSetByScript = FALSE;
|
||||
if (m_nFrontendTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nFrontendTrack <= STREAMED_SOUND_AMBSIL_AMBIENT)
|
||||
SetUpCorrectAmbienceTrack();
|
||||
ServiceTrack(vehicle, ped);
|
||||
if (m_bSetNextStation)
|
||||
m_bSetNextStation = false;
|
||||
m_bSetNextStation = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_bAnnouncementInProgress)
|
||||
{
|
||||
SampleManager.StopStreamedFile(0);
|
||||
if (SampleManager.IsStreamPlaying(0))
|
||||
SampleManager.StopStreamedFile();
|
||||
if (SampleManager.IsStreamPlaying())
|
||||
return;
|
||||
g_bAnnouncementReadPosAlready = false;
|
||||
g_bAnnouncementReadPosAlready = FALSE;
|
||||
m_nAnnouncement = NO_TRACK;
|
||||
m_bAnnouncementInProgress = false;
|
||||
m_bAnnouncementInProgress = FALSE;
|
||||
m_nNextTrack = NO_TRACK;
|
||||
m_nFrontendTrack = NO_TRACK;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
|
@ -808,7 +825,7 @@ GetHeightScale()
|
|||
}
|
||||
|
||||
void
|
||||
cMusicManager::ComputeAmbienceVol(uint8 reset, uint8& outVolume)
|
||||
cMusicManager::ComputeAmbienceVol(bool8 reset, uint8& outVolume)
|
||||
{
|
||||
static float fVol = 0.0f;
|
||||
|
||||
|
@ -868,77 +885,77 @@ cMusicManager::ComputeAmbienceVol(uint8 reset, uint8& outVolume)
|
|||
outVolume = (90.0f - fHeightScale) / 50.0f * fVol;
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cMusicManager::ServiceAnnouncement()
|
||||
{
|
||||
if (m_bAnnouncementInProgress) {
|
||||
if (SampleManager.IsStreamPlaying(0))
|
||||
if (SampleManager.IsStreamPlaying())
|
||||
m_nPlayingTrack = m_nNextTrack;
|
||||
else if (m_nPlayingTrack != NO_TRACK) {
|
||||
m_nAnnouncement = NO_TRACK;
|
||||
m_bAnnouncementInProgress = false;
|
||||
m_bAnnouncementInProgress = FALSE;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
}
|
||||
return true;
|
||||
} else if (SampleManager.IsStreamPlaying(0)) {
|
||||
return TRUE;
|
||||
} else if (SampleManager.IsStreamPlaying()) {
|
||||
if (m_nPlayingTrack != NO_TRACK && !g_bAnnouncementReadPosAlready) {
|
||||
RecordRadioStats();
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
|
||||
g_bAnnouncementReadPosAlready = true;
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition();
|
||||
g_bAnnouncementReadPosAlready = TRUE;
|
||||
m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
}
|
||||
SampleManager.StopStreamedFile(0);
|
||||
SampleManager.StopStreamedFile();
|
||||
} else {
|
||||
g_bAnnouncementReadPosAlready = false;
|
||||
g_bAnnouncementReadPosAlready = FALSE;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
m_nNextTrack = m_nAnnouncement;
|
||||
SampleManager.SetStreamedFileLoopFlag(0, 0);
|
||||
SampleManager.StartStreamedFile(m_nNextTrack, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 0, 0);
|
||||
m_bAnnouncementInProgress = true;
|
||||
SampleManager.SetStreamedFileLoopFlag(FALSE);
|
||||
SampleManager.StartStreamedFile(m_nNextTrack, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, FALSE);
|
||||
m_bAnnouncementInProgress = TRUE;
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped)
|
||||
{
|
||||
static bool bRadioStatsRecorded = false;
|
||||
static bool bRadioStatsRecorded2 = false;
|
||||
static bool8 bRadioStatsRecorded = FALSE;
|
||||
static bool8 bRadioStatsRecorded2 = FALSE;
|
||||
uint8 volume;
|
||||
if (!m_bTrackChangeStarted)
|
||||
m_nNextTrack = m_nFrontendTrack;
|
||||
if (gRetuneCounter != 0 || m_bSetNextStation) {
|
||||
if (SampleManager.IsStreamPlaying(0)) {
|
||||
if (SampleManager.IsStreamPlaying()) {
|
||||
if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded) {
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition();
|
||||
m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
RecordRadioStats();
|
||||
bRadioStatsRecorded = true;
|
||||
bRadioStatsRecorded = TRUE;
|
||||
}
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
|
||||
SampleManager.StopStreamedFile(0);
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE);
|
||||
SampleManager.StopStreamedFile();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (bRadioStatsRecorded) {
|
||||
bRadioStatsRecorded = false;
|
||||
bRadioStatsRecorded = FALSE;
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
}
|
||||
|
||||
if (m_nNextTrack != m_nPlayingTrack)
|
||||
{
|
||||
m_bTrackChangeStarted = true;
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
|
||||
m_bTrackChangeStarted = TRUE;
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE);
|
||||
if (!(AudioManager.m_FrameCounter & 1)) {
|
||||
if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying(0)) {
|
||||
bRadioStatsRecorded2 = false;
|
||||
if (SampleManager.IsStreamPlaying(0)) {
|
||||
if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying()) {
|
||||
bRadioStatsRecorded2 = FALSE;
|
||||
if (SampleManager.IsStreamPlaying()) {
|
||||
m_nPlayingTrack = m_nNextTrack;
|
||||
m_bVerifyNextTrackStartedToPlay = false;
|
||||
m_bTrackChangeStarted = false;
|
||||
m_bVerifyNextTrackStartedToPlay = FALSE;
|
||||
m_bTrackChangeStarted = FALSE;
|
||||
if (veh) {
|
||||
#ifdef FIX_BUGS
|
||||
if (m_nPlayingTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_AMBSIL_AMBIENT)
|
||||
|
@ -955,23 +972,23 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped)
|
|||
} else {
|
||||
uint32 pos = GetTrackStartPos(m_nNextTrack);
|
||||
if (m_nNextTrack != NO_TRACK) {
|
||||
SampleManager.SetStreamedFileLoopFlag(1, 0);
|
||||
SampleManager.StartStreamedFile(m_nNextTrack, pos, 0);
|
||||
SampleManager.SetStreamedFileLoopFlag(TRUE);
|
||||
SampleManager.StartStreamedFile(m_nNextTrack, pos);
|
||||
if (m_nFrontendTrack < STREAMED_SOUND_CITY_AMBIENT || m_nFrontendTrack > STREAMED_SOUND_AMBSIL_AMBIENT)
|
||||
{
|
||||
m_nVolumeLatency = 10;
|
||||
m_nCurrentVolume = 0;
|
||||
m_nMaxVolume = 100;
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
ComputeAmbienceVol(true, volume);
|
||||
SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0);
|
||||
ComputeAmbienceVol(TRUE, volume);
|
||||
SampleManager.SetStreamedVolumeAndPan(volume, 63, TRUE);
|
||||
}
|
||||
if (m_nNextTrack < STREAMED_SOUND_CITY_AMBIENT)
|
||||
m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
m_bVerifyNextTrackStartedToPlay = true;
|
||||
m_bVerifyNextTrackStartedToPlay = TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -979,9 +996,9 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped)
|
|||
debug("m_nPlayingTrack == NO_TRACK, yet track playing - tidying up\n");
|
||||
else if (!bRadioStatsRecorded2)
|
||||
{
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
|
||||
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition();
|
||||
m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
bRadioStatsRecorded2 = true;
|
||||
bRadioStatsRecorded2 = TRUE;
|
||||
RecordRadioStats();
|
||||
if (m_nPlayingTrack >= STREAMED_SOUND_HAVANA_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_HAVANA_BEACH_AMBIENT)
|
||||
{
|
||||
|
@ -989,8 +1006,8 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped)
|
|||
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_HURRICANE, 0.0);
|
||||
}
|
||||
}
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
|
||||
SampleManager.StopStreamedFile(0);
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE);
|
||||
SampleManager.StopStreamedFile();
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -998,8 +1015,8 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped)
|
|||
|
||||
if (m_nPlayingTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_AMBSIL_AMBIENT)
|
||||
{
|
||||
ComputeAmbienceVol(false, volume);
|
||||
SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0);
|
||||
ComputeAmbienceVol(FALSE, volume);
|
||||
SampleManager.SetStreamedVolumeAndPan(volume, 63, TRUE);
|
||||
return;
|
||||
}
|
||||
if (CTimer::GetIsSlowMotionActive())
|
||||
|
@ -1009,7 +1026,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped)
|
|||
float DistToTargetSq = (TheCamera.pTargetEntity->GetPosition() - TheCamera.GetPosition()).MagnitudeSqr();
|
||||
if (DistToTargetSq >= SQR(55.0f))
|
||||
{
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE);
|
||||
}
|
||||
else if (DistToTargetSq >= SQR(10.0f))
|
||||
{
|
||||
|
@ -1026,17 +1043,17 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped)
|
|||
}
|
||||
if (gRetuneCounter != 0)
|
||||
volume = 0;
|
||||
SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(volume, pan, FALSE);
|
||||
}
|
||||
else if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1))
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE);
|
||||
else if (gRetuneCounter != 0)
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE);
|
||||
else
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE);
|
||||
}
|
||||
} else if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1)) {
|
||||
SampleManager.SetStreamedVolumeAndPan(Min(m_nCurrentVolume, 25), 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(Min(m_nCurrentVolume, 25), 63, FALSE);
|
||||
nFramesSinceCutsceneEnded = 0;
|
||||
} else {
|
||||
if (nFramesSinceCutsceneEnded == -1)
|
||||
|
@ -1058,7 +1075,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped)
|
|||
}
|
||||
if (gRetuneCounter != 0)
|
||||
volume = 0;
|
||||
SampleManager.SetStreamedVolumeAndPan(volume, 63, 0, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(volume, 63, FALSE);
|
||||
}
|
||||
if (m_nVolumeLatency > 0)
|
||||
m_nVolumeLatency--;
|
||||
|
@ -1071,10 +1088,10 @@ cMusicManager::PreloadCutSceneMusic(uint32 track)
|
|||
{
|
||||
if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS && m_nMusicMode == MUSICMODE_CUTSCENE) {
|
||||
AudioManager.ResetPoliceRadio();
|
||||
while (SampleManager.IsStreamPlaying(0))
|
||||
SampleManager.StopStreamedFile(0);
|
||||
SampleManager.PreloadStreamedFile(track, 0);
|
||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0);
|
||||
while (SampleManager.IsStreamPlaying())
|
||||
SampleManager.StopStreamedFile();
|
||||
SampleManager.PreloadStreamedFile(track);
|
||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE);
|
||||
m_nPlayingTrack = track;
|
||||
}
|
||||
}
|
||||
|
@ -1083,27 +1100,27 @@ void
|
|||
cMusicManager::PlayPreloadedCutSceneMusic(void)
|
||||
{
|
||||
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_CUTSCENE)
|
||||
SampleManager.StartPreloadedStreamedFile(0);
|
||||
SampleManager.StartPreloadedStreamedFile();
|
||||
}
|
||||
|
||||
void
|
||||
cMusicManager::StopCutSceneMusic(void)
|
||||
{
|
||||
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_CUTSCENE) {
|
||||
SampleManager.StopStreamedFile(0);
|
||||
SampleManager.StopStreamedFile();
|
||||
m_nPlayingTrack = NO_TRACK;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cMusicManager::PlayFrontEndTrack(uint32 track, uint8 loopFlag)
|
||||
cMusicManager::PlayFrontEndTrack(uint32 track, bool8 loopFlag)
|
||||
{
|
||||
if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS && (m_nUpcomingMusicMode == MUSICMODE_FRONTEND || m_nMusicMode == MUSICMODE_FRONTEND))
|
||||
{
|
||||
m_nFrontendTrack = track;
|
||||
m_FrontendLoopFlag = loopFlag;
|
||||
if (m_nMusicMode != MUSICMODE_FRONTEND)
|
||||
m_bEarlyFrontendTrack = true;
|
||||
m_bEarlyFrontendTrack = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1154,7 +1171,7 @@ cMusicManager::GetCarTuning()
|
|||
if (UsesPoliceRadio(veh)) return STREAMED_SOUND_RADIO_POLICE;
|
||||
if (UsesTaxiRadio(veh)) return STREAMED_SOUND_RADIO_TAXI;
|
||||
if (veh->m_nRadioStation == USERTRACK && !SampleManager.IsMP3RadioChannelAvailable())
|
||||
veh->m_nRadioStation = AudioManager.GetRandomNumber(2) % USERTRACK;
|
||||
veh->m_nRadioStation = AudioManager.m_anRandomTable[2] % USERTRACK;
|
||||
return veh->m_nRadioStation;
|
||||
}
|
||||
|
||||
|
@ -1201,7 +1218,7 @@ cMusicManager::GetFavouriteRadioStation()
|
|||
return favstation;
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cMusicManager::CheckForMusicInterruptions()
|
||||
{
|
||||
return (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED) || (m_nPlayingTrack == STREAMED_SOUND_CUTSCENE_FINALE);
|
||||
|
@ -1265,7 +1282,8 @@ cMusicManager::DisplayRadioStationName()
|
|||
|
||||
if (vehicle)
|
||||
{
|
||||
#if defined RADIO_SCROLL_TO_PREV_STATION || defined FIX_BUGS // Because m_nFrontendTrack can have NO_TRACK
|
||||
// Prev scroll needs it to be signed, and m_nFrontendTrack can be NO_TRACK thus FIX_BUGS
|
||||
#if defined RADIO_SCROLL_TO_PREV_STATION || defined FIX_BUGS
|
||||
int track;
|
||||
#else
|
||||
uint8 track;
|
||||
|
@ -1281,13 +1299,16 @@ cMusicManager::DisplayRadioStationName()
|
|||
#endif
|
||||
while (track >= NUM_RADIOS + 1) track -= NUM_RADIOS + 1;
|
||||
|
||||
// We already handle this condition while scrolling back, on key press. No need to change this.
|
||||
// On scrolling back we handle this condition on key press. No need to change this.
|
||||
if (!DMAudio.IsMP3RadioChannelAvailable() && track == USERTRACK)
|
||||
gNumRetunePresses++;
|
||||
}
|
||||
else
|
||||
#ifdef RADIO_OFF_TEXT
|
||||
track = GetCarTuning(); // gStreamedSound or veh->m_nRadioStation would also work, but these don't cover police/taxi radios
|
||||
#else
|
||||
track = m_nFrontendTrack;
|
||||
|
||||
#endif
|
||||
wchar* string = nil;
|
||||
switch (track) {
|
||||
case WILDSTYLE: string = TheText.Get("FEA_FM0"); break;
|
||||
|
@ -1313,7 +1334,11 @@ cMusicManager::DisplayRadioStationName()
|
|||
}
|
||||
else {
|
||||
if (cDisplay == 0) return;
|
||||
#ifdef FIX_BUGS
|
||||
cDisplay -= CTimer::GetLogicalFramesPassed();
|
||||
#else
|
||||
cDisplay--;
|
||||
#endif
|
||||
}
|
||||
|
||||
CFont::SetJustifyOff();
|
||||
|
@ -1343,7 +1368,7 @@ cMusicManager::DisplayRadioStationName()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cMusicManager::UsesPoliceRadio(CVehicle *veh)
|
||||
{
|
||||
switch (veh->GetModelIndex())
|
||||
|
@ -1353,18 +1378,18 @@ cMusicManager::UsesPoliceRadio(CVehicle *veh)
|
|||
case MI_COASTG:
|
||||
case MI_RHINO:
|
||||
case MI_BARRACKS:
|
||||
return true;
|
||||
return TRUE;
|
||||
case MI_MRWHOOP:
|
||||
case MI_HUNTER:
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
return veh->UsesSiren();
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cMusicManager::UsesTaxiRadio(CVehicle *veh)
|
||||
{
|
||||
if (veh->GetModelIndex() != MI_CABBIE) return false;
|
||||
if (veh->GetModelIndex() != MI_CABBIE) return FALSE;
|
||||
return CTheScripts::bPlayerHasMetDebbieHarry;
|
||||
}
|
||||
|
||||
|
@ -1373,10 +1398,10 @@ cMusicManager::ServiceAmbience()
|
|||
{
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cMusicManager::ChangeRadioChannel()
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// these two are empty
|
||||
|
|
|
@ -16,18 +16,18 @@ class CPed;
|
|||
class cMusicManager
|
||||
{
|
||||
public:
|
||||
bool m_bIsInitialised;
|
||||
bool m_bDisabled;
|
||||
bool m_bSetNextStation;
|
||||
bool8 m_bIsInitialised;
|
||||
bool8 m_bDisabled;
|
||||
bool8 m_bSetNextStation;
|
||||
uint8 m_nVolumeLatency;
|
||||
uint8 m_nCurrentVolume;
|
||||
uint8 m_nMaxVolume;
|
||||
uint32 m_nAnnouncement;
|
||||
bool m_bAnnouncementInProgress;
|
||||
bool8 m_bAnnouncementInProgress;
|
||||
tStreamedSample m_aTracks[TOTAL_STREAMED_SOUNDS];
|
||||
bool m_bResetTimers;
|
||||
bool8 m_bResetTimers;
|
||||
uint32 m_nResetTime;
|
||||
bool m_bRadioSetByScript;
|
||||
bool8 m_bRadioSetByScript;
|
||||
uint8 m_nRadioStationScript;
|
||||
int32 m_nRadioPosition;
|
||||
uint32 m_nRadioInCar;
|
||||
|
@ -35,40 +35,40 @@ public:
|
|||
uint32 m_nPlayingTrack;
|
||||
uint8 m_nUpcomingMusicMode;
|
||||
uint8 m_nMusicMode;
|
||||
bool m_FrontendLoopFlag;
|
||||
bool m_bTrackChangeStarted;
|
||||
bool8 m_FrontendLoopFlag;
|
||||
bool8 m_bTrackChangeStarted;
|
||||
uint32 m_nNextTrack;
|
||||
bool m_nNextLoopFlag;
|
||||
bool m_bVerifyNextTrackStartedToPlay;
|
||||
bool m_bGameplayAllowsRadio;
|
||||
bool m_bRadioStreamReady;
|
||||
bool8 m_nNextLoopFlag;
|
||||
bool8 m_bVerifyNextTrackStartedToPlay;
|
||||
bool8 m_bGameplayAllowsRadio;
|
||||
bool8 m_bRadioStreamReady;
|
||||
int8 nFramesSinceCutsceneEnded;
|
||||
bool m_bUserResumedGame;
|
||||
bool m_bMusicModeChangeStarted;
|
||||
bool8 m_bUserResumedGame;
|
||||
bool8 m_bMusicModeChangeStarted;
|
||||
uint8 m_nMusicModeToBeSet;
|
||||
bool m_bEarlyFrontendTrack;
|
||||
bool8 m_bEarlyFrontendTrack;
|
||||
float aListenTimeArray[NUM_RADIOS];
|
||||
float m_nLastTrackServiceTime;
|
||||
|
||||
public:
|
||||
cMusicManager();
|
||||
bool IsInitialised() { return m_bIsInitialised; }
|
||||
bool8 IsInitialised() { return m_bIsInitialised; }
|
||||
uint8 GetMusicMode() { return m_nMusicMode; }
|
||||
uint32 GetCurrentTrack() { return m_nPlayingTrack; }
|
||||
|
||||
void ResetMusicAfterReload();
|
||||
void SetStartingTrackPositions(uint8 isNewGameTimer);
|
||||
bool Initialise();
|
||||
void SetStartingTrackPositions(bool8 isNewGameTimer);
|
||||
bool8 Initialise();
|
||||
void Terminate();
|
||||
|
||||
void ChangeMusicMode(uint8 mode);
|
||||
void StopFrontEndTrack();
|
||||
|
||||
bool PlayerInCar();
|
||||
bool8 PlayerInCar();
|
||||
void DisplayRadioStationName();
|
||||
|
||||
void PlayAnnouncement(uint32);
|
||||
void PlayFrontEndTrack(uint32, uint8);
|
||||
void PlayFrontEndTrack(uint32, bool8);
|
||||
void PreloadCutSceneMusic(uint32);
|
||||
void PlayPreloadedCutSceneMusic(void);
|
||||
void StopCutSceneMusic(void);
|
||||
|
@ -76,23 +76,23 @@ public:
|
|||
void SetRadioInCar(uint32);
|
||||
void SetRadioChannelByScript(uint32, int32);
|
||||
|
||||
void ResetTimers(int32);
|
||||
void ResetTimers(uint32);
|
||||
void Service();
|
||||
void ServiceFrontEndMode();
|
||||
void ServiceGameMode();
|
||||
void ServiceAmbience();
|
||||
void ServiceTrack(CVehicle *veh, CPed *ped);
|
||||
|
||||
bool UsesPoliceRadio(CVehicle *veh);
|
||||
bool UsesTaxiRadio(CVehicle *veh);
|
||||
bool8 UsesPoliceRadio(CVehicle *veh);
|
||||
bool8 UsesTaxiRadio(CVehicle *veh);
|
||||
uint32 GetTrackStartPos(uint32 track);
|
||||
|
||||
void ComputeAmbienceVol(uint8 reset, uint8& outVolume);
|
||||
bool ServiceAnnouncement();
|
||||
void ComputeAmbienceVol(bool8 reset, uint8& outVolume);
|
||||
bool8 ServiceAnnouncement();
|
||||
|
||||
uint32 GetCarTuning();
|
||||
uint32 GetNextCarTuning();
|
||||
bool ChangeRadioChannel();
|
||||
bool8 ChangeRadioChannel();
|
||||
void RecordRadioStats();
|
||||
void SetUpCorrectAmbienceTrack();
|
||||
float *GetListenTimeArray();
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
uint32 GetFavouriteRadioStation();
|
||||
void SetMalibuClubTrackPos(uint8 pos);
|
||||
void SetStripClubTrackPos(uint8 pos);
|
||||
bool CheckForMusicInterruptions();
|
||||
bool8 CheckForMusicInterruptions();
|
||||
|
||||
void Enable();
|
||||
void Disable();
|
||||
|
@ -109,5 +109,5 @@ public:
|
|||
VALIDATE_SIZE(cMusicManager, 0x95C);
|
||||
|
||||
extern cMusicManager MusicManager;
|
||||
extern bool g_bAnnouncementReadPosAlready; // we have a symbol of this so it was declared in .h
|
||||
extern bool8 g_bAnnouncementReadPosAlready; // we have a symbol of this so it was declared in .h
|
||||
float GetHeightScale();
|
||||
|
|
|
@ -0,0 +1,751 @@
|
|||
#include "common.h"
|
||||
|
||||
#include "DMAudio.h"
|
||||
|
||||
#include "AudioManager.h"
|
||||
|
||||
#include "AudioSamples.h"
|
||||
#include "MusicManager.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "PolRadio.h"
|
||||
#include "Replay.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
#include "Zones.h"
|
||||
#include "sampman.h"
|
||||
#include "Wanted.h"
|
||||
|
||||
struct tPoliceRadioZone {
|
||||
char m_aName[8];
|
||||
uint32 m_nSampleIndex;
|
||||
int32 field_12;
|
||||
};
|
||||
|
||||
tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
|
||||
|
||||
uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
|
||||
int8 g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
|
||||
bool8 gSpecialSuspectLastSeenReport;
|
||||
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
|
||||
|
||||
void
|
||||
cAudioManager::InitialisePoliceRadioZones()
|
||||
{
|
||||
for (int32 i = 0; i < NUMAUDIOZONES; i++)
|
||||
memset(ZoneSfx[i].m_aName, 0, 8);
|
||||
|
||||
#define SETZONESFX(i, name, sample) \
|
||||
strcpy(ZoneSfx[i].m_aName, name); \
|
||||
ZoneSfx[i].m_nSampleIndex = sample;
|
||||
|
||||
SETZONESFX(0, "VICE_C", SFX_SFX_POLICE_RADIO_VICE_CITY);
|
||||
SETZONESFX(1, "IND_ZON", SFX_SFX_POLICE_RADIO_VICE_CITY_BEACH);
|
||||
SETZONESFX(2, "COM_ZON", SFX_SFX_POLICE_RADIO_VICE_CITY_MAINLAND);
|
||||
SETZONESFX(3, "BEACH1", SFX_SFX_POLICE_RADIO_OCEAN_BEACH);
|
||||
SETZONESFX(4, "BEACH2", SFX_SFX_POLICE_RADIO_WASHINGTON_BEACH);
|
||||
SETZONESFX(5, "BEACH3", SFX_SFX_POLICE_RADIO_VICE_POINT);
|
||||
SETZONESFX(6, "GOLFC", SFX_SFX_POLICE_RADIO_LEAF_LINKS);
|
||||
SETZONESFX(7, "STARI", SFX_SFX_POLICE_RADIO_STARFISH_ISLAND);
|
||||
SETZONESFX(8, "DOCKS", SFX_SFX_POLICE_RADIO_VICEPORT);
|
||||
SETZONESFX(9, "HAVANA", SFX_SFX_POLICE_RADIO_LITTLE_HAVANA);
|
||||
SETZONESFX(10, "HAITI", SFX_SFX_POLICE_RADIO_LITTLE_HAITI);
|
||||
SETZONESFX(11, "PORNI", SFX_SFX_POLICE_RADIO_PRAWN_ISLAND);
|
||||
SETZONESFX(12, "DTOWN", SFX_SFX_POLICE_RADIO_DOWNTOWN);
|
||||
SETZONESFX(13, "A_PORT", SFX_SFX_POLICE_RADIO_ESCOBAR_INTERNATIONAL);
|
||||
|
||||
#undef SETZONESFX
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::InitialisePoliceRadio()
|
||||
{
|
||||
m_sPoliceRadioQueue.Reset();
|
||||
for (int32 i = 0; i < ARRAY_SIZE(m_aCrimes); i++)
|
||||
m_aCrimes[i].type = CRIME_NONE;
|
||||
#if !defined(GTA_PS2) || defined(AUDIO_REVERB)
|
||||
SampleManager.SetChannelReverbFlag(CHANNEL_POLICE_RADIO, FALSE);
|
||||
#endif
|
||||
gSpecialSuspectLastSeenReport = FALSE;
|
||||
for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++)
|
||||
gMinTimeToNextReport[i] = m_FrameCounter;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ResetPoliceRadio()
|
||||
{
|
||||
if (!m_bIsInitialised) return;
|
||||
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
InitialisePoliceRadio();
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx)
|
||||
{
|
||||
if (!m_bIsInitialised) return;
|
||||
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) {
|
||||
g_nMissionAudioPlayingStatus = PLAY_STATUS_STOPPED;
|
||||
g_nMissionAudioSfx = sfx;
|
||||
}
|
||||
}
|
||||
|
||||
int8
|
||||
cAudioManager::GetMissionScriptPoliceAudioPlayingStatus()
|
||||
{
|
||||
return g_nMissionAudioPlayingStatus;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::DoPoliceRadioCrackle()
|
||||
{
|
||||
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
|
||||
m_sQueueSample.m_nCounter = 0;
|
||||
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
|
||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_bIs2D = TRUE;
|
||||
m_sQueueSample.m_nPriority = 10;
|
||||
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
|
||||
m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15;
|
||||
m_sQueueSample.m_nLoopCount = 0;
|
||||
SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
|
||||
SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE)
|
||||
m_sQueueSample.m_bStatic = FALSE;
|
||||
SET_SOUND_REVERB(FALSE);
|
||||
m_sQueueSample.m_nPan = 63;
|
||||
m_sQueueSample.m_nFramesToPlay = 3;
|
||||
SET_SOUND_REFLECTION(FALSE);
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ServicePoliceRadio()
|
||||
{
|
||||
/*
|
||||
int32 wantedLevel = 0; // uninitialized variable
|
||||
static uint32 nLastSeen = 300;
|
||||
|
||||
if(!m_bIsInitialised) return;
|
||||
|
||||
if(!m_bIsPaused) {
|
||||
bool8 crimeReport = SetupCrimeReport();
|
||||
#ifdef FIX_BUGS // Crash at 0x5fe6ef
|
||||
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
||||
return;
|
||||
#endif
|
||||
CPlayerPed *playerPed = FindPlayerPed();
|
||||
if (playerPed) {
|
||||
wantedLevel = playerPed->m_pWanted->GetWantedLevel();
|
||||
if (!crimeReport) {
|
||||
if (wantedLevel != 0) {
|
||||
if (nLastSeen != 0)
|
||||
#ifdef FIX_BUGS
|
||||
nLastSeen -= CTimer::GetLogicalFramesPassed();
|
||||
#else
|
||||
nLastSeen--;
|
||||
#endif
|
||||
else {
|
||||
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
|
||||
SetupSuspectLastSeenReport();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ServicePoliceRadioChannel(wantedLevel);
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||
{
|
||||
bool8 processed = FALSE;
|
||||
uint32 sample;
|
||||
uint32 freq;
|
||||
|
||||
static int cWait = 0;
|
||||
static bool8 bChannelOpen = FALSE;
|
||||
static uint8 bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
|
||||
static uint32 PoliceChannelFreq = 22050;
|
||||
|
||||
if (!m_bIsInitialised) return;
|
||||
|
||||
if (m_bIsPaused) {
|
||||
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
|
||||
SampleManager.IsStreamPlaying(1)) {
|
||||
SampleManager.PauseStream(TRUE, 1);
|
||||
}
|
||||
} else {
|
||||
if (m_bWasPaused && g_nMissionAudioSfx != NO_SAMPLE &&
|
||||
bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
|
||||
SampleManager.PauseStream(FALSE, 1);
|
||||
}
|
||||
if (m_sPoliceRadioQueue.m_nSamplesInQueue == 0) bChannelOpen = FALSE;
|
||||
if (cWait) {
|
||||
#ifdef FIX_BUGS
|
||||
cWait -= CTimer::GetLogicalFramesPassed();
|
||||
#else
|
||||
--cWait;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (g_nMissionAudioSfx != NO_SAMPLE && !bChannelOpen) {
|
||||
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_STOPPED) {
|
||||
if (g_nMissionAudioPlayingStatus == PLAY_STATUS_PLAYING && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_STOPPED &&
|
||||
SampleManager.IsStreamPlaying(1)) {
|
||||
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_PLAYING;
|
||||
}
|
||||
if (bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
|
||||
if (SampleManager.IsStreamPlaying(1)) {
|
||||
DoPoliceRadioCrackle();
|
||||
} else {
|
||||
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_FINISHED;
|
||||
g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
|
||||
g_nMissionAudioSfx = NO_SAMPLE;
|
||||
cWait = 30;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if (!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) {
|
||||
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
|
||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
|
||||
SampleManager.StartPreloadedStreamedFile(1);
|
||||
g_nMissionAudioPlayingStatus = PLAY_STATUS_PLAYING;
|
||||
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (bChannelOpen) DoPoliceRadioCrackle();
|
||||
if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) &&
|
||||
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.m_nSamplesInQueue != 0) {
|
||||
sample = m_sPoliceRadioQueue.Remove();
|
||||
if (wantedLevel == 0) {
|
||||
if (gSpecialSuspectLastSeenReport) {
|
||||
gSpecialSuspectLastSeenReport = FALSE;
|
||||
} else if (sample == SFX_POLICE_RADIO_MESSAGE_NOISE_1) {
|
||||
bChannelOpen = FALSE;
|
||||
processed = TRUE;
|
||||
}
|
||||
}
|
||||
if (sample == NO_SAMPLE) {
|
||||
if (!processed) cWait = 30;
|
||||
} else {
|
||||
SampleManager.InitialiseChannel(CHANNEL_POLICE_RADIO, sample, SFX_BANK_0);
|
||||
switch (sample) {
|
||||
case SFX_POLICE_RADIO_MESSAGE_NOISE_1:
|
||||
freq = m_anRandomTable[4] % 2000 + 10025;
|
||||
bChannelOpen = bChannelOpen == FALSE;
|
||||
break;
|
||||
default: freq = SampleManager.GetSampleBaseFrequency(sample); break;
|
||||
}
|
||||
PoliceChannelFreq = freq;
|
||||
#ifdef USE_TIME_SCALE_FOR_AUDIO
|
||||
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq * CTimer::GetTimeScale());
|
||||
#else
|
||||
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq);
|
||||
#endif
|
||||
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
|
||||
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
|
||||
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
|
||||
#ifndef GTA_PS2
|
||||
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
|
||||
#endif
|
||||
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
|
||||
}
|
||||
if (processed) ResetPoliceRadio();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool8
|
||||
cAudioManager::SetupCrimeReport()
|
||||
{
|
||||
int16 audioZoneId;
|
||||
CZone *zone;
|
||||
float rangeX;
|
||||
float rangeY;
|
||||
float halfX;
|
||||
float halfY;
|
||||
float quarterX;
|
||||
float quarterY;
|
||||
int i;
|
||||
uint32 sampleIndex;
|
||||
bool8 processed = FALSE;
|
||||
|
||||
if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return FALSE;
|
||||
|
||||
if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue <= 9) {
|
||||
AgeCrimes();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||
if (m_aCrimes[i].type != CRIME_NONE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(m_aCrimes)) return FALSE;
|
||||
audioZoneId = CTheZones::FindAudioZone(&m_aCrimes[i].position);
|
||||
if (audioZoneId >= 0 && audioZoneId < NUMAUDIOZONES) {
|
||||
zone = CTheZones::GetAudioZone(audioZoneId);
|
||||
for (int j = 0; j < NUMAUDIOZONES; j++) {
|
||||
if (strcmp(zone->name, ZoneSfx[j].m_aName) == 0) {
|
||||
sampleIndex = ZoneSfx[j].m_nSampleIndex;
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(m_anRandomTable[0] % 3 + SFX_WEVE_GOT);
|
||||
m_sPoliceRadioQueue.Add(SFX_A_10);
|
||||
switch (m_aCrimes[i].type) {
|
||||
case CRIME_PED_BURNED:
|
||||
case CRIME_HIT_PED_NASTYWEAPON:
|
||||
m_aCrimes[i].type = CRIME_HIT_PED;
|
||||
break;
|
||||
case CRIME_COP_BURNED:
|
||||
case CRIME_HIT_COP_NASTYWEAPON:
|
||||
m_aCrimes[i].type = CRIME_HIT_COP;
|
||||
break;
|
||||
case CRIME_VEHICLE_BURNED: m_aCrimes[i].type = CRIME_STEAL_CAR; break;
|
||||
case CRIME_DESTROYED_CESSNA: m_aCrimes[i].type = CRIME_SHOOT_HELI; break;
|
||||
case CRIME_EXPLOSION: m_aCrimes[i].type = CRIME_STEAL_CAR; break; // huh?
|
||||
default: break;
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
m_sPoliceRadioQueue.Add(m_aCrimes[i].type + SFX_SFX_CRIME_1 - 1);
|
||||
#else
|
||||
m_sPoliceRadioQueue.Add(m_aCrimes[i].type + SFX_SFX_CRIME_1);
|
||||
#endif
|
||||
m_sPoliceRadioQueue.Add(SFX_IN);
|
||||
rangeX = zone->maxx - zone->minx;
|
||||
rangeY = zone->maxy - zone->miny;
|
||||
halfX = 0.5f * rangeX + zone->minx;
|
||||
halfY = 0.5f * rangeY + zone->miny;
|
||||
quarterX = 0.25f * rangeX;
|
||||
quarterY = 0.25f * rangeY;
|
||||
|
||||
if (m_aCrimes[i].position.y > halfY + quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
||||
processed = TRUE;
|
||||
} else if (m_aCrimes[i].position.y < halfY - quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
||||
processed = TRUE;
|
||||
}
|
||||
|
||||
if (m_aCrimes[i].position.x > halfX + quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_EAST);
|
||||
else if (m_aCrimes[i].position.x < halfX - quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_WEST);
|
||||
else if (!processed)
|
||||
m_sPoliceRadioQueue.Add(SFX_CENTRAL);
|
||||
|
||||
m_sPoliceRadioQueue.Add(sampleIndex);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_aCrimes[i].type = CRIME_NONE;
|
||||
AgeCrimes();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Const uint32 gCarColourTable[][3] = {
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_BLACK, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_WHITE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_BRIGHT, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, SFX_SFX_POLICE_RADIO_BLUE, SFX_SFX_POLICE_RADIO_GREY},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, SFX_SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE}
|
||||
};
|
||||
|
||||
void
|
||||
cAudioManager::SetupSuspectLastSeenReport()
|
||||
{
|
||||
CVehicle *veh;
|
||||
uint8 color1;
|
||||
uint32 main_color;
|
||||
uint32 sample;
|
||||
|
||||
uint32 color_pre_modifier;
|
||||
uint32 color_post_modifier;
|
||||
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
||||
veh = FindVehicleOfPlayer();
|
||||
if (veh != nil) {
|
||||
if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 9) {
|
||||
color1 = veh->m_currentColour1;
|
||||
if (color1 >= ARRAY_SIZE(gCarColourTable)) {
|
||||
debug("\n *** UNKNOWN CAR COLOUR %d *** ", color1);
|
||||
} else {
|
||||
main_color = gCarColourTable[color1][1];
|
||||
color_pre_modifier = gCarColourTable[color1][0];
|
||||
color_post_modifier = gCarColourTable[color1][2];
|
||||
switch (veh->GetModelIndex()) {
|
||||
case MI_LANDSTAL:
|
||||
case MI_PATRIOT:
|
||||
case MI_RANCHER:
|
||||
case MI_FBIRANCH:
|
||||
case MI_SANDKING:
|
||||
sample = SFX_SFX_POLICE_RADIO_OFFROAD;
|
||||
break;
|
||||
case MI_IDAHO:
|
||||
case MI_MANANA:
|
||||
case MI_ESPERANT:
|
||||
case MI_CUBAN:
|
||||
case MI_STALLION:
|
||||
case MI_SABRE:
|
||||
case MI_SABRETUR:
|
||||
case MI_VIRGO:
|
||||
case MI_BLISTAC:
|
||||
sample = SFX_SFX_POLICE_RADIO_TUDOOR;
|
||||
break;
|
||||
case MI_STINGER:
|
||||
case MI_INFERNUS:
|
||||
case MI_CHEETAH:
|
||||
case MI_BANSHEE:
|
||||
case MI_PHEONIX:
|
||||
case MI_COMET:
|
||||
case MI_DELUXO:
|
||||
case MI_HOTRING:
|
||||
sample = SFX_SFX_POLICE_RADIO_SPORTS_CAR;
|
||||
break;
|
||||
case MI_LINERUN:
|
||||
sample = SFX_SFX_POLICE_RADIO_RIG;
|
||||
break;
|
||||
case MI_PEREN:
|
||||
case MI_REGINA:
|
||||
sample = SFX_SFX_POLICE_RADIO_STATION_WAGON;
|
||||
break;
|
||||
case MI_SENTINEL:
|
||||
case MI_FBICAR:
|
||||
case MI_WASHING:
|
||||
case MI_SENTXS:
|
||||
case MI_ADMIRAL:
|
||||
case MI_GLENDALE:
|
||||
case MI_OCEANIC:
|
||||
case MI_HERMES:
|
||||
case MI_GREENWOO:
|
||||
sample = SFX_SFX_POLICE_RADIO_SEDAN;
|
||||
break;
|
||||
case MI_RIO:
|
||||
sample = SFX_SFX_POLICE_RADIO_CRUISER;
|
||||
break;
|
||||
case MI_FIRETRUCK:
|
||||
sample = SFX_SFX_POLICE_RADIO_FIRE_TRUCK;
|
||||
break;
|
||||
case MI_TRASH:
|
||||
sample = SFX_SFX_POLICE_RADIO_GARBAGE_TRUCK;
|
||||
break;
|
||||
case MI_STRETCH:
|
||||
case MI_LOVEFIST:
|
||||
sample = SFX_SFX_POLICE_RADIO_STRETCH;
|
||||
break;
|
||||
case MI_VOODOO:
|
||||
sample = SFX_SFX_POLICE_RADIO_LOWRIDER;
|
||||
break;
|
||||
case MI_PONY:
|
||||
case MI_MOONBEAM:
|
||||
case MI_SECURICA:
|
||||
case MI_RUMPO:
|
||||
case MI_GANGBUR:
|
||||
case MI_YANKEE:
|
||||
case MI_TOPFUN:
|
||||
case MI_BURRITO:
|
||||
case MI_SPAND:
|
||||
sample = SFX_SFX_POLICE_RADIO_VAN;
|
||||
break;
|
||||
case MI_MULE:
|
||||
case MI_BARRACKS:
|
||||
case MI_PACKER:
|
||||
case MI_FLATBED:
|
||||
sample = SFX_SFX_POLICE_RADIO_TRUCK;
|
||||
break;
|
||||
case MI_AMBULAN:
|
||||
sample = SFX_SFX_POLICE_RADIO_AMBULANCE;
|
||||
break;
|
||||
case MI_TAXI:
|
||||
case MI_CABBIE:
|
||||
case MI_BORGNINE:
|
||||
sample = SFX_SFX_POLICE_RADIO_TAXI;
|
||||
break;
|
||||
case MI_BOBCAT:
|
||||
case MI_WALTON:
|
||||
sample = SFX_SFX_POLICE_RADIO_PICKUP;
|
||||
break;
|
||||
case MI_MRWHOOP:
|
||||
sample = SFX_SFX_POLICE_RADIO_ICE_CREAM_VAN;
|
||||
break;
|
||||
case MI_BFINJECT:
|
||||
sample = SFX_SFX_POLICE_RADIO_BUGGY;
|
||||
break;
|
||||
case MI_HUNTER:
|
||||
case MI_CHOPPER:
|
||||
case MI_SEASPAR:
|
||||
case MI_SPARROW:
|
||||
case MI_MAVERICK:
|
||||
case MI_VCNMAV:
|
||||
case MI_POLMAV:
|
||||
sample = SFX_SFX_POLICE_RADIO_HELICOPTER;
|
||||
break;
|
||||
case MI_POLICE:
|
||||
sample = SFX_SFX_POLICE_RADIO_POLICE_CAR;
|
||||
break;
|
||||
case MI_ENFORCER:
|
||||
sample = SFX_SFX_POLICE_RADIO_SWAT_VAN;
|
||||
break;
|
||||
case MI_PREDATOR:
|
||||
case MI_SQUALO:
|
||||
case MI_SPEEDER:
|
||||
sample = SFX_SFX_POLICE_RADIO_SPEEDBOAT;
|
||||
break;
|
||||
case MI_BUS:
|
||||
sample = SFX_SFX_POLICE_RADIO_BUS;
|
||||
break;
|
||||
case MI_RHINO:
|
||||
sample = SFX_SFX_POLICE_RADIO_TANK;
|
||||
break;
|
||||
case MI_ANGEL:
|
||||
case MI_PCJ600:
|
||||
case MI_FREEWAY:
|
||||
case MI_SANCHEZ:
|
||||
sample = SFX_SFX_POLICE_RADIO_MOTOBIKE;
|
||||
break;
|
||||
case MI_COACH:
|
||||
sample = SFX_SFX_POLICE_RADIO_COACH;
|
||||
break;
|
||||
case MI_HEARSE:
|
||||
sample = SFX_SFX_POLICE_RADIO_HEARSE;
|
||||
break;
|
||||
case MI_PIZZABOY:
|
||||
case MI_FAGGIO:
|
||||
sample = SFX_SFX_POLICE_RADIO_MOPED;
|
||||
break;
|
||||
case MI_DEADDODO:
|
||||
case MI_SKIMMER:
|
||||
sample = SFX_SFX_POLICE_RADIO_PLANE;
|
||||
break;
|
||||
case MI_REEFER:
|
||||
case MI_TROPIC:
|
||||
case MI_COASTG:
|
||||
case MI_MARQUIS:
|
||||
case MI_JETMAX:
|
||||
sample = SFX_SFX_POLICE_RADIO_BOAT;
|
||||
break;
|
||||
case MI_CADDY:
|
||||
sample = SFX_SFX_POLICE_RADIO_GOLF_CART;
|
||||
break;
|
||||
case MI_DINGHY:
|
||||
sample = SFX_SFX_POLICE_RADIO_DINGHY;
|
||||
break;
|
||||
default:
|
||||
//debug("\n *** UNKNOWN CAR MODEL INDEX %d *** ", veh->GetModelIndex());
|
||||
return;
|
||||
}
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
if (m_anRandomTable[3] % 2)
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_LAST_SEEN);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_IN_A);
|
||||
if (color_pre_modifier != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(color_pre_modifier);
|
||||
if (main_color != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(main_color);
|
||||
if (color_post_modifier != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(color_post_modifier);
|
||||
m_sPoliceRadioQueue.Add(sample);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
}
|
||||
}
|
||||
} else if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 4) {
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_ON_FOOT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
||||
{
|
||||
int32 lastCrime = ARRAY_SIZE(m_aCrimes);
|
||||
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 &&
|
||||
(type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) {
|
||||
for (int32 i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||
if (m_aCrimes[i].type != CRIME_NONE) {
|
||||
if (m_aCrimes[i].type == type) {
|
||||
m_aCrimes[i].position = pos;
|
||||
m_aCrimes[i].timer = 0;
|
||||
return;
|
||||
}
|
||||
} else
|
||||
lastCrime = i;
|
||||
}
|
||||
|
||||
if (lastCrime < ARRAY_SIZE(m_aCrimes)) {
|
||||
m_aCrimes[lastCrime].type = type;
|
||||
m_aCrimes[lastCrime].position = pos;
|
||||
m_aCrimes[lastCrime].timer = 0;
|
||||
gMinTimeToNextReport[type] = m_FrameCounter + 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::PlaySuspectLastSeen(float x, float y, float z)
|
||||
{
|
||||
int16 audioZone;
|
||||
CZone *zone;
|
||||
float rangeX;
|
||||
float rangeY;
|
||||
float halfX;
|
||||
float halfY;
|
||||
float quarterX;
|
||||
float quarterY;
|
||||
uint32 sample;
|
||||
bool8 processed = FALSE;
|
||||
CVector vec = CVector(x, y, z);
|
||||
|
||||
if (!m_bIsInitialised) return;
|
||||
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 9) {
|
||||
audioZone = CTheZones::FindAudioZone(&vec);
|
||||
if (audioZone >= 0 && audioZone < NUMAUDIOZONES) {
|
||||
zone = CTheZones::GetAudioZone(audioZone);
|
||||
for (int i = 0; i < NUMAUDIOZONES; i++) {
|
||||
if (strcmp(zone->name, ZoneSfx[i].m_aName) == 0) {
|
||||
sample = ZoneSfx[i].m_nSampleIndex;
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_LAST_SEEN);
|
||||
m_sPoliceRadioQueue.Add(SFX_IN);
|
||||
rangeX = zone->maxx - zone->minx;
|
||||
rangeY = zone->maxy - zone->miny;
|
||||
halfX = 0.5f * rangeX + zone->minx;
|
||||
halfY = 0.5f * rangeY + zone->miny;
|
||||
quarterX = 0.25f * rangeX;
|
||||
quarterY = 0.25f * rangeY;
|
||||
|
||||
if (vec.y > halfY + quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
||||
processed = TRUE;
|
||||
} else if (vec.y < halfY - quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
||||
processed = TRUE;
|
||||
}
|
||||
|
||||
if (vec.x > halfX + quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_EAST);
|
||||
else if (vec.x < halfX - quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_WEST);
|
||||
else if (!processed)
|
||||
m_sPoliceRadioQueue.Add(SFX_CENTRAL);
|
||||
m_sPoliceRadioQueue.Add(sample);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
gSpecialSuspectLastSeenReport = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::AgeCrimes()
|
||||
{
|
||||
for (uint8 i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||
if (m_aCrimes[i].type != CRIME_NONE) {
|
||||
if (++m_aCrimes[i].timer > 1200) m_aCrimes[i].type = CRIME_NONE;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
#pragma once
|
||||
|
||||
#include "Crime.h"
|
||||
#include "AudioSamples.h"
|
||||
|
||||
struct cAMCrime {
|
||||
int32 type;
|
||||
CVector position;
|
||||
uint16 timer;
|
||||
|
||||
cAMCrime()
|
||||
{
|
||||
type = CRIME_NONE;
|
||||
position = CVector(0.0f, 0.0f, 0.0f);
|
||||
timer = 0;
|
||||
}
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cAMCrime, 20);
|
||||
|
||||
#define POLICE_RADIO_QUEUE_MAX_SAMPLES 60
|
||||
|
||||
class cPoliceRadioQueue
|
||||
{
|
||||
public:
|
||||
uint32 m_aSamples[POLICE_RADIO_QUEUE_MAX_SAMPLES];
|
||||
uint8 m_nSamplesInQueue;
|
||||
uint8 m_nAddOffset;
|
||||
uint8 m_nRemoveOffset;
|
||||
|
||||
cPoliceRadioQueue()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_nAddOffset = 0;
|
||||
m_nRemoveOffset = 0;
|
||||
m_nSamplesInQueue = 0;
|
||||
}
|
||||
|
||||
bool8 Add(uint32 sample)
|
||||
{
|
||||
if (m_nSamplesInQueue != POLICE_RADIO_QUEUE_MAX_SAMPLES) {
|
||||
m_aSamples[m_nAddOffset] = sample;
|
||||
m_nSamplesInQueue++;
|
||||
m_nAddOffset = (m_nAddOffset + 1) % POLICE_RADIO_QUEUE_MAX_SAMPLES;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint32 Remove()
|
||||
{
|
||||
if (m_nSamplesInQueue != 0) {
|
||||
uint32 sample = m_aSamples[m_nRemoveOffset];
|
||||
m_nSamplesInQueue--;
|
||||
m_nRemoveOffset = (m_nRemoveOffset + 1) % POLICE_RADIO_QUEUE_MAX_SAMPLES;
|
||||
return sample;
|
||||
}
|
||||
return NO_SAMPLE;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cPoliceRadioQueue, 244);
|
|
@ -1,746 +0,0 @@
|
|||
#include "common.h"
|
||||
|
||||
#include "DMAudio.h"
|
||||
|
||||
#include "AudioManager.h"
|
||||
|
||||
#include "AudioSamples.h"
|
||||
#include "MusicManager.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "PoliceRadio.h"
|
||||
#include "Replay.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
#include "Zones.h"
|
||||
#include "sampman.h"
|
||||
#include "Wanted.h"
|
||||
|
||||
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
|
||||
const int policeChannel = channels + 1;
|
||||
|
||||
struct tPoliceRadioZone {
|
||||
char m_aName[8];
|
||||
uint32 m_nSampleIndex;
|
||||
int32 field_12;
|
||||
};
|
||||
|
||||
tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
|
||||
|
||||
int32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
|
||||
int8 g_nMissionAudioPlayingStatus = 2;
|
||||
uint8 gSpecialSuspectLastSeenReport;
|
||||
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
|
||||
|
||||
void
|
||||
cAudioManager::InitialisePoliceRadioZones()
|
||||
{
|
||||
for (int32 i = 0; i < NUMAUDIOZONES; i++)
|
||||
memset(ZoneSfx[i].m_aName, 0, 8);
|
||||
|
||||
#define SETZONESFX(i, name, sample) \
|
||||
strcpy(ZoneSfx[i].m_aName, name); \
|
||||
ZoneSfx[i].m_nSampleIndex = sample;
|
||||
|
||||
SETZONESFX(0, "VICE_C", SFX_POLICE_RADIO_VICE_CITY);
|
||||
SETZONESFX(1, "IND_ZON", SFX_POLICE_RADIO_VICE_CITY_BEACH);
|
||||
SETZONESFX(2, "COM_ZON", SFX_POLICE_RADIO_VICE_CITY_MAINLAND);
|
||||
SETZONESFX(3, "BEACH1", SFX_POLICE_RADIO_OCEAN_BEACH);
|
||||
SETZONESFX(4, "BEACH2", SFX_POLICE_RADIO_WASHINGTON_BEACH);
|
||||
SETZONESFX(5, "BEACH3", SFX_POLICE_RADIO_VICE_POINT);
|
||||
SETZONESFX(6, "GOLFC", SFX_POLICE_RADIO_LEAF_LINKS);
|
||||
SETZONESFX(7, "STARI", SFX_POLICE_RADIO_STRAFISH_ISLAND);
|
||||
SETZONESFX(8, "DOCKS", SFX_POLICE_RADIO_VICE_PORT);
|
||||
SETZONESFX(9, "HAVANA", SFX_POLICE_RADIO_LITTLE_HAVANA);
|
||||
SETZONESFX(10, "HAITI", SFX_POLICE_RADIO_LITTLE_HAITI);
|
||||
SETZONESFX(11, "PORNI", SFX_POLICE_RADIO_PRAWN_ISLAND);
|
||||
SETZONESFX(12, "DTOWN", SFX_POLICE_RADIO_DOWNTOWN);
|
||||
SETZONESFX(13, "A_PORT", SFX_POLICE_RADIO_ESCOBAR_INTERNATIONAL);
|
||||
|
||||
#undef SETZONESFX
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::InitialisePoliceRadio()
|
||||
{
|
||||
m_sPoliceRadioQueue.policeChannelTimer = 0;
|
||||
m_sPoliceRadioQueue.policeChannelTimerSeconds = 0;
|
||||
m_sPoliceRadioQueue.policeChannelCounterSeconds = 0;
|
||||
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++)
|
||||
m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
||||
|
||||
SampleManager.SetChannelReverbFlag(policeChannel, false);
|
||||
gSpecialSuspectLastSeenReport = false;
|
||||
for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++)
|
||||
gMinTimeToNextReport[i] = m_FrameCounter;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ResetPoliceRadio()
|
||||
{
|
||||
if (!m_bIsInitialised) return;
|
||||
if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel);
|
||||
InitialisePoliceRadio();
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::SetMissionScriptPoliceAudio(int32 sfx) const
|
||||
{
|
||||
if (!m_bIsInitialised) return;
|
||||
if (g_nMissionAudioPlayingStatus != 1) {
|
||||
g_nMissionAudioPlayingStatus = 0;
|
||||
g_nMissionAudioSfx = sfx;
|
||||
}
|
||||
}
|
||||
|
||||
int8
|
||||
cAudioManager::GetMissionScriptPoliceAudioPlayingStatus() const
|
||||
{
|
||||
return g_nMissionAudioPlayingStatus;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::DoPoliceRadioCrackle()
|
||||
{
|
||||
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
|
||||
m_sQueueSample.m_nCounter = 0;
|
||||
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
|
||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_bIs2D = true;
|
||||
m_sQueueSample.m_nReleasingVolumeModificator = 10;
|
||||
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
|
||||
m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15;
|
||||
m_sQueueSample.m_nLoopCount = 0;
|
||||
m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
|
||||
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE);
|
||||
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE);
|
||||
m_sQueueSample.m_bReleasingSoundFlag = false;
|
||||
m_sQueueSample.m_bReverbFlag = false;
|
||||
m_sQueueSample.m_nOffset = 63;
|
||||
m_sQueueSample.m_nReleasingVolumeDivider = 3;
|
||||
m_sQueueSample.m_bRequireReflection = false;
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ServicePoliceRadio()
|
||||
{
|
||||
int32 wantedLevel = 0; // uninitialized variable
|
||||
static uint32 nLastSeen = 300;
|
||||
|
||||
if(!m_bIsInitialised) return;
|
||||
|
||||
if(m_nUserPause == 0) {
|
||||
bool crimeReport = SetupCrimeReport();
|
||||
#ifdef FIX_BUGS // Crash at 0x5fe6ef
|
||||
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
||||
return;
|
||||
#endif
|
||||
CPlayerPed *playerPed = FindPlayerPed();
|
||||
if (playerPed) {
|
||||
wantedLevel = playerPed->m_pWanted->GetWantedLevel();
|
||||
if (!crimeReport) {
|
||||
if (wantedLevel != 0) {
|
||||
if (nLastSeen != 0)
|
||||
--nLastSeen;
|
||||
else {
|
||||
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
|
||||
SetupSuspectLastSeenReport();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ServicePoliceRadioChannel(wantedLevel);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||
{
|
||||
bool processed = false;
|
||||
uint32 sample;
|
||||
int32 freq;
|
||||
|
||||
static int cWait = 0;
|
||||
static bool bChannelOpen = false;
|
||||
static uint8 bMissionAudioPhysicalPlayingStatus = 0;
|
||||
static int32 PoliceChannelFreq = 22050;
|
||||
|
||||
if (!m_bIsInitialised) return;
|
||||
|
||||
if (m_nUserPause != 0) {
|
||||
if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel);
|
||||
if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == 1 &&
|
||||
SampleManager.IsStreamPlaying(1)) {
|
||||
SampleManager.PauseStream(1, 1);
|
||||
}
|
||||
} else {
|
||||
if (m_nPreviousUserPause && g_nMissionAudioSfx != NO_SAMPLE &&
|
||||
bMissionAudioPhysicalPlayingStatus == 1) {
|
||||
SampleManager.PauseStream(0, 1);
|
||||
}
|
||||
if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = false;
|
||||
if (cWait) {
|
||||
--cWait;
|
||||
return;
|
||||
}
|
||||
if (g_nMissionAudioSfx != NO_SAMPLE && !bChannelOpen) {
|
||||
if (g_nMissionAudioPlayingStatus) {
|
||||
if (g_nMissionAudioPlayingStatus == 1 && !bMissionAudioPhysicalPlayingStatus &&
|
||||
SampleManager.IsStreamPlaying(1)) {
|
||||
bMissionAudioPhysicalPlayingStatus = 1;
|
||||
}
|
||||
if (bMissionAudioPhysicalPlayingStatus == 1) {
|
||||
if (SampleManager.IsStreamPlaying(1)) {
|
||||
DoPoliceRadioCrackle();
|
||||
} else {
|
||||
bMissionAudioPhysicalPlayingStatus = 2;
|
||||
g_nMissionAudioPlayingStatus = 2;
|
||||
g_nMissionAudioSfx = NO_SAMPLE;
|
||||
cWait = 30;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if (!SampleManager.GetChannelUsedFlag(policeChannel)) {
|
||||
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
|
||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 1);
|
||||
SampleManager.StartPreloadedStreamedFile(1);
|
||||
g_nMissionAudioPlayingStatus = 1;
|
||||
bMissionAudioPhysicalPlayingStatus = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (bChannelOpen) DoPoliceRadioCrackle();
|
||||
if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != 1) &&
|
||||
!SampleManager.GetChannelUsedFlag(policeChannel) && m_sPoliceRadioQueue.policeChannelTimer) {
|
||||
if (m_sPoliceRadioQueue.policeChannelTimer) {
|
||||
sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds];
|
||||
m_sPoliceRadioQueue.policeChannelTimer--;
|
||||
m_sPoliceRadioQueue.policeChannelCounterSeconds = (m_sPoliceRadioQueue.policeChannelCounterSeconds + 1) % 60;
|
||||
} else {
|
||||
sample = NO_SAMPLE;
|
||||
}
|
||||
if (wantedLevel == 0) {
|
||||
if (gSpecialSuspectLastSeenReport) {
|
||||
gSpecialSuspectLastSeenReport = 0;
|
||||
} else if (sample == SFX_POLICE_RADIO_MESSAGE_NOISE_1) {
|
||||
bChannelOpen = false;
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
if (sample == NO_SAMPLE) {
|
||||
if (!processed) cWait = 30;
|
||||
} else {
|
||||
SampleManager.InitialiseChannel(policeChannel, sample, 0);
|
||||
switch (sample) {
|
||||
case SFX_POLICE_RADIO_MESSAGE_NOISE_1:
|
||||
freq = m_anRandomTable[4] % 2000 + 10025;
|
||||
bChannelOpen = bChannelOpen == false;
|
||||
break;
|
||||
default: freq = SampleManager.GetSampleBaseFrequency(sample); break;
|
||||
}
|
||||
PoliceChannelFreq = freq;
|
||||
SampleManager.SetChannelFrequency(policeChannel, freq);
|
||||
SampleManager.SetChannelVolume(policeChannel, 100);
|
||||
SampleManager.SetChannelPan(policeChannel, 63);
|
||||
SampleManager.SetChannelLoopCount(policeChannel, 1);
|
||||
SampleManager.SetChannelLoopPoints(policeChannel, 0, -1);
|
||||
SampleManager.StartChannel(policeChannel);
|
||||
}
|
||||
if (processed) ResetPoliceRadio();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
cAudioManager::SetupCrimeReport()
|
||||
{
|
||||
int16 audioZoneId;
|
||||
CZone *zone;
|
||||
float rangeX;
|
||||
float rangeY;
|
||||
float halfX;
|
||||
float halfY;
|
||||
float quarterX;
|
||||
float quarterY;
|
||||
int i;
|
||||
int32 sampleIndex;
|
||||
bool processed = false;
|
||||
|
||||
if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return false;
|
||||
|
||||
if (60 - m_sPoliceRadioQueue.policeChannelTimer <= 9) {
|
||||
AgeCrimes();
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
||||
if (m_sPoliceRadioQueue.crimes[i].type != CRIME_NONE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) return false;
|
||||
audioZoneId = CTheZones::FindAudioZone(&m_sPoliceRadioQueue.crimes[i].position);
|
||||
if (audioZoneId >= 0 && audioZoneId < NUMAUDIOZONES) {
|
||||
zone = CTheZones::GetAudioZone(audioZoneId);
|
||||
for (int j = 0; j < NUMAUDIOZONES; j++) {
|
||||
if (strcmp(zone->name, ZoneSfx[j].m_aName) == 0) {
|
||||
sampleIndex = ZoneSfx[j].m_nSampleIndex;
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(m_anRandomTable[0] % 3 + SFX_WEVE_GOT);
|
||||
m_sPoliceRadioQueue.Add(SFX_A_10);
|
||||
switch (m_sPoliceRadioQueue.crimes[i].type) {
|
||||
case CRIME_PED_BURNED:
|
||||
case CRIME_HIT_PED_NASTYWEAPON:
|
||||
m_sPoliceRadioQueue.crimes[i].type = CRIME_HIT_PED;
|
||||
break;
|
||||
case CRIME_COP_BURNED:
|
||||
case CRIME_HIT_COP_NASTYWEAPON:
|
||||
m_sPoliceRadioQueue.crimes[i].type = CRIME_HIT_COP;
|
||||
break;
|
||||
case CRIME_VEHICLE_BURNED: m_sPoliceRadioQueue.crimes[i].type = CRIME_STEAL_CAR; break;
|
||||
case CRIME_DESTROYED_CESSNA: m_sPoliceRadioQueue.crimes[i].type = CRIME_SHOOT_HELI; break;
|
||||
case CRIME_EXPLOSION: m_sPoliceRadioQueue.crimes[i].type = CRIME_STEAL_CAR; break; // huh?
|
||||
default: break;
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
m_sPoliceRadioQueue.Add(m_sPoliceRadioQueue.crimes[i].type + SFX_CRIME_1 - 1);
|
||||
#else
|
||||
m_sPoliceRadioQueue.Add(m_sPoliceRadioQueue.crimes[i].type + SFX_CRIME_1);
|
||||
#endif
|
||||
m_sPoliceRadioQueue.Add(SFX_IN);
|
||||
rangeX = zone->maxx - zone->minx;
|
||||
rangeY = zone->maxy - zone->miny;
|
||||
halfX = 0.5f * rangeX + zone->minx;
|
||||
halfY = 0.5f * rangeY + zone->miny;
|
||||
quarterX = 0.25f * rangeX;
|
||||
quarterY = 0.25f * rangeY;
|
||||
|
||||
if (m_sPoliceRadioQueue.crimes[i].position.y > halfY + quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
||||
processed = true;
|
||||
} else if (m_sPoliceRadioQueue.crimes[i].position.y < halfY - quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
||||
processed = true;
|
||||
}
|
||||
|
||||
if (m_sPoliceRadioQueue.crimes[i].position.x > halfX + quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_EAST);
|
||||
else if (m_sPoliceRadioQueue.crimes[i].position.x < halfX - quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_WEST);
|
||||
else if (!processed)
|
||||
m_sPoliceRadioQueue.Add(SFX_CENTRAL);
|
||||
|
||||
m_sPoliceRadioQueue.Add(sampleIndex);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
||||
AgeCrimes();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::SetupSuspectLastSeenReport()
|
||||
{
|
||||
CVehicle *veh;
|
||||
uint8 color1;
|
||||
int32 main_color;
|
||||
int32 sample;
|
||||
|
||||
int32 color_pre_modifier;
|
||||
int32 color_post_modifier;
|
||||
|
||||
const int32 gCarColourTable[][3] = {
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLACK, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_WHITE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_BRIGHT, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_BLUE, SFX_POLICE_RADIO_GREY},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE}
|
||||
};
|
||||
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
||||
veh = FindVehicleOfPlayer();
|
||||
if (veh != nil) {
|
||||
if (60 - m_sPoliceRadioQueue.policeChannelTimer > 9) {
|
||||
color1 = veh->m_currentColour1;
|
||||
if (color1 >= ARRAY_SIZE(gCarColourTable)) {
|
||||
debug("\n *** UNKNOWN CAR COLOUR %d *** ", color1);
|
||||
} else {
|
||||
main_color = gCarColourTable[color1][1];
|
||||
color_pre_modifier = gCarColourTable[color1][0];
|
||||
color_post_modifier = gCarColourTable[color1][2];
|
||||
switch (veh->GetModelIndex()) {
|
||||
case MI_LANDSTAL:
|
||||
case MI_PATRIOT:
|
||||
case MI_RANCHER:
|
||||
case MI_FBIRANCH:
|
||||
case MI_SANDKING:
|
||||
sample = SFX_POLICE_RADIO_OFFROAD;
|
||||
break;
|
||||
case MI_IDAHO:
|
||||
case MI_MANANA:
|
||||
case MI_ESPERANT:
|
||||
case MI_CUBAN:
|
||||
case MI_STALLION:
|
||||
case MI_SABRE:
|
||||
case MI_SABRETUR:
|
||||
case MI_VIRGO:
|
||||
case MI_BLISTAC:
|
||||
sample = SFX_POLICE_RADIO_2_DOOR;
|
||||
break;
|
||||
case MI_STINGER:
|
||||
case MI_INFERNUS:
|
||||
case MI_CHEETAH:
|
||||
case MI_BANSHEE:
|
||||
case MI_PHEONIX:
|
||||
case MI_COMET:
|
||||
case MI_DELUXO:
|
||||
case MI_HOTRING:
|
||||
sample = SFX_POLICE_RADIO_SPORTS_CAR;
|
||||
break;
|
||||
case MI_LINERUN:
|
||||
sample = SFX_POLICE_RADIO_RIG;
|
||||
break;
|
||||
case MI_PEREN:
|
||||
case MI_REGINA:
|
||||
sample = SFX_POLICE_RADIO_STATION_WAGON;
|
||||
break;
|
||||
case MI_SENTINEL:
|
||||
case MI_FBICAR:
|
||||
case MI_WASHING:
|
||||
case MI_SENTXS:
|
||||
case MI_ADMIRAL:
|
||||
case MI_GLENDALE:
|
||||
case MI_OCEANIC:
|
||||
case MI_HERMES:
|
||||
case MI_GREENWOO:
|
||||
sample = SFX_POLICE_RADIO_SEDAN;
|
||||
break;
|
||||
case MI_RIO:
|
||||
sample = SFX_POLICE_RADIO_CRUISER;
|
||||
break;
|
||||
case MI_FIRETRUCK:
|
||||
sample = SFX_POLICE_RADIO_FIRE_TRUCK;
|
||||
break;
|
||||
case MI_TRASH:
|
||||
sample = SFX_POLICE_RADIO_GARBAGE_TRUCK;
|
||||
break;
|
||||
case MI_STRETCH:
|
||||
case MI_LOVEFIST:
|
||||
sample = SFX_POLICE_RADIO_STRETCH;
|
||||
break;
|
||||
case MI_VOODOO:
|
||||
sample = SFX_POLICE_RADIO_LOWRIDER;
|
||||
break;
|
||||
case MI_PONY:
|
||||
case MI_MOONBEAM:
|
||||
case MI_SECURICA:
|
||||
case MI_RUMPO:
|
||||
case MI_GANGBUR:
|
||||
case MI_YANKEE:
|
||||
case MI_TOPFUN:
|
||||
case MI_BURRITO:
|
||||
case MI_SPAND:
|
||||
sample = SFX_POLICE_RADIO_VAN;
|
||||
break;
|
||||
case MI_MULE:
|
||||
case MI_BARRACKS:
|
||||
case MI_PACKER:
|
||||
case MI_FLATBED:
|
||||
sample = SFX_POLICE_RADIO_TRUCK;
|
||||
break;
|
||||
case MI_AMBULAN:
|
||||
sample = SFX_POLICE_RADIO_AMBULANCE;
|
||||
break;
|
||||
case MI_TAXI:
|
||||
case MI_CABBIE:
|
||||
case MI_BORGNINE:
|
||||
sample = SFX_POLICE_RADIO_TAXI;
|
||||
break;
|
||||
case MI_BOBCAT:
|
||||
case MI_WALTON:
|
||||
sample = SFX_POLICE_RADIO_PICKUP;
|
||||
break;
|
||||
case MI_MRWHOOP:
|
||||
sample = SFX_POLICE_RADIO_ICE_CREAM_VAN;
|
||||
break;
|
||||
case MI_BFINJECT:
|
||||
sample = SFX_POLICE_RADIO_BUGGY;
|
||||
break;
|
||||
case MI_HUNTER:
|
||||
case MI_CHOPPER:
|
||||
case MI_SEASPAR:
|
||||
case MI_SPARROW:
|
||||
case MI_MAVERICK:
|
||||
case MI_VCNMAV:
|
||||
case MI_POLMAV:
|
||||
sample = SFX_POLICE_RADIO_HELICOPTER;
|
||||
break;
|
||||
case MI_POLICE:
|
||||
sample = SFX_POLICE_RADIO_POLICE_CAR;
|
||||
break;
|
||||
case MI_ENFORCER:
|
||||
sample = SFX_POLICE_RADIO_SWAT_VAN;
|
||||
break;
|
||||
case MI_PREDATOR:
|
||||
case MI_SQUALO:
|
||||
case MI_SPEEDER:
|
||||
sample = SFX_POLICE_RADIO_SPEEDBOAT;
|
||||
break;
|
||||
case MI_BUS:
|
||||
sample = SFX_POLICE_RADIO_BUS;
|
||||
break;
|
||||
case MI_RHINO:
|
||||
sample = SFX_POLICE_RADIO_TANK;
|
||||
break;
|
||||
case MI_ANGEL:
|
||||
case MI_PCJ600:
|
||||
case MI_FREEWAY:
|
||||
case MI_SANCHEZ:
|
||||
sample = SFX_POLICE_RADIO_MOTOBIKE;
|
||||
break;
|
||||
case MI_COACH:
|
||||
sample = SFX_POLICE_RADIO_COACH;
|
||||
break;
|
||||
case MI_ROMERO:
|
||||
sample = SFX_POLICE_RADIO_HEARSE;
|
||||
break;
|
||||
case MI_PIZZABOY:
|
||||
case MI_FAGGIO:
|
||||
sample = SFX_POLICE_RADIO_MOPED;
|
||||
break;
|
||||
case MI_DEADDODO:
|
||||
case MI_SKIMMER:
|
||||
sample = SFX_POLICE_RADIO_PLANE;
|
||||
break;
|
||||
case MI_REEFER:
|
||||
case MI_TROPIC:
|
||||
case MI_COASTG:
|
||||
case MI_MARQUIS:
|
||||
case MI_JETMAX:
|
||||
sample = SFX_POLICE_RADIO_BOAT;
|
||||
break;
|
||||
case MI_CADDY:
|
||||
sample = SFX_POLICE_RADIO_GOLF_CART;
|
||||
break;
|
||||
case MI_DINGHY:
|
||||
sample = SFX_POLICE_RADIO_DINGHY;
|
||||
break;
|
||||
default:
|
||||
//debug("\n *** UNKNOWN CAR MODEL INDEX %d *** ", veh->GetModelIndex());
|
||||
return;
|
||||
}
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
if (m_anRandomTable[3] % 2)
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_LAST_SEEN);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_IN_A);
|
||||
if (color_pre_modifier != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(color_pre_modifier);
|
||||
if (main_color != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(main_color);
|
||||
if (color_post_modifier != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(color_post_modifier);
|
||||
m_sPoliceRadioQueue.Add(sample);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
}
|
||||
}
|
||||
} else if (60 - m_sPoliceRadioQueue.policeChannelTimer > 4) {
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_ON_FOOT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
||||
{
|
||||
int32 lastCrime = ARRAY_SIZE(m_sPoliceRadioQueue.crimes);
|
||||
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 &&
|
||||
(type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) {
|
||||
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
||||
if (m_sPoliceRadioQueue.crimes[i].type != CRIME_NONE) {
|
||||
if (m_sPoliceRadioQueue.crimes[i].type == type) {
|
||||
m_sPoliceRadioQueue.crimes[i].position = pos;
|
||||
m_sPoliceRadioQueue.crimes[i].timer = 0;
|
||||
return;
|
||||
}
|
||||
} else
|
||||
lastCrime = i;
|
||||
}
|
||||
|
||||
if (lastCrime < ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) {
|
||||
m_sPoliceRadioQueue.crimes[lastCrime].type = type;
|
||||
m_sPoliceRadioQueue.crimes[lastCrime].position = pos;
|
||||
m_sPoliceRadioQueue.crimes[lastCrime].timer = 0;
|
||||
gMinTimeToNextReport[type] = m_FrameCounter + 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::PlaySuspectLastSeen(float x, float y, float z)
|
||||
{
|
||||
int16 audioZone;
|
||||
CZone *zone;
|
||||
float rangeX;
|
||||
float rangeY;
|
||||
float halfX;
|
||||
float halfY;
|
||||
float quarterX;
|
||||
float quarterY;
|
||||
int32 sample;
|
||||
bool processed = false;
|
||||
CVector vec = CVector(x, y, z);
|
||||
|
||||
if (!m_bIsInitialised) return;
|
||||
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && 60 - m_sPoliceRadioQueue.policeChannelTimer > 9) {
|
||||
audioZone = CTheZones::FindAudioZone(&vec);
|
||||
if (audioZone >= 0 && audioZone < NUMAUDIOZONES) {
|
||||
zone = CTheZones::GetAudioZone(audioZone);
|
||||
for (int i = 0; i < NUMAUDIOZONES; i++) {
|
||||
if (strcmp(zone->name, ZoneSfx[i].m_aName) == 0) {
|
||||
sample = ZoneSfx[i].m_nSampleIndex;
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_LAST_SEEN);
|
||||
m_sPoliceRadioQueue.Add(SFX_IN);
|
||||
rangeX = zone->maxx - zone->minx;
|
||||
rangeY = zone->maxy - zone->miny;
|
||||
halfX = 0.5f * rangeX + zone->minx;
|
||||
halfY = 0.5f * rangeY + zone->miny;
|
||||
quarterX = 0.25f * rangeX;
|
||||
quarterY = 0.25f * rangeY;
|
||||
|
||||
if (vec.y > halfY + quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
||||
processed = true;
|
||||
} else if (vec.y < halfY - quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
||||
processed = true;
|
||||
}
|
||||
|
||||
if (vec.x > halfX + quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_EAST);
|
||||
else if (vec.x < halfX - quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_WEST);
|
||||
else if (!processed)
|
||||
m_sPoliceRadioQueue.Add(SFX_CENTRAL);
|
||||
m_sPoliceRadioQueue.Add(sample);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
gSpecialSuspectLastSeenReport = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::AgeCrimes()
|
||||
{
|
||||
for (uint8 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
||||
if (m_sPoliceRadioQueue.crimes[i].type != CRIME_NONE) {
|
||||
if (++m_sPoliceRadioQueue.crimes[i].timer > 1200) m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "Crime.h"
|
||||
|
||||
struct cAMCrime {
|
||||
int32 type;
|
||||
CVector position;
|
||||
uint16 timer;
|
||||
|
||||
cAMCrime()
|
||||
{
|
||||
type = CRIME_NONE;
|
||||
position = CVector(0.0f, 0.0f, 0.0f);
|
||||
timer = 0;
|
||||
}
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cAMCrime, 20);
|
||||
|
||||
class cPoliceRadioQueue
|
||||
{
|
||||
public:
|
||||
int32 crimesSamples[60];
|
||||
uint8 policeChannelTimer;
|
||||
uint8 policeChannelTimerSeconds;
|
||||
uint8 policeChannelCounterSeconds;
|
||||
cAMCrime crimes[10];
|
||||
|
||||
cPoliceRadioQueue()
|
||||
{
|
||||
policeChannelTimerSeconds = 0;
|
||||
policeChannelCounterSeconds = 0;
|
||||
policeChannelTimer = 0;
|
||||
}
|
||||
|
||||
void Add(uint32 sample)
|
||||
{
|
||||
if (policeChannelTimer != 60) {
|
||||
crimesSamples[policeChannelTimerSeconds] = sample;
|
||||
policeChannelTimer++;
|
||||
policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cPoliceRadioQueue, 0x1BC);
|
|
@ -137,3 +137,44 @@ enum eAudioType
|
|||
AUDIOTYPE_POLICERADIO,
|
||||
TOTAL_AUDIO_TYPES,
|
||||
};
|
||||
|
||||
#ifdef GTA_PS2
|
||||
enum
|
||||
{
|
||||
NUM_CHANNELS_GENERIC = 40,
|
||||
CHANNEL_POLICE_RADIO = NUM_CHANNELS_GENERIC,
|
||||
CHANNEL_MISSION_AUDIO_1,
|
||||
CHANNEL_MISSION_AUDIO_2,
|
||||
CHANNEL_PLAYER_VEHICLE_ENGINE,
|
||||
NUM_CHANNELS,
|
||||
|
||||
NUM_CHANNELS_DTS_GENERIC = 18,
|
||||
CHANNEL_DTS_POLICE_RADIO = NUM_CHANNELS_DTS_GENERIC,
|
||||
CHANNEL_DTS_MISSION_AUDIO_1,
|
||||
CHANNEL_DTS_MISSION_AUDIO_2,
|
||||
CHANNEL_DTS_PLAYER_VEHICLE_ENGINE,
|
||||
};
|
||||
#else
|
||||
enum
|
||||
{
|
||||
#ifdef PS2_AUDIO_CHANNELS
|
||||
NUM_CHANNELS_GENERIC = 40,
|
||||
#else
|
||||
NUM_CHANNELS_GENERIC = 20,
|
||||
#endif
|
||||
CHANNEL_POLICE_RADIO,
|
||||
CHANNEL_MISSION_AUDIO_1,
|
||||
CHANNEL_MISSION_AUDIO_2,
|
||||
NUM_CHANNELS
|
||||
};
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
MISSION_AUDIO_SLOT_1,
|
||||
MISSION_AUDIO_SLOT_2,
|
||||
MISSION_AUDIO_POLRADIO_CRIME_OR_COLOR,
|
||||
MISSION_AUDIO_POLRADIO_AREA_OR_CAR,
|
||||
MISSION_AUDIO_PLAYER_COMMENT,
|
||||
MISSION_AUDIO_COUNT
|
||||
};
|
||||
|
|
|
@ -24,12 +24,6 @@
|
|||
|
||||
#include "aldlist.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#define _stricmp strcasecmp
|
||||
#define _strnicmp strncasecmp
|
||||
#define _strdup strdup
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
/*
|
||||
* Init call
|
||||
|
@ -47,8 +41,8 @@ ALDeviceList::ALDeviceList()
|
|||
defaultDeviceIndex = 0;
|
||||
|
||||
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) {
|
||||
devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
||||
devices = (char *)alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
|
||||
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER);
|
||||
|
||||
index = 0;
|
||||
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
||||
|
@ -62,17 +56,11 @@ ALDeviceList::ALDeviceList()
|
|||
if (context) {
|
||||
alcMakeContextCurrent(context);
|
||||
// if new actual device name isn't already in the list, then add it...
|
||||
actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
|
||||
bool bNewName = true;
|
||||
for (unsigned int i = 0; i < GetNumDevices(); i++) {
|
||||
if (strcmp(GetDeviceName(i), actualDeviceName) == 0) {
|
||||
bNewName = false;
|
||||
}
|
||||
}
|
||||
if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
|
||||
ALDEVICEINFO ALDeviceInfo;
|
||||
actualDeviceName = alcGetString(device, ALC_ALL_DEVICES_SPECIFIER);
|
||||
if ((actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
|
||||
ALDEVICEINFO &ALDeviceInfo = aDeviceInfo[nNumOfDevices++];
|
||||
ALDeviceInfo.bSelected = true;
|
||||
ALDeviceInfo.strDeviceName = _strdup(actualDeviceName);
|
||||
ALDeviceInfo.SetName(actualDeviceName);
|
||||
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion);
|
||||
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion);
|
||||
|
||||
|
@ -105,8 +93,6 @@ ALDeviceList::ALDeviceList()
|
|||
|
||||
// Get Source Count
|
||||
ALDeviceInfo.uiSourceCount = GetMaxNumSources();
|
||||
|
||||
aDeviceInfo[nNumOfDevices++] = ALDeviceInfo;
|
||||
}
|
||||
alcMakeContextCurrent(NULL);
|
||||
alcDestroyContext(context);
|
||||
|
|
|
@ -21,7 +21,7 @@ enum
|
|||
};
|
||||
|
||||
struct ALDEVICEINFO {
|
||||
const char *strDeviceName;
|
||||
char *strDeviceName;
|
||||
int iMajorVersion;
|
||||
int iMinorVersion;
|
||||
unsigned int uiSourceCount;
|
||||
|
@ -33,6 +33,19 @@ struct ALDEVICEINFO {
|
|||
strDeviceName = NULL;
|
||||
Extensions = 0;
|
||||
}
|
||||
|
||||
~ALDEVICEINFO()
|
||||
{
|
||||
delete[] strDeviceName;
|
||||
strDeviceName = NULL;
|
||||
}
|
||||
|
||||
void SetName(const char *name)
|
||||
{
|
||||
if(strDeviceName) delete[] strDeviceName;
|
||||
strDeviceName = new char[strlen(name) + 1];
|
||||
strcpy(strDeviceName, name);
|
||||
}
|
||||
};
|
||||
|
||||
typedef ALDEVICEINFO *LPALDEVICEINFO;
|
||||
|
|
|
@ -10,20 +10,22 @@
|
|||
|
||||
extern bool IsFXSupported();
|
||||
|
||||
ALuint alSources[MAXCHANNELS+MAX2DCHANNELS];
|
||||
ALuint alFilters[MAXCHANNELS+MAX2DCHANNELS];
|
||||
ALuint alBuffers[MAXCHANNELS+MAX2DCHANNELS];
|
||||
ALuint alSources[NUM_CHANNELS];
|
||||
ALuint alFilters[NUM_CHANNELS];
|
||||
ALuint alBuffers[NUM_CHANNELS];
|
||||
bool bChannelsCreated = false;
|
||||
|
||||
int32 CChannel::channelsThatNeedService = 0;
|
||||
|
||||
uint8 tempStereoBuffer[PED_BLOCKSIZE * 2];
|
||||
|
||||
void
|
||||
CChannel::InitChannels()
|
||||
{
|
||||
alGenSources(MAXCHANNELS+MAX2DCHANNELS, alSources);
|
||||
alGenBuffers(MAXCHANNELS+MAX2DCHANNELS, alBuffers);
|
||||
alGenSources(NUM_CHANNELS, alSources);
|
||||
alGenBuffers(NUM_CHANNELS, alBuffers);
|
||||
if (IsFXSupported())
|
||||
alGenFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters);
|
||||
alGenFilters(NUM_CHANNELS, alFilters);
|
||||
bChannelsCreated = true;
|
||||
}
|
||||
|
||||
|
@ -32,13 +34,13 @@ CChannel::DestroyChannels()
|
|||
{
|
||||
if (bChannelsCreated)
|
||||
{
|
||||
alDeleteSources(MAXCHANNELS + MAX2DCHANNELS, alSources);
|
||||
alDeleteSources(NUM_CHANNELS, alSources);
|
||||
memset(alSources, 0, sizeof(alSources));
|
||||
alDeleteBuffers(MAXCHANNELS + MAX2DCHANNELS, alBuffers);
|
||||
alDeleteBuffers(NUM_CHANNELS, alBuffers);
|
||||
memset(alBuffers, 0, sizeof(alBuffers));
|
||||
if (IsFXSupported())
|
||||
{
|
||||
alDeleteFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters);
|
||||
alDeleteFilters(NUM_CHANNELS, alFilters);
|
||||
memset(alFilters, 0, sizeof(alFilters));
|
||||
}
|
||||
bChannelsCreated = false;
|
||||
|
@ -50,6 +52,7 @@ CChannel::CChannel()
|
|||
{
|
||||
Data = nil;
|
||||
DataSize = 0;
|
||||
bIs2D = false;
|
||||
SetDefault();
|
||||
}
|
||||
|
||||
|
@ -90,6 +93,7 @@ void CChannel::Init(uint32 _id, bool Is2D)
|
|||
|
||||
if ( Is2D )
|
||||
{
|
||||
bIs2D = true;
|
||||
alSource3f(alSources[id], AL_POSITION, 0.0f, 0.0f, 0.0f);
|
||||
alSourcef(alSources[id], AL_GAIN, 1.0f);
|
||||
}
|
||||
|
@ -113,7 +117,20 @@ void CChannel::Start()
|
|||
if ( !HasSource() ) return;
|
||||
if ( !Data ) return;
|
||||
|
||||
alBufferData(alBuffers[id], AL_FORMAT_MONO16, Data, DataSize, Frequency);
|
||||
if ( bIs2D )
|
||||
{
|
||||
// convert mono data to stereo
|
||||
int16 *monoData = (int16*)Data;
|
||||
int16 *stereoData = (int16*)tempStereoBuffer;
|
||||
for (size_t i = 0; i < DataSize / 2; i++)
|
||||
{
|
||||
*(stereoData++) = *monoData;
|
||||
*(stereoData++) = *(monoData++);
|
||||
}
|
||||
alBufferData(alBuffers[id], AL_FORMAT_STEREO16, tempStereoBuffer, DataSize * 2, Frequency);
|
||||
}
|
||||
else
|
||||
alBufferData(alBuffers[id], AL_FORMAT_MONO16, Data, DataSize, Frequency);
|
||||
if ( LoopPoints[0] != 0 && LoopPoints[0] != -1 )
|
||||
alBufferiv(alBuffers[id], AL_LOOP_POINTS_SOFT, LoopPoints);
|
||||
alSourcei(alSources[id], AL_BUFFER, alBuffers[id]);
|
||||
|
|
|
@ -20,6 +20,7 @@ class CChannel
|
|||
int32 LoopCount;
|
||||
ALint LoopPoints[2];
|
||||
ALint LastProcessedOffset;
|
||||
bool bIs2D;
|
||||
public:
|
||||
static int32 channelsThatNeedService;
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include "common.h"
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
#include "stream.h"
|
||||
#include "sampman.h"
|
||||
|
||||
#if defined _MSC_VER && !defined CMAKE_NO_AUTOLINK
|
||||
#ifdef AUDIO_OAL_USE_SNDFILE
|
||||
|
@ -22,6 +20,29 @@
|
|||
#include <opusfile.h>
|
||||
#endif
|
||||
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include "MusicManager.h"
|
||||
#include "stream.h"
|
||||
|
||||
std::thread gAudioThread;
|
||||
std::mutex gAudioThreadQueueMutex;
|
||||
std::condition_variable gAudioThreadCv;
|
||||
bool gAudioThreadTerm = false;
|
||||
std::queue<CStream*> gStreamsToProcess; // values are not unique, we will handle that ourself
|
||||
std::queue<std::pair<IDecoder*, void*>> gStreamsToClose;
|
||||
#else
|
||||
#include "stream.h"
|
||||
#endif
|
||||
|
||||
#include "sampman.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "crossplatform.h"
|
||||
#endif
|
||||
|
@ -39,6 +60,10 @@ class CSortStereoBuffer
|
|||
{
|
||||
uint16* PcmBuf;
|
||||
size_t BufSize;
|
||||
//#ifdef MULTITHREADED_AUDIO
|
||||
// std::mutex Mutex;
|
||||
//#endif
|
||||
|
||||
public:
|
||||
CSortStereoBuffer() : PcmBuf(nil), BufSize(0) {}
|
||||
~CSortStereoBuffer()
|
||||
|
@ -65,6 +90,9 @@ public:
|
|||
|
||||
void SortStereo(void* buf, size_t size)
|
||||
{
|
||||
//#ifdef MULTITHREADED_AUDIO
|
||||
// std::lock_guard<std::mutex> lock(Mutex);
|
||||
//#endif
|
||||
uint16* InBuf = (uint16*)buf;
|
||||
uint16* OutBuf = GetBuffer(size);
|
||||
|
||||
|
@ -134,7 +162,7 @@ public:
|
|||
else
|
||||
StepIndex--;
|
||||
|
||||
StepIndex = clamp(StepIndex, 0, 88);
|
||||
StepIndex = Clamp(StepIndex, 0, 88);
|
||||
|
||||
int delta = step >> 3;
|
||||
if (adpcm & 1) delta += step >> 2;
|
||||
|
@ -143,7 +171,7 @@ public:
|
|||
if (adpcm & 8) delta = -delta;
|
||||
|
||||
int newSample = Sample + delta;
|
||||
Sample = clamp(newSample, -32768, 32767);
|
||||
Sample = Clamp(newSample, -32768, 32767);
|
||||
return Sample;
|
||||
}
|
||||
};
|
||||
|
@ -279,6 +307,10 @@ public:
|
|||
#undef CLOSE_ON_ERROR
|
||||
}
|
||||
|
||||
void FileOpen()
|
||||
{
|
||||
}
|
||||
|
||||
~CWavFile()
|
||||
{
|
||||
Close();
|
||||
|
@ -289,6 +321,7 @@ public:
|
|||
return m_bIsOpen;
|
||||
}
|
||||
|
||||
|
||||
uint32 GetSampleSize()
|
||||
{
|
||||
return sizeof(uint16);
|
||||
|
@ -405,6 +438,10 @@ public:
|
|||
m_pfSound = sf_open(path, SFM_READ, &m_soundInfo);
|
||||
}
|
||||
|
||||
void FileOpen()
|
||||
{
|
||||
}
|
||||
|
||||
~CSndFile()
|
||||
{
|
||||
if ( m_pfSound )
|
||||
|
@ -464,8 +501,6 @@ public:
|
|||
#endif
|
||||
|
||||
#ifdef AUDIO_OAL_USE_MPG123
|
||||
// fuzzy seek eliminates stutter when playing ADF but spams errors a lot (and breaks radio sometimes)
|
||||
//#define MP3_USE_FUZZY_SEEK
|
||||
|
||||
class CMP3File : public IDecoder
|
||||
{
|
||||
|
@ -474,45 +509,58 @@ protected:
|
|||
bool m_bOpened;
|
||||
uint32 m_nRate;
|
||||
uint32 m_nChannels;
|
||||
|
||||
const char* m_pPath;
|
||||
bool m_bFileNotOpenedYet;
|
||||
|
||||
CMP3File() :
|
||||
m_pMH(nil),
|
||||
m_bOpened(false),
|
||||
m_nRate(0),
|
||||
m_bFileNotOpenedYet(false),
|
||||
m_nChannels(0) {}
|
||||
public:
|
||||
CMP3File(const char *path) :
|
||||
m_pMH(nil),
|
||||
m_bOpened(false),
|
||||
m_nRate(0),
|
||||
m_nChannels(0)
|
||||
m_nChannels(0),
|
||||
m_pPath(path),
|
||||
m_bFileNotOpenedYet(false)
|
||||
{
|
||||
m_pMH = mpg123_new(nil, nil);
|
||||
if ( m_pMH )
|
||||
{
|
||||
#ifdef MP3_USE_FUZZY_SEEK
|
||||
mpg123_param(m_pMH, MPG123_FLAGS, MPG123_FUZZY | MPG123_SEEKBUFFER | MPG123_GAPLESS | MPG123_QUIET, 0.0);
|
||||
#else
|
||||
mpg123_param(m_pMH, MPG123_FLAGS, MPG123_SEEKBUFFER | MPG123_GAPLESS, 0.0);
|
||||
#endif
|
||||
long rate = 0;
|
||||
int channels = 0;
|
||||
int encoding = 0;
|
||||
|
||||
m_bOpened = mpg123_open(m_pMH, path) == MPG123_OK
|
||||
&& mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK;
|
||||
|
||||
m_nRate = rate;
|
||||
m_nChannels = channels;
|
||||
|
||||
if ( IsOpened() )
|
||||
{
|
||||
mpg123_format_none(m_pMH);
|
||||
mpg123_format(m_pMH, rate, channels, encoding);
|
||||
}
|
||||
m_bOpened = true;
|
||||
m_bFileNotOpenedYet = true;
|
||||
// It's possible to move this to audioFileOpsThread(), but effect isn't noticable + probably not compatible with our current cutscene audio handling
|
||||
#if 1
|
||||
FileOpen();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void FileOpen()
|
||||
{
|
||||
if(!m_bFileNotOpenedYet) return;
|
||||
|
||||
long rate = 0;
|
||||
int channels = 0;
|
||||
int encoding = 0;
|
||||
m_bOpened = mpg123_open(m_pMH, m_pPath) == MPG123_OK
|
||||
&& mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK;
|
||||
|
||||
m_nRate = rate;
|
||||
m_nChannels = channels;
|
||||
|
||||
if(IsOpened()) {
|
||||
mpg123_format_none(m_pMH);
|
||||
mpg123_format(m_pMH, rate, channels, encoding);
|
||||
}
|
||||
m_bFileNotOpenedYet = false;
|
||||
}
|
||||
|
||||
~CMP3File()
|
||||
{
|
||||
if ( m_pMH )
|
||||
|
@ -535,7 +583,7 @@ public:
|
|||
|
||||
uint32 GetSampleCount()
|
||||
{
|
||||
if ( !IsOpened() ) return 0;
|
||||
if ( !IsOpened() || m_bFileNotOpenedYet ) return 0;
|
||||
return mpg123_length(m_pMH);
|
||||
}
|
||||
|
||||
|
@ -551,19 +599,19 @@ public:
|
|||
|
||||
void Seek(uint32 milliseconds)
|
||||
{
|
||||
if ( !IsOpened() ) return;
|
||||
if ( !IsOpened() || m_bFileNotOpenedYet ) return;
|
||||
mpg123_seek(m_pMH, ms2samples(milliseconds), SEEK_SET);
|
||||
}
|
||||
|
||||
uint32 Tell()
|
||||
{
|
||||
if ( !IsOpened() ) return 0;
|
||||
if ( !IsOpened() || m_bFileNotOpenedYet ) return 0;
|
||||
return samples2ms(mpg123_tell(m_pMH));
|
||||
}
|
||||
|
||||
uint32 Decode(void *buffer)
|
||||
{
|
||||
if ( !IsOpened() ) return 0;
|
||||
if ( !IsOpened() || m_bFileNotOpenedYet ) return 0;
|
||||
|
||||
size_t size;
|
||||
int err = mpg123_read(m_pMH, (unsigned char *)buffer, GetBufferSize(), &size);
|
||||
|
@ -602,29 +650,42 @@ public:
|
|||
m_pMH = mpg123_new(nil, nil);
|
||||
if (m_pMH)
|
||||
{
|
||||
#ifdef MP3_USE_FUZZY_SEEK
|
||||
mpg123_param(m_pMH, MPG123_FLAGS, MPG123_FUZZY | MPG123_SEEKBUFFER | MPG123_GAPLESS | MPG123_QUIET, 0.0);
|
||||
#else
|
||||
mpg123_param(m_pMH, MPG123_FLAGS, MPG123_SEEKBUFFER | MPG123_GAPLESS, 0.0);
|
||||
|
||||
m_bOpened = true;
|
||||
m_bFileNotOpenedYet = true;
|
||||
m_pPath = path;
|
||||
// It's possible to move this to audioFileOpsThread(), but effect isn't noticable + probably not compatible with our current cutscene audio handling
|
||||
#if 1
|
||||
FileOpen();
|
||||
#endif
|
||||
long rate = 0;
|
||||
int channels = 0;
|
||||
int encoding = 0;
|
||||
|
||||
FILE* f = fopen(path, "rb");
|
||||
|
||||
m_bOpened = mpg123_replace_reader_handle(m_pMH, r_read, r_seek, r_close) == MPG123_OK
|
||||
&& mpg123_open_handle(m_pMH, f) == MPG123_OK && mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK;
|
||||
m_nRate = rate;
|
||||
m_nChannels = channels;
|
||||
|
||||
if (IsOpened())
|
||||
{
|
||||
mpg123_format_none(m_pMH);
|
||||
mpg123_format(m_pMH, rate, channels, encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileOpen()
|
||||
{
|
||||
if(!m_bFileNotOpenedYet) return;
|
||||
|
||||
long rate = 0;
|
||||
int channels = 0;
|
||||
int encoding = 0;
|
||||
|
||||
FILE *f = fopen(m_pPath, "rb");
|
||||
|
||||
m_bOpened = f && mpg123_replace_reader_handle(m_pMH, r_read, r_seek, r_close) == MPG123_OK
|
||||
&& mpg123_open_handle(m_pMH, f) == MPG123_OK && mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK;
|
||||
|
||||
m_nRate = rate;
|
||||
m_nChannels = channels;
|
||||
|
||||
if(IsOpened()) {
|
||||
mpg123_format_none(m_pMH);
|
||||
mpg123_format(m_pMH, rate, channels, encoding);
|
||||
}
|
||||
|
||||
m_bFileNotOpenedYet = false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -655,7 +716,7 @@ public:
|
|||
static short quantize(double sample)
|
||||
{
|
||||
int a = int(sample + 0.5);
|
||||
return short(clamp(a, -32768, 32767));
|
||||
return short(Clamp(a, -32768, 32767));
|
||||
}
|
||||
|
||||
void Decode(void* _inbuf, int16* _outbuf, size_t size)
|
||||
|
@ -744,6 +805,10 @@ public:
|
|||
m_ppVagBuffers[i] = new uint8[VB_BLOCK_SIZE];
|
||||
}
|
||||
|
||||
void FileOpen()
|
||||
{
|
||||
}
|
||||
|
||||
~CVbFile()
|
||||
{
|
||||
if (m_pFile)
|
||||
|
@ -896,6 +961,10 @@ public:
|
|||
m_bOpened = true;
|
||||
}
|
||||
}
|
||||
|
||||
void FileOpen()
|
||||
{
|
||||
}
|
||||
|
||||
~COpusFile()
|
||||
{
|
||||
|
@ -961,11 +1030,173 @@ public:
|
|||
};
|
||||
#endif
|
||||
|
||||
|
||||
// For multi-thread: Someone always acquire stream's mutex before entering here
|
||||
void
|
||||
CStream::BuffersShouldBeFilled()
|
||||
{
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
||||
std::queue<std::pair<ALuint, ALuint>> tempQueue;
|
||||
for(int i = 0; i < NUM_STREAMBUFFERS / 2; i++) {
|
||||
tempQueue.push(std::pair<ALuint, ALuint>(m_alBuffers[i * 2], m_alBuffers[i * 2 + 1]));
|
||||
}
|
||||
m_fillBuffers.swap(tempQueue);
|
||||
|
||||
FlagAsToBeProcessed();
|
||||
|
||||
m_bActive = true; // to allow Update() to queue the filled buffers & play
|
||||
return;
|
||||
}
|
||||
std::queue<std::pair<ALuint, ALuint>>().swap(m_fillBuffers);
|
||||
#endif
|
||||
if ( FillBuffers() != 0 )
|
||||
{
|
||||
SetPlay(true);
|
||||
}
|
||||
}
|
||||
|
||||
// returns whether it's queued (not on multi-thread)
|
||||
bool
|
||||
CStream::BufferShouldBeFilledAndQueued(std::pair<ALuint, ALuint>* bufs)
|
||||
{
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE)
|
||||
m_fillBuffers.push(*bufs);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ALuint alBuffers[2] = {(*bufs).first, (*bufs).second}; // left - right
|
||||
if (FillBuffer(alBuffers)) {
|
||||
alSourceQueueBuffers(m_pAlSources[0], 1, &alBuffers[0]);
|
||||
alSourceQueueBuffers(m_pAlSources[1], 1, &alBuffers[1]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
void
|
||||
CStream::FlagAsToBeProcessed(bool close)
|
||||
{
|
||||
if (!close && MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE)
|
||||
return;
|
||||
|
||||
gAudioThreadQueueMutex.lock();
|
||||
if (close)
|
||||
gStreamsToClose.push(std::pair<IDecoder*, void*>(m_pSoundFile ? m_pSoundFile : nil, m_pBuffer ? m_pBuffer : nil));
|
||||
else
|
||||
gStreamsToProcess.push(this);
|
||||
|
||||
gAudioThreadQueueMutex.unlock();
|
||||
|
||||
gAudioThreadCv.notify_one();
|
||||
}
|
||||
|
||||
void audioFileOpsThread()
|
||||
{
|
||||
do
|
||||
{
|
||||
CStream *stream;
|
||||
{
|
||||
// Just a semaphore
|
||||
std::unique_lock<std::mutex> queueMutex(gAudioThreadQueueMutex);
|
||||
gAudioThreadCv.wait(queueMutex, [] { return gStreamsToProcess.size() > 0 || gStreamsToClose.size() > 0 || gAudioThreadTerm; });
|
||||
if (gAudioThreadTerm)
|
||||
return;
|
||||
|
||||
if (!gStreamsToClose.empty()) {
|
||||
auto streamToClose = gStreamsToClose.front();
|
||||
gStreamsToClose.pop();
|
||||
if (streamToClose.first) { // pSoundFile
|
||||
delete streamToClose.first;
|
||||
}
|
||||
|
||||
if (streamToClose.second) { // pBuffer
|
||||
free(streamToClose.second);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gStreamsToProcess.empty()) {
|
||||
stream = gStreamsToProcess.front();
|
||||
gStreamsToProcess.pop();
|
||||
} else
|
||||
continue;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lock(stream->m_mutex);
|
||||
|
||||
std::pair<ALuint, ALuint> buffers, *lastBufAddr;
|
||||
bool insertBufsAfterCheck = false;
|
||||
|
||||
do {
|
||||
if (!stream->IsOpened()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (stream->m_bReset)
|
||||
break;
|
||||
|
||||
// We gave up this idea for now
|
||||
/*
|
||||
stream->m_pSoundFile->FileOpen();
|
||||
|
||||
// Deffered allocation, do it now
|
||||
if (stream->m_pBuffer == nil) {
|
||||
stream->m_pBuffer = malloc(stream->m_pSoundFile->GetBufferSize());
|
||||
ASSERT(stream->m_pBuffer != nil);
|
||||
}
|
||||
*/
|
||||
|
||||
if (stream->m_bDoSeek) {
|
||||
stream->m_bDoSeek = false;
|
||||
int pos = stream->m_SeekPos;
|
||||
lock.unlock();
|
||||
stream->m_pSoundFile->Seek(pos);
|
||||
lock.lock();
|
||||
|
||||
continue; // let's do the checks again, make sure we didn't miss anything while Seeking
|
||||
}
|
||||
|
||||
if (insertBufsAfterCheck) {
|
||||
stream->m_queueBuffers.push(buffers);
|
||||
insertBufsAfterCheck = false;
|
||||
}
|
||||
|
||||
if (!stream->m_fillBuffers.empty()) {
|
||||
lastBufAddr = &stream->m_fillBuffers.front();
|
||||
buffers = *lastBufAddr;
|
||||
lock.unlock();
|
||||
|
||||
ALuint alBuffers[2] = {buffers.first, buffers.second}; // left - right
|
||||
bool filled = stream->FillBuffer(alBuffers);
|
||||
|
||||
lock.lock();
|
||||
|
||||
// Make sure queue isn't touched after we released mutex
|
||||
if (!stream->m_fillBuffers.empty() && lastBufAddr == &stream->m_fillBuffers.front()) {
|
||||
stream->m_fillBuffers.pop();
|
||||
if (filled)
|
||||
insertBufsAfterCheck = true; // Also make sure stream's properties aren't changed. So make one more pass, and push it to m_queueBuffers only if it pass checks again.
|
||||
}
|
||||
} else
|
||||
break;
|
||||
|
||||
} while (true);
|
||||
|
||||
} while(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CStream::Initialise()
|
||||
{
|
||||
#ifdef AUDIO_OAL_USE_MPG123
|
||||
mpg123_init();
|
||||
#endif
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
gAudioThread = std::thread(audioFileOpsThread);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CStream::Terminate()
|
||||
|
@ -973,14 +1204,27 @@ void CStream::Terminate()
|
|||
#ifdef AUDIO_OAL_USE_MPG123
|
||||
mpg123_exit();
|
||||
#endif
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
gAudioThreadQueueMutex.lock();
|
||||
gAudioThreadTerm = true;
|
||||
gAudioThreadQueueMutex.unlock();
|
||||
|
||||
gAudioThreadCv.notify_one();
|
||||
gAudioThread.join();
|
||||
#endif
|
||||
}
|
||||
|
||||
CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS], uint32 overrideSampleRate) :
|
||||
CStream::CStream(ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS]) :
|
||||
m_pAlSources(sources),
|
||||
m_alBuffers(buffers),
|
||||
m_pBuffer(nil),
|
||||
m_bPaused(false),
|
||||
m_bActive(false),
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
m_bIExist(false),
|
||||
m_bDoSeek(false),
|
||||
m_SeekPos(0),
|
||||
#endif
|
||||
m_pSoundFile(nil),
|
||||
m_bReset(false),
|
||||
m_nVolume(0),
|
||||
|
@ -989,6 +1233,27 @@ CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBU
|
|||
m_nLoopCount(1)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
bool CStream::Open(const char* filename, uint32 overrideSampleRate)
|
||||
{
|
||||
if (IsOpened()) return false;
|
||||
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
m_bDoSeek = false;
|
||||
m_SeekPos = 0;
|
||||
#endif
|
||||
|
||||
m_bPaused = false;
|
||||
m_bActive = false;
|
||||
m_bReset = false;
|
||||
m_nVolume = 0;
|
||||
m_nPan = 0;
|
||||
m_nPosBeforeReset = 0;
|
||||
m_nLoopCount = 1;
|
||||
|
||||
// Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/)
|
||||
#if !defined(_WIN32)
|
||||
char *real = casepath(filename);
|
||||
|
@ -1025,44 +1290,67 @@ CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBU
|
|||
else
|
||||
m_pSoundFile = nil;
|
||||
|
||||
if ( IsOpened() )
|
||||
if ( m_pSoundFile && m_pSoundFile->IsOpened() )
|
||||
{
|
||||
m_pBuffer = malloc(m_pSoundFile->GetBufferSize());
|
||||
ASSERT(m_pBuffer!=nil);
|
||||
|
||||
DEV("AvgSamplesPerSec: %d\n", m_pSoundFile->GetAvgSamplesPerSec());
|
||||
DEV("SampleCount: %d\n", m_pSoundFile->GetSampleCount());
|
||||
DEV("SampleRate: %d\n", m_pSoundFile->GetSampleRate());
|
||||
DEV("Channels: %d\n", m_pSoundFile->GetChannels());
|
||||
DEV("Buffer Samples: %d\n", m_pSoundFile->GetBufferSamples());
|
||||
DEV("Buffer sec: %f\n", (float(m_pSoundFile->GetBufferSamples()) / float(m_pSoundFile->GetChannels())/ float(m_pSoundFile->GetSampleRate())));
|
||||
DEV("Length MS: %02d:%02d\n", (m_pSoundFile->GetLength() / 1000) / 60, (m_pSoundFile->GetLength() / 1000) % 60);
|
||||
|
||||
return;
|
||||
uint32 bufSize = m_pSoundFile->GetBufferSize();
|
||||
if(bufSize != 0) { // Otherwise it's deferred
|
||||
m_pBuffer = malloc(bufSize);
|
||||
ASSERT(m_pBuffer != nil);
|
||||
|
||||
DEV("AvgSamplesPerSec: %d\n", m_pSoundFile->GetAvgSamplesPerSec());
|
||||
DEV("SampleCount: %d\n", m_pSoundFile->GetSampleCount());
|
||||
DEV("SampleRate: %d\n", m_pSoundFile->GetSampleRate());
|
||||
DEV("Channels: %d\n", m_pSoundFile->GetChannels());
|
||||
DEV("Buffer Samples: %d\n", m_pSoundFile->GetBufferSamples());
|
||||
DEV("Buffer sec: %f\n", (float(m_pSoundFile->GetBufferSamples()) / float(m_pSoundFile->GetChannels())/ float(m_pSoundFile->GetSampleRate())));
|
||||
DEV("Length MS: %02d:%02d\n", (m_pSoundFile->GetLength() / 1000) / 60, (m_pSoundFile->GetLength() / 1000) % 60);
|
||||
}
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
m_bIExist = true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CStream::~CStream()
|
||||
{
|
||||
Delete();
|
||||
assert(!IsOpened());
|
||||
}
|
||||
|
||||
void CStream::Delete()
|
||||
void CStream::Close()
|
||||
{
|
||||
if(!IsOpened()) return;
|
||||
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
Stop();
|
||||
ClearBuffers();
|
||||
m_bIExist = false;
|
||||
std::queue<std::pair<ALuint, ALuint>>().swap(m_fillBuffers);
|
||||
tsQueue<std::pair<ALuint, ALuint>>().swapNts(m_queueBuffers); // TSness not required, mutex is acquired
|
||||
}
|
||||
|
||||
FlagAsToBeProcessed(true);
|
||||
#else
|
||||
|
||||
Stop();
|
||||
ClearBuffers();
|
||||
|
||||
|
||||
if ( m_pSoundFile )
|
||||
{
|
||||
delete m_pSoundFile;
|
||||
m_pSoundFile = nil;
|
||||
}
|
||||
|
||||
|
||||
if ( m_pBuffer )
|
||||
{
|
||||
free(m_pBuffer);
|
||||
m_pBuffer = nil;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CStream::HasSource()
|
||||
|
@ -1070,9 +1358,14 @@ bool CStream::HasSource()
|
|||
return (m_pAlSources[0] != AL_NONE) && (m_pAlSources[1] != AL_NONE);
|
||||
}
|
||||
|
||||
// m_bIExist only written in main thread, thus mutex is not needed on main thread
|
||||
bool CStream::IsOpened()
|
||||
{
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
return m_bIExist;
|
||||
#else
|
||||
return m_pSoundFile && m_pSoundFile->IsOpened();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CStream::IsPlaying()
|
||||
|
@ -1086,6 +1379,14 @@ bool CStream::IsPlaying()
|
|||
alGetSourcei(m_pAlSources[1], AL_SOURCE_STATE, &sourceState[1]);
|
||||
if (sourceState[0] == AL_PLAYING || sourceState[1] == AL_PLAYING)
|
||||
return true;
|
||||
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
// Streams are designed in such a way that m_fillBuffers and m_queueBuffers will be *always* filled if audio is playing, and mutex is acquired
|
||||
if (!m_fillBuffers.empty() || !m_queueBuffers.emptyNts())
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1147,10 +1448,10 @@ void CStream::SetVolume(uint32 nVol)
|
|||
|
||||
void CStream::SetPan(uint8 nPan)
|
||||
{
|
||||
m_nPan = clamp((int8)nPan - 63, 0, 63);
|
||||
m_nPan = Clamp((int8)nPan - 63, 0, 63);
|
||||
SetPosition(0, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
|
||||
|
||||
m_nPan = clamp((int8)nPan + 64, 64, 127);
|
||||
m_nPan = Clamp((int8)nPan + 64, 64, 127);
|
||||
SetPosition(1, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
|
||||
|
||||
m_nPan = nPan;
|
||||
|
@ -1160,8 +1461,24 @@ void CStream::SetPan(uint8 nPan)
|
|||
void CStream::SetPosMS(uint32 nPos)
|
||||
{
|
||||
if ( !IsOpened() ) return;
|
||||
m_pSoundFile->Seek(nPos);
|
||||
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
std::queue<std::pair<ALuint, ALuint>>().swap(m_fillBuffers);
|
||||
tsQueue<std::pair<ALuint, ALuint>>().swapNts(m_queueBuffers); // TSness not required, second thread always access it when stream mutex acquired
|
||||
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
||||
m_bDoSeek = true;
|
||||
m_SeekPos = nPos;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
m_pSoundFile->Seek(nPos);
|
||||
}
|
||||
ClearBuffers();
|
||||
|
||||
// adding to gStreamsToProcess not needed, someone always calls Start() / BuffersShouldBeFilled() after SetPosMS
|
||||
}
|
||||
|
||||
uint32 CStream::GetPosMS()
|
||||
|
@ -1169,10 +1486,16 @@ uint32 CStream::GetPosMS()
|
|||
if ( !HasSource() ) return 0;
|
||||
if ( !IsOpened() ) return 0;
|
||||
|
||||
// Deferred init causes division by zero
|
||||
if (m_pSoundFile->GetChannels() == 0)
|
||||
return 0;
|
||||
|
||||
ALint offset;
|
||||
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
|
||||
alGetSourcei(m_pAlSources[0], AL_BYTE_OFFSET, &offset);
|
||||
|
||||
//std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
return m_pSoundFile->Tell()
|
||||
- m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS/2-1)) / m_pSoundFile->GetChannels()
|
||||
+ m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize()) / m_pSoundFile->GetChannels();
|
||||
|
@ -1186,6 +1509,7 @@ uint32 CStream::GetLengthMS()
|
|||
|
||||
bool CStream::FillBuffer(ALuint *alBuffer)
|
||||
{
|
||||
#ifndef MULTITHREADED_AUDIO
|
||||
if ( !HasSource() )
|
||||
return false;
|
||||
if ( !IsOpened() )
|
||||
|
@ -1194,13 +1518,14 @@ bool CStream::FillBuffer(ALuint *alBuffer)
|
|||
return false;
|
||||
if ( !(alBuffer[1] != AL_NONE && alIsBuffer(alBuffer[1])) )
|
||||
return false;
|
||||
|
||||
#endif
|
||||
|
||||
uint32 size = m_pSoundFile->Decode(m_pBuffer);
|
||||
if( size == 0 )
|
||||
return false;
|
||||
|
||||
uint32 channelSize = size / m_pSoundFile->GetChannels();
|
||||
|
||||
uint32 channelSize = size / m_pSoundFile->GetChannels();
|
||||
|
||||
alBufferData(alBuffer[0], AL_FORMAT_MONO16, m_pBuffer, channelSize, m_pSoundFile->GetSampleRate());
|
||||
// TODO: use just one buffer if we play mono
|
||||
if (m_pSoundFile->GetChannels() == 1)
|
||||
|
@ -1210,6 +1535,26 @@ bool CStream::FillBuffer(ALuint *alBuffer)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
bool CStream::QueueBuffers()
|
||||
{
|
||||
bool buffersQueued = false;
|
||||
std::pair<ALuint, ALuint> buffers;
|
||||
while (m_queueBuffers.peekPop(&buffers)) // beware: m_queueBuffers is tsQueue
|
||||
{
|
||||
ALuint leftBuf = buffers.first;
|
||||
ALuint rightBuf = buffers.second;
|
||||
|
||||
alSourceQueueBuffers(m_pAlSources[0], 1, &leftBuf);
|
||||
alSourceQueueBuffers(m_pAlSources[1], 1, &rightBuf);
|
||||
|
||||
buffersQueued = true;
|
||||
}
|
||||
return buffersQueued;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Only used in single-threaded audio or cutscene audio
|
||||
int32 CStream::FillBuffers()
|
||||
{
|
||||
int32 i = 0;
|
||||
|
@ -1239,17 +1584,33 @@ void CStream::ClearBuffers()
|
|||
alSourceUnqueueBuffers(m_pAlSources[1], 1, &value);
|
||||
}
|
||||
|
||||
bool CStream::Setup(bool imSureQueueIsEmpty)
|
||||
bool CStream::Setup(bool imSureQueueIsEmpty, bool lock)
|
||||
{
|
||||
if ( IsOpened() )
|
||||
{
|
||||
alSourcei(m_pAlSources[0], AL_LOOPING, AL_FALSE);
|
||||
alSourcei(m_pAlSources[1], AL_LOOPING, AL_FALSE);
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
if (lock)
|
||||
m_mutex.lock();
|
||||
#endif
|
||||
|
||||
if (!imSureQueueIsEmpty) {
|
||||
SetPlay(false);
|
||||
Stop();
|
||||
ClearBuffers();
|
||||
}
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) {
|
||||
m_pSoundFile->Seek(0);
|
||||
} else {
|
||||
m_bDoSeek = true;
|
||||
m_SeekPos = 0;
|
||||
}
|
||||
|
||||
if (lock)
|
||||
m_mutex.unlock();
|
||||
#else
|
||||
m_pSoundFile->Seek(0);
|
||||
#endif
|
||||
|
||||
//SetPosition(0.0f, 0.0f, 0.0f);
|
||||
SetPitch(1.0f);
|
||||
//SetPan(m_nPan);
|
||||
|
@ -1287,7 +1648,7 @@ void CStream::SetPlay(bool state)
|
|||
{
|
||||
ALint sourceState = AL_STOPPED;
|
||||
alGetSourcei(m_pAlSources[0], AL_SOURCE_STATE, &sourceState);
|
||||
if (sourceState != AL_STOPPED )
|
||||
if (sourceState != AL_STOPPED)
|
||||
alSourceStop(m_pAlSources[0]);
|
||||
|
||||
sourceState = AL_STOPPED;
|
||||
|
@ -1302,8 +1663,12 @@ void CStream::SetPlay(bool state)
|
|||
void CStream::Start()
|
||||
{
|
||||
if ( !HasSource() ) return;
|
||||
if ( FillBuffers() != 0 )
|
||||
SetPlay(true);
|
||||
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
tsQueue<std::pair<ALuint, ALuint>>().swapNts(m_queueBuffers); // TSness not required, second thread always access it when stream mutex acquired
|
||||
#endif
|
||||
BuffersShouldBeFilled();
|
||||
}
|
||||
|
||||
void CStream::Stop()
|
||||
|
@ -1325,9 +1690,23 @@ void CStream::Update()
|
|||
|
||||
if ( !m_bPaused )
|
||||
{
|
||||
ALint totalBuffers[2] = { 0, 0 };
|
||||
ALint buffersProcessed[2] = { 0, 0 };
|
||||
|
||||
bool buffersQueuedAndStarted = false;
|
||||
bool buffersQueuedButNotStarted = false;
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
// Put it in here because we need totalBuffers after queueing to decide when to loop audio
|
||||
if (m_bActive)
|
||||
{
|
||||
buffersQueuedAndStarted = QueueBuffers();
|
||||
if(buffersQueuedAndStarted) {
|
||||
SetPlay(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ALint totalBuffers[2] = {0, 0};
|
||||
ALint buffersProcessed[2] = {0, 0};
|
||||
|
||||
// Relying a lot on left buffer states in here
|
||||
|
||||
do
|
||||
|
@ -1339,44 +1718,66 @@ void CStream::Update()
|
|||
alGetSourcei(m_pAlSources[1], AL_BUFFERS_QUEUED, &totalBuffers[1]);
|
||||
alGetSourcei(m_pAlSources[1], AL_BUFFERS_PROCESSED, &buffersProcessed[1]);
|
||||
} while (buffersProcessed[0] != buffersProcessed[1]);
|
||||
|
||||
|
||||
assert(buffersProcessed[0] == buffersProcessed[1]);
|
||||
|
||||
// Correcting OpenAL concepts here:
|
||||
// AL_BUFFERS_QUEUED = Number of *all* buffers in queue, including processed, processing and pending
|
||||
// AL_BUFFERS_PROCESSED = Index of the buffer being processing right now. Buffers coming after that(have greater index) are pending buffers.
|
||||
// which means: totalBuffers[0] - buffersProcessed[0] = pending buffers
|
||||
|
||||
bool buffersRefilled = false;
|
||||
|
||||
|
||||
// We should wait queue to be cleared to loop track, because position calculation relies on queue.
|
||||
if (m_nLoopCount != 1 && m_bActive && totalBuffers[0] == 0)
|
||||
{
|
||||
Setup(true);
|
||||
buffersRefilled = FillBuffers() != 0;
|
||||
if (m_nLoopCount != 0)
|
||||
m_nLoopCount--;
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (m_fillBuffers.empty() && m_queueBuffers.emptyNts()) // we already acquired stream mutex, which is enough for second thread. thus Nts variant
|
||||
#endif
|
||||
{
|
||||
Setup(true, false);
|
||||
BuffersShouldBeFilled(); // will also call SetPlay(true)
|
||||
if (m_nLoopCount != 0)
|
||||
m_nLoopCount--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while( buffersProcessed[0]-- )
|
||||
static std::queue<std::pair<ALuint, ALuint>> tempFillBuffer;
|
||||
|
||||
while ( buffersProcessed[0]-- )
|
||||
{
|
||||
ALuint buffer[2];
|
||||
|
||||
alSourceUnqueueBuffers(m_pAlSources[0], 1, &buffer[0]);
|
||||
alSourceUnqueueBuffers(m_pAlSources[1], 1, &buffer[1]);
|
||||
|
||||
if (m_bActive && FillBuffer(buffer))
|
||||
|
||||
if (m_bActive)
|
||||
{
|
||||
buffersRefilled = true;
|
||||
alSourceQueueBuffers(m_pAlSources[0], 1, &buffer[0]);
|
||||
alSourceQueueBuffers(m_pAlSources[1], 1, &buffer[1]);
|
||||
tempFillBuffer.push(std::pair<ALuint, ALuint>(buffer[0], buffer[1]));
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bActive && buffersProcessed[1])
|
||||
{
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
m_mutex.lock();
|
||||
#endif
|
||||
while (!tempFillBuffer.empty()) {
|
||||
auto elem = tempFillBuffer.front();
|
||||
tempFillBuffer.pop();
|
||||
buffersQueuedButNotStarted = BufferShouldBeFilledAndQueued(&elem);
|
||||
}
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
m_mutex.unlock();
|
||||
FlagAsToBeProcessed();
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Two reasons: 1-Source may be starved to audio and stopped itself, 2- We're already waiting it to starve and die for looping track!
|
||||
if (m_bActive && (buffersRefilled || (totalBuffers[1] - buffersProcessed[1] != 0)))
|
||||
// Source may be starved to audio and stopped itself
|
||||
if (m_bActive && !buffersQueuedAndStarted && (buffersQueuedButNotStarted || (totalBuffers[1] - buffersProcessed[1] != 0)))
|
||||
SetPlay(true);
|
||||
}
|
||||
}
|
||||
|
@ -1385,28 +1786,45 @@ void CStream::ProviderInit()
|
|||
{
|
||||
if ( m_bReset )
|
||||
{
|
||||
if ( Setup(true) )
|
||||
if ( Setup(true, false) ) // lock not needed, thread can't process streams with m_bReset set
|
||||
{
|
||||
SetPan(m_nPan);
|
||||
SetVolume(m_nVolume);
|
||||
SetLoopCount(m_nLoopCount);
|
||||
SetPosMS(m_nPosBeforeReset);
|
||||
if (m_bActive)
|
||||
FillBuffers();
|
||||
SetPlay(m_bActive);
|
||||
if ( m_bPaused )
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
#endif
|
||||
if(m_bActive)
|
||||
BuffersShouldBeFilled();
|
||||
|
||||
if (m_bPaused)
|
||||
Pause();
|
||||
|
||||
m_bReset = false;
|
||||
|
||||
} else {
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
#endif
|
||||
m_bReset = false;
|
||||
}
|
||||
|
||||
m_bReset = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CStream::ProviderTerm()
|
||||
{
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
// unlike Close() we will reuse this stream, so clearing queues are important.
|
||||
std::queue<std::pair<ALuint, ALuint>>().swap(m_fillBuffers);
|
||||
tsQueue<std::pair<ALuint, ALuint>>().swapNts(m_queueBuffers); // stream mutex is already acquired, thus Nts variant
|
||||
#endif
|
||||
m_bReset = true;
|
||||
m_nPosBeforeReset = GetPosMS();
|
||||
|
||||
|
||||
Stop();
|
||||
ClearBuffers();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ public:
|
|||
virtual ~IDecoder() { }
|
||||
|
||||
virtual bool IsOpened() = 0;
|
||||
virtual void FileOpen() = 0;
|
||||
|
||||
virtual uint32 GetSampleSize() = 0;
|
||||
virtual uint32 GetSampleCount() = 0;
|
||||
|
@ -48,12 +49,70 @@ public:
|
|||
|
||||
uint32 GetLength()
|
||||
{
|
||||
FileOpen(); // abort deferred init, we need length now - game has to cache audio file sizes
|
||||
return float(GetSampleCount()) * 1000.0f / float(GetSampleRate());
|
||||
}
|
||||
|
||||
virtual uint32 Decode(void *buffer) = 0;
|
||||
};
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
template <typename T> class tsQueue
|
||||
{
|
||||
public:
|
||||
tsQueue() : count(0) { }
|
||||
|
||||
void push(const T &value)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_queue.push(value);
|
||||
count++;
|
||||
}
|
||||
|
||||
bool peekPop(T *retVal)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (count == 0)
|
||||
return false;
|
||||
|
||||
*retVal = m_queue.front();
|
||||
m_queue.pop();
|
||||
count--;
|
||||
return true;
|
||||
}
|
||||
|
||||
void swapNts(tsQueue<T> &replaceWith)
|
||||
{
|
||||
m_queue.swap(replaceWith.m_queue);
|
||||
replaceWith.count = count;
|
||||
}
|
||||
|
||||
/*
|
||||
void swapTs(tsQueue<T> &replaceWith)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
std::lock_guard<std::mutex> lock2(replaceWith.m_mutex);
|
||||
swapNts(replaceWith);
|
||||
}
|
||||
*/
|
||||
|
||||
bool emptyNts()
|
||||
{
|
||||
return count == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
bool emptyTs()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
return emptyNts();
|
||||
}
|
||||
*/
|
||||
|
||||
std::queue<T> m_queue;
|
||||
int count;
|
||||
mutable std::mutex m_mutex;
|
||||
};
|
||||
#endif
|
||||
class CStream
|
||||
{
|
||||
char m_aFilename[128];
|
||||
|
@ -63,6 +122,17 @@ class CStream
|
|||
bool m_bPaused;
|
||||
bool m_bActive;
|
||||
|
||||
public:
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::mutex m_mutex;
|
||||
std::queue<std::pair<ALuint, ALuint>> m_fillBuffers; // left and right buffer
|
||||
tsQueue<std::pair<ALuint, ALuint>> m_queueBuffers;
|
||||
// std::condition_variable m_closeCv;
|
||||
bool m_bDoSeek;
|
||||
uint32 m_SeekPos;
|
||||
bool m_bIExist;
|
||||
#endif
|
||||
|
||||
void *m_pBuffer;
|
||||
|
||||
bool m_bReset;
|
||||
|
@ -72,7 +142,14 @@ class CStream
|
|||
int32 m_nLoopCount;
|
||||
|
||||
IDecoder *m_pSoundFile;
|
||||
|
||||
|
||||
void BuffersShouldBeFilled(); // all
|
||||
bool BufferShouldBeFilledAndQueued(std::pair<ALuint, ALuint>*); // two (left-right)
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
void FlagAsToBeProcessed(bool close = false);
|
||||
bool QueueBuffers();
|
||||
#endif
|
||||
|
||||
bool HasSource();
|
||||
void SetPosition(int i, float x, float y, float z);
|
||||
void SetPitch(float pitch);
|
||||
|
@ -81,15 +158,17 @@ class CStream
|
|||
void SetPlay(bool state);
|
||||
|
||||
bool FillBuffer(ALuint *alBuffer);
|
||||
int32 FillBuffers();
|
||||
int32 FillBuffers();
|
||||
void ClearBuffers();
|
||||
public:
|
||||
//public:
|
||||
static void Initialise();
|
||||
static void Terminate();
|
||||
|
||||
CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS], uint32 overrideSampleRate = 32000);
|
||||
CStream(ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS]);
|
||||
~CStream();
|
||||
void Delete();
|
||||
bool Open(const char *filename, uint32 overrideSampleRate = 32000);
|
||||
void Close();
|
||||
|
||||
bool IsOpened();
|
||||
bool IsPlaying();
|
||||
|
@ -100,12 +179,11 @@ public:
|
|||
uint32 GetPosMS();
|
||||
uint32 GetLengthMS();
|
||||
|
||||
bool Setup(bool imSureQueueIsEmpty = false);
|
||||
bool Setup(bool imSureQueueIsEmpty = false, bool lock = true);
|
||||
void Start();
|
||||
void Stop();
|
||||
void Update(void);
|
||||
void SetLoopCount(int32);
|
||||
|
||||
|
||||
void ProviderInit();
|
||||
void ProviderTerm();
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#pragma once
|
||||
#include "AudioSamples.h"
|
||||
#include "audio_enums.h"
|
||||
|
||||
#define MAX_VOLUME 127
|
||||
#define MAX_FREQ DIGITALRATE
|
||||
|
||||
struct tSample {
|
||||
int32 nOffset;
|
||||
uint32 nOffset;
|
||||
uint32 nSize;
|
||||
int32 nFrequency;
|
||||
int32 nLoopStart;
|
||||
uint32 nFrequency;
|
||||
uint32 nLoopStart;
|
||||
int32 nLoopEnd;
|
||||
};
|
||||
|
||||
|
@ -112,21 +113,35 @@ enum
|
|||
};
|
||||
#define MAX_PEDSFX 7
|
||||
#define PED_BLOCKSIZE 79000
|
||||
#define MISSION_AUDIO_BLOCKSIZE 160000
|
||||
|
||||
#define MAXPROVIDERS 64
|
||||
|
||||
#define MAXCHANNELS 28
|
||||
#define MAXCHANNELS_SURROUND 24
|
||||
#define MAX2DCHANNELS 1
|
||||
#define CHANNEL2D MAXCHANNELS
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
#define MAXCHANNELS (NUM_CHANNELS_GENERIC+1)
|
||||
#define MAXCHANNELS_SURROUND (MAXCHANNELS-4)
|
||||
#define MAX2DCHANNELS 3
|
||||
#else
|
||||
#define MAXCHANNELS 0
|
||||
#define MAXCHANNELS_SURROUND 0
|
||||
#define MAX2DCHANNELS NUM_CHANNELS
|
||||
#endif
|
||||
|
||||
#define MAX_STREAMS 3
|
||||
#define MAX_STREAMS 1
|
||||
|
||||
#define DIGITALRATE 32000
|
||||
#define DIGITALBITS 16
|
||||
#define DIGITALCHANNELS 2
|
||||
|
||||
#define MAX_DIGITAL_MIXER_CHANNELS 32
|
||||
#ifdef FIX_BUGS
|
||||
#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2+MAX2DCHANNELS)
|
||||
#else
|
||||
#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2)
|
||||
#endif
|
||||
|
||||
static_assert( NUM_CHANNELS == MAXCHANNELS + MAX2DCHANNELS, "The number of channels doesn't match with an enum" );
|
||||
|
||||
extern int gBankStartOffset[67];
|
||||
|
||||
class cSampleManager
|
||||
{
|
||||
|
@ -135,9 +150,9 @@ class cSampleManager
|
|||
uint8 m_nMP3BoostVolume;
|
||||
uint8 m_nEffectsFadeVolume;
|
||||
uint8 m_nMusicFadeVolume;
|
||||
uint8 m_nMonoMode;
|
||||
bool8 m_nMonoMode;
|
||||
char m_szCDRomRootPath[80];
|
||||
bool m_bInitialised;
|
||||
bool8 m_bInitialised;
|
||||
uint8 m_nNumberOfProviders;
|
||||
char *m_aAudioProviders[MAXPROVIDERS];
|
||||
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
|
||||
|
@ -152,7 +167,8 @@ public:
|
|||
|
||||
cSampleManager(void);
|
||||
~cSampleManager(void);
|
||||
|
||||
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
void SetSpeakerConfig(int32 nConfig);
|
||||
uint32 GetMaximumSupportedChannels(void);
|
||||
|
||||
|
@ -166,17 +182,18 @@ public:
|
|||
int8 SetCurrent3DProvider(uint8 which);
|
||||
|
||||
int8 AutoDetect3DProviders();
|
||||
|
||||
bool IsMP3RadioChannelAvailable(void);
|
||||
#endif
|
||||
|
||||
bool8 IsMP3RadioChannelAvailable(void);
|
||||
|
||||
void ReleaseDigitalHandle (void);
|
||||
void ReacquireDigitalHandle(void);
|
||||
|
||||
bool Initialise(void);
|
||||
void Terminate (void);
|
||||
bool8 Initialise(void);
|
||||
void Terminate (void);
|
||||
|
||||
bool CheckForAnAudioFileOnCD(void);
|
||||
char GetCDAudioDriveLetter (void);
|
||||
bool8 CheckForAnAudioFileOnCD(void);
|
||||
char GetCDAudioDriveLetter (void);
|
||||
|
||||
void UpdateEffectsVolume(void);
|
||||
|
||||
|
@ -185,270 +202,131 @@ public:
|
|||
void SetMP3BoostVolume (uint8 nVolume);
|
||||
void SetEffectsFadeVolume (uint8 nVolume);
|
||||
void SetMusicFadeVolume (uint8 nVolume);
|
||||
void SetMonoMode (uint8 nMode);
|
||||
void SetMonoMode (bool8 nMode);
|
||||
|
||||
bool LoadSampleBank (uint8 nBank);
|
||||
void UnloadSampleBank (uint8 nBank);
|
||||
bool IsSampleBankLoaded(uint8 nBank);
|
||||
bool8 LoadSampleBank (uint8 nBank);
|
||||
void UnloadSampleBank (uint8 nBank);
|
||||
int8 IsSampleBankLoaded(uint8 nBank);
|
||||
|
||||
uint8 IsMissionAudioLoaded(uint8 nSlot, uint32 nSample);
|
||||
bool8 LoadMissionAudio (uint8 nSlot, uint32 nSample);
|
||||
|
||||
bool IsPedCommentLoaded(uint32 nComment);
|
||||
bool LoadPedComment (uint32 nComment);
|
||||
uint8 IsPedCommentLoaded(uint32 nComment);
|
||||
bool8 LoadPedComment (uint32 nComment);
|
||||
int32 GetBankContainingSound(uint32 offset);
|
||||
|
||||
int32 _GetPedCommentSlot(uint32 nComment);
|
||||
|
||||
int32 GetSampleBaseFrequency (uint32 nSample);
|
||||
int32 GetSampleLoopStartOffset(uint32 nSample);
|
||||
uint32 GetSampleBaseFrequency (uint32 nSample);
|
||||
uint32 GetSampleLoopStartOffset(uint32 nSample);
|
||||
int32 GetSampleLoopEndOffset (uint32 nSample);
|
||||
uint32 GetSampleLength (uint32 nSample);
|
||||
|
||||
bool UpdateReverb(void);
|
||||
bool8 UpdateReverb(void);
|
||||
|
||||
void SetChannelReverbFlag (uint32 nChannel, uint8 nReverbFlag);
|
||||
bool InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
|
||||
void SetChannelReverbFlag (uint32 nChannel, bool8 nReverbFlag);
|
||||
bool8 InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
|
||||
void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
|
||||
void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
|
||||
#endif
|
||||
void SetChannelVolume (uint32 nChannel, uint32 nVolume);
|
||||
void SetChannelPan (uint32 nChannel, uint32 nPan);
|
||||
void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
|
||||
void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd);
|
||||
void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount);
|
||||
bool GetChannelUsedFlag (uint32 nChannel);
|
||||
bool8 GetChannelUsedFlag (uint32 nChannel);
|
||||
void StartChannel (uint32 nChannel);
|
||||
void StopChannel (uint32 nChannel);
|
||||
|
||||
void PreloadStreamedFile (uint32 nFile, uint8 nStream);
|
||||
void PauseStream (uint8 nPauseFlag, uint8 nStream);
|
||||
void StartPreloadedStreamedFile (uint8 nStream);
|
||||
bool StartStreamedFile (uint32 nFile, uint32 nPos, uint8 nStream);
|
||||
void StopStreamedFile (uint8 nStream);
|
||||
int32 GetStreamedFilePosition (uint8 nStream);
|
||||
void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream);
|
||||
int32 GetStreamedFileLength (uint8 nStream);
|
||||
bool IsStreamPlaying (uint8 nStream);
|
||||
void PreloadStreamedFile (uint32 nFile, uint8 nStream = 0);
|
||||
void PauseStream (bool8 nPauseFlag, uint8 nStream = 0);
|
||||
void StartPreloadedStreamedFile (uint8 nStream = 0);
|
||||
bool8 StartStreamedFile (uint32 nFile, uint32 nPos, uint8 nStream = 0);
|
||||
void StopStreamedFile (uint8 nStream = 0);
|
||||
int32 GetStreamedFilePosition (uint8 nStream = 0);
|
||||
void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream = 0);
|
||||
int32 GetStreamedFileLength (uint8 nStream = 0);
|
||||
bool8 IsStreamPlaying (uint8 nStream = 0);
|
||||
void SetStreamedFileLoopFlag (bool8 nLoopFlag, uint8 nStream = 0);
|
||||
#ifdef AUDIO_OAL
|
||||
void Service(void);
|
||||
#endif
|
||||
bool InitialiseSampleBanks(void);
|
||||
bool8 InitialiseSampleBanks(void);
|
||||
|
||||
uint8 GetMusicVolume() const { return m_nMusicVolume; }
|
||||
void SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nStream);
|
||||
uint8 GetMusicFadeVolume() const { return m_nMusicFadeVolume; }
|
||||
};
|
||||
|
||||
extern cSampleManager SampleManager;
|
||||
extern uint32 BankStartOffset[MAX_SFX_BANKS];
|
||||
|
||||
#if defined(OPUS_AUDIO_PATHS)
|
||||
static char StreamedNameTable[][25] = {
|
||||
"AUDIO\\HEAD.OPUS", "AUDIO\\CLASS.OPUS", "AUDIO\\KJAH.OPUS", "AUDIO\\RISE.OPUS", "AUDIO\\LIPS.OPUS", "AUDIO\\GAME.OPUS",
|
||||
"AUDIO\\MSX.OPUS", "AUDIO\\FLASH.OPUS", "AUDIO\\CHAT.OPUS", "AUDIO\\HEAD.OPUS", "AUDIO\\POLICE.OPUS", "AUDIO\\CITY.OPUS",
|
||||
"AUDIO\\WATER.OPUS", "AUDIO\\COMOPEN.OPUS", "AUDIO\\SUBOPEN.OPUS", "AUDIO\\JB.OPUS", "AUDIO\\BET.OPUS", "AUDIO\\L1_LG.OPUS",
|
||||
"AUDIO\\L2_DSB.OPUS", "AUDIO\\L3_DM.OPUS", "AUDIO\\L4_PAP.OPUS", "AUDIO\\L5_TFB.OPUS", "AUDIO\\J0_DM2.OPUS", "AUDIO\\J1_LFL.OPUS",
|
||||
"AUDIO\\J2_KCL.OPUS", "AUDIO\\J3_VH.OPUS", "AUDIO\\J4_ETH.OPUS", "AUDIO\\J5_DST.OPUS", "AUDIO\\J6_TBJ.OPUS", "AUDIO\\T1_TOL.OPUS",
|
||||
"AUDIO\\T2_TPU.OPUS", "AUDIO\\T3_MAS.OPUS", "AUDIO\\T4_TAT.OPUS", "AUDIO\\T5_BF.OPUS", "AUDIO\\S0_MAS.OPUS", "AUDIO\\S1_PF.OPUS",
|
||||
"AUDIO\\S2_CTG.OPUS", "AUDIO\\S3_RTC.OPUS", "AUDIO\\S5_LRQ.OPUS", "AUDIO\\S4_BDBA.OPUS", "AUDIO\\S4_BDBB.OPUS", "AUDIO\\S2_CTG2.OPUS",
|
||||
"AUDIO\\S4_BDBD.OPUS", "AUDIO\\S5_LRQB.OPUS", "AUDIO\\S5_LRQC.OPUS", "AUDIO\\A1_SSO.OPUS", "AUDIO\\A2_PP.OPUS", "AUDIO\\A3_SS.OPUS",
|
||||
"AUDIO\\A4_PDR.OPUS", "AUDIO\\A5_K2FT.OPUS", "AUDIO\\K1_KBO.OPUS", "AUDIO\\K2_GIS.OPUS", "AUDIO\\K3_DS.OPUS", "AUDIO\\K4_SHI.OPUS",
|
||||
"AUDIO\\K5_SD.OPUS", "AUDIO\\R0_PDR2.OPUS", "AUDIO\\R1_SW.OPUS", "AUDIO\\R2_AP.OPUS", "AUDIO\\R3_ED.OPUS", "AUDIO\\R4_GF.OPUS",
|
||||
"AUDIO\\R5_PB.OPUS", "AUDIO\\R6_MM.OPUS", "AUDIO\\D1_STOG.OPUS", "AUDIO\\D2_KK.OPUS", "AUDIO\\D3_ADO.OPUS", "AUDIO\\D5_ES.OPUS",
|
||||
"AUDIO\\D7_MLD.OPUS", "AUDIO\\D4_GTA.OPUS", "AUDIO\\D4_GTA2.OPUS", "AUDIO\\D6_STS.OPUS", "AUDIO\\A6_BAIT.OPUS", "AUDIO\\A7_ETG.OPUS",
|
||||
"AUDIO\\A8_PS.OPUS", "AUDIO\\A9_ASD.OPUS", "AUDIO\\K4_SHI2.OPUS", "AUDIO\\C1_TEX.OPUS", "AUDIO\\EL_PH1.OPUS", "AUDIO\\EL_PH2.OPUS",
|
||||
"AUDIO\\EL_PH3.OPUS", "AUDIO\\EL_PH4.OPUS", "AUDIO\\YD_PH1.OPUS", "AUDIO\\YD_PH2.OPUS", "AUDIO\\YD_PH3.OPUS", "AUDIO\\YD_PH4.OPUS",
|
||||
"AUDIO\\HD_PH1.OPUS", "AUDIO\\HD_PH2.OPUS", "AUDIO\\HD_PH3.OPUS", "AUDIO\\HD_PH4.OPUS", "AUDIO\\HD_PH5.OPUS", "AUDIO\\MT_PH1.OPUS",
|
||||
"AUDIO\\MT_PH2.OPUS", "AUDIO\\MT_PH3.OPUS", "AUDIO\\MT_PH4.OPUS", "AUDIO\\MISCOM.OPUS", "AUDIO\\END.OPUS", "AUDIO\\lib_a1.OPUS",
|
||||
"AUDIO\\lib_a2.OPUS", "AUDIO\\lib_a.OPUS", "AUDIO\\lib_b.OPUS", "AUDIO\\lib_c.OPUS", "AUDIO\\lib_d.OPUS", "AUDIO\\l2_a.OPUS",
|
||||
"AUDIO\\j4t_1.OPUS", "AUDIO\\j4t_2.OPUS", "AUDIO\\j4t_3.OPUS", "AUDIO\\j4t_4.OPUS", "AUDIO\\j4_a.OPUS", "AUDIO\\j4_b.OPUS",
|
||||
"AUDIO\\j4_c.OPUS", "AUDIO\\j4_d.OPUS", "AUDIO\\j4_e.OPUS", "AUDIO\\j4_f.OPUS", "AUDIO\\j6_1.OPUS", "AUDIO\\j6_a.OPUS",
|
||||
"AUDIO\\j6_b.OPUS", "AUDIO\\j6_c.OPUS", "AUDIO\\j6_d.OPUS", "AUDIO\\t4_a.OPUS", "AUDIO\\s1_a.OPUS", "AUDIO\\s1_a1.OPUS",
|
||||
"AUDIO\\s1_b.OPUS", "AUDIO\\s1_c.OPUS", "AUDIO\\s1_c1.OPUS", "AUDIO\\s1_d.OPUS", "AUDIO\\s1_e.OPUS", "AUDIO\\s1_f.OPUS",
|
||||
"AUDIO\\s1_g.OPUS", "AUDIO\\s1_h.OPUS", "AUDIO\\s1_i.OPUS", "AUDIO\\s1_j.OPUS", "AUDIO\\s1_k.OPUS", "AUDIO\\s1_l.OPUS",
|
||||
"AUDIO\\s3_a.OPUS", "AUDIO\\s3_b.OPUS", "AUDIO\\el3_a.OPUS", "AUDIO\\mf1_a.OPUS", "AUDIO\\mf2_a.OPUS", "AUDIO\\mf3_a.OPUS",
|
||||
"AUDIO\\mf3_b.OPUS", "AUDIO\\mf3_b1.OPUS", "AUDIO\\mf3_c.OPUS", "AUDIO\\mf4_a.OPUS", "AUDIO\\mf4_b.OPUS", "AUDIO\\mf4_c.OPUS",
|
||||
"AUDIO\\a1_a.OPUS", "AUDIO\\a3_a.OPUS", "AUDIO\\a5_a.OPUS", "AUDIO\\a4_a.OPUS", "AUDIO\\a4_b.OPUS", "AUDIO\\a4_c.OPUS",
|
||||
"AUDIO\\a4_d.OPUS", "AUDIO\\k1_a.OPUS", "AUDIO\\k3_a.OPUS", "AUDIO\\r1_a.OPUS", "AUDIO\\r2_a.OPUS", "AUDIO\\r2_b.OPUS",
|
||||
"AUDIO\\r2_c.OPUS", "AUDIO\\r2_d.OPUS", "AUDIO\\r2_e.OPUS", "AUDIO\\r2_f.OPUS", "AUDIO\\r2_g.OPUS", "AUDIO\\r2_h.OPUS",
|
||||
"AUDIO\\r5_a.OPUS", "AUDIO\\r6_a.OPUS", "AUDIO\\r6_a1.OPUS", "AUDIO\\r6_b.OPUS", "AUDIO\\lo2_a.OPUS", "AUDIO\\lo6_a.OPUS",
|
||||
"AUDIO\\yd2_a.OPUS", "AUDIO\\yd2_b.OPUS", "AUDIO\\yd2_c.OPUS", "AUDIO\\yd2_c1.OPUS", "AUDIO\\yd2_d.OPUS", "AUDIO\\yd2_e.OPUS",
|
||||
"AUDIO\\yd2_f.OPUS", "AUDIO\\yd2_g.OPUS", "AUDIO\\yd2_h.OPUS", "AUDIO\\yd2_ass.OPUS", "AUDIO\\yd2_ok.OPUS", "AUDIO\\h5_a.OPUS",
|
||||
"AUDIO\\h5_b.OPUS", "AUDIO\\h5_c.OPUS", "AUDIO\\ammu_a.OPUS", "AUDIO\\ammu_b.OPUS", "AUDIO\\ammu_c.OPUS", "AUDIO\\door_1.OPUS",
|
||||
"AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS",
|
||||
"AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"};
|
||||
#elif defined(PS2_AUDIO_PATHS)
|
||||
static char StreamedNameTable[][40] =
|
||||
{
|
||||
"AUDIO\\MUSIC\\HEAD.VB",
|
||||
"AUDIO\\MUSIC\\DOUBLE.VB",
|
||||
"AUDIO\\MUSIC\\KJAH.VB",
|
||||
"AUDIO\\MUSIC\\RISE.VB",
|
||||
"AUDIO\\MUSIC\\LIPS.VB",
|
||||
"AUDIO\\MUSIC\\MUNDO.VB",
|
||||
"AUDIO\\MUSIC\\MSX.VB",
|
||||
"AUDIO\\MUSIC\\FLASH.VB",
|
||||
"AUDIO\\MUSIC\\LCJ.VB",
|
||||
"AUDIO\\MUSIC\\LCFR.VB",
|
||||
"AUDIO\\MUSIC\\MISCOM2.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\WATER.VB",
|
||||
"AUDIO\\MUSIC\\SAWMILL.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\WATER.VB",
|
||||
"AUDIO\\MUSIC\\WATER.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\CITY.VB",
|
||||
"AUDIO\\MUSIC\\POLICE.VB",
|
||||
"AUDIO\\MUSIC\\TAXI.VB",
|
||||
"AUDIO\\NEWS\\NEWS_A.VB",
|
||||
"AUDIO\\NEWS\\NEWS_B.VB",
|
||||
"AUDIO\\NEWS\\NEWS_C.VB",
|
||||
"AUDIO\\NEWS\\NEWS_D.VB",
|
||||
"AUDIO\\NEWS\\NEWS_E.VB",
|
||||
"AUDIO\\NEWS\\NEWS_F.VB",
|
||||
"AUDIO\\NEWS\\NEWS_G.VB",
|
||||
"AUDIO\\NEWS\\NEWS_H.VB",
|
||||
"AUDIO\\NEWS\\NEWS_I.VB",
|
||||
"AUDIO\\NEWS\\NEWS_J.VB",
|
||||
"AUDIO\\NEWS\\NEWS_K.VB",
|
||||
"AUDIO\\NEWS\\NEWS_L.VB",
|
||||
"AUDIO\\NEWS\\NEWS_M.VB",
|
||||
"AUDIO\\NEWS\\NEWS_N.VB",
|
||||
"AUDIO\\CUTSCENE\\BIKER.VB",
|
||||
"AUDIO\\CUTSCENE\\BONEVOY.VB",
|
||||
"AUDIO\\CUTSCENE\\CAMPAIN.VB",
|
||||
"AUDIO\\CUTSCENE\\CASHCHP.VB",
|
||||
"AUDIO\\CUTSCENE\\CONTBAN.VB",
|
||||
"AUDIO\\CUTSCENE\\CRAZY69.VB",
|
||||
"AUDIO\\CUTSCENE\\CRAZY69.VB",
|
||||
"AUDIO\\CUTSCENE\\DEADLY.VB",
|
||||
"AUDIO\\CUTSCENE\\DONPROB.VB",
|
||||
"AUDIO\\CUTSCENE\\DRIVNMR.VB",
|
||||
"AUDIO\\CUTSCENE\\ELECTON.VB",
|
||||
"AUDIO\\CUTSCENE\\FINAL.VB",
|
||||
"AUDIO\\CUTSCENE\\FINAL_2.VB",
|
||||
"AUDIO\\CUTSCENE\\HOMSWET.VB",
|
||||
"AUDIO\\CUTSCENE\\HOTWHEL.VB",
|
||||
"AUDIO\\CUTSCENE\\KIDNAPP.VB",
|
||||
"AUDIO\\CUTSCENE\\LANDGRB.VB",
|
||||
"AUDIO\\CUTSCENE\\MORGUE.VB",
|
||||
"AUDIO\\CUTSCENE\\OVERDOS.VB",
|
||||
"AUDIO\\CUTSCENE\\RUFJUST.VB",
|
||||
"AUDIO\\CUTSCENE\\SAYONAR.VB",
|
||||
"AUDIO\\CUTSCENE\\SICILAN.VB",
|
||||
"AUDIO\\CUTSCENE\\THEOFER.VB",
|
||||
"AUDIO\\CUTSCENE\\INTRO.VB",
|
||||
"AUDIO\\MUSIC\\FINALE.VB",
|
||||
"AUDIO\\MUSIC\\MISCOM2.VB"
|
||||
#else
|
||||
static char StreamedNameTable[][25] =
|
||||
{
|
||||
"AUDIO\\WILD.ADF",
|
||||
"AUDIO\\FLASH.ADF",
|
||||
"AUDIO\\KCHAT.ADF",
|
||||
"AUDIO\\FEVER.ADF",
|
||||
"AUDIO\\VROCK.ADF",
|
||||
"AUDIO\\VCPR.ADF",
|
||||
"AUDIO\\ESPANT.ADF",
|
||||
"AUDIO\\EMOTION.ADF",
|
||||
"AUDIO\\WAVE.ADF",
|
||||
"AUDIO\\MISCOM.MP3",
|
||||
"AUDIO\\CITY.MP3",
|
||||
"AUDIO\\WATER.MP3",
|
||||
"AUDIO\\BEACHAMB.MP3",
|
||||
"AUDIO\\HCITY.MP3",
|
||||
"AUDIO\\HWATER.MP3",
|
||||
"AUDIO\\HBEACH.MP3",
|
||||
"AUDIO\\MALLAMB.MP3",
|
||||
"AUDIO\\STRIP.MP3",
|
||||
"AUDIO\\MALIBU.MP3",
|
||||
"AUDIO\\HOTEL.MP3",
|
||||
"AUDIO\\DIRTRING.MP3",
|
||||
"AUDIO\\LAW4RIOT.MP3",
|
||||
"AUDIO\\AMBSIL.MP3",
|
||||
"AUDIO\\POLICE.MP3",
|
||||
"AUDIO\\TAXI.MP3",
|
||||
"AUDIO\\BCLOSED.MP3",
|
||||
"AUDIO\\BOPEN.MP3",
|
||||
"AUDIO\\ASS_1.MP3",
|
||||
"AUDIO\\ASS_2.MP3",
|
||||
"AUDIO\\BANK_1.MP3",
|
||||
"AUDIO\\BANK_2A.MP3",
|
||||
"AUDIO\\BANK_2B.MP3",
|
||||
"AUDIO\\BANK_3A.MP3",
|
||||
"AUDIO\\BANK_3B.MP3",
|
||||
"AUDIO\\BANK_4.MP3",
|
||||
"AUDIO\\BIKE_1.MP3",
|
||||
"AUDIO\\BIKE_2.MP3",
|
||||
"AUDIO\\BIKE_3.MP3",
|
||||
"AUDIO\\BUD_1.MP3",
|
||||
"AUDIO\\BUD_2.MP3",
|
||||
"AUDIO\\BUD_3.MP3",
|
||||
"AUDIO\\CAP_1.MP3",
|
||||
"AUDIO\\CAR_1.MP3",
|
||||
"AUDIO\\CNT_1A.MP3",
|
||||
"AUDIO\\CNT_1B.MP3",
|
||||
"AUDIO\\CNT_2.MP3",
|
||||
"AUDIO\\COK_1.MP3",
|
||||
"AUDIO\\COK_2A.MP3",
|
||||
"AUDIO\\COK_2B.MP3",
|
||||
"AUDIO\\COK_3.MP3",
|
||||
"AUDIO\\COK_4A.MP3",
|
||||
"AUDIO\\COK_4A2.MP3",
|
||||
"AUDIO\\COK_4B.MP3",
|
||||
"AUDIO\\COL_1.MP3",
|
||||
"AUDIO\\COL_2.MP3",
|
||||
"AUDIO\\COL_3A.MP3",
|
||||
"AUDIO\\COL_4A.MP3",
|
||||
"AUDIO\\COL_5A.MP3",
|
||||
"AUDIO\\COL_5B.MP3",
|
||||
"AUDIO\\CUB_1.MP3",
|
||||
"AUDIO\\CUB_2.MP3",
|
||||
"AUDIO\\CUB_3.MP3",
|
||||
"AUDIO\\CUB_4.MP3",
|
||||
"AUDIO\\DRUG_1.MP3",
|
||||
"AUDIO\\FIN.MP3",
|
||||
"AUDIO\\FIN2.MP3",
|
||||
"AUDIO\\FINALE.MP3",
|
||||
"AUDIO\\HAT_1.MP3",
|
||||
"AUDIO\\HAT_2.MP3",
|
||||
"AUDIO\\HAT_3.MP3",
|
||||
"AUDIO\\ICE_1.MP3",
|
||||
"AUDIO\\INT_A.MP3",
|
||||
"AUDIO\\INT_B.MP3",
|
||||
"AUDIO\\INT_D.MP3",
|
||||
"AUDIO\\INT_M.MP3",
|
||||
"AUDIO\\LAW_1A.MP3",
|
||||
"AUDIO\\LAW_1B.MP3",
|
||||
"AUDIO\\LAW_2A.MP3",
|
||||
"AUDIO\\LAW_2B.MP3",
|
||||
"AUDIO\\LAW_2C.MP3",
|
||||
"AUDIO\\LAW_3.MP3",
|
||||
"AUDIO\\LAW_4.MP3",
|
||||
"AUDIO\\PHIL_1.MP3",
|
||||
"AUDIO\\PHIL_2.MP3",
|
||||
"AUDIO\\PORN_1.MP3",
|
||||
"AUDIO\\PORN_2.MP3",
|
||||
"AUDIO\\PORN_3.MP3",
|
||||
"AUDIO\\PORN_4.MP3",
|
||||
"AUDIO\\RESC_1A.MP3",
|
||||
"AUDIO\\ROK_1.MP3",
|
||||
"AUDIO\\ROK_2.MP3",
|
||||
"AUDIO\\ROK_3A.MP3",
|
||||
"AUDIO\\STRIPA.MP3",
|
||||
"AUDIO\\TAX_1.MP3",
|
||||
"AUDIO\\TEX_1.MP3",
|
||||
"AUDIO\\TEX_2.MP3",
|
||||
"AUDIO\\TEX_3.MP3",
|
||||
"AUDIO\\GLIGHT.MP3",
|
||||
"AUDIO\\FIST.MP3",
|
||||
"AUDIO\\MISCOM.MP3",
|
||||
"AUDIO\\MISCOM.MP3",
|
||||
"AUDIO\\MISCOM.MP3",
|
||||
"AUDIO\\MISCOM.MP3",
|
||||
#endif
|
||||
|
||||
static char StreamedNameTable[][40] = {
|
||||
"AUDIO\\MUSIC\\HEAD",
|
||||
"AUDIO\\MUSIC\\DOUBLE",
|
||||
"AUDIO\\MUSIC\\KJAH",
|
||||
"AUDIO\\MUSIC\\RISE",
|
||||
"AUDIO\\MUSIC\\LIPS",
|
||||
"AUDIO\\MUSIC\\MUNDO",
|
||||
"AUDIO\\MUSIC\\MSX",
|
||||
"AUDIO\\MUSIC\\FLASH",
|
||||
"AUDIO\\MUSIC\\LCJ",
|
||||
"AUDIO\\MUSIC\\LCFR",
|
||||
"AUDIO\\MUSIC\\MISCOM2",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\WATER",
|
||||
"AUDIO\\MUSIC\\SAWMILL",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\WATER",
|
||||
"AUDIO\\MUSIC\\WATER",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\CITY",
|
||||
"AUDIO\\MUSIC\\POLICE",
|
||||
"AUDIO\\MUSIC\\TAXI",
|
||||
"AUDIO\\NEWS\\NEWS_A",
|
||||
"AUDIO\\NEWS\\NEWS_B",
|
||||
"AUDIO\\NEWS\\NEWS_C",
|
||||
"AUDIO\\NEWS\\NEWS_D",
|
||||
"AUDIO\\NEWS\\NEWS_E",
|
||||
"AUDIO\\NEWS\\NEWS_F",
|
||||
"AUDIO\\NEWS\\NEWS_G",
|
||||
"AUDIO\\NEWS\\NEWS_H",
|
||||
"AUDIO\\NEWS\\NEWS_I",
|
||||
"AUDIO\\NEWS\\NEWS_J",
|
||||
"AUDIO\\NEWS\\NEWS_K",
|
||||
"AUDIO\\NEWS\\NEWS_L",
|
||||
"AUDIO\\NEWS\\NEWS_M",
|
||||
"AUDIO\\NEWS\\NEWS_N",
|
||||
"AUDIO\\CUTSCENE\\BIKER",
|
||||
"AUDIO\\CUTSCENE\\BONEVOY",
|
||||
"AUDIO\\CUTSCENE\\CAMPAIN",
|
||||
"AUDIO\\CUTSCENE\\CASHCHP",
|
||||
"AUDIO\\CUTSCENE\\CONTBAN",
|
||||
"AUDIO\\CUTSCENE\\CRAZY69",
|
||||
"AUDIO\\CUTSCENE\\CRAZY69",
|
||||
"AUDIO\\CUTSCENE\\DEADLY",
|
||||
"AUDIO\\CUTSCENE\\DONPROB",
|
||||
"AUDIO\\CUTSCENE\\DRIVNMR",
|
||||
"AUDIO\\CUTSCENE\\ELECTON",
|
||||
"AUDIO\\CUTSCENE\\FINAL",
|
||||
"AUDIO\\CUTSCENE\\FINAL_2",
|
||||
"AUDIO\\CUTSCENE\\HOMSWET",
|
||||
"AUDIO\\CUTSCENE\\HOTWHEL",
|
||||
"AUDIO\\CUTSCENE\\KIDNAPP",
|
||||
"AUDIO\\CUTSCENE\\LANDGRB",
|
||||
"AUDIO\\CUTSCENE\\MORGUE",
|
||||
"AUDIO\\CUTSCENE\\OVERDOS",
|
||||
"AUDIO\\CUTSCENE\\RUFJUST",
|
||||
"AUDIO\\CUTSCENE\\SAYONAR",
|
||||
"AUDIO\\CUTSCENE\\SICILAN",
|
||||
"AUDIO\\CUTSCENE\\THEOFER",
|
||||
"AUDIO\\CUTSCENE\\INTRO",
|
||||
"AUDIO\\MUSIC\\FINALE",
|
||||
"AUDIO\\MUSIC\\MISCOM2"
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@
|
|||
#include "AudioManager.h"
|
||||
|
||||
cSampleManager SampleManager;
|
||||
bool _bSampmanInitialised = false;
|
||||
bool8 _bSampmanInitialised = FALSE;
|
||||
|
||||
uint32 BankStartOffset[MAX_SFX_BANKS];
|
||||
uint32 nNumMP3s;
|
||||
|
@ -19,6 +19,7 @@ cSampleManager::~cSampleManager(void)
|
|||
|
||||
}
|
||||
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
void cSampleManager::SetSpeakerConfig(int32 nConfig)
|
||||
{
|
||||
|
||||
|
@ -59,8 +60,9 @@ int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::IsMP3RadioChannelAvailable(void)
|
||||
{
|
||||
return nNumMP3s != 0;
|
||||
|
@ -75,10 +77,10 @@ void cSampleManager::ReacquireDigitalHandle(void)
|
|||
{
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::Initialise(void)
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -87,9 +89,9 @@ cSampleManager::Terminate(void)
|
|||
|
||||
}
|
||||
|
||||
bool cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||
bool8 cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char cSampleManager::GetCDAudioDriveLetter(void)
|
||||
|
@ -114,7 +116,7 @@ cSampleManager::SetMusicMasterVolume(uint8 nVolume)
|
|||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetMusicMasterVolume(uint8 nVolume)
|
||||
cSampleManager::SetMP3BoostVolume(uint8 nVolume)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -129,15 +131,15 @@ cSampleManager::SetMusicFadeVolume(uint8 nVolume)
|
|||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetMonoMode(uint8 nMode)
|
||||
cSampleManager::SetMonoMode(bool8 nMode)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::LoadSampleBank(uint8 nBank)
|
||||
{
|
||||
ASSERT( nBank < MAX_SFX_BANKS );
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -146,20 +148,36 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
|
|||
ASSERT( nBank < MAX_SFX_BANKS );
|
||||
}
|
||||
|
||||
bool
|
||||
int8
|
||||
cSampleManager::IsSampleBankLoaded(uint8 nBank)
|
||||
{
|
||||
ASSERT( nBank < MAX_SFX_BANKS );
|
||||
|
||||
return false;
|
||||
return LOADING_STATUS_NOT_LOADED;
|
||||
}
|
||||
|
||||
bool
|
||||
uint8
|
||||
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
|
||||
{
|
||||
ASSERT(nSlot < MISSION_AUDIO_COUNT);
|
||||
|
||||
return LOADING_STATUS_NOT_LOADED;
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
|
||||
{
|
||||
ASSERT(nSlot < MISSION_AUDIO_COUNT);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint8
|
||||
cSampleManager::IsPedCommentLoaded(uint32 nComment)
|
||||
{
|
||||
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
|
||||
|
||||
return false;
|
||||
return LOADING_STATUS_NOT_LOADED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,11 +187,11 @@ cSampleManager::_GetPedCommentSlot(uint32 nComment)
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::LoadPedComment(uint32 nComment)
|
||||
{
|
||||
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int32
|
||||
|
@ -182,14 +200,14 @@ cSampleManager::GetBankContainingSound(uint32 offset)
|
|||
return INVALID_SFX_BANK;
|
||||
}
|
||||
|
||||
int32
|
||||
uint32
|
||||
cSampleManager::GetSampleBaseFrequency(uint32 nSample)
|
||||
{
|
||||
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32
|
||||
uint32
|
||||
cSampleManager::GetSampleLoopStartOffset(uint32 nSample)
|
||||
{
|
||||
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
|
||||
|
@ -210,56 +228,58 @@ cSampleManager::GetSampleLength(uint32 nSample)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool cSampleManager::UpdateReverb(void)
|
||||
bool8 cSampleManager::UpdateReverb(void)
|
||||
{
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag)
|
||||
cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
void
|
||||
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
|
||||
{
|
||||
ASSERT( nChannel != CHANNEL2D );
|
||||
ASSERT( nChannel < MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
|
||||
{
|
||||
ASSERT( nChannel != CHANNEL2D );
|
||||
ASSERT( nChannel < MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
|
||||
{
|
||||
ASSERT( nChannel != CHANNEL2D );
|
||||
ASSERT( nChannel < MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
|
||||
{
|
||||
ASSERT( nChannel == CHANNEL2D );
|
||||
ASSERT( nChannel >= MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
|
||||
{
|
||||
ASSERT(nChannel == CHANNEL2D);
|
||||
ASSERT( nChannel >= MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
|
@ -281,12 +301,12 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
|
|||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -308,7 +328,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
|
|||
}
|
||||
|
||||
void
|
||||
cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream)
|
||||
cSampleManager::PauseStream(bool8 nPauseFlag, uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
}
|
||||
|
@ -319,12 +339,12 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
|
|||
ASSERT( nStream < MAX_STREAMS );
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -342,7 +362,7 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream)
|
|||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream)
|
||||
cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
}
|
||||
|
@ -355,23 +375,23 @@ cSampleManager::GetStreamedFileLength(uint8 nStream)
|
|||
return 1;
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::IsStreamPlaying(uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool
|
||||
bool8
|
||||
cSampleManager::InitialiseSampleBanks(void)
|
||||
{
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel)
|
||||
cSampleManager::SetStreamedFileLoopFlag(bool8 nLoopFlag, uint8 nChannel)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -54,8 +54,8 @@ enum eSound
|
|||
SOUND_49,
|
||||
SOUND_WEAPON_BAT_ATTACK,
|
||||
SOUND_WEAPON_KNIFE_ATTACK,
|
||||
SOUND_WEAPON_CHAINSAW_ATTACK,
|
||||
SOUND_WEAPON_CHAINSAW_IDLE,
|
||||
SOUND_WEAPON_CHAINSAW_ATTACK,
|
||||
SOUND_WEAPON_CHAINSAW_MADECONTACT,
|
||||
SOUND_WEAPON_SHOT_FIRED,
|
||||
SOUND_WEAPON_RELOAD,
|
||||
|
@ -116,8 +116,8 @@ enum eSound
|
|||
SOUND_PED_MIAMIVICE_EXITING_CAR,
|
||||
SOUND_PED_COP_HELIPILOTPHRASE,
|
||||
SOUND_PED_PULLOUTWEAPON,
|
||||
SOUND_PED_HELI_PLAYER_FOUND = 114,
|
||||
SOUND_PED_VCPA_PLAYER_FOUND = 115,
|
||||
SOUND_PED_HELI_PLAYER_FOUND,
|
||||
SOUND_PED_VCPA_PLAYER_FOUND,
|
||||
SOUND_PED_ON_FIRE,
|
||||
SOUND_PED_AIMING,
|
||||
SOUND_PED_HANDS_UP,
|
||||
|
@ -128,15 +128,15 @@ enum eSound
|
|||
SOUND_PED_CAR_JACKED,
|
||||
SOUND_PED_ROBBED,
|
||||
SOUND_PED_ACCIDENTREACTION1,
|
||||
SOUND_PED_UNK_126,
|
||||
SOUND_PED_INNOCENT,
|
||||
SOUND_PED_PLAYER_AFTERSEX,
|
||||
SOUND_PED_PLAYER_BEFORESEX,
|
||||
SOUND_PED_COP_UNK_129, // also used for medics
|
||||
SOUND_PED_COP_TARGETING, // also used for medics
|
||||
SOUND_PED_COP_MANYCOPSAROUND, // also used for medics
|
||||
SOUND_PED_GUNAIMEDAT2,
|
||||
SOUND_PED_COP_ALONE, // also used for medics
|
||||
SOUND_PED_GUNAIMEDAT3,
|
||||
SOUND_PED_COP_REACTION,
|
||||
SOUND_PED_COP_ASK_FOR_ID,
|
||||
SOUND_PED_COP_LITTLECOPSAROUND, // also used for medics
|
||||
SOUND_PED_PLAYER_FARFROMCOPS, // also used for medics
|
||||
SOUND_PED_TAXI_WAIT,
|
||||
|
@ -151,12 +151,12 @@ enum eSound
|
|||
SOUND_PED_ANNOYED_DRIVER,
|
||||
SOUND_PED_147,
|
||||
SOUND_PED_SOLICIT,
|
||||
SOUND_PED_149,
|
||||
SOUND_PED_JEER,
|
||||
SOUND_PED_150,
|
||||
SOUND_PED_EXTINGUISHING_FIRE,
|
||||
SOUND_PED_WAIT_DOUBLEBACK,
|
||||
SOUND_153,
|
||||
SOUND_PED_CHAT_SEXY,
|
||||
SOUND_PED_CHAT_SEXY_FEMALE,
|
||||
SOUND_PED_CHAT_SEXY_MALE,
|
||||
SOUND_PED_CHAT_EVENT,
|
||||
SOUND_PED_PED_COLLISION,
|
||||
SOUND_PED_CHAT,
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#include "Streaming.h"
|
||||
#include "Pools.h"
|
||||
|
||||
void *CBuilding::operator new(size_t sz) { return CPools::GetBuildingPool()->New(); }
|
||||
void CBuilding::operator delete(void *p, size_t sz) { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
|
||||
void *CBuilding::operator new(size_t sz) throw() { return CPools::GetBuildingPool()->New(); }
|
||||
void CBuilding::operator delete(void *p, size_t sz) throw() { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
|
||||
|
||||
void
|
||||
CBuilding::ReplaceWithNewModel(int32 id)
|
||||
|
|
|
@ -9,8 +9,8 @@ public:
|
|||
m_type = ENTITY_TYPE_BUILDING;
|
||||
bUsesCollision = true;
|
||||
}
|
||||
static void *operator new(size_t);
|
||||
static void operator delete(void*, size_t);
|
||||
static void *operator new(size_t) throw();
|
||||
static void operator delete(void*, size_t) throw();
|
||||
|
||||
void ReplaceWithNewModel(int32 id);
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
#include "Treadable.h"
|
||||
#include "Pools.h"
|
||||
|
||||
void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); }
|
||||
void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
|
||||
void *CTreadable::operator new(size_t sz) throw() { return CPools::GetTreadablePool()->New(); }
|
||||
void CTreadable::operator delete(void *p, size_t sz) throw() { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
class CTreadable : public CBuilding
|
||||
{
|
||||
public:
|
||||
static void *operator new(size_t);
|
||||
static void operator delete(void*, size_t);
|
||||
static void *operator new(size_t) throw();
|
||||
static void operator delete(void*, size_t) throw();
|
||||
|
||||
bool GetIsATreadable(void) { return true; }
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ CColModel::~CColModel(void)
|
|||
|
||||
//--LCS: no pool used, but maybe we better keep it?
|
||||
void*
|
||||
CColModel::operator new(size_t)
|
||||
CColModel::operator new(size_t) throw()
|
||||
{
|
||||
CColModel* node = CPools::GetColModelPool()->New();
|
||||
assert(node);
|
||||
|
@ -44,7 +44,7 @@ CColModel::operator new(size_t)
|
|||
}
|
||||
|
||||
void
|
||||
CColModel::operator delete(void *p, size_t)
|
||||
CColModel::operator delete(void *p, size_t) throw()
|
||||
{
|
||||
CPools::GetColModelPool()->Delete((CColModel*)p);
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ struct CColModel
|
|||
void SetLinkPtr(CLink<CColModel*>*);
|
||||
void GetTrianglePoint(CVector &v, int i) const;
|
||||
|
||||
void *operator new(size_t);
|
||||
void operator delete(void *p, size_t);
|
||||
void *operator new(size_t) throw();
|
||||
void operator delete(void *p, size_t) throw();
|
||||
CColModel& operator=(const CColModel& other);
|
||||
|
||||
bool Write(base::cRelocatableChunkWriter &writer, bool allocSpace);
|
||||
|
|
|
@ -292,7 +292,7 @@ CColStore::LoadCollision(const CVector &pos, eLevelName level)
|
|||
}else{
|
||||
for (int j = 0; j < MAX_CLEANUP; j++) {
|
||||
CPhysical* pEntity = nil;
|
||||
cleanup_entity_struct* pCleanup = &CTheScripts::MissionCleanUp.m_sEntities[i];
|
||||
cleanup_entity_struct* pCleanup = &CTheScripts::MissionCleanUp.m_sEntities[j];
|
||||
if (pCleanup->type == CLEANUP_CAR) {
|
||||
pEntity = CPools::GetVehiclePool()->GetAt(pCleanup->id);
|
||||
if (!pEntity || pEntity->GetStatus() == STATUS_WRECKED)
|
||||
|
|
|
@ -47,3 +47,5 @@ public:
|
|||
return ms_pColPool->GetSlot(slot);
|
||||
}
|
||||
};
|
||||
|
||||
const CVector& LevelPos(eLevelName level);
|
||||
|
|
|
@ -105,7 +105,7 @@ GetCollisionInSectorList(CPtrList &list)
|
|||
|
||||
for(node = list.first; node; node = node->next){
|
||||
e = (CEntity*)node->item;
|
||||
level = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel()->level;
|
||||
level = CModelInfo::GetColModel(e->GetModelIndex())->level;
|
||||
if(level != LEVEL_GENERIC)
|
||||
return (eLevelName)level;
|
||||
}
|
||||
|
@ -148,11 +148,10 @@ CCollision::SortOutCollisionAfterLoad(void)
|
|||
void
|
||||
CCollision::LoadCollisionScreen(eLevelName level)
|
||||
{
|
||||
static Const char *levelNames[4] = {
|
||||
static Const char *levelNames[] = {
|
||||
"",
|
||||
"IND_ZON",
|
||||
"COM_ZON",
|
||||
"SUB_ZON"
|
||||
};
|
||||
|
||||
// Why twice?
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#include "CarCtrl.h"
|
||||
#include "Curves.h"
|
||||
#include "PathFind.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
//--LCS: file done
|
||||
|
||||
void CAutoPilot::ModifySpeed(float speed)
|
||||
{
|
||||
|
@ -49,86 +52,87 @@ void CAutoPilot::RemoveOnePathNode()
|
|||
#ifdef COMPATIBLE_SAVES
|
||||
void CAutoPilot::Save(uint8*& buf)
|
||||
{
|
||||
WriteSaveBuf<int32>(buf, m_nCurrentRouteNode);
|
||||
WriteSaveBuf<int32>(buf, m_nNextRouteNode);
|
||||
WriteSaveBuf<int32>(buf, m_nPrevRouteNode);
|
||||
WriteSaveBuf<int32>(buf, m_nTimeEnteredCurve);
|
||||
WriteSaveBuf<int32>(buf, m_nTimeToSpendOnCurrentCurve);
|
||||
WriteSaveBuf<uint32>(buf, m_nCurrentPathNodeInfo);
|
||||
WriteSaveBuf<uint32>(buf, m_nNextPathNodeInfo);
|
||||
WriteSaveBuf<uint32>(buf, m_nPreviousPathNodeInfo);
|
||||
WriteSaveBuf<uint32>(buf, m_nAntiReverseTimer);
|
||||
WriteSaveBuf<uint32>(buf, m_nTimeToStartMission);
|
||||
WriteSaveBuf<int8>(buf, m_nPreviousDirection);
|
||||
WriteSaveBuf<int8>(buf, m_nCurrentDirection);
|
||||
WriteSaveBuf<int8>(buf, m_nNextDirection);
|
||||
WriteSaveBuf<int8>(buf, m_nCurrentLane);
|
||||
WriteSaveBuf<int8>(buf, m_nNextLane);
|
||||
WriteSaveBuf<uint8>(buf, m_nDrivingStyle);
|
||||
WriteSaveBuf<uint8>(buf, m_nCarMission);
|
||||
WriteSaveBuf<uint8>(buf, m_nTempAction);
|
||||
WriteSaveBuf<uint32>(buf, m_nTimeTempAction);
|
||||
WriteSaveBuf<float>(buf, m_fMaxTrafficSpeed);
|
||||
WriteSaveBuf<uint8>(buf, m_nCruiseSpeed);
|
||||
WriteSaveBuf<uint8>(buf, m_nCruiseSpeedMultiplierType);
|
||||
SkipSaveBuf(buf, 2);
|
||||
WriteSaveBuf<float>(buf, m_fCruiseSpeedMultiplier);
|
||||
WriteSaveBuf(buf, m_nCurrentRouteNode);
|
||||
WriteSaveBuf(buf, m_nNextRouteNode);
|
||||
WriteSaveBuf(buf, m_nPrevRouteNode);
|
||||
WriteSaveBuf(buf, m_nTimeEnteredCurve);
|
||||
WriteSaveBuf(buf, m_nTimeToSpendOnCurrentCurve);
|
||||
WriteSaveBuf(buf, m_nCurrentPathNodeInfo);
|
||||
WriteSaveBuf(buf, m_nNextPathNodeInfo);
|
||||
WriteSaveBuf(buf, m_nPreviousPathNodeInfo);
|
||||
WriteSaveBuf(buf, m_nAntiReverseTimer);
|
||||
WriteSaveBuf(buf, m_nTimeToStartMission);
|
||||
WriteSaveBuf(buf, m_nPreviousDirection);
|
||||
WriteSaveBuf(buf, m_nCurrentDirection);
|
||||
WriteSaveBuf(buf, m_nNextDirection);
|
||||
WriteSaveBuf(buf, m_nCurrentLane);
|
||||
WriteSaveBuf(buf, m_nNextLane);
|
||||
WriteSaveBuf(buf, m_nDrivingStyle);
|
||||
WriteSaveBuf(buf, m_nCarMission);
|
||||
WriteSaveBuf(buf, m_nTempAction);
|
||||
WriteSaveBuf(buf, m_nTimeTempAction);
|
||||
WriteSaveBuf(buf, m_fMaxTrafficSpeed);
|
||||
WriteSaveBuf(buf, m_nCruiseSpeed);
|
||||
WriteSaveBuf(buf, m_nCruiseSpeedMultiplierType);
|
||||
ZeroSaveBuf(buf, 2);
|
||||
WriteSaveBuf(buf, m_fCruiseSpeedMultiplier);
|
||||
uint8 flags = 0;
|
||||
if (m_bSlowedDownBecauseOfCars) flags |= BIT(0);
|
||||
if (m_bSlowedDownBecauseOfPeds) flags |= BIT(1);
|
||||
if (m_bStayInCurrentLevel) flags |= BIT(2);
|
||||
if (m_bStayInFastLane) flags |= BIT(3);
|
||||
if (m_bIgnorePathfinding) flags |= BIT(4);
|
||||
WriteSaveBuf<uint8>(buf, flags);
|
||||
WriteSaveBuf<uint8>(buf, m_nSwitchDistance);
|
||||
SkipSaveBuf(buf, 2);
|
||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.x);
|
||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.y);
|
||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.z);
|
||||
SkipSaveBuf(buf, 32);
|
||||
WriteSaveBuf<int16>(buf, m_nPathFindNodesCount);
|
||||
SkipSaveBuf(buf, 6);
|
||||
WriteSaveBuf(buf, flags);
|
||||
WriteSaveBuf(buf, m_nSwitchDistance);
|
||||
ZeroSaveBuf(buf, 2);
|
||||
WriteSaveBuf(buf, m_vecDestinationCoors.x);
|
||||
WriteSaveBuf(buf, m_vecDestinationCoors.y);
|
||||
WriteSaveBuf(buf, m_vecDestinationCoors.z);
|
||||
ZeroSaveBuf(buf, 32);
|
||||
WriteSaveBuf(buf, m_nPathFindNodesCount);
|
||||
ZeroSaveBuf(buf, 6);
|
||||
}
|
||||
|
||||
void CAutoPilot::Load(uint8*& buf)
|
||||
{
|
||||
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
|
||||
m_nNextRouteNode = ReadSaveBuf<int32>(buf);
|
||||
m_nPrevRouteNode = ReadSaveBuf<int32>(buf);
|
||||
m_nTimeEnteredCurve = ReadSaveBuf<int32>(buf);
|
||||
m_nTimeToSpendOnCurrentCurve = ReadSaveBuf<int32>(buf);
|
||||
m_nCurrentPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
||||
m_nNextPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
||||
m_nPreviousPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
||||
m_nAntiReverseTimer = ReadSaveBuf<uint32>(buf);
|
||||
m_nTimeToStartMission = ReadSaveBuf<uint32>(buf);
|
||||
m_nPreviousDirection = ReadSaveBuf<int8>(buf);
|
||||
m_nCurrentDirection = ReadSaveBuf<int8>(buf);
|
||||
m_nNextDirection = ReadSaveBuf<int8>(buf);
|
||||
m_nCurrentLane = ReadSaveBuf<int8>(buf);
|
||||
m_nNextLane = ReadSaveBuf<int8>(buf);
|
||||
m_nDrivingStyle = ReadSaveBuf<uint8>(buf);
|
||||
m_nCarMission = ReadSaveBuf<uint8>(buf);
|
||||
m_nTempAction = ReadSaveBuf<uint8>(buf);
|
||||
m_nTimeTempAction = ReadSaveBuf<uint32>(buf);
|
||||
m_fMaxTrafficSpeed = ReadSaveBuf<float>(buf);
|
||||
m_nCruiseSpeed = ReadSaveBuf<uint8>(buf);
|
||||
m_nCruiseSpeedMultiplierType = ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf(&m_nCurrentRouteNode, buf);
|
||||
ReadSaveBuf(&m_nNextRouteNode, buf);
|
||||
ReadSaveBuf(&m_nPrevRouteNode, buf);
|
||||
ReadSaveBuf(&m_nTimeEnteredCurve, buf);
|
||||
ReadSaveBuf(&m_nTimeToSpendOnCurrentCurve, buf);
|
||||
ReadSaveBuf(&m_nCurrentPathNodeInfo, buf);
|
||||
ReadSaveBuf(&m_nNextPathNodeInfo, buf);
|
||||
ReadSaveBuf(&m_nPreviousPathNodeInfo, buf);
|
||||
ReadSaveBuf(&m_nAntiReverseTimer, buf);
|
||||
ReadSaveBuf(&m_nTimeToStartMission, buf);
|
||||
ReadSaveBuf(&m_nPreviousDirection, buf);
|
||||
ReadSaveBuf(&m_nCurrentDirection, buf);
|
||||
ReadSaveBuf(&m_nNextDirection, buf);
|
||||
ReadSaveBuf(&m_nCurrentLane, buf);
|
||||
ReadSaveBuf(&m_nNextLane, buf);
|
||||
ReadSaveBuf(&m_nDrivingStyle, buf);
|
||||
ReadSaveBuf(&m_nCarMission, buf);
|
||||
ReadSaveBuf(&m_nTempAction, buf);
|
||||
ReadSaveBuf(&m_nTimeTempAction, buf);
|
||||
ReadSaveBuf(&m_fMaxTrafficSpeed, buf);
|
||||
ReadSaveBuf(&m_nCruiseSpeed, buf);
|
||||
ReadSaveBuf(&m_nCruiseSpeedMultiplierType, buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
m_fCruiseSpeedMultiplier = ReadSaveBuf<float>(buf);
|
||||
uint8 flags = ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf(&m_fCruiseSpeedMultiplier, buf);
|
||||
uint8 flags;
|
||||
ReadSaveBuf(&flags, buf);
|
||||
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
||||
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
||||
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
||||
m_bStayInFastLane = !!(flags & BIT(3));
|
||||
m_bIgnorePathfinding = !!(flags & BIT(4));
|
||||
m_nSwitchDistance = ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf(&m_nSwitchDistance, buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
m_vecDestinationCoors.x = ReadSaveBuf<float>(buf);
|
||||
m_vecDestinationCoors.y = ReadSaveBuf<float>(buf);
|
||||
m_vecDestinationCoors.z = ReadSaveBuf<float>(buf);
|
||||
ReadSaveBuf(&m_vecDestinationCoors.x, buf);
|
||||
ReadSaveBuf(&m_vecDestinationCoors.y, buf);
|
||||
ReadSaveBuf(&m_vecDestinationCoors.z, buf);
|
||||
SkipSaveBuf(buf, 32);
|
||||
m_nPathFindNodesCount = ReadSaveBuf<int16>(buf);
|
||||
ReadSaveBuf(&m_nPathFindNodesCount, buf);
|
||||
SkipSaveBuf(buf, 6);
|
||||
}
|
||||
#endif
|
|
@ -6,6 +6,8 @@
|
|||
#include "PathFind.h"
|
||||
#include "Stats.h"
|
||||
|
||||
//--LCS: file done except TODO
|
||||
|
||||
CEntity *CBridge::pLiftRoad;
|
||||
CEntity *CBridge::pLiftPart;
|
||||
CEntity *CBridge::pWeight;
|
||||
|
@ -25,14 +27,14 @@ void CBridge::Init()
|
|||
{
|
||||
#ifdef GTA_BRIDGE
|
||||
FindBridgeEntities();
|
||||
State = STATE_BRIDGE_LOCKED;
|
||||
OldLift = -1.0f;
|
||||
if (pLiftPart && pWeight)
|
||||
{
|
||||
DefaultZLiftPart = pLiftPart->GetPosition().z;
|
||||
DefaultZLiftWeight = pWeight->GetPosition().z;
|
||||
|
||||
if (pLiftRoad)
|
||||
DefaultZLiftRoad = pLiftRoad->GetPosition().z;
|
||||
DefaultZLiftWeight = pWeight->GetPosition().z;
|
||||
|
||||
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
|
||||
}
|
||||
|
@ -49,36 +51,42 @@ void CBridge::Update()
|
|||
|
||||
float liftHeight;
|
||||
|
||||
// Set bridge height and state
|
||||
if (CStats::CommercialPassed)
|
||||
{
|
||||
if (State == STATE_BRIDGE_LOCKED) {
|
||||
liftHeight = 25.0f;
|
||||
TimeOfBridgeBecomingOperational = 0;
|
||||
}
|
||||
else if (State == STATE_BRIDGE_ALWAYS_UNLOCKED) {
|
||||
liftHeight = 0.0f;
|
||||
TimeOfBridgeBecomingOperational = CTimer::GetTimeInMilliseconds() - 20001;
|
||||
}
|
||||
else {
|
||||
if (TimeOfBridgeBecomingOperational == 0)
|
||||
TimeOfBridgeBecomingOperational = CTimer::GetTimeInMilliseconds();
|
||||
|
||||
// Time remaining for bridge to become operational
|
||||
// uint16, so after about a minute it overflows to 0 and the cycle repeats
|
||||
uint16 timeElapsed = CTimer::GetTimeInMilliseconds() - TimeOfBridgeBecomingOperational;
|
||||
// this time cycle duration is 0x20000, so ~2:11
|
||||
uint32 timeElapsed = (CTimer::GetTimeInMilliseconds() - TimeOfBridgeBecomingOperational) % 0x20000;
|
||||
|
||||
// Calculate lift part height and bridge state
|
||||
if (timeElapsed < 10000)
|
||||
if (timeElapsed < 20000)
|
||||
{
|
||||
State = STATE_LIFT_PART_MOVING_DOWN;
|
||||
liftHeight = 25.0f - timeElapsed / 10000.0f * 25.0f;
|
||||
liftHeight = 25.0f - timeElapsed / 20000.0f * 25.0f;
|
||||
}
|
||||
else if (timeElapsed < 40000)
|
||||
else if (timeElapsed < 80000)
|
||||
{
|
||||
liftHeight = 0.0f;
|
||||
State = STATE_LIFT_PART_IS_DOWN;
|
||||
}
|
||||
else if (timeElapsed < 50000)
|
||||
else if (timeElapsed < 90000)
|
||||
{
|
||||
liftHeight = 0.0f;
|
||||
State = STATE_LIFT_PART_ABOUT_TO_MOVE_UP;
|
||||
}
|
||||
else if (timeElapsed < 60000)
|
||||
else if (timeElapsed < 110000)
|
||||
{
|
||||
State = STATE_LIFT_PART_MOVING_UP;
|
||||
liftHeight = (timeElapsed - 50000) / 10000.0f * 25.0f;
|
||||
liftHeight = (timeElapsed - 90000) / 20000.0f * 25.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -86,12 +94,7 @@ void CBridge::Update()
|
|||
State = STATE_LIFT_PART_IS_UP;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
liftHeight = 25.0f;
|
||||
TimeOfBridgeBecomingOperational = 0;
|
||||
State = STATE_BRIDGE_LOCKED;
|
||||
}
|
||||
|
||||
|
||||
// Move bridge part
|
||||
if (liftHeight != OldLift)
|
||||
|
@ -112,6 +115,8 @@ void CBridge::Update()
|
|||
OldLift = liftHeight;
|
||||
}
|
||||
|
||||
// TODO(LCS): cWorldStream
|
||||
|
||||
if (State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP && OldState == STATE_LIFT_PART_IS_DOWN)
|
||||
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
|
||||
else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN)
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "World.h"
|
||||
#include "ZoneCull.h"
|
||||
|
||||
//--LCS: file done
|
||||
|
||||
#define DISTANCE_TO_SWITCH_DISTANCE_GOTO 20.0f
|
||||
|
||||
float CCarAI::FindSwitchDistanceClose(CVehicle* pVehicle)
|
||||
|
@ -597,8 +599,18 @@ void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle)
|
|||
{
|
||||
if (pVehicle->pDriver){
|
||||
pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
|
||||
if (pVehicle->GetModelIndex() == MI_AMBULAN)
|
||||
switch (pVehicle->GetModelIndex()) {
|
||||
case MI_FIRETRUCK:
|
||||
case MI_FBICAR:
|
||||
case MI_ENFORCER:
|
||||
case MI_BARRACKS:
|
||||
case MI_RHINO:
|
||||
case MI_POLICE:
|
||||
break;
|
||||
case MI_AMBULAN:
|
||||
pVehicle->pDriver->Say(SOUND_PED_LEAVE_VEHICLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
int timer = 100;
|
||||
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++){
|
||||
|
@ -614,8 +626,18 @@ void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle)
|
|||
{
|
||||
if (pVehicle->pDriver && !pVehicle->pDriver->IsPlayer()) {
|
||||
pVehicle->pDriver->SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
|
||||
if (pVehicle->GetModelIndex() != MI_FIRETRUCK && pVehicle->GetModelIndex() == MI_AMBULAN)
|
||||
switch (pVehicle->GetModelIndex()) {
|
||||
case MI_FIRETRUCK:
|
||||
case MI_FBIRANCH:
|
||||
case MI_ENFORCER:
|
||||
case MI_BARRACKS:
|
||||
case MI_RHINO:
|
||||
case MI_POLICE:
|
||||
break;
|
||||
case MI_AMBULAN:
|
||||
pVehicle->pDriver->Say(SOUND_PED_LEAVE_VEHICLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
int timer = 100;
|
||||
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "Garages.h"
|
||||
#include "General.h"
|
||||
#include "IniFile.h"
|
||||
#include "Lines.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "PathFind.h"
|
||||
#include "Ped.h"
|
||||
|
@ -38,7 +39,9 @@
|
|||
#include "Zones.h"
|
||||
#include "Pickups.h"
|
||||
|
||||
#define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f)
|
||||
//--LCS: file done except TODO
|
||||
|
||||
#define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f) // apparently POPULATION_CULL_RANGE? TODO: unite with CPopulation
|
||||
#define DISTANCE_TO_SCAN_FOR_DANGER (14.0f)
|
||||
#define DISTANCE_TO_SCAN_FOR_PED_DANGER (11.0f)
|
||||
#define SAFE_DISTANCE_TO_PED (3.0f)
|
||||
|
@ -78,13 +81,30 @@
|
|||
#define DISTANCE_BETWEEN_CAR_AND_DEAD_PED (6.0f)
|
||||
#define PROBABILITY_OF_PASSENGER_IN_VEHICLE (0.125f)
|
||||
|
||||
#ifdef GTA_PSP
|
||||
#define ONSCREEN_DESPAWN_RANGE (160.0f)
|
||||
#define MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN (100.0f)
|
||||
#define MAX_DISTANCE_FROM_CAMERA_TO_SPAWN_ONSCREEN (82.5f)
|
||||
#else
|
||||
#define ONSCREEN_DESPAWN_RANGE (190.0f)
|
||||
#define MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN (130.0f)
|
||||
#define MAX_DISTANCE_FROM_CAMERA_TO_SPAWN_ONSCREEN (105.0f)
|
||||
#endif
|
||||
|
||||
#define REQUEST_ONSCREEN_DISTANCE (140.0f)
|
||||
#define OFFSCREEN_DESPAWN_RANGE (60.0f)
|
||||
#define MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN (40.0f)
|
||||
#define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f)
|
||||
|
||||
#ifdef GTA_NETWORK
|
||||
const int32 CCarCtrl::MultiplayerCarBanks[TOTAL_MULTIPLAYER_CAR_BANKS][CARS_IN_MULTIPLAYER_BANK] =
|
||||
{
|
||||
MI_SANCHEZ, MI_KURUMA, MI_ESPRIT, MI_MULE, MI_DIABLOS, MI_KURUMA, MI_PEREN, MI_STINGER,
|
||||
MI_PCJ600, MI_BOBCAT, MI_BLISTA, MI_LANDSTAL,MI_SENTINEL,MI_MOONBEAM,MI_MANANA, MI_PEREN,
|
||||
MI_SANCHEZ2,MI_PCJ600, MI_STALLION,MI_MANANA, MI_LINERUN, MI_RCBANDIT,MI_MRWONGS, MI_STINGER
|
||||
};
|
||||
#endif
|
||||
|
||||
bool CCarCtrl::bMadDriversCheat;
|
||||
int CCarCtrl::NumLawEnforcerCars;
|
||||
int CCarCtrl::NumAmbulancesOnDuty;
|
||||
|
@ -96,7 +116,7 @@ int32 CCarCtrl::NumRandomCars;
|
|||
int32 CCarCtrl::NumParkedCars;
|
||||
int32 CCarCtrl::NumPermanentCars;
|
||||
int8 CCarCtrl::CountDownToCarsAtStart;
|
||||
int32 CCarCtrl::MaxNumberOfCarsInUse = 30;
|
||||
int32 CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS;
|
||||
uint32 CCarCtrl::LastTimeLawEnforcerCreated;
|
||||
uint32 CCarCtrl::LastTimeFireTruckCreated;
|
||||
uint32 CCarCtrl::LastTimeAmbulanceCreated;
|
||||
|
@ -110,9 +130,16 @@ int32 CCarCtrl::CarFreqArrays[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
|
|||
int32 CCarCtrl::LoadedCarsArray[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
|
||||
CVehicle* apCarsToKeep[MAX_CARS_TO_KEEP];
|
||||
uint32 aCarsToKeepTime[MAX_CARS_TO_KEEP];
|
||||
uint32 CCarCtrl::maxRandomMpCars = 20;
|
||||
bool CCarCtrl::scriptControlsMpCarLimit = false;
|
||||
|
||||
bool gbEmergencyVehiclesEnabled = true;
|
||||
|
||||
#ifdef GTA_NETWORK // TMP
|
||||
extern bool gIsMultiplayerGame;
|
||||
extern int8 nAmbientCarBank; // actually gMultiGame.nAmbientCarBank (TODO)
|
||||
#endif
|
||||
|
||||
void
|
||||
CCarCtrl::GenerateRandomCars()
|
||||
{
|
||||
|
@ -145,31 +172,55 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
CZoneInfo zone;
|
||||
CTheZones::GetZoneInfoForTimeOfDay(&vecTargetPos, &zone);
|
||||
pPlayer->m_nTrafficMultiplier = pPlayer->m_fRoadDensity * zone.carDensity;
|
||||
if (NumRandomCars >= pPlayer->m_nTrafficMultiplier * CarDensityMultiplier * CIniFile::CarNumberMultiplier)
|
||||
return;
|
||||
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars + NumLawEnforcerCars + NumRandomCars >= MaxNumberOfCarsInUse)
|
||||
return;
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame) {
|
||||
// TODO (count number of players within 250 meters from spawn position
|
||||
int numPlayersClose = 1;
|
||||
if (NumRandomCars >= pPlayer->m_nTrafficMultiplier * CarDensityMultiplier * CIniFile::CarNumberMultiplier * numPlayersClose)
|
||||
return;
|
||||
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars + NumLawEnforcerCars + NumRandomCars >= MaxNumberOfCarsInUse)
|
||||
return;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (NumRandomCars >= pPlayer->m_nTrafficMultiplier * CarDensityMultiplier * CIniFile::CarNumberMultiplier)
|
||||
return;
|
||||
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars + NumLawEnforcerCars + NumRandomCars >= MaxNumberOfCarsInUse)
|
||||
return;
|
||||
}
|
||||
CWanted* pWanted = pPlayer->m_pPed->m_pWanted;
|
||||
int carClass;
|
||||
int carModel;
|
||||
if (pWanted->GetWantedLevel() > 1 && NumLawEnforcerCars < pWanted->m_MaximumLawEnforcerVehicles &&
|
||||
pWanted->m_CurrentCops < pWanted->m_MaxCops && !CGame::IsInInterior() && (
|
||||
pWanted->GetWantedLevel() > 3 ||
|
||||
pWanted->GetWantedLevel() > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 ||
|
||||
pWanted->GetWantedLevel() > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) {
|
||||
/* Last pWanted->GetWantedLevel() > 1 is unnecessary but I added it for better readability. */
|
||||
/* Wouldn't be surprised it was there originally but was optimized out. */
|
||||
carClass = COPS;
|
||||
carModel = ChoosePoliceCarModel();
|
||||
}else{
|
||||
for (int i = 0; i < 5; i++) {
|
||||
carModel = ChooseModel(&zone, &carClass);
|
||||
if (carModel == -1)
|
||||
return;
|
||||
if (!(carClass == COPS && pWanted->GetWantedLevel() >= 1))
|
||||
/* All cop spawns with wanted level are handled by condition above. */
|
||||
/* In particular it means that cop cars never spawn if player has wanted level of 1. */
|
||||
break;
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame) {
|
||||
carModel = ChooseModel(&zone, &carClass);
|
||||
if (carModel == -1)
|
||||
return;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (pWanted->GetWantedLevel() > 1 && NumLawEnforcerCars < pWanted->m_MaximumLawEnforcerVehicles &&
|
||||
pWanted->m_CurrentCops < pWanted->m_MaxCops && !CGame::IsInInterior() && (
|
||||
pWanted->GetWantedLevel() > 3 ||
|
||||
pWanted->GetWantedLevel() > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 ||
|
||||
pWanted->GetWantedLevel() > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) {
|
||||
/* Last pWanted->GetWantedLevel() > 1 is unnecessary but I added it for better readability. */
|
||||
/* Wouldn't be surprised it was there originally but was optimized out. */
|
||||
carClass = COPS;
|
||||
carModel = ChoosePoliceCarModel();
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
carModel = ChooseModel(&zone, &carClass);
|
||||
if (carModel == -1)
|
||||
return;
|
||||
if (!(carClass == COPS && pWanted->GetWantedLevel() >= 1))
|
||||
/* All cop spawns with wanted level are handled by condition above. */
|
||||
/* In particular it means that cop cars never spawn if player has wanted level of 1. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
float frontX, frontY;
|
||||
|
@ -370,10 +421,16 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
CVehicle* pVehicle;
|
||||
if (CModelInfo::IsBoatModel(carModel))
|
||||
pVehicle = new CBoat(carModel, RANDOM_VEHICLE);
|
||||
else if (CModelInfo::IsBikeModel(carModel))
|
||||
pVehicle = new CBike(carModel, RANDOM_VEHICLE);
|
||||
else
|
||||
pVehicle = new CAutomobile(carModel, RANDOM_VEHICLE);
|
||||
{
|
||||
if (CModelInfo::IsBikeModel(carModel))
|
||||
pVehicle = new CBike(carModel, RANDOM_VEHICLE);
|
||||
else
|
||||
pVehicle = new CAutomobile(carModel, RANDOM_VEHICLE);
|
||||
#ifdef GTA_NETWORK
|
||||
// TODO
|
||||
#endif
|
||||
}
|
||||
pVehicle->AutoPilot.m_nPrevRouteNode = 0;
|
||||
pVehicle->AutoPilot.m_nCurrentRouteNode = curNodeId;
|
||||
pVehicle->AutoPilot.m_nNextRouteNode = nextNodeId;
|
||||
|
@ -391,7 +448,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||
}
|
||||
if (carModel == MI_FBIRANCH){
|
||||
if (carModel == MI_FBICAR){
|
||||
pVehicle->m_currentColour1 = 0;
|
||||
pVehicle->m_currentColour2 = 0;
|
||||
}
|
||||
|
@ -424,7 +481,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
pVehicle->m_bSirenOrAlarm = true;
|
||||
pVehicle->AutoPilot.m_nNextPathNodeInfo = connectionId;
|
||||
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane = CGeneral::GetRandomNumber() % lanesOnCurrentRoad;
|
||||
CBox* boundingBox = &CModelInfo::GetModelInfo(pVehicle->GetModelIndex())->GetColModel()->boundingBox;
|
||||
CBox* boundingBox = &CModelInfo::GetColModel(pVehicle->GetModelIndex())->boundingBox;
|
||||
float carLength = 1.0f + (boundingBox->max.y - boundingBox->min.y) / 2;
|
||||
float distanceBetweenNodes = (pCurNode->GetPosition() - pNextNode->GetPosition()).Magnitude2D();
|
||||
/* If car is so long that it doesn't fit between two car nodes, place it directly in the middle. */
|
||||
|
@ -613,6 +670,9 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
break;
|
||||
}
|
||||
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
|
||||
#ifdef GTA_MOBILE
|
||||
//CVisibilityPlugins::SetObjectDistanceAlpha(pVehicle->GetClump(), 0) // TODO(LCS)
|
||||
#endif
|
||||
if (!pVehicle->GetIsOnScreen()){
|
||||
if ((vecTargetPos - pVehicle->GetPosition()).Magnitude2D() > OFFSCREEN_DESPAWN_RANGE * (pVehicle->bExtendedRange ? EXTENDED_RANGE_DESPAWN_MULTIPLIER : 1.0f)) {
|
||||
/* Too far away cars that are not visible aren't needed. */
|
||||
|
@ -625,7 +685,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
delete pVehicle;
|
||||
return;
|
||||
}
|
||||
if ((TheCamera.GetPosition() - pVehicle->GetPosition()).Magnitude2D() < 105.0f * requestMultiplier * TheCamera.GenerationDistMultiplier || bTopDownCamera) {
|
||||
if ((TheCamera.GetPosition() - pVehicle->GetPosition()).Magnitude2D() < MAX_DISTANCE_FROM_CAMERA_TO_SPAWN_ONSCREEN * requestMultiplier * TheCamera.GenerationDistMultiplier || bTopDownCamera) {
|
||||
delete pVehicle;
|
||||
return;
|
||||
}
|
||||
|
@ -659,16 +719,21 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
CCarAI::AddPoliceCarOccupants(pVehicle);
|
||||
else {
|
||||
pVehicle->SetUpDriver();
|
||||
int32 passengers = 0;
|
||||
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++)
|
||||
passengers += (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < PROBABILITY_OF_PASSENGER_IN_VEHICLE) ? 1 : 0;
|
||||
if (CModelInfo::IsCarModel(carModel) && (CModelInfo::GetModelInfo(carModel)->GetAnimFileIndex() == CAnimManager::GetAnimationBlockIndex("van") && passengers >= 1))
|
||||
passengers = 1;
|
||||
for (int i = 0; i < passengers; i++) {
|
||||
CPed* pPassenger = pVehicle->SetupPassenger(i);
|
||||
if (pPassenger) {
|
||||
++CPopulation::ms_nTotalCarPassengerPeds;
|
||||
pPassenger->bCarPassenger = true;
|
||||
#ifdef GTA_NETWORK
|
||||
if (!gIsMultiplayerGame)
|
||||
#endif
|
||||
{
|
||||
int32 passengers = 0;
|
||||
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++)
|
||||
passengers += (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < PROBABILITY_OF_PASSENGER_IN_VEHICLE) ? 1 : 0;
|
||||
if (CModelInfo::IsCarModel(carModel) && (CModelInfo::GetModelInfo(carModel)->GetAnimFileIndex() == CAnimManager::GetAnimationBlockIndex("van") && passengers >= 1))
|
||||
passengers = 1;
|
||||
for (int i = 0; i < passengers; i++) {
|
||||
CPed* pPassenger = pVehicle->SetupPassenger(i);
|
||||
if (pPassenger) {
|
||||
++CPopulation::ms_nTotalCarPassengerPeds;
|
||||
pPassenger->bCarPassenger = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -738,6 +803,9 @@ CCarCtrl::GenerateOneRandomCar()
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef GTA_NETWORK
|
||||
// TODO
|
||||
#endif
|
||||
}
|
||||
|
||||
int32
|
||||
|
@ -773,6 +841,22 @@ int32
|
|||
CCarCtrl::ChooseModel(CZoneInfo* pZone, int* pClass) {
|
||||
int32 model = -1;
|
||||
int32 i;
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame) {
|
||||
for (i = 10; i > 0 && (model == -1 || !CStreaming::HasModelLoaded(model)); i--) {
|
||||
*pClass = ChooseCarRating(pZone);
|
||||
model = ChooseCarModel(*pClass);
|
||||
bool found = false;
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (model == MultiplayerCarBanks[nAmbientCarBank][j])
|
||||
found = true;
|
||||
}
|
||||
if (!found)
|
||||
model = -1;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
#endif
|
||||
for (i = 10; i > 0 && (model == -1 || !CStreaming::HasModelLoaded(model)); i--) {
|
||||
int rnd = CGeneral::GetRandomNumberInRange(0, 1000);
|
||||
|
||||
|
@ -799,6 +883,9 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, int* pClass) {
|
|||
}
|
||||
if (i == 0)
|
||||
return -1;
|
||||
CColModel* pColModel = CModelInfo::GetColModel(model);
|
||||
if (!pColModel || pColModel->boundingSphere.radius > 20.0f)
|
||||
return -1;
|
||||
return model;
|
||||
}
|
||||
|
||||
|
@ -983,9 +1070,12 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
|||
}
|
||||
float distanceToPlayer = (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D();
|
||||
float despawnMultiplier = 1.0f;
|
||||
#if !defined EXTENDED_OFFSCREEN_DESPAWN_RANGE || defined GTA_PSP
|
||||
if (FindPlayerVehicle() && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON && !FrontEndMenuManager.m_PrefsUseWideScreen)
|
||||
despawnMultiplier = 0.75f;
|
||||
#endif
|
||||
float threshold = OFFSCREEN_DESPAWN_RANGE * despawnMultiplier;
|
||||
#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
|
||||
if (pVehicle->GetIsOnScreen() ||
|
||||
TheCamera.Cams[TheCamera.ActiveCam].LookingLeft ||
|
||||
TheCamera.Cams[TheCamera.ActiveCam].LookingRight ||
|
||||
|
@ -997,17 +1087,29 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
|||
pVehicle->bIsLawEnforcer ||
|
||||
pVehicle->bIsCarParkVehicle ||
|
||||
CTimer::GetTimeInMilliseconds() < pVehicle->m_nSetPieceExtendedRangeTime
|
||||
){
|
||||
)
|
||||
#endif
|
||||
{
|
||||
threshold = ONSCREEN_DESPAWN_RANGE * despawnMultiplier * TheCamera.GenerationDistMultiplier;
|
||||
}
|
||||
#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
|
||||
if (TheCamera.GetForward().z < -0.9f)
|
||||
threshold = 70.0f;
|
||||
#endif
|
||||
if (pVehicle->bExtendedRange)
|
||||
threshold *= EXTENDED_RANGE_DESPAWN_MULTIPLIER;
|
||||
if (distanceToPlayer > threshold && !CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
|
||||
if (pVehicle->GetIsOnScreen()){
|
||||
pVehicle->bFadeOut = true;
|
||||
}else{
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame) {
|
||||
// TODO
|
||||
if (false)
|
||||
MultiPlayerRemoveVehicleAndDriver(pVehicle);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
}
|
||||
|
@ -1025,18 +1127,44 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
|||
!CTrafficLights::ShouldCarStopForLight(pVehicle, true) &&
|
||||
!CTrafficLights::ShouldCarStopForBridge(pVehicle) &&
|
||||
!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
#ifdef GTA_NETWORK
|
||||
if (!gIsMultiplayerGame)
|
||||
#endif
|
||||
{
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
return;
|
||||
}
|
||||
#ifdef GTA_NETWORK
|
||||
if (false) // TODO(LCS): figure out condition for mp
|
||||
MultiPlayerRemoveVehicleAndDriver(pVehicle);
|
||||
#endif
|
||||
}
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame) {
|
||||
if (pVehicle->GetStatus() == STATUS_WRECKED && CTimer::GetLogicalFrameCounter() == pVehicle->m_randomSeed) {
|
||||
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(6.5f)) {
|
||||
if (pVehicle->GetMoveSpeed().MagnitudeSqr() <= SQR(0.01f)) {
|
||||
printf("viciously removing dead vehicle");
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pVehicle->GetStatus() != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0)
|
||||
return;
|
||||
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
|
||||
!pVehicle->GetIsOnScreen()){
|
||||
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(7.5f)){
|
||||
if (!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
#endif
|
||||
if (pVehicle->GetStatus() == STATUS_WRECKED) {
|
||||
if (pVehicle->m_nTimeOfDeath != 0) {
|
||||
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
|
||||
CTimer::GetTimeInMilliseconds() > pVehicle->m_nSetPieceExtendedRangeTime &&
|
||||
!(pVehicle->GetIsOnScreen())) {
|
||||
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(6.5f)) {
|
||||
if (!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())) {
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1074,8 +1202,8 @@ CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle)
|
|||
pVehicle->AutoPilot.ModifySpeed(0.0f);
|
||||
if (CTimer::GetTimeInMilliseconds() > pVehicle->AutoPilot.m_nTempAction){
|
||||
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
||||
pVehicle->AutoPilot.m_nAntiReverseTimer = 0;
|
||||
pVehicle->AutoPilot.m_nTimeToStartMission = 0;
|
||||
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||
pVehicle->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1361,6 +1489,10 @@ void CCarCtrl::SlowCarDownForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle,
|
|||
pVehicle->AutoPilot.m_bSlowedDownBecauseOfCars = true;
|
||||
*pSpeed = Min(*pSpeed, minProximity * curSpeed);
|
||||
}
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame)
|
||||
return;
|
||||
#endif
|
||||
if (minProximity >= 0.0f && minProximity < 0.5f && pOtherEntity->IsVehicle() &&
|
||||
CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeToStartMission > 15000 &&
|
||||
CTimer::GetTimeInMilliseconds() - pOtherVehicle->AutoPilot.m_nTimeToStartMission > 15000){
|
||||
|
@ -1576,7 +1708,7 @@ void CCarCtrl::WeaveThroughCarsSectorList(CPtrList& lst, CVehicle* pVehicle, CPh
|
|||
continue;
|
||||
if (Abs(pTestVehicle->GetPosition().z - pVehicle->GetPosition().z) >= VEHICLE_HEIGHT_DIFF_TO_CONSIDER_WEAVING)
|
||||
continue;
|
||||
if (pTestVehicle != pVehicle)
|
||||
if (pTestVehicle != pVehicle && (!pVehicle->bPartOfConvoy || !pTestVehicle->bPartOfConvoy))
|
||||
WeaveForOtherCar(pTestVehicle, pVehicle, pAngleToWeaveLeft, pAngleToWeaveRight);
|
||||
}
|
||||
}
|
||||
|
@ -1584,14 +1716,12 @@ void CCarCtrl::WeaveThroughCarsSectorList(CPtrList& lst, CVehicle* pVehicle, CPh
|
|||
void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float* pAngleToWeaveLeft, float* pAngleToWeaveRight)
|
||||
{
|
||||
CVehicle* pOtherCar = (CVehicle*)pOtherEntity;
|
||||
if (pVehicle->bPartOfConvoy && pOtherCar->bPartOfConvoy)
|
||||
return;
|
||||
if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE && pOtherEntity == FindPlayerVehicle())
|
||||
return;
|
||||
if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMCAR_CLOSE && pOtherEntity == pVehicle->AutoPilot.m_pTargetCar)
|
||||
return;
|
||||
CVector2D vecDiff = pOtherCar->GetPosition() - pVehicle->GetPosition();
|
||||
float angleBetweenVehicles = GetATanOfXY(vecDiff.x, vecDiff.y);
|
||||
float angleBetweenVehicles = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y);
|
||||
float distance = vecDiff.Magnitude();
|
||||
if (distance < 1.0f)
|
||||
return;
|
||||
|
@ -1601,10 +1731,10 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float
|
|||
return;
|
||||
CVector2D forward = pVehicle->GetForward();
|
||||
forward.Normalise();
|
||||
float forwardAngle = GetATanOfXY(forward.x, forward.y);
|
||||
float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y);
|
||||
float angleDiff = angleBetweenVehicles - forwardAngle;
|
||||
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff));
|
||||
float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * cos(angleDiff));
|
||||
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * Sin(angleDiff));
|
||||
float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * Cos(angleDiff));
|
||||
float lengthToEvade = (2 * (lenProjection + widthProjection) + WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x) / distance;
|
||||
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveLeft);
|
||||
diffToLeftAngle = ABS(diffToLeftAngle);
|
||||
|
@ -1647,7 +1777,7 @@ void CCarCtrl::WeaveForPed(CEntity* pOtherEntity, CVehicle* pVehicle, float* pAn
|
|||
return;
|
||||
CPed* pPed = (CPed*)pOtherEntity;
|
||||
CVector2D vecDiff = pPed->GetPosition() - pVehicle->GetPosition();
|
||||
float angleBetweenVehicleAndPed = GetATanOfXY(vecDiff.x, vecDiff.y);
|
||||
float angleBetweenVehicleAndPed = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y);
|
||||
float distance = vecDiff.Magnitude();
|
||||
float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + PED_WIDTH_TO_WEAVE) / distance;
|
||||
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveLeft);
|
||||
|
@ -1715,7 +1845,7 @@ void CCarCtrl::WeaveForObject(CEntity* pOtherEntity, CVehicle* pVehicle, float*
|
|||
rightCoef * pObject->GetRight() +
|
||||
forwardCoef * pObject->GetForward() -
|
||||
pVehicle->GetPosition();
|
||||
float angleBetweenVehicleAndObject = GetATanOfXY(vecDiff.x, vecDiff.y);
|
||||
float angleBetweenVehicleAndObject = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y);
|
||||
float distance = vecDiff.Magnitude();
|
||||
float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + OBJECT_WIDTH_TO_WEAVE) / distance;
|
||||
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveLeft);
|
||||
|
@ -1990,13 +2120,13 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
|||
#else
|
||||
CVector(targetX, targetY, 0.0f),
|
||||
#endif
|
||||
pTargetNode, &numNodes, 2, pVehicle, &distanceToTargetNode, 999999.9f, -1);
|
||||
pTargetNode, &numNodes, 2, pVehicle, &distanceToTargetNode, 100.0f, -1);
|
||||
|
||||
int newNextNode;
|
||||
int nextLink;
|
||||
if (numNodes != 1 && numNodes != 2 || pTargetNode[0] == pCurNode){
|
||||
if (numNodes != 2 || pTargetNode[1] == pCurNode) {
|
||||
float currentAngle = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
||||
float currentAngle = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
||||
nextLink = 0;
|
||||
float lowestAngleChange = 10.0f;
|
||||
int numLinks = pCurNode->numLinks;
|
||||
|
@ -2006,7 +2136,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
|||
if (conNode == prevNode && i > 1)
|
||||
continue;
|
||||
CPathNode* pTestNode = &ThePaths.m_pathNodes[conNode];
|
||||
float angle = GetATanOfXY(pTestNode->GetX() - pCurNode->GetX(), pTestNode->GetY() - pCurNode->GetY());
|
||||
float angle = CGeneral::GetATanOfXY(pTestNode->GetX() - pCurNode->GetX(), pTestNode->GetY() - pCurNode->GetY());
|
||||
angle = LimitRadianAngle(angle - currentAngle);
|
||||
angle = ABS(angle);
|
||||
if (angle < lowestAngleChange) {
|
||||
|
@ -2105,14 +2235,14 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
|||
bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
|
||||
{
|
||||
if (pVehicle->m_nRouteSeed)
|
||||
CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed);
|
||||
CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++);
|
||||
int curNode = pVehicle->AutoPilot.m_nNextRouteNode;
|
||||
CPathNode* pCurNode = &ThePaths.m_pathNodes[curNode];
|
||||
if (pVehicle->AutoPilot.m_nPathFindNodesCount == 0){
|
||||
ThePaths.DoPathSearch(0, pVehicle->GetPosition(), curNode,
|
||||
pVehicle->AutoPilot.m_vecDestinationCoors, pVehicle->AutoPilot.m_aPathFindNodesInfo,
|
||||
&pVehicle->AutoPilot.m_nPathFindNodesCount, NUM_PATH_NODES_IN_AUTOPILOT,
|
||||
pVehicle, nil, 999999.9f, -1);
|
||||
pVehicle, nil, 100.0f, -1);
|
||||
if (pVehicle->AutoPilot.m_nPathFindNodesCount < 2)
|
||||
return true;
|
||||
pVehicle->AutoPilot.RemoveOnePathNode();
|
||||
|
@ -2605,10 +2735,10 @@ void CCarCtrl::SteerAIBoatWithPhysicsHeadingForTarget(CVehicle* pVehicle, float
|
|||
{
|
||||
CVector2D forward = pVehicle->GetForward();
|
||||
forward.Normalise();
|
||||
float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
||||
float angleForward = GetATanOfXY(forward.x, forward.y);
|
||||
float angleToTarget = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
||||
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
||||
steerAngle = clamp(steerAngle, -DEFAULT_MAX_STEER_ANGLE, DEFAULT_MAX_STEER_ANGLE);
|
||||
steerAngle = Clamp(steerAngle, -DEFAULT_MAX_STEER_ANGLE, DEFAULT_MAX_STEER_ANGLE);
|
||||
#ifdef FIX_BUGS
|
||||
float speedTarget = pVehicle->AutoPilot.GetCruiseSpeed();
|
||||
#else
|
||||
|
@ -2637,8 +2767,8 @@ void CCarCtrl::SteerAIBoatWithPhysicsAttackingPlayer(CVehicle* pVehicle, float*
|
|||
CVector2D forward = pVehicle->GetForward();
|
||||
forward.Normalise();
|
||||
CVector2D vecToProjection = FindPlayerCoors() + FindPlayerSpeed() * projection * GAME_SPEED_TO_CARAI_SPEED;
|
||||
float angleToTarget = GetATanOfXY(vecToProjection.x - pVehicle->GetPosition().x, vecToProjection.y - pVehicle->GetPosition().y);
|
||||
float angleForward = GetATanOfXY(forward.x, forward.y);
|
||||
float angleToTarget = CGeneral::GetATanOfXY(vecToProjection.x - pVehicle->GetPosition().x, vecToProjection.y - pVehicle->GetPosition().y);
|
||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
||||
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
||||
#ifdef FIX_BUGS
|
||||
float speedTarget = pVehicle->AutoPilot.GetCruiseSpeed();
|
||||
|
@ -2726,7 +2856,7 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
|
|||
if (distanceToTarget < 8.0f && pHeli->m_fHeliOrientation < 0.0f)
|
||||
ZTurnSpeedTarget = 0.0f;
|
||||
else {
|
||||
float fAngleTarget = GetATanOfXY(vecToTarget.x, vecToTarget.y) + PI;
|
||||
float fAngleTarget = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y) + PI;
|
||||
if (pHeli->m_fHeliOrientation >= 0.0f)
|
||||
fAngleTarget = pHeli->m_fHeliOrientation;
|
||||
fAngleTarget -= pHeli->m_fOrientation;
|
||||
|
@ -2768,8 +2898,8 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
|
|||
{
|
||||
CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition();
|
||||
float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude();
|
||||
fForwardZ = clamp(fForwardZ, -0.3f, 0.3f);
|
||||
float angle = GetATanOfXY(vecToTarget.x, vecToTarget.y);
|
||||
fForwardZ = Clamp(fForwardZ, -0.3f, 0.3f);
|
||||
float angle = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y);
|
||||
while (angle > TWOPI)
|
||||
angle -= TWOPI;
|
||||
float difference = LimitRadianAngle(angle - pPlane->m_fOrientation);
|
||||
|
@ -2866,8 +2996,8 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
|
|||
projectedPosition.y = positionOnCurrentLinkIncludingLane.y;
|
||||
}
|
||||
CVector2D distanceToProjectedPosition = projectedPosition - pVehicle->GetPosition();
|
||||
float angleCurrentLink = GetATanOfXY(distanceToProjectedPosition.x, distanceToProjectedPosition.y);
|
||||
float angleForward = GetATanOfXY(forward.x, forward.y);
|
||||
float angleCurrentLink = CGeneral::GetATanOfXY(distanceToProjectedPosition.x, distanceToProjectedPosition.y);
|
||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
||||
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
|
||||
angleCurrentLink = FindAngleToWeaveThroughTraffic(pVehicle, nil, angleCurrentLink, angleForward);
|
||||
float steerAngle = LimitRadianAngle(angleCurrentLink - angleForward);
|
||||
|
@ -2912,11 +3042,11 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
|
|||
pCurrentLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
|
||||
trajectory -= pVehicle->GetPosition();
|
||||
float speedAngleMultiplier = FindSpeedMultiplier(
|
||||
GetATanOfXY(trajectory.x, trajectory.y) - angleForward,
|
||||
CGeneral::GetATanOfXY(trajectory.x, trajectory.y) - angleForward,
|
||||
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
||||
float tmpWideMultiplier = FindSpeedMultiplier(
|
||||
GetATanOfXY(currentPathLinkForward.x, currentPathLinkForward.y) -
|
||||
GetATanOfXY(nextPathLinkForwardX, nextPathLinkForwardY),
|
||||
CGeneral::GetATanOfXY(currentPathLinkForward.x, currentPathLinkForward.y) -
|
||||
CGeneral::GetATanOfXY(nextPathLinkForwardX, nextPathLinkForwardY),
|
||||
MIN_ANGLE_FOR_SPEED_LIMITING_BETWEEN_NODES, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
||||
float speedNodesMultiplier;
|
||||
if (scalarDistanceToNextNode > DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN || pVehicle->AutoPilot.m_nCruiseSpeed < 12)
|
||||
|
@ -2950,8 +3080,8 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
|
|||
*pHandbrake = false;
|
||||
CVector2D forward = pVehicle->GetForward();
|
||||
forward.Normalise();
|
||||
float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
||||
float angleForward = GetATanOfXY(forward.x, forward.y);
|
||||
float angleToTarget = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
||||
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
|
||||
angleToTarget = FindAngleToWeaveThroughTraffic(pVehicle, pTarget, angleToTarget, angleForward);
|
||||
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
||||
|
@ -3136,7 +3266,7 @@ bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle* pVehicle, CVector vecTar
|
|||
{
|
||||
pVehicle->AutoPilot.m_vecDestinationCoors = vecTarget;
|
||||
ThePaths.DoPathSearch(0, pVehicle->GetPosition(), -1, vecTarget, pVehicle->AutoPilot.m_aPathFindNodesInfo,
|
||||
&pVehicle->AutoPilot.m_nPathFindNodesCount, NUM_PATH_NODES_IN_AUTOPILOT, pVehicle, nil, 999999.9f, -1);
|
||||
&pVehicle->AutoPilot.m_nPathFindNodesCount, NUM_PATH_NODES_IN_AUTOPILOT, pVehicle, nil, 100.0f, -1);
|
||||
ThePaths.RemoveBadStartNode(pVehicle->GetPosition(),
|
||||
pVehicle->AutoPilot.m_aPathFindNodesInfo, &pVehicle->AutoPilot.m_nPathFindNodesCount);
|
||||
if (pVehicle->AutoPilot.m_nPathFindNodesCount < 2){
|
||||
|
@ -3195,12 +3325,18 @@ void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
|
|||
|
||||
void CCarCtrl::GenerateEmergencyServicesCar(void)
|
||||
{
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame)
|
||||
return;
|
||||
#endif
|
||||
if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 3)
|
||||
return;
|
||||
if (CGame::IsInInterior())
|
||||
return;
|
||||
if (TheCamera.m_WideScreenOn) // TODO(LCS): verify
|
||||
#ifndef GTA_PSP
|
||||
if (TheCamera.m_WideScreenOn)
|
||||
return;
|
||||
#endif
|
||||
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars +
|
||||
NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse)
|
||||
return;
|
||||
|
@ -3254,6 +3390,10 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
|
|||
|
||||
bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
|
||||
{
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame)
|
||||
return;
|
||||
#endif
|
||||
CVector pPlayerPos = FindPlayerCentreOfWorld(CWorld::PlayerInFocus);
|
||||
bool created = false;
|
||||
int attempts = 0;
|
||||
|
@ -3273,7 +3413,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
|
|||
attempts += 1;
|
||||
}
|
||||
if (attempts >= 5)
|
||||
return nil;
|
||||
return false;
|
||||
CAutomobile* pVehicle = new CAutomobile(mi, RANDOM_VEHICLE);
|
||||
pVehicle->AutoPilot.m_vecDestinationCoors = vecPos;
|
||||
pVehicle->SetPosition(spawnPos);
|
||||
|
@ -3319,6 +3459,11 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
|
|||
pVehicle->m_bSirenOrAlarm = true;
|
||||
CWorld::Add(pVehicle);
|
||||
printf("CREATED EMERGENCY VEHICLE\n");
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame) {
|
||||
// TODO (register car for network)
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3396,6 +3541,11 @@ CCarCtrl::BoatWithTallMast(int32 mi)
|
|||
|
||||
bool CCarCtrl::OkToCreateVehicleAtThisPosition(const CVector& pos)
|
||||
{
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame) {
|
||||
// TODO
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3409,7 +3559,63 @@ float CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(int8 type)
|
|||
return 1.0f;
|
||||
}
|
||||
|
||||
void CCarCtrl::RenderDebugInfo(CVehicle*)
|
||||
void CCarCtrl::RenderDebugInfo(CVehicle* pVehicle)
|
||||
{
|
||||
//TODO(LCS)
|
||||
if (!pVehicle->AutoPilot.m_nNextRouteNode || !pVehicle->AutoPilot.m_nCurrentRouteNode)
|
||||
return;
|
||||
|
||||
CPathNode* pCurNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nCurrentRouteNode];
|
||||
CPathNode* pNextNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode];
|
||||
CCarPathLink* pCurLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
|
||||
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
|
||||
|
||||
CVector vCurNodePos(pCurNode->GetPosition());
|
||||
vCurNodePos.z += 1.0f;
|
||||
CVector vNextNodePos(pNextNode->GetPosition());
|
||||
vNextNodePos.z += 1.0f;
|
||||
CVector vCurLinkDir(pCurLink->GetDirX() * pVehicle->AutoPilot.m_nCurrentDirection, pCurLink->GetDirY() * pVehicle->AutoPilot.m_nCurrentDirection, 0.0f);
|
||||
CVector vNextLinkDir(pNextLink->GetDirX() * pVehicle->AutoPilot.m_nNextDirection, pNextLink->GetDirY() * pVehicle->AutoPilot.m_nNextDirection, 0.0f);
|
||||
vCurLinkDir.Normalise();
|
||||
vNextLinkDir.Normalise();
|
||||
|
||||
if (vCurLinkDir.x * vNextLinkDir.x + vCurLinkDir.y * vNextLinkDir.y < 0.5f) {
|
||||
CVector vCurPos(vCurNodePos);
|
||||
CVector vCurDir(0.0f, 0.0f, 1.0f);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
CVector vPrevPos = vCurPos;
|
||||
CCurves::CalcCurvePoint(&vCurNodePos, &vNextNodePos, &vCurLinkDir, &vNextLinkDir, i * 0.1f, pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve, &vCurPos, &vCurDir);
|
||||
// Render3DLine(&vCurPos, &vNextPos, CVector(255.0f, 255.0f, 0.0f, 255.0f)); // <- originally this is called, let's reuse stuff we have
|
||||
// TODO: not drawing :(
|
||||
CLines::RenderLineWithClipping(vPrevPos.x, vPrevPos.y, vCurNodePos.z, vCurPos.x, vCurPos.y, vNextNodePos.z, 0xFFFF00FF, 0xFFFF00FF); // using NodePos for Z coord cause Curves set it to 0
|
||||
}
|
||||
DefinedState();
|
||||
}
|
||||
}
|
||||
|
||||
void CCarCtrl::SetMultiplayerAmbientCarLimit(uint32 limit)
|
||||
{
|
||||
maxRandomMpCars = limit;
|
||||
}
|
||||
|
||||
void CCarCtrl::ToggleScriptControlsMpCarLimit(bool toggle)
|
||||
{
|
||||
scriptControlsMpCarLimit = toggle;
|
||||
}
|
||||
|
||||
void CCarCtrl::MultiPlayerRemoveVehicleAndDriver(CVehicle* pVehicle)
|
||||
{
|
||||
CPed* pDriver = pVehicle->pDriver;
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
if (pDriver) {
|
||||
CWorld::Remove(pDriver);
|
||||
delete pDriver;
|
||||
}
|
||||
}
|
||||
|
||||
void CCarCtrl::Write(base::cRelocatableChunkWriter& writer)
|
||||
{
|
||||
writer.AllocateRaw(CarArrays, sizeof(CarArrays), 4);
|
||||
writer.AllocateRaw(TotalNumOfCarsOfRating, sizeof(TotalNumOfCarsOfRating), 4, false, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,13 @@ enum{
|
|||
MAX_CAR_MODELS_IN_ARRAY = 25,
|
||||
};
|
||||
|
||||
#ifdef GTA_NETWORK
|
||||
enum {
|
||||
TOTAL_MULTIPLAYER_CAR_BANKS = 3,
|
||||
CARS_IN_MULTIPLAYER_BANK = 8
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
#define FIX_PATHFIND_BUG
|
||||
#endif
|
||||
|
@ -133,7 +140,10 @@ public:
|
|||
|
||||
static bool OkToCreateVehicleAtThisPosition(const CVector&);
|
||||
static void RenderDebugInfo(CVehicle*);
|
||||
static float GetATanOfXY(float x, float y) { float t = CGeneral::GetATanOfXY(x, y); if (t < 0.0f) t += TWOPI; return t; }
|
||||
static void SetMultiplayerAmbientCarLimit(uint32);
|
||||
static void ToggleScriptControlsMpCarLimit(bool);
|
||||
static void MultiPlayerRemoveVehicleAndDriver(CVehicle*);
|
||||
static void Write(base::cRelocatableChunkWriter&);
|
||||
|
||||
static float GetPositionAlongCurrentCurve(CVehicle* pVehicle)
|
||||
{
|
||||
|
@ -170,6 +180,14 @@ public:
|
|||
static int32 NumOfLoadedCarsOfRating[TOTAL_CUSTOM_CLASSES];
|
||||
static int32 CarFreqArrays[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
|
||||
static int32 LoadedCarsArray[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
|
||||
|
||||
#ifdef GTA_NETWORK
|
||||
static const int32 MultiplayerCarBanks[TOTAL_MULTIPLAYER_CAR_BANKS][CARS_IN_MULTIPLAYER_BANK];
|
||||
#endif
|
||||
|
||||
static uint32 maxRandomMpCars;
|
||||
static bool scriptControlsMpCarLimit;
|
||||
|
||||
};
|
||||
|
||||
extern CVehicle* apCarsToKeep[MAX_CARS_TO_KEEP];
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "Curves.h"
|
||||
|
||||
//--LCS: file done except TODO
|
||||
|
||||
float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y)
|
||||
{
|
||||
CVector2D dir1(dir1X, dir1Y);
|
||||
|
@ -19,17 +21,27 @@ void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVe
|
|||
float actualFactor = CalcSpeedScaleFactor(pPos1, pPos2, pDir1->x, pDir1->y, pDir2->x, pDir2->y);
|
||||
CVector2D dir1 = *pDir1 * actualFactor;
|
||||
CVector2D dir2 = *pDir2 * actualFactor;
|
||||
float t1 = Abs(DotProduct2D(*pPos1 - *pPos2, *pDir1));
|
||||
float t2 = Abs(DotProduct2D(*pPos2 - *pPos1, *pDir2));
|
||||
float t1 = Abs(DotProduct2D(*pPos2 - *pPos1, *pDir1));
|
||||
float t2 = Abs(DotProduct2D(*pPos1 - *pPos2, *pDir2));
|
||||
float curveCoef;
|
||||
if (t1 > t2) {
|
||||
if (between < (t1 - t2) / (t1 + t2))
|
||||
float coef = (t1 - t2) / (t1 + t2);
|
||||
#ifdef FIX_BUGS
|
||||
if (between <= coef)
|
||||
#else
|
||||
if (between < coef)
|
||||
#endif
|
||||
curveCoef = 0.0f;
|
||||
else
|
||||
curveCoef = 0.5f - 0.5f * Cos(3.1415f * (t1 + t2) / (2 * t2) * (between - (t1 - t2) / (t1 + t2)));
|
||||
curveCoef = 0.5f - 0.5f * Cos(3.1415f * (between - coef) * (t1 + t2) / (2 * t2));
|
||||
}
|
||||
else {
|
||||
if (2 * t1 / (t1 + t2) < between)
|
||||
float coef = 2 * t1 / (t1 + t2);
|
||||
#ifdef FIX_BUGS
|
||||
if (coef <= between)
|
||||
#else
|
||||
if (coef < between)
|
||||
#endif
|
||||
curveCoef = 1.0f;
|
||||
else
|
||||
curveCoef = 0.5f - 0.5f * Cos(3.1415f * between * (t1 + t2) / (2 * t1));
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "Automobile.h"
|
||||
#include "MBlur.h"
|
||||
#include "screendroplets.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
uint8 CGameLogic::ActivePlayers;
|
||||
uint8 CGameLogic::ShortCutState;
|
||||
|
@ -158,7 +159,7 @@ CGameLogic::Update()
|
|||
#endif
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true);
|
||||
CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
|
||||
|
@ -191,7 +192,7 @@ CGameLogic::Update()
|
|||
}
|
||||
|
||||
|
||||
if (!CTheScripts::IsPlayerOnAMission() && pPlayerInfo.m_nBustedAudioStatus == 0) {
|
||||
if (!CTheScripts::IsPlayerOnAMission() && pPlayerInfo.m_nBustedAudioStatus == BUSTEDAUDIO_NONE) {
|
||||
if (CGeneral::GetRandomNumberInRange(0, 4) == 0)
|
||||
pPlayerInfo.m_nBustedAudioStatus = BUSTEDAUDIO_DONE;
|
||||
else {
|
||||
|
@ -267,7 +268,7 @@ CGameLogic::Update()
|
|||
#endif
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true);
|
||||
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
|
||||
|
@ -322,7 +323,7 @@ CGameLogic::Update()
|
|||
#endif
|
||||
CMessages::ClearMessages();
|
||||
CCarCtrl::ClearInterestingVehicleList();
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
|
||||
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, true);
|
||||
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
|
||||
CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
|
||||
CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
|
||||
|
@ -379,10 +380,10 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector
|
|||
pPlayerPed->m_fRotationDest = pPlayerPed->m_fRotationCur;
|
||||
pPlayerPed->SetHeading(pPlayerPed->m_fRotationCur);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, pPlayerPed);
|
||||
CWorld::ClearExcitingStuffFromArea(pos, 4000.0, 1);
|
||||
CWorld::ClearExcitingStuffFromArea(pos, 4000.0f, true);
|
||||
pPlayerPed->RestoreHeadingRate();
|
||||
CGame::currArea = AREA_MAIN_MAP;
|
||||
CStreaming::RemoveBuildingsNotInArea(0);
|
||||
CStreaming::RemoveBuildingsNotInArea(AREA_MAIN_MAP);
|
||||
TheCamera.SetCameraDirectlyInFrontForFollowPed_CamOnAString();
|
||||
TheCamera.Restore();
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
|
@ -489,7 +490,7 @@ CGameLogic::UpdateShortCut()
|
|||
pShortCutTaxi->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD;
|
||||
pShortCutTaxi->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2500;
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(2.5f, 0);
|
||||
TheCamera.Fade(2.5f, FADE_OUT);
|
||||
ShortCutState = SHORTCUT_TRANSITION;
|
||||
ShortCutTimer = CTimer::GetTimeInMilliseconds() + 3000;
|
||||
CMessages::AddBigMessage(TheText.Get("TAXI"), 4500, 1);
|
||||
|
@ -509,7 +510,7 @@ CGameLogic::UpdateShortCut()
|
|||
pShortCutTaxi->SetMoveSpeed(pShortCutTaxi->GetForward() * 0.4f);
|
||||
ShortCutTimer = CTimer::GetTimeInMilliseconds() + 1500;
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(1.0f, 1);
|
||||
TheCamera.Fade(1.0f, FADE_IN);
|
||||
ShortCutState = SHORTCUT_ARRIVING;
|
||||
CTimer::Resume();
|
||||
}
|
||||
|
@ -612,12 +613,12 @@ void
|
|||
CGameLogic::Load(uint8* buf, uint32 size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
NumAfterDeathStartPoints = ReadSaveBuf<uint32>(buf);
|
||||
ReadSaveBuf(&NumAfterDeathStartPoints, buf);
|
||||
for (int i = 0; i < NUM_SHORTCUT_START_POINTS; i++) {
|
||||
AfterDeathStartPoints[i].x = ReadSaveBuf<float>(buf);
|
||||
AfterDeathStartPoints[i].y = ReadSaveBuf<float>(buf);
|
||||
AfterDeathStartPoints[i].z = ReadSaveBuf<float>(buf);
|
||||
AfterDeathStartPointOrientation[i] = ReadSaveBuf<float>(buf);
|
||||
ReadSaveBuf(&AfterDeathStartPoints[i].x, buf);
|
||||
ReadSaveBuf(&AfterDeathStartPoints[i].y, buf);
|
||||
ReadSaveBuf(&AfterDeathStartPoints[i].z, buf);
|
||||
ReadSaveBuf(&AfterDeathStartPointOrientation[i], buf);
|
||||
}
|
||||
VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
|
|
@ -27,13 +27,9 @@
|
|||
#include "Wanted.h"
|
||||
#include "World.h"
|
||||
#include "VarConsole.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
#define CRUSHER_GARAGE_X1 (1135.5f)
|
||||
#define CRUSHER_GARAGE_Y1 (57.0f)
|
||||
#define CRUSHER_GARAGE_Z1 (-1.0f)
|
||||
#define CRUSHER_GARAGE_X2 (1149.5f)
|
||||
#define CRUSHER_GARAGE_Y2 (63.7f)
|
||||
#define CRUSHER_GARAGE_Z2 (3.5f)
|
||||
//--LCS: file done except TODO
|
||||
|
||||
#define ROTATED_DOOR_OPEN_SPEED (0.015f)
|
||||
#define ROTATED_DOOR_CLOSE_SPEED (0.02f)
|
||||
|
@ -163,7 +159,7 @@ void CGarages::Init(void)
|
|||
}
|
||||
hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
|
||||
if (hGarages >= 0)
|
||||
DMAudio.SetEntityStatus(hGarages, true);
|
||||
DMAudio.SetEntityStatus(hGarages, TRUE);
|
||||
}
|
||||
|
||||
void CGarages::Shutdown(void)
|
||||
|
@ -631,13 +627,24 @@ void CGarage::Update()
|
|||
case GS_OPENED:
|
||||
UpdateDoorsHeight();
|
||||
if (IsStaticPlayerCarEntirelyInside()) {
|
||||
#ifndef BOMBS_ON_BIKES
|
||||
if (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) {
|
||||
CGarages::TriggerMessage("GA_22", -1, 4000, -1);
|
||||
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
||||
DMAudio.PlayFrontEndSound(SOUND_GARAGE_BOMB_ALREADY_SET, 1);
|
||||
break;
|
||||
}
|
||||
if (!FindPlayerVehicle() || FindPlayerVehicle()->m_bombType) {
|
||||
#endif
|
||||
if (!FindPlayerVehicle()
|
||||
#ifdef FIX_BUGS
|
||||
|| (FindPlayerVehicle()->IsCar() && ((CAutomobile*)FindPlayerVehicle())->m_bombType)
|
||||
#else
|
||||
|| ((CAutomobile*)FindPlayerVehicle())->m_bombType
|
||||
#endif
|
||||
#ifdef BOMBS_ON_BIKES
|
||||
|| (FindPlayerVehicle()->IsBike() && ((CBike*)FindPlayerVehicle())->m_bombType)
|
||||
#endif
|
||||
) {
|
||||
CGarages::TriggerMessage("GA_5", -1, 4000, -1); //"Your car is already fitted with a bomb"
|
||||
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
||||
DMAudio.PlayFrontEndSound(SOUND_GARAGE_BOMB_ALREADY_SET, 1);
|
||||
|
@ -681,10 +688,16 @@ void CGarage::Update()
|
|||
if (!CGarages::BombsAreFree)
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - BOMB_PRICE);
|
||||
if (FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike())) {
|
||||
#if (!defined GTA_PS2 || defined FIX_BUGS) // <- this remained in CAutomobile in LCS
|
||||
FindPlayerVehicle()->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
|
||||
FindPlayerVehicle()->m_pBombRigger = FindPlayerPed();
|
||||
#else // PS2 version contained a bug: CBike was casted to CAutomobile, but due to coincidence it didn't corrupt memory
|
||||
#ifdef BOMBS_ON_BIKES
|
||||
if (FindPlayerVehicle()->IsCar()) {
|
||||
((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
|
||||
((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
|
||||
}
|
||||
else {
|
||||
((CBike*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
|
||||
((CBike*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
|
||||
}
|
||||
#else
|
||||
((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
|
||||
((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
|
||||
#endif
|
||||
|
@ -698,6 +711,13 @@ void CGarage::Update()
|
|||
pCar->m_pBombRigger = nil;
|
||||
pCar->m_pBlowUpEntity = nil;
|
||||
}
|
||||
#ifdef BOMBS_ON_BIKES
|
||||
if (pVehicle->IsBike() && pVehicle->GetStatus() == STATUS_WRECKED) {
|
||||
CBike* pBike = (CBike*)pVehicle;
|
||||
pBike->m_pBombRigger = nil;
|
||||
pBike->m_pBlowUpEntity = nil;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (m_eGarageType == GARAGE_BOMBSHOP3)
|
||||
|
@ -2140,7 +2160,7 @@ void CStoredCar::StoreCar(CVehicle* pVehicle)
|
|||
m_nModelIndex = pVehicle->GetModelIndex();
|
||||
m_fPosX = pVehicle->GetPosition().x;
|
||||
m_fPosY = pVehicle->GetPosition().y;
|
||||
m_fPosY = pVehicle->GetPosition().z;
|
||||
m_fPosZ = pVehicle->GetPosition().z;
|
||||
m_fForwardX = pVehicle->GetForward().x;
|
||||
m_fForwardY = pVehicle->GetForward().y;
|
||||
m_fForwardZ = pVehicle->GetForward().z;
|
||||
|
@ -2351,7 +2371,7 @@ void CGarages::GivePlayerDetonator()
|
|||
|
||||
float CGarages::FindDoorHeightForMI(int32 mi)
|
||||
{
|
||||
return CModelInfo::GetModelInfo(mi)->GetColModel()->boundingBox.max.z - CModelInfo::GetModelInfo(mi)->GetColModel()->boundingBox.min.z - 0.1f;
|
||||
return CModelInfo::GetColModel(mi)->boundingBox.max.z - CModelInfo::GetColModel(mi)->boundingBox.min.z - 0.1f;
|
||||
}
|
||||
|
||||
void CGarage::TidyUpGarage()
|
||||
|
@ -2619,11 +2639,12 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
|
|||
}
|
||||
}
|
||||
|
||||
#define GARAGE_SIZE 208
|
||||
|
||||
void CGarages::Save(uint8 * buf, uint32 * size)
|
||||
{
|
||||
//INITSAVEBUF
|
||||
*size = 10692; // for some reason it's not actual size again
|
||||
//*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
|
||||
INITSAVEBUF
|
||||
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * GARAGE_SIZE);
|
||||
CloseHideOutGaragesBeforeSave();
|
||||
WriteSaveBuf(buf, NumGarages);
|
||||
WriteSaveBuf(buf, (uint32)BombsAreFree);
|
||||
|
@ -2639,33 +2660,150 @@ void CGarages::Save(uint8 * buf, uint32 * size)
|
|||
WriteSaveBuf(buf, aCarsInSafeHouses[j][i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < NUM_GARAGES; i++)
|
||||
for (int i = 0; i < NUM_GARAGES; i++) {
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
WriteSaveBuf(buf, aGarages[i].m_eGarageType);
|
||||
WriteSaveBuf(buf, aGarages[i].m_eGarageState);
|
||||
WriteSaveBuf(buf, aGarages[i].m_nMaxStoredCars);
|
||||
WriteSaveBuf(buf, aGarages[i].field_2);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bClosingWithoutTargetCar);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bDeactivated);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bResprayHappened);
|
||||
ZeroSaveBuf(buf, 1);
|
||||
WriteSaveBuf(buf, aGarages[i].m_nTargetModelIndex);
|
||||
ZeroSaveBuf(buf, 4 + 4);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bDoor1PoolIndex);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bDoor2PoolIndex);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bDoor1IsDummy);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bDoor2IsDummy);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bRecreateDoorOnNextRefresh);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bRotatedDoor);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bCameraFollowsPlayer);
|
||||
ZeroSaveBuf(buf, 1);
|
||||
WriteSaveBuf(buf, aGarages[i].m_vecCorner1);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fInfZ);
|
||||
WriteSaveBuf(buf, aGarages[i].m_vDir1);
|
||||
WriteSaveBuf(buf, aGarages[i].m_vDir2);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fSupZ);
|
||||
WriteSaveBuf(buf, aGarages[i].m_vecSSGaragePos);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fSSGarageAngle);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDir1Len);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDir2Len);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fInfX);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fSupX);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fInfY);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fSupY);
|
||||
WriteSaveBuf(buf, aGarages[i].m_nTimeCrusherCraneActivated);
|
||||
ZeroSaveBuf(buf, 4);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDoorPos);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDoorHeight);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDoor1X);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDoor1Y);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDoor2X);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDoor2Y);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDoor1Z);
|
||||
WriteSaveBuf(buf, aGarages[i].m_fDoor2Z);
|
||||
WriteSaveBuf(buf, aGarages[i].m_nTimeToStartAction);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bCollectedCarsState);
|
||||
ZeroSaveBuf(buf, 3 + 4);
|
||||
ZeroSaveBuf(buf, sizeof(aGarages[i].m_sStoredCar));
|
||||
WriteSaveBuf(buf, aGarages[i].m_bInitialized);
|
||||
ZeroSaveBuf(buf, 3);
|
||||
#ifdef GTA_NETWORK
|
||||
ZeroSaveBuf(buf, 4);
|
||||
#endif
|
||||
WriteSaveBuf(buf, aGarages[i].m_bSSGarageAcceptedVehicle);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bLocked);
|
||||
WriteSaveBuf(buf, aGarages[i].m_nSSGarageState);
|
||||
WriteSaveBuf(buf, aGarages[i].m_bSSGarageStateChanging);
|
||||
#else
|
||||
WriteSaveBuf(buf, aGarages[i]);
|
||||
//VALIDATESAVEBUF(*size);
|
||||
#endif
|
||||
}
|
||||
VALIDATESAVEBUF(*size);
|
||||
}
|
||||
|
||||
void CGarages::Load(uint8* buf, uint32 size)
|
||||
{
|
||||
//INITSAVEBUF
|
||||
assert(size == 10692);
|
||||
//assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
|
||||
INITSAVEBUF
|
||||
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * GARAGE_SIZE));
|
||||
CloseHideOutGaragesBeforeSave();
|
||||
NumGarages = ReadSaveBuf<uint32>(buf);
|
||||
BombsAreFree = ReadSaveBuf<uint32>(buf);
|
||||
RespraysAreFree = ReadSaveBuf<uint32>(buf);
|
||||
CarsCollected = ReadSaveBuf<int32>(buf);
|
||||
BankVansCollected = ReadSaveBuf<int32>(buf);
|
||||
PoliceCarsCollected = ReadSaveBuf<int32>(buf);
|
||||
ReadSaveBuf(&NumGarages, buf);
|
||||
int32 tempInt;
|
||||
ReadSaveBuf(&tempInt, buf);
|
||||
BombsAreFree = tempInt ? true : false;
|
||||
ReadSaveBuf(&tempInt, buf);
|
||||
RespraysAreFree = tempInt ? true : false;
|
||||
ReadSaveBuf(&CarsCollected, buf);
|
||||
ReadSaveBuf(&BankVansCollected, buf);
|
||||
ReadSaveBuf(&PoliceCarsCollected, buf);
|
||||
for (int i = 0; i < TOTAL_COLLECTCARS_GARAGES; i++)
|
||||
CarTypesCollected[i] = ReadSaveBuf<uint32>(buf);
|
||||
LastTimeHelpMessage = ReadSaveBuf<uint32>(buf);
|
||||
ReadSaveBuf(&CarTypesCollected[i], buf);
|
||||
ReadSaveBuf(&LastTimeHelpMessage, buf);
|
||||
for (int i = 0; i < NUM_GARAGE_STORED_CARS; i++) {
|
||||
for (int j = 0; j < TOTAL_HIDEOUT_GARAGES; j++) {
|
||||
aCarsInSafeHouses[j][i] = ReadSaveBuf<CStoredCar>(buf);
|
||||
ReadSaveBuf(&aCarsInSafeHouses[j][i], buf);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < NUM_GARAGES; i++) {
|
||||
aGarages[i] = ReadSaveBuf<CGarage>(buf);
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
ReadSaveBuf(&aGarages[i].m_eGarageType, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_eGarageState, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_nMaxStoredCars, buf);
|
||||
ReadSaveBuf(&aGarages[i].field_2, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bClosingWithoutTargetCar, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bDeactivated, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bResprayHappened, buf);
|
||||
SkipSaveBuf(buf, 1);
|
||||
ReadSaveBuf(&aGarages[i].m_nTargetModelIndex, buf);
|
||||
SkipSaveBuf(buf, 4 + 4);
|
||||
ReadSaveBuf(&aGarages[i].m_bDoor1PoolIndex, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bDoor2PoolIndex, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bDoor1IsDummy, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bDoor2IsDummy, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bRecreateDoorOnNextRefresh, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bRotatedDoor, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bCameraFollowsPlayer, buf);
|
||||
SkipSaveBuf(buf, 1);
|
||||
ReadSaveBuf(&aGarages[i].m_vecCorner1, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fInfZ, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_vDir1, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_vDir2, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fSupZ, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_vecSSGaragePos, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fSSGarageAngle, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDir1Len, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDir2Len, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fInfX, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fSupX, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fInfY, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fSupY, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_nTimeCrusherCraneActivated, buf);
|
||||
SkipSaveBuf(buf, 4);
|
||||
ReadSaveBuf(&aGarages[i].m_fDoorPos, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDoorHeight, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDoor1X, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDoor1Y, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDoor2X, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDoor2Y, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDoor1Z, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_fDoor2Z, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_nTimeToStartAction, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bCollectedCarsState, buf);
|
||||
SkipSaveBuf(buf, 3 + 4);
|
||||
SkipSaveBuf(buf, sizeof(aGarages[i].m_sStoredCar));
|
||||
ReadSaveBuf(&aGarages[i].m_bInitialized, buf);
|
||||
SkipSaveBuf(buf, 3);
|
||||
#ifdef GTA_NETWORK
|
||||
SkipSaveBuf(buf, 4);
|
||||
#endif
|
||||
ReadSaveBuf(&aGarages[i].m_bSSGarageAcceptedVehicle, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bLocked, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_nSSGarageState, buf);
|
||||
ReadSaveBuf(&aGarages[i].m_bSSGarageStateChanging, buf);
|
||||
#else
|
||||
ReadSaveBuf(&aGarages[i], buf);
|
||||
#endif
|
||||
aGarages[i].m_pDoor1 = nil;
|
||||
aGarages[i].m_pDoor2 = nil;
|
||||
aGarages[i].m_pTarget = nil;
|
||||
|
@ -2676,11 +2814,14 @@ void CGarages::Load(uint8* buf, uint32 size)
|
|||
else
|
||||
aGarages[i].UpdateDoorsHeight();
|
||||
}
|
||||
//VALIDATESAVEBUF(size);
|
||||
VALIDATESAVEBUF(size);
|
||||
|
||||
MessageEndTime = 0;
|
||||
bCamShouldBeOutisde = false;
|
||||
MessageStartTime = 0;
|
||||
hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
|
||||
if (hGarages >= 0)
|
||||
DMAudio.SetEntityStatus(hGarages, TRUE);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
bool m_bClosingWithoutTargetCar;
|
||||
bool m_bDeactivated;
|
||||
bool m_bResprayHappened;
|
||||
int m_nTargetModelIndex;
|
||||
int32 m_nTargetModelIndex;
|
||||
CEntity *m_pDoor1;
|
||||
CEntity *m_pDoor2;
|
||||
uint8 m_bDoor1PoolIndex;
|
||||
|
|
|
@ -9,39 +9,60 @@
|
|||
#include "OnscreenTimer.h"
|
||||
#include "Camera.h"
|
||||
|
||||
void COnscreenTimer::Init() {
|
||||
CRGBA gbColour(255, 255, 255, 255);
|
||||
CRGBA gbColour2(255, 255, 255, 255);
|
||||
|
||||
void
|
||||
COnscreenTimer::Init()
|
||||
{
|
||||
m_bDisabled = false;
|
||||
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
|
||||
m_sCounters[i].m_nCounterOffset = 0;
|
||||
m_sCounters[i].m_nTotal = -1;
|
||||
|
||||
for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++) {
|
||||
m_sCounters[i].m_aCounterText[j] = 0;
|
||||
for (uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText1); j++) {
|
||||
m_sCounters[i].m_aCounterText1[j] = '\0';
|
||||
}
|
||||
|
||||
for (uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText2); j++) {
|
||||
m_sCounters[i].m_aCounterText2[j] = '\0';
|
||||
}
|
||||
|
||||
m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
||||
m_sCounters[i].m_nTypeOfTotal = 0;
|
||||
m_sCounters[i].m_bCounterProcessed = false;
|
||||
m_sCounters[i].m_colour1 = CRGBA(112, 132, 157, 255);
|
||||
m_sCounters[i].m_colour2 = CRGBA(42, 58, 81, 255);
|
||||
|
||||
}
|
||||
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||
m_sClocks[i].m_nClockOffset = 0;
|
||||
|
||||
for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++) {
|
||||
m_sClocks[i].m_aClockText[j] = 0;
|
||||
}
|
||||
for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++)
|
||||
m_sClocks[i].m_aClockText[j] = '\0';
|
||||
|
||||
m_sClocks[i].m_bClockProcessed = false;
|
||||
m_sClocks[i].m_bClockGoingDown = true;
|
||||
m_sClocks[i].m_aClockColour = CRGBA(244, 225, 91, 255);
|
||||
m_sClocks[i].m_bClockTickThisFrame = false;
|
||||
}
|
||||
}
|
||||
|
||||
void COnscreenTimer::Process() {
|
||||
if(!CReplay::IsPlayingBack() && !m_bDisabled) {
|
||||
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||
void
|
||||
COnscreenTimer::Process()
|
||||
{
|
||||
if(!CReplay::IsPlayingBack() && !m_bDisabled)
|
||||
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++)
|
||||
m_sClocks[i].Process();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void COnscreenTimer::ProcessForDisplay() {
|
||||
void
|
||||
COnscreenTimer::ProcessForDisplay()
|
||||
{
|
||||
#ifdef GTA_NETWORK
|
||||
if (gIsMultiplayerGame)
|
||||
return;
|
||||
#endif
|
||||
if(CHud::m_Wants_To_Draw_Hud) {
|
||||
m_bProcessed = false;
|
||||
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||
|
@ -63,67 +84,100 @@ void COnscreenTimer::ProcessForDisplay() {
|
|||
}
|
||||
}
|
||||
|
||||
void COnscreenTimer::ClearCounter(uint32 offset) {
|
||||
void
|
||||
COnscreenTimer::ClearCounter(uint32 offset)
|
||||
{
|
||||
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
|
||||
if(offset == m_sCounters[i].m_nCounterOffset) {
|
||||
m_sCounters[i].m_nCounterOffset = 0;
|
||||
m_sCounters[i].m_aCounterText[0] = 0;
|
||||
m_sCounters[i].m_aCounterText1[0] = '\0';
|
||||
m_sCounters[i].m_aCounterText2[0] = '\0';
|
||||
m_sCounters[i].m_nTypeOfTotal = 0;
|
||||
m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
||||
m_sCounters[i].m_bCounterProcessed = 0;
|
||||
m_sCounters[i].m_bCounterProcessed = false;
|
||||
m_sCounters[i].m_bAddDollarPrefix = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void COnscreenTimer::ClearClock(uint32 offset) {
|
||||
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||
void
|
||||
COnscreenTimer::ClearClock(uint32 offset)
|
||||
{
|
||||
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++)
|
||||
if(offset == m_sClocks[i].m_nClockOffset) {
|
||||
m_sClocks[i].m_nClockOffset = 0;
|
||||
m_sClocks[i].m_aClockText[0] = 0;
|
||||
m_sClocks[i].m_bClockProcessed = 0;
|
||||
m_sClocks[i].m_aClockText[0] = '\0';
|
||||
m_sClocks[i].m_bClockProcessed = false;
|
||||
m_sClocks[i].m_bClockGoingDown = true;
|
||||
m_sClocks[i].m_bClockTickThisFrame = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos) {
|
||||
|
||||
if (m_sCounters[pos].m_aCounterText[0] != '\0')
|
||||
void
|
||||
COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text1, uint16 pos, int32 total, char* text2, uint16 totalType)
|
||||
{
|
||||
if (m_sCounters[pos].m_nCounterOffset)
|
||||
return;
|
||||
|
||||
m_sCounters[pos].m_nCounterOffset = offset;
|
||||
if(text) {
|
||||
strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(m_sCounters[0].m_aCounterText));
|
||||
} else {
|
||||
m_sCounters[pos].m_aCounterText[0] = 0;
|
||||
}
|
||||
m_sCounters[pos].m_nTotal = total;
|
||||
if(text1)
|
||||
strncpy(m_sCounters[pos].m_aCounterText1, text1, ARRAY_SIZE(m_sCounters[0].m_aCounterText1));
|
||||
else
|
||||
m_sCounters[pos].m_aCounterText1[0] = '\0';
|
||||
|
||||
if (text2)
|
||||
strncpy(m_sCounters[pos].m_aCounterText2, text2, ARRAY_SIZE(m_sCounters[0].m_aCounterText2));
|
||||
else
|
||||
m_sCounters[pos].m_aCounterText2[0] = '\0';
|
||||
|
||||
m_sCounters[pos].m_nTypeOfTotal = totalType;
|
||||
m_sCounters[pos].m_nType = type;
|
||||
m_sCounters[pos].m_bAddDollarPrefix = 0;
|
||||
|
||||
if (gbColour == CRGBA(255, 255, 255, 255))
|
||||
m_sCounters[pos].m_colour1 = CRGBA(112, 132, 157, 255);
|
||||
else {
|
||||
m_sCounters[pos].m_colour1 = gbColour;
|
||||
gbColour = CRGBA(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
if (gbColour == CRGBA(255, 255, 255, 255))
|
||||
m_sCounters[pos].m_colour2 = CRGBA(42, 58, 81, 255);
|
||||
else {
|
||||
m_sCounters[pos].m_colour2 = gbColour;
|
||||
gbColour = CRGBA(255, 255, 255, 255);
|
||||
}
|
||||
}
|
||||
|
||||
void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) {
|
||||
|
||||
// dead code in here
|
||||
uint32 i;
|
||||
for(i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||
void
|
||||
COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown)
|
||||
{
|
||||
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
|
||||
if(m_sClocks[i].m_nClockOffset == 0) {
|
||||
m_sClocks[i].m_nClockOffset = offset;
|
||||
m_sClocks[i].m_bClockGoingDown = bGoingDown;
|
||||
m_sClocks[i].m_bClockTickThisFrame = false;
|
||||
if (gbColour == CRGBA(255, 255, 255, 255))
|
||||
m_sClocks[i].m_aClockColour = CRGBA(244, 225, 91, 255);
|
||||
else {
|
||||
m_sClocks[i].m_aClockColour = gbColour;
|
||||
gbColour = CRGBA(255, 255, 255, 255);
|
||||
}
|
||||
if(text)
|
||||
strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText));
|
||||
else
|
||||
m_sClocks[i].m_aClockText[0] = '\0';
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
m_sClocks[i].m_nClockOffset = offset;
|
||||
m_sClocks[i].m_bClockGoingDown = bGoingDown;
|
||||
if(text) {
|
||||
strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText));
|
||||
} else {
|
||||
m_sClocks[i].m_aClockText[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void COnscreenTimerEntry::Process() {
|
||||
if(m_nClockOffset == 0) {
|
||||
void
|
||||
COnscreenTimerEntry::Process()
|
||||
{
|
||||
if(m_nClockOffset == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nClockOffset);
|
||||
int32 oldTime = *timerPtr;
|
||||
|
@ -138,8 +192,12 @@ void COnscreenTimerEntry::Process() {
|
|||
}
|
||||
else {
|
||||
int32 oldTimeSeconds = oldTime / 1000;
|
||||
if (oldTimeSeconds < 12 && newTime / 1000 != oldTimeSeconds && !TheCamera.m_WideScreenOn) {
|
||||
DMAudio.PlayFrontEndSound(SOUND_CLOCK_TICK, newTime / 1000);
|
||||
if (oldTimeSeconds < 12) {
|
||||
m_bClockTickThisFrame = false;
|
||||
if (newTime / 1000 != oldTimeSeconds) {
|
||||
m_bClockTickThisFrame = true;
|
||||
DMAudio.PlayFrontEndSound(SOUND_CLOCK_TICK, newTime / 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,13 +205,40 @@ void COnscreenTimerEntry::Process() {
|
|||
*timerPtr = oldTime + int32(CTimer::GetTimeStepInMilliseconds());
|
||||
}
|
||||
|
||||
void COnscreenTimerEntry::ProcessForDisplayClock() {
|
||||
void
|
||||
COnscreenTimerEntry::ProcessForDisplayClock()
|
||||
{
|
||||
uint32 time = *CTheScripts::GetPointerToScriptVariable(m_nClockOffset);
|
||||
sprintf(m_aClockBuffer, "%02d:%02d", time / 1000 / 60 % 100,
|
||||
sprintf(m_aClockBuffer, "%d:%02d", time / 1000 / 60 % 100,
|
||||
time / 1000 % 60);
|
||||
}
|
||||
|
||||
void COnscreenCounterEntry::ProcessForDisplayCounter() {
|
||||
void
|
||||
COnscreenCounterEntry::ProcessForDisplayCounter()
|
||||
{
|
||||
uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nCounterOffset);
|
||||
sprintf(m_aCounterBuffer, "%d", counter);
|
||||
char prefix[2] = { '\0' };
|
||||
if (m_bAddDollarPrefix)
|
||||
sprintf(prefix, "$");
|
||||
#ifdef FIX_BUGS
|
||||
char suffix[4] = { '\0' };
|
||||
#else
|
||||
char suffix[2] = { '\0' };
|
||||
#endif
|
||||
if (m_nTotal != -1) {
|
||||
m_nTotal = Min(99, m_nTotal);
|
||||
sprintf(suffix, "/%d", m_nTotal);
|
||||
}
|
||||
sprintf(m_aCounterBuffer, "%s%d%s", prefix, counter, suffix);
|
||||
}
|
||||
|
||||
void
|
||||
COnscreenTimer::ChangeCounterPrefix(uint32 offset, bool bChange)
|
||||
{
|
||||
for (uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
|
||||
if (offset == m_sCounters[i].m_nCounterOffset) {
|
||||
m_sCounters[i].m_bAddDollarPrefix = bChange;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
|
||||
enum
|
||||
{
|
||||
COUNTER_DISPLAY_NUMBER,
|
||||
|
@ -14,27 +16,31 @@ public:
|
|||
char m_aClockBuffer[40];
|
||||
bool m_bClockProcessed;
|
||||
bool m_bClockGoingDown;
|
||||
CRGBA m_aClockColour;
|
||||
bool m_bClockTickThisFrame;
|
||||
|
||||
void Process();
|
||||
void ProcessForDisplayClock();
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(COnscreenTimerEntry, 0x3C);
|
||||
|
||||
class COnscreenCounterEntry
|
||||
{
|
||||
public:
|
||||
uint32 m_nCounterOffset;
|
||||
char m_aCounterText[10];
|
||||
int32 m_nTotal;
|
||||
char m_aCounterText1[10];
|
||||
char m_aCounterText2[10];
|
||||
uint16 m_nTypeOfTotal;
|
||||
uint16 m_nType;
|
||||
char m_aCounterBuffer[40];
|
||||
bool m_bCounterProcessed;
|
||||
CRGBA m_colour1;
|
||||
CRGBA m_colour2;
|
||||
bool m_bAddDollarPrefix;
|
||||
|
||||
void ProcessForDisplayCounter();
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(COnscreenCounterEntry, 0x3C);
|
||||
|
||||
class COnscreenTimer
|
||||
{
|
||||
public:
|
||||
|
@ -50,8 +56,12 @@ public:
|
|||
void ClearCounter(uint32 offset);
|
||||
void ClearClock(uint32 offset);
|
||||
|
||||
void AddCounter(uint32 offset, uint16 type, char* text, uint16 pos);
|
||||
void AddCounter(uint32 offset, uint16 type, char* text, uint16 pos, int32, char*, uint16);
|
||||
void AddClock(uint32 offset, char* text, bool bGoingDown);
|
||||
|
||||
void ChangeCounterPrefix(uint32 offset, bool bChange);
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(COnscreenTimer, 0xF4);
|
||||
extern CRGBA gbColour;
|
||||
extern CRGBA gbColour2;
|
||||
|
||||
|
|
|
@ -200,8 +200,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
|
|||
const float fBoundMaxY = boundingBox.max.y + 0.3f;
|
||||
const float fBoundMinY = boundingBox.min.y - 0.3f;
|
||||
const float fBoundMaxX = boundingBox.max.x + 0.3f;
|
||||
const float fDistanceX = pPosition->x - pEntity->m_matrix.GetPosition().x;
|
||||
const float fDistanceY = pPosition->y - pEntity->m_matrix.GetPosition().y;
|
||||
const float fDistanceX = pPosition->x - pEntity->GetMatrix().GetPosition().x;
|
||||
const float fDistanceY = pPosition->y - pEntity->GetMatrix().GetPosition().y;
|
||||
const float fBoundRadius = pEntity->GetBoundRadius();
|
||||
CVector vecBoundCentre;
|
||||
pEntity->GetBoundCentre(vecBoundCentre);
|
||||
|
@ -215,8 +215,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
|
|||
if (!pathNodes[x][y].bBlockade) {
|
||||
const float pointY = y * 0.7f + fDistanceY;
|
||||
CVector2D point(pointX, pointY);
|
||||
if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->m_matrix.GetRight()))) {
|
||||
float fDotProduct = DotProduct2D(point, pEntity->m_matrix.GetForward());
|
||||
if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->GetMatrix().GetRight()))) {
|
||||
float fDotProduct = DotProduct2D(point, pEntity->GetMatrix().GetForward());
|
||||
if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
|
||||
pathNodes[x][y].bBlockade = true;
|
||||
}
|
||||
|
|
|
@ -13,10 +13,17 @@
|
|||
#include "RpAnimBlend.h"
|
||||
#include "AnimBlendAssociation.h"
|
||||
#include "soundlist.h"
|
||||
#include "SaveBuf.h"
|
||||
#ifdef FIX_BUGS
|
||||
#include "Replay.h"
|
||||
#endif
|
||||
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
#define PHONEINFO_SAVE_SIZE 0xA30
|
||||
#else
|
||||
#define PHONEINFO_SAVE_SIZE sizeof(CPhoneInfo)
|
||||
#endif
|
||||
|
||||
CPhoneInfo gPhoneInfo;
|
||||
|
||||
bool CPhoneInfo::bDisplayingPhoneMessage; // is phone picked up
|
||||
|
@ -197,14 +204,27 @@ void
|
|||
CPhoneInfo::Load(uint8 *buf, uint32 size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
m_nMax = ReadSaveBuf<int32>(buf);
|
||||
m_nScriptPhonesMax = ReadSaveBuf<int32>(buf);
|
||||
ReadSaveBuf(&m_nMax, buf);
|
||||
ReadSaveBuf(&m_nScriptPhonesMax, buf);
|
||||
for (int i = 0; i < NUMPHONES; i++) {
|
||||
m_aPhones[i] = ReadSaveBuf<CPhone>(buf);
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
ReadSaveBuf(&m_aPhones[i].m_vecPos, buf);
|
||||
SkipSaveBuf(buf, 6 * 4);
|
||||
ReadSaveBuf(&m_aPhones[i].m_repeatedMessagePickupStart, buf);
|
||||
int32 tmp;
|
||||
ReadSaveBuf(&tmp, buf);
|
||||
// It's saved as building pool index in save file, convert it to true entity
|
||||
m_aPhones[i].m_pEntity = tmp != 0 ? CPools::GetBuildingPool()->GetSlot(tmp - 1) : nil;
|
||||
ReadSaveBuf(&m_aPhones[i].m_nState, buf);
|
||||
ReadSaveBuf(&m_aPhones[i].m_visibleToCam, buf);
|
||||
SkipSaveBuf(buf, 3);
|
||||
#else
|
||||
ReadSaveBuf(&m_aPhones[i], buf);
|
||||
// It's saved as building pool index in save file, convert it to true entity
|
||||
if (m_aPhones[i].m_pEntity) {
|
||||
m_aPhones[i].m_pEntity = CPools::GetBuildingPool()->GetSlot((uintptr)m_aPhones[i].m_pEntity - 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
@ -298,17 +318,29 @@ CPhoneInfo::Initialise(void)
|
|||
void
|
||||
CPhoneInfo::Save(uint8 *buf, uint32 *size)
|
||||
{
|
||||
*size = sizeof(CPhoneInfo);
|
||||
*size = PHONEINFO_SAVE_SIZE;
|
||||
INITSAVEBUF
|
||||
WriteSaveBuf(buf, m_nMax);
|
||||
WriteSaveBuf(buf, m_nScriptPhonesMax);
|
||||
for(int phoneId = 0; phoneId < NUMPHONES; phoneId++) {
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
WriteSaveBuf(buf, m_aPhones[phoneId].m_vecPos);
|
||||
ZeroSaveBuf(buf, 6 * 4);
|
||||
WriteSaveBuf(buf, m_aPhones[phoneId].m_repeatedMessagePickupStart);
|
||||
// Convert entity pointer to building pool index while saving
|
||||
int32 tmp = m_aPhones[phoneId].m_pEntity ? CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert((CBuilding*)m_aPhones[phoneId].m_pEntity) + 1 : 0;
|
||||
WriteSaveBuf(buf, tmp);
|
||||
WriteSaveBuf(buf, m_aPhones[phoneId].m_nState);
|
||||
WriteSaveBuf(buf, m_aPhones[phoneId].m_visibleToCam);
|
||||
ZeroSaveBuf(buf, 3);
|
||||
#else
|
||||
CPhone* phone = WriteSaveBuf(buf, m_aPhones[phoneId]);
|
||||
|
||||
// Convert entity pointer to building pool index while saving
|
||||
if (phone->m_pEntity) {
|
||||
phone->m_pEntity = (CEntity*) (CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert((CBuilding*)phone->m_pEntity) + 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
VALIDATESAVEBUF(*size)
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#ifdef FIX_BUGS
|
||||
#include "Replay.h"
|
||||
#endif
|
||||
#include "SaveBuf.h"
|
||||
#include "Script.h"
|
||||
#include "Shadows.h"
|
||||
#include "SpecialFX.h"
|
||||
|
@ -33,6 +34,13 @@
|
|||
#include "Hud.h"
|
||||
#include "Messages.h"
|
||||
#include "Streaming.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
#define PICKUPS_SAVE_SIZE 0x4440
|
||||
#else
|
||||
#define PICKUPS_SAVE_SIZE sizeof(aPickUps)
|
||||
#endif
|
||||
|
||||
CPickup CPickups::aPickUps[NUMPICKUPS];
|
||||
int16 CPickups::NumMessages;
|
||||
|
@ -701,8 +709,10 @@ bool
|
|||
CPickups::TestForPickupsInBubble(CVector pos, float range)
|
||||
{
|
||||
for (int i = 0; i < NUMPICKUPS; i++) {
|
||||
if ((aPickUps[i].m_vecPos - pos).Magnitude() < range)
|
||||
return true;
|
||||
if (aPickUps[i].m_eType != PICKUP_NONE) {
|
||||
if ((aPickUps[i].m_vecPos - pos).Magnitude() < range)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1008,8 +1018,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
|||
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
|
||||
|
||||
if (!entity->bDoNotRender) {
|
||||
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
|
||||
float modifiedSin = 0.3f * (s + 1.0f);
|
||||
float modifiedSin = 0.3f * (Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800)) + 1.0f);
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
int16 colorId = 0;
|
||||
|
@ -1149,7 +1158,20 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
|||
if (model == MI_MINIGUN || model == MI_MINIGUN2)
|
||||
scale = 1.2f;
|
||||
|
||||
entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), scale);
|
||||
float angle = (float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800);
|
||||
float c = Cos(angle) * scale;
|
||||
float s = Sin(angle) * scale;
|
||||
|
||||
// we know from SA they were setting each field manually like this
|
||||
entity->GetMatrix().rx = c;
|
||||
entity->GetMatrix().ry = s;
|
||||
entity->GetMatrix().rz = 0.0f;
|
||||
entity->GetMatrix().fx = -s;
|
||||
entity->GetMatrix().fy = c;
|
||||
entity->GetMatrix().fz = 0.0f;
|
||||
entity->GetMatrix().ux = 0.0f;
|
||||
entity->GetMatrix().uy = 0.0f;
|
||||
entity->GetMatrix().uz = scale;
|
||||
|
||||
if (entity->GetModelIndex() == MI_MINIGUN2) {
|
||||
CMatrix matrix1;
|
||||
|
@ -1429,7 +1451,32 @@ CPickups::Load(uint8 *buf, uint32 size)
|
|||
INITSAVEBUF
|
||||
|
||||
for (int32 i = 0; i < NUMPICKUPS; i++) {
|
||||
aPickUps[i] = ReadSaveBuf<CPickup>(buf);
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
ReadSaveBuf(&aPickUps[i].m_vecPos, buf);
|
||||
ReadSaveBuf(&aPickUps[i].m_fRevenue, buf);
|
||||
int32 tmp_pObject;
|
||||
ReadSaveBuf(&tmp_pObject, buf);
|
||||
int32 tmp_pExtraObject;
|
||||
ReadSaveBuf(&tmp_pExtraObject, buf);
|
||||
ReadSaveBuf(&aPickUps[i].m_nQuantity, buf);
|
||||
ReadSaveBuf(&aPickUps[i].m_nTimer, buf);
|
||||
ReadSaveBuf(&aPickUps[i].m_nMoneySpeed, buf);
|
||||
ReadSaveBuf(&aPickUps[i].m_eModelIndex, buf);
|
||||
ReadSaveBuf(&aPickUps[i].m_nIndex, buf);
|
||||
memcpy(aPickUps[i].m_sTextKey, buf, sizeof(aPickUps[i].m_sTextKey));
|
||||
SkipSaveBuf(buf, sizeof(aPickUps[i].m_sTextKey));
|
||||
ReadSaveBuf(&aPickUps[i].m_eType, buf);
|
||||
ReadSaveBuf(&aPickUps[i].m_bRemoved, buf);
|
||||
uint8 flags;
|
||||
ReadSaveBuf(&flags, buf);
|
||||
aPickUps[i].m_bWasAmmoCollected = !!(flags & BIT(0));
|
||||
aPickUps[i].m_bWasControlMessageShown = !!(flags & BIT(1));
|
||||
SkipSaveBuf(buf, 3);
|
||||
|
||||
aPickUps[i].m_pObject = aPickUps[i].m_eType != PICKUP_NONE && tmp_pObject != 0 ? CPools::GetObjectPool()->GetSlot(tmp_pObject - 1) : nil;
|
||||
aPickUps[i].m_pExtraObject = aPickUps[i].m_eType != PICKUP_NONE && tmp_pExtraObject != 0 ? CPools::GetObjectPool()->GetSlot(tmp_pExtraObject - 1) : nil;
|
||||
#else
|
||||
ReadSaveBuf(&aPickUps[i], buf);
|
||||
|
||||
if (aPickUps[i].m_eType != PICKUP_NONE) {
|
||||
if (aPickUps[i].m_pObject != nil)
|
||||
|
@ -1437,15 +1484,15 @@ INITSAVEBUF
|
|||
if (aPickUps[i].m_pExtraObject != nil)
|
||||
aPickUps[i].m_pExtraObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pExtraObject - 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
CollectedPickUpIndex = ReadSaveBuf<uint16>(buf);
|
||||
ReadSaveBuf<uint16>(buf);
|
||||
ReadSaveBuf(&CollectedPickUpIndex, buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
NumMessages = 0;
|
||||
|
||||
for (uint16 i = 0; i < NUMCOLLECTEDPICKUPS; i++)
|
||||
aPickUpsCollected[i] = ReadSaveBuf<int32>(buf);
|
||||
ReadSaveBuf(&aPickUpsCollected[i], buf);
|
||||
|
||||
VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
@ -1453,12 +1500,34 @@ VALIDATESAVEBUF(size)
|
|||
void
|
||||
CPickups::Save(uint8 *buf, uint32 *size)
|
||||
{
|
||||
*size = sizeof(aPickUps);
|
||||
*size = PICKUPS_SAVE_SIZE;
|
||||
*size += sizeof(uint16) + sizeof(uint16) + sizeof(aPickUpsCollected);
|
||||
|
||||
INITSAVEBUF
|
||||
|
||||
for (int32 i = 0; i < NUMPICKUPS; i++) {
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
WriteSaveBuf(buf, aPickUps[i].m_vecPos);
|
||||
WriteSaveBuf(buf, aPickUps[i].m_fRevenue);
|
||||
int32 tmp = aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].m_pObject != nil ? CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(aPickUps[i].m_pObject) + 1 : 0;
|
||||
WriteSaveBuf(buf, tmp);
|
||||
tmp = aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].m_pExtraObject != nil ? CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(aPickUps[i].m_pExtraObject) + 1 : 0;
|
||||
WriteSaveBuf(buf, tmp);
|
||||
WriteSaveBuf(buf, aPickUps[i].m_nQuantity);
|
||||
WriteSaveBuf(buf, aPickUps[i].m_nTimer);
|
||||
WriteSaveBuf(buf, aPickUps[i].m_nMoneySpeed);
|
||||
WriteSaveBuf(buf, aPickUps[i].m_eModelIndex);
|
||||
WriteSaveBuf(buf, aPickUps[i].m_nIndex);
|
||||
memcpy(buf, aPickUps[i].m_sTextKey, sizeof(aPickUps[i].m_sTextKey));
|
||||
SkipSaveBuf(buf, sizeof(aPickUps[i].m_sTextKey));
|
||||
WriteSaveBuf(buf, aPickUps[i].m_eType);
|
||||
WriteSaveBuf(buf, aPickUps[i].m_bRemoved);
|
||||
uint8 flags = 0;
|
||||
if (aPickUps[i].m_bWasAmmoCollected) flags |= BIT(0);
|
||||
if (aPickUps[i].m_bWasControlMessageShown) flags |= BIT(1);
|
||||
WriteSaveBuf(buf, flags);
|
||||
ZeroSaveBuf(buf, 3);
|
||||
#else
|
||||
CPickup *buf_pickup = WriteSaveBuf(buf, aPickUps[i]);
|
||||
if (buf_pickup->m_eType != PICKUP_NONE) {
|
||||
if (buf_pickup->m_pObject != nil)
|
||||
|
@ -1466,6 +1535,7 @@ INITSAVEBUF
|
|||
if (buf_pickup->m_pExtraObject != nil)
|
||||
buf_pickup->m_pExtraObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(buf_pickup->m_pExtraObject) + 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
WriteSaveBuf(buf, CollectedPickUpIndex);
|
||||
|
|
|
@ -425,9 +425,9 @@ void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CV
|
|||
pp->pos_x = 4.0f * vecPos.x;
|
||||
pp->pos_y = 4.0f * vecPos.y;
|
||||
pp->pos_z = 4.0f * vecPos.z;
|
||||
pp->dir_x = 120.0f * clamp(vecDir.x, -1.0f, 1.0f);
|
||||
pp->dir_y = 120.0f * clamp(vecDir.y, -1.0f, 1.0f);
|
||||
pp->dir_z = 120.0f * clamp(vecDir.z, -1.0f, 1.0f);
|
||||
pp->dir_x = 120.0f * Clamp(vecDir.x, -1.0f, 1.0f);
|
||||
pp->dir_y = 120.0f * Clamp(vecDir.y, -1.0f, 1.0f);
|
||||
pp->dir_z = 120.0f * Clamp(vecDir.z, -1.0f, 1.0f);
|
||||
pp->size = fSize;
|
||||
pp->r = color.red;
|
||||
pp->g = color.green;
|
||||
|
@ -463,8 +463,8 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||
CAnimBlendAssociation* main = RpAnimBlendClumpGetMainAssociation((RpClump*)ped->m_rwObject, &second, &blend_amount);
|
||||
if (main){
|
||||
state->animId = main->animId;
|
||||
state->time = 255.0f / 4.0f * clamp(main->currentTime, 0.0f, 4.0f);
|
||||
state->speed = 255.0f / 3.0f * clamp(main->speed, 0.0f, 3.0f);
|
||||
state->time = 255.0f / 4.0f * Clamp(main->currentTime, 0.0f, 4.0f);
|
||||
state->speed = 255.0f / 3.0f * Clamp(main->speed, 0.0f, 3.0f);
|
||||
state->groupId = main->groupId;
|
||||
}else{
|
||||
state->animId = 3;
|
||||
|
@ -474,9 +474,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||
}
|
||||
if (second) {
|
||||
state->secAnimId = second->animId;
|
||||
state->secTime = 255.0f / 4.0f * clamp(second->currentTime, 0.0f, 4.0f);
|
||||
state->secSpeed = 255.0f / 3.0f * clamp(second->speed, 0.0f, 3.0f);
|
||||
state->blendAmount = 255.0f / 2.0f * clamp(blend_amount, 0.0f, 2.0f);
|
||||
state->secTime = 255.0f / 4.0f * Clamp(second->currentTime, 0.0f, 4.0f);
|
||||
state->secSpeed = 255.0f / 3.0f * Clamp(second->speed, 0.0f, 3.0f);
|
||||
state->blendAmount = 255.0f / 2.0f * Clamp(blend_amount, 0.0f, 2.0f);
|
||||
state->secGroupId = second->groupId;
|
||||
}else{
|
||||
state->secAnimId = 0;
|
||||
|
@ -488,9 +488,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||
CAnimBlendAssociation* partial = RpAnimBlendClumpGetMainPartialAssociation((RpClump*)ped->m_rwObject);
|
||||
if (partial) {
|
||||
state->partAnimId = partial->animId;
|
||||
state->partAnimTime = 255.0f / 4.0f * clamp(partial->currentTime, 0.0f, 4.0f);
|
||||
state->partAnimSpeed = 255.0f / 3.0f * clamp(partial->speed, 0.0f, 3.0f);
|
||||
state->partBlendAmount = 255.0f / 2.0f * clamp(partial->blendAmount, 0.0f, 2.0f);
|
||||
state->partAnimTime = 255.0f / 4.0f * Clamp(partial->currentTime, 0.0f, 4.0f);
|
||||
state->partAnimSpeed = 255.0f / 3.0f * Clamp(partial->speed, 0.0f, 3.0f);
|
||||
state->partBlendAmount = 255.0f / 2.0f * Clamp(partial->blendAmount, 0.0f, 2.0f);
|
||||
state->partGroupId = partial->groupId;
|
||||
}else{
|
||||
state->partAnimId = 0;
|
||||
|
@ -507,10 +507,10 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainAssociation_N((RpClump*)ped->m_rwObject, i);
|
||||
if (assoc){
|
||||
state->aAnimId[i] = assoc->animId;
|
||||
state->aCurTime[i] = 255.0f / 4.0f * clamp(assoc->currentTime, 0.0f, 4.0f);
|
||||
state->aSpeed[i] = 255.0f / 3.0f * clamp(assoc->speed, 0.0f, 3.0f);
|
||||
state->aBlendAmount[i] = 255.0f / 2.0f * clamp(assoc->blendAmount, 0.0f, 2.0f);
|
||||
state->aBlendDelta[i] = 127.0f / 32.0f * clamp(assoc->blendDelta, -16.0f, 16.0f);
|
||||
state->aCurTime[i] = 255.0f / 4.0f * Clamp(assoc->currentTime, 0.0f, 4.0f);
|
||||
state->aSpeed[i] = 255.0f / 3.0f * Clamp(assoc->speed, 0.0f, 3.0f);
|
||||
state->aBlendAmount[i] = 255.0f / 2.0f * Clamp(assoc->blendAmount, 0.0f, 2.0f);
|
||||
state->aBlendDelta[i] = 127.0f / 32.0f * Clamp(assoc->blendDelta, -16.0f, 16.0f);
|
||||
state->aFlags[i] = assoc->flags;
|
||||
state->aGroupId[i] = assoc->groupId;
|
||||
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
||||
|
@ -533,10 +533,10 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainPartialAssociation_N((RpClump*)ped->m_rwObject, i);
|
||||
if (assoc) {
|
||||
state->aAnimId2[i] = assoc->animId;
|
||||
state->aCurTime2[i] = 255.0f / 4.0f * clamp(assoc->currentTime, 0.0f, 4.0f);
|
||||
state->aSpeed2[i] = 255.0f / 3.0f * clamp(assoc->speed, 0.0f, 3.0f);
|
||||
state->aBlendAmount2[i] = 255.0f / 2.0f * clamp(assoc->blendAmount, 0.0f, 2.0f);
|
||||
state->aBlendDelta2[i] = 127.0f / 16.0f * clamp(assoc->blendDelta, -16.0f, 16.0f);
|
||||
state->aCurTime2[i] = 255.0f / 4.0f * Clamp(assoc->currentTime, 0.0f, 4.0f);
|
||||
state->aSpeed2[i] = 255.0f / 3.0f * Clamp(assoc->speed, 0.0f, 3.0f);
|
||||
state->aBlendAmount2[i] = 255.0f / 2.0f * Clamp(assoc->blendAmount, 0.0f, 2.0f);
|
||||
state->aBlendDelta2[i] = 127.0f / 16.0f * Clamp(assoc->blendDelta, -16.0f, 16.0f);
|
||||
state->aFlags2[i] = assoc->flags;
|
||||
state->aGroupId2[i] = assoc->groupId;
|
||||
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
||||
|
@ -1463,7 +1463,7 @@ void CReplay::RestoreStuffFromMem(void)
|
|||
ped->SetModelIndex(mi);
|
||||
ped->m_pVehicleAnim = nil;
|
||||
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
|
||||
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
|
||||
DMAudio.SetEntityStatus(ped->m_audioEntityId, TRUE);
|
||||
CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
|
||||
for (int j = 0; j < TOTAL_WEAPON_SLOTS; j++) {
|
||||
int mi1 = CWeaponInfo::GetWeaponInfo(ped->m_weapons[j].m_eWeaponType)->m_nModelId;
|
||||
|
@ -1529,7 +1529,7 @@ void CReplay::RestoreStuffFromMem(void)
|
|||
car->SetDoorDamage(CAR_DOOR_RR, DOOR_REAR_RIGHT, true);
|
||||
}
|
||||
vehicle->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, vehicle);
|
||||
DMAudio.SetEntityStatus(vehicle->m_audioEntityId, true);
|
||||
DMAudio.SetEntityStatus(vehicle->m_audioEntityId, TRUE);
|
||||
CCarCtrl::UpdateCarCount(vehicle, false);
|
||||
if ((mi == MI_AIRTRAIN || mi == MI_DEADDODO) && vehicle->m_rwObject){
|
||||
CVehicleModelInfo* info = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "common.h"
|
||||
|
||||
#include "Restart.h"
|
||||
#include "SaveBuf.h"
|
||||
#include "Zones.h"
|
||||
#include "PathFind.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
uint8 CRestart::OverrideHospitalLevel;
|
||||
uint8 CRestart::OverridePoliceStationLevel;
|
||||
|
@ -173,29 +175,28 @@ INITSAVEBUF
|
|||
CheckSaveHeader(buf, 'R','S','T','\0', size - SAVE_HEADER_SIZE);
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
HospitalRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
||||
HospitalRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
||||
ReadSaveBuf(&HospitalRestartPoints[i], buf);
|
||||
ReadSaveBuf(&HospitalRestartHeadings[i], buf);
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||
PoliceRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
||||
PoliceRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
||||
ReadSaveBuf(&PoliceRestartPoints[i], buf);
|
||||
ReadSaveBuf(&PoliceRestartHeadings[i], buf);
|
||||
}
|
||||
|
||||
NumberOfHospitalRestarts = ReadSaveBuf<uint16>(buf);
|
||||
NumberOfPoliceRestarts = ReadSaveBuf<uint16>(buf);
|
||||
bOverrideRestart = ReadSaveBuf<bool>(buf);
|
||||
ReadSaveBuf(&NumberOfHospitalRestarts, buf);
|
||||
ReadSaveBuf(&NumberOfPoliceRestarts, buf);
|
||||
ReadSaveBuf(&bOverrideRestart, buf);
|
||||
|
||||
// skip something unused
|
||||
ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf<uint16>(buf);
|
||||
SkipSaveBuf(buf, 3);
|
||||
|
||||
OverridePosition = ReadSaveBuf<CVector>(buf);
|
||||
OverrideHeading = ReadSaveBuf<float>(buf);
|
||||
bFadeInAfterNextDeath = ReadSaveBuf<bool>(buf);
|
||||
bFadeInAfterNextArrest = ReadSaveBuf<bool>(buf);
|
||||
OverrideHospitalLevel = ReadSaveBuf<uint8>(buf);
|
||||
OverridePoliceStationLevel = ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf(&OverridePosition, buf);
|
||||
ReadSaveBuf(&OverrideHeading, buf);
|
||||
ReadSaveBuf(&bFadeInAfterNextDeath, buf);
|
||||
ReadSaveBuf(&bFadeInAfterNextArrest, buf);
|
||||
ReadSaveBuf(&OverrideHospitalLevel, buf);
|
||||
ReadSaveBuf(&OverridePoliceStationLevel, buf);
|
||||
VALIDATESAVEBUF(size);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,11 +60,11 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
|
|||
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
|
||||
if (!pEntityToAttack)
|
||||
pEntityToAttack = (CEntity*)FindPlayerPed();
|
||||
CColModel* pPoliceColModel = CModelInfo::GetModelInfo(MI_POLICE)->GetColModel();
|
||||
CColModel* pPoliceColModel = CModelInfo::GetColModel(MI_POLICE);
|
||||
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
|
||||
for (int32 i = 0; i < 2; i++) {
|
||||
const int32 roadBlockIndex = i + 2 * roadBlockType;
|
||||
CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
|
||||
CVector posForZ = pVehicle->GetMatrix() * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
|
||||
int32 modelInfoId = MI_COP;
|
||||
eCopType copType = COP_STREET;
|
||||
switch (pVehicle->GetModelIndex())
|
||||
|
@ -217,7 +217,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
|
|||
vehicleId = MI_ENFORCER;
|
||||
if (!CStreaming::HasModelLoaded(vehicleId))
|
||||
vehicleId = MI_POLICE;
|
||||
CColModel* pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel();
|
||||
CColModel *pVehicleColModel = CModelInfo::GetColModel(vehicleId);
|
||||
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
|
||||
int16 numRoadblockVehicles = Min(6, (int16)(distBetween / fModelRadius));
|
||||
for (int16 i = 0; i < numRoadblockVehicles; i++) {
|
||||
|
@ -231,7 +231,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
|
|||
tmp.RotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + 3.1416f);
|
||||
tmp.SetTranslateOnly(offset * forward + pos);
|
||||
tmp.GetPosition().z += 0.6f;
|
||||
float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
|
||||
float fModelRadius = CModelInfo::GetColModel(vehicleId)->boundingSphere.radius - 0.25f;
|
||||
int16 colliding = 0;
|
||||
CWorld::FindObjectsKindaColliding(tmp.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
|
||||
if (!colliding) {
|
||||
|
@ -239,10 +239,10 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
|
|||
pVehicle->SetStatus(STATUS_ABANDONED);
|
||||
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
|
||||
tmp.GetPosition().z += fModelRadius - 0.6f;
|
||||
pVehicle->m_matrix = tmp;
|
||||
pVehicle->SetMatrix(tmp);
|
||||
pVehicle->PlaceOnRoadProperly();
|
||||
pVehicle->SetIsStatic(false);
|
||||
pVehicle->m_matrix.UpdateRW();
|
||||
pVehicle->GetMatrix().UpdateRW();
|
||||
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||
pVehicle->bIsLocked = false;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -49,6 +49,7 @@ void FlushLog();
|
|||
|
||||
#define KEY_LENGTH_IN_SCRIPT (8)
|
||||
|
||||
//#define GTA_SCRIPT_COLLECTIVE
|
||||
#define GET_INTEGER_PARAM(i) (ScriptParams[i])
|
||||
#define GET_FLOAT_PARAM(i) (*(float*)&ScriptParams[i])
|
||||
#define GET_VECTOR_PARAM(i) (CVector(GET_FLOAT_PARAM(i), GET_FLOAT_PARAM(i+1), GET_FLOAT_PARAM(i+2)))
|
||||
|
@ -444,6 +445,13 @@ public:
|
|||
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
int CollectParameterForDebug(char* buf, bool& var);
|
||||
void GetStoredParameterForDebug(char* buf);
|
||||
void LogOnStartProcessing();
|
||||
void LogBeforeProcessingCommand(int32 command);
|
||||
void LogAfterProcessingCommand(int32 command);
|
||||
|
||||
static char commandInfo[];
|
||||
static uint32 storedIp;
|
||||
|
||||
#endif
|
||||
|
||||
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
|
||||
|
@ -524,7 +532,7 @@ public:
|
|||
static bool bPlayerHasMetDebbieHarry;
|
||||
|
||||
static int AllowedCollision[MAX_ALLOWED_COLLISIONS];
|
||||
static short* SavedVarIndices;
|
||||
static uint16* SavedVarIndices;
|
||||
static int NumSaveVars;
|
||||
static int FSDestroyedFlag;
|
||||
static int NextProcessId;
|
||||
|
@ -653,19 +661,32 @@ public:
|
|||
static void SetObjectiveForAllPedsInCollective(int, eObjective);
|
||||
#endif
|
||||
|
||||
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
|
||||
static bool MissionSupportsMissionReplay(int index)
|
||||
{
|
||||
return (index >= 48 && index <= 61) || (index >= 63 && index <= 117);
|
||||
}
|
||||
#endif
|
||||
static bool IsFortStauntonDestroyed() { return FSDestroyedFlag && *(int32*)&ScriptSpace[FSDestroyedFlag] == 1; }
|
||||
|
||||
|
||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||
static int ScriptToLoad;
|
||||
static int OpenScript();
|
||||
#endif
|
||||
|
||||
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
static void LogAfterScriptInitializing();
|
||||
static void LogBeforeScriptProcessing();
|
||||
static void LogAfterScriptProcessing();
|
||||
#endif
|
||||
};
|
||||
|
||||
extern int ScriptParams[32];
|
||||
|
||||
VALIDATE_SIZE(uStackReturnValue, 4);
|
||||
|
||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||
extern int scriptToLoad;
|
||||
#endif
|
||||
#ifdef MISSION_REPLAY
|
||||
static_assert(false, "Mission replay is not supported");
|
||||
extern int AllowMissionReplay;
|
||||
extern uint32 WaitForMissionActivate;
|
||||
extern uint32 WaitForSave;
|
||||
|
@ -676,12 +697,29 @@ extern bool gbTryingPorn4Again;
|
|||
extern int IsInAmmunation;
|
||||
extern int MissionSkipLevel;
|
||||
|
||||
uint32 AddExtraDeathDelay();
|
||||
void RetryMission(int, int);
|
||||
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
|
||||
extern bool AlreadySavedGame;
|
||||
#endif
|
||||
|
||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||
extern int scriptToLoad;
|
||||
uint32 AddExtraDeathDelay();
|
||||
void RetryMission(int, int unk = 0);
|
||||
|
||||
enum {
|
||||
MISSION_RETRY_TYPE_SUGGEST_TO_PLAYER = 0,
|
||||
MISSION_RETRY_TYPE_1,
|
||||
MISSION_RETRY_TYPE_BEGIN_RESTARTING
|
||||
};
|
||||
|
||||
enum {
|
||||
MISSION_RETRY_STAGE_NORMAL = 0,
|
||||
MISSION_RETRY_STAGE_WAIT_FOR_SCRIPT_TO_TERMINATE,
|
||||
MISSION_RETRY_STAGE_START_PROCESSING,
|
||||
MISSION_RETRY_STAGE_WAIT_FOR_DELAY,
|
||||
MISSION_RETRY_STAGE_WAIT_FOR_MENU,
|
||||
MISSION_RETRY_STAGE_WAIT_FOR_USER,
|
||||
MISSION_RETRY_STAGE_START_RESTARTING,
|
||||
MISSION_RETRY_STAGE_WAIT_FOR_TIMER_AFTER_RESTART,
|
||||
};
|
||||
#endif
|
||||
|
||||
extern int gScriptsFile;
|
||||
|
|
|
@ -94,6 +94,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
|
|||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
SET_INTEGER_PARAM(0, CPickups::GetValue(GET_INTEGER_PARAM(0)));
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_PICKUP_VALUE:
|
||||
|
@ -103,7 +104,11 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
|
|||
return 0;
|
||||
}
|
||||
case COMMAND_IS_DEVELOPER:
|
||||
#ifdef GTA_NETWORK
|
||||
UpdateCompareFlag(gDeveloperFlag || gIsMultiplayerGame);
|
||||
#else
|
||||
UpdateCompareFlag(gDeveloperFlag);
|
||||
#endif
|
||||
return 0;
|
||||
case COMMAND_SET_DEVELOPER_FLAG:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
@ -241,7 +246,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
|
|||
{
|
||||
uint16 offset = (uint8*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - CTheScripts::ScriptSpace;
|
||||
CollectParameters(&m_nIp, 1);
|
||||
//CUserDisplay::OnscnTimer.ChangeCounterPrefix(offset, GET_INTEGER_PARAMS(0));
|
||||
CUserDisplay::OnscnTimer.ChangeCounterPrefix(offset, GET_INTEGER_PARAM(0) != 0);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_STORE_PLAYER_OUTFIT:
|
||||
|
@ -262,7 +267,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
|
|||
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
||||
strncpy(onscreen_str1, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
|
||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data
|
||||
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0, GET_INTEGER_PARAM(0), nil, 0);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_PLAYER_CURRENT_WEAPON_AMMO_IN_CLIP:
|
||||
|
@ -278,7 +283,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
|
|||
CollectParameters(&m_nIp, 3);
|
||||
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
if (pPed)
|
||||
pPed->SetWaitState((eWaitState)GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) >= 0 ? (void*)GET_INTEGER_PARAM(0) : nil); // + true
|
||||
pPed->SetWaitState((eWaitState)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2) >= 0 ? &GET_INTEGER_PARAM(2) : nil, true);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_REGISTER_BEST_TIME_GOGO_FAGGIO:
|
||||
|
@ -321,7 +326,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
|
|||
wchar* text2 = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
||||
strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
|
||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data
|
||||
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str2, 0, GET_INTEGER_PARAM(0), onscreen_str1, GET_INTEGER_PARAM(2));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GET_PLAYER_STORED_WEAPON:
|
||||
|
|
|
@ -190,7 +190,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
|
|||
{
|
||||
uint16 counter = (uint8*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - CTheScripts::ScriptSpace;
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CUserDisplay::OnscnTimer.AddCounter(counter, GET_INTEGER_PARAM(0), nil, 0);
|
||||
CUserDisplay::OnscnTimer.AddCounter(counter, GET_INTEGER_PARAM(0), nil, 0, -1, nil, 0);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CLEAR_ONSCREEN_COUNTER:
|
||||
|
@ -467,8 +467,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
|
|||
float length = GET_FLOAT_PARAM(5);
|
||||
float x, y;
|
||||
if (angle != 0.0f){
|
||||
y = cos(angle) * length;
|
||||
x = sin(angle) * length;
|
||||
y = Cos(angle) * length;
|
||||
x = Sin(angle) * length;
|
||||
}else{
|
||||
y = length;
|
||||
x = 0.0f;
|
||||
|
|
|
@ -316,7 +316,6 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||
CVehicle* pTarget;
|
||||
if (GET_INTEGER_PARAM(1) >= 0) {
|
||||
pTarget = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
|
||||
script_assert(pTarget);
|
||||
}
|
||||
else {
|
||||
pTarget = nil;
|
||||
|
@ -374,10 +373,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||
case COMMAND_IS_CAR_ARMED_WITH_ANY_BOMB:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
script_assert(pCar);
|
||||
script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
script_assert(pVehicle);
|
||||
#ifdef FIX_BUGS
|
||||
if (pVehicle->IsCar())
|
||||
UpdateCompareFlag(((CAutomobile*)pVehicle)->m_bombType != 0);
|
||||
else if (pVehicle->IsBike())
|
||||
UpdateCompareFlag(((CBike*)pVehicle)->m_bombType != 0);
|
||||
else
|
||||
UpdateCompareFlag(false);
|
||||
#else
|
||||
CAutomobile* pCar = (CVehicle*)pVehicle;
|
||||
UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_APPLY_BRAKES_TO_PLAYERS_CAR:
|
||||
|
@ -448,10 +456,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||
case COMMAND_IS_CAR_ARMED_WITH_BOMB:
|
||||
{
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
script_assert(pCar);
|
||||
script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
|
||||
UpdateCompareFlag(pCar->m_bombType == GET_INTEGER_PARAM(1));
|
||||
CAutomobile* pVehicle = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
script_assert(pVehicle);
|
||||
#ifdef FIX_BUGS
|
||||
if (pVehicle->IsCar())
|
||||
UpdateCompareFlag(((CAutomobile*)pVehicle)->m_bombType == GET_INTEGER_PARAM(1));
|
||||
else if (pVehicle->IsBike())
|
||||
UpdateCompareFlag(((CBike*)pVehicle)->m_bombType == GET_INTEGER_PARAM(1));
|
||||
else
|
||||
UpdateCompareFlag(false);
|
||||
#else
|
||||
CAutomobile* pCar = (CVehicle*)pVehicle;
|
||||
UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CHANGE_CAR_COLOUR:
|
||||
|
@ -711,9 +728,19 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||
CollectParameters(&m_nIp, 2);
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
script_assert(pVehicle);
|
||||
script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
|
||||
#ifdef FIX_BUGS
|
||||
if (pVehicle->IsCar()) {
|
||||
((CAutomobile*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1);
|
||||
((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed();
|
||||
}
|
||||
else if (pVehicle->IsBike()) {
|
||||
((CBike*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1);
|
||||
((CBike*)pVehicle)->m_pBombRigger = FindPlayerPed();
|
||||
}
|
||||
#else
|
||||
((CAutomobile*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1);
|
||||
((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CHAR_PERSONALITY:
|
||||
|
@ -777,7 +804,10 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||
int model = GET_INTEGER_PARAM(0);
|
||||
if (model < 0)
|
||||
model = CTheScripts::UsedObjectArray[-model].index;
|
||||
CStreaming::SetMissionDoesntRequireModel(model);
|
||||
if (m_bIsMissionScript)
|
||||
CStreaming::SetMissionDoesntRequireModel(model);
|
||||
else
|
||||
CStreaming::SetAmbientMissionDoesntRequireModel(model);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GRAB_PHONE:
|
||||
|
@ -1244,8 +1274,8 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
|
|||
CollectParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CStreaming::SetMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1);
|
||||
//else
|
||||
// CStreaming::SetAmbientMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1); // TODO
|
||||
else
|
||||
CStreaming::SetAmbientMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1);
|
||||
return 0;
|
||||
case COMMAND_RESET_NUM_OF_MODELS_KILLED_BY_PLAYER:
|
||||
CDarkel::ResetModelsKilledByPlayer();
|
||||
|
@ -1394,7 +1424,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
|
|||
if (GET_INTEGER_PARAM(0) != 0)
|
||||
TheCamera.SetWideScreenOn();
|
||||
else {
|
||||
// TODO: unknown field
|
||||
// TODO(LCS): unknown field
|
||||
TheCamera.SetWideScreenOff();
|
||||
}
|
||||
return 0;
|
||||
|
@ -1945,7 +1975,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
|
||||
CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
|
||||
SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, GET_INTEGER_PARAM(3))); // MI_MONEY -> gpModelIndices[...]
|
||||
SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, GET_INTEGER_PARAM(3)));
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1954,7 +1984,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||
CollectParameters(&m_nIp, 2);
|
||||
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
script_assert(pPed);
|
||||
pPed->m_wepAccuracy = GET_INTEGER_PARAM(1) * 1.25f;
|
||||
pPed->m_wepAccuracy = Min(100, GET_INTEGER_PARAM(1) * 1.25f);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GET_CAR_SPEED:
|
||||
|
@ -1970,7 +2000,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||
{
|
||||
char name[KEY_LENGTH_IN_SCRIPT];
|
||||
strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
|
||||
// unknown call FUN_29df68(name) on PS2
|
||||
// unknown call FUN_29df68(name) on PS2 - not on PSP
|
||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||
CColStore::RemoveAllCollision();
|
||||
CCutsceneMgr::LoadCutsceneData(name);
|
||||
|
@ -2011,7 +2041,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||
return 0;
|
||||
}
|
||||
case COMMAND_CLEAR_CUTSCENE:
|
||||
// unknown call on PS2 FUN_29DFA0();
|
||||
// unknown call on PS2 FUN_29DFA0() - not on PSP
|
||||
printf("clear cutscene\n");
|
||||
CCutsceneMgr::DeleteCutsceneData();
|
||||
return 0;
|
||||
|
|
|
@ -744,7 +744,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||
CollectParameters(&m_nIp, 2);
|
||||
CPlayerPed* pPlayerPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
|
||||
script_assert(pPlayerPed);
|
||||
pPlayerPed->m_fArmour = clamp(pPlayerPed->m_fArmour + GET_INTEGER_PARAM(1), 0.0f, CWorld::Players[GET_INTEGER_PARAM(0)].m_nMaxArmour);
|
||||
pPlayerPed->m_fArmour = Clamp(pPlayerPed->m_fArmour + GET_INTEGER_PARAM(1), 0.0f, CWorld::Players[GET_INTEGER_PARAM(0)].m_nMaxArmour);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ADD_ARMOUR_TO_CHAR:
|
||||
|
@ -752,7 +752,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||
CollectParameters(&m_nIp, 2);
|
||||
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
script_assert(pPed);
|
||||
pPed->m_fArmour = clamp(pPed->m_fArmour + GET_INTEGER_PARAM(1), 0.0f, 100.0f);
|
||||
pPed->m_fArmour = Clamp(pPed->m_fArmour + GET_INTEGER_PARAM(1), 0.0f, 100.0f);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_OPEN_GARAGE:
|
||||
|
@ -789,7 +789,22 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||
pPed->m_pMyVehicle->RemovePassenger(pPed);
|
||||
}
|
||||
if (pPed->m_vehDoor) {
|
||||
if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR) {
|
||||
eDoors door;
|
||||
switch (pPed->m_vehDoor) {
|
||||
case CAR_DOOR_LF:
|
||||
door = DOOR_FRONT_LEFT;
|
||||
break;
|
||||
case CAR_DOOR_RF:
|
||||
door = DOOR_FRONT_RIGHT;
|
||||
break;
|
||||
case CAR_DOOR_LR:
|
||||
door = DOOR_REAR_LEFT;
|
||||
break;
|
||||
case CAR_DOOR_RR:
|
||||
door = DOOR_REAR_RIGHT;
|
||||
break;
|
||||
}
|
||||
if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR || !pPed->m_pMyVehicle->IsDoorClosed(door)) {
|
||||
uint8 flags = 0;
|
||||
if (pPed->m_pMyVehicle->IsBike()) {
|
||||
if (pPed->m_vehDoor == CAR_DOOR_LF ||
|
||||
|
@ -806,7 +821,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||
flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_LF : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR;
|
||||
break;
|
||||
case CAR_DOOR_LR:
|
||||
flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_RF : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR;
|
||||
flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_LR : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR;
|
||||
break;
|
||||
case CAR_DOOR_RF:
|
||||
flags = CAR_DOOR_FLAG_RF;
|
||||
|
@ -1396,8 +1411,10 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
|
||||
DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, 0);
|
||||
DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, FALSE);
|
||||
#ifndef GTA_PSP
|
||||
//DMAudio.SaveAnnouncementsWhenMissionPassedPlayed(); // TODO!
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CLEAR_AREA:
|
||||
|
@ -1407,6 +1424,9 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
CWorld::ClearExcitingStuffFromArea(pos, GET_FLOAT_PARAM(3), GET_INTEGER_PARAM(4));
|
||||
#ifdef GTA_MOBILE
|
||||
// CPopulation::ms_blockPedCreationForAFrame = true;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_FREEZE_ONSCREEN_TIMER:
|
||||
|
@ -1471,7 +1491,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
float size = Max(0.0f, GET_FLOAT_PARAM(7));
|
||||
eParticleObjectType type = (eParticleObjectType)GET_INTEGER_PARAM(0);
|
||||
RwRGBA color;
|
||||
if (type == POBJECT_SMOKE_TRAIL){ // 17 in LCS -- assuming enum is the same
|
||||
if (type == POBJECT_SMOKE_TRAIL){
|
||||
color.alpha = -1;
|
||||
color.red = GET_INTEGER_PARAM(8);
|
||||
color.green = GET_INTEGER_PARAM(9);
|
||||
|
@ -1771,7 +1791,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
|
||||
strncpy(onscreen_str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
|
||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(0), onscreen_str, 0);
|
||||
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(0), onscreen_str, 0, -1, nil, 0);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CREATE_RANDOM_CAR_FOR_CAR_PARK:
|
||||
|
@ -1790,8 +1810,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
continue;
|
||||
if (CModelInfo::IsCarModel(model) || CModelInfo::IsBikeModel(model)) {
|
||||
switch (model) {
|
||||
// TODO(LCS): do it right
|
||||
// apparently leeds didn't :lmao:
|
||||
case MI_LANDSTAL:
|
||||
case MI_LINERUN:
|
||||
case MI_RIO:
|
||||
|
@ -1804,6 +1822,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
case MI_FBICAR:
|
||||
case MI_MRWHOOP:
|
||||
case MI_BFINJECT:
|
||||
case MI_HEARSE:
|
||||
case MI_HUNTER:
|
||||
case MI_POLICE:
|
||||
case MI_ENFORCER:
|
||||
|
@ -1817,13 +1836,15 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
case MI_ANGEL:
|
||||
case MI_COACH:
|
||||
case MI_RCBANDIT:
|
||||
//case MI_ROMERO:
|
||||
//case MI_PACKER:
|
||||
//case MI_SENTXS:
|
||||
case MI_PACKER:
|
||||
case MI_SENTXS:
|
||||
case MI_SQUALO:
|
||||
case MI_SEASPAR:
|
||||
case MI_PIZZABOY:
|
||||
//case MI_GANGBUR:
|
||||
case MI_NOODLEBOY:
|
||||
case MI_ANGEL2:
|
||||
case MI_SANCHEZ2:
|
||||
case MI_GANGBUR:
|
||||
case MI_AIRTRAIN:
|
||||
case MI_DEADDODO:
|
||||
case MI_SPEEDER:
|
||||
|
@ -1832,45 +1853,49 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
case MI_FLATBED:
|
||||
case MI_YANKEE:
|
||||
case MI_CADDY:
|
||||
//case MI_ZEBRA:
|
||||
case MI_BORGNINE:
|
||||
case MI_TOPFUN:
|
||||
case MI_CAMPVAN:
|
||||
case MI_BALLOT:
|
||||
case MI_SKIMMER:
|
||||
case MI_RCBARON:
|
||||
case MI_RCRAIDER:
|
||||
case MI_SPARROW:
|
||||
case MI_PATRIOT:
|
||||
//case MI_LOVEFIST:
|
||||
case MI_LOVEFIST:
|
||||
case MI_COASTG:
|
||||
case MI_DINGHY:
|
||||
//case MI_HERMES:
|
||||
//case MI_SABRETUR:
|
||||
case MI_HERMES:
|
||||
case MI_SABRETUR:
|
||||
case MI_PHEONIX:
|
||||
//case MI_WALTON:
|
||||
case MI_WALTON:
|
||||
case MI_COMET:
|
||||
//case MI_DELUXO:
|
||||
//case MI_BURRITO:
|
||||
//case MI_SPAND:
|
||||
case MI_DELUXO:
|
||||
case MI_BURRITO:
|
||||
case MI_SPAND:
|
||||
case MI_MARQUIS:
|
||||
case MI_BAGGAGE:
|
||||
//case MI_KAUFMAN:
|
||||
case MI_KAUFMAN:
|
||||
case MI_MAVERICK:
|
||||
case MI_VCNMAV:
|
||||
//case MI_RANCHER:
|
||||
case MI_RANCHER:
|
||||
case MI_FBIRANCH:
|
||||
case MI_JETMAX:
|
||||
//case MI_HOTRING:
|
||||
case MI_HOTRING:
|
||||
case MI_SANDKING:
|
||||
//case MI_BLISTAC:
|
||||
case MI_BLISTAC:
|
||||
case MI_POLMAV:
|
||||
//case MI_BOXVILLE:
|
||||
//case MI_BENSON:
|
||||
//case MI_MESA:
|
||||
case MI_BOXVILLE:
|
||||
case MI_BENSON:
|
||||
case MI_MESA:
|
||||
case MI_RCGOBLIN:
|
||||
//case MI_HOTRINA:
|
||||
//case MI_HOTRINB:
|
||||
//case MI_BLOODRA:
|
||||
//case MI_BLOODRB:
|
||||
case MI_HOTRINA:
|
||||
case MI_HOTRINB:
|
||||
case MI_BLOODRA:
|
||||
case MI_BLOODRB:
|
||||
case MI_VICECHEE:
|
||||
case MI_CABBIE:
|
||||
case MI_MAFIA:
|
||||
model = -1;
|
||||
break;
|
||||
case MI_IDAHO:
|
||||
|
@ -1884,23 +1909,22 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
case MI_MOONBEAM:
|
||||
case MI_ESPERANT:
|
||||
case MI_TAXI:
|
||||
//case MI_WASHING:
|
||||
case MI_WASHING:
|
||||
case MI_BOBCAT:
|
||||
case MI_BANSHEE:
|
||||
//case MI_CABBIE:
|
||||
case MI_STALLION:
|
||||
case MI_RUMPO:
|
||||
//case MI_ADMIRAL:
|
||||
case MI_ADMIRAL:
|
||||
case MI_PCJ600:
|
||||
case MI_FAGGIO:
|
||||
case MI_FREEWAY:
|
||||
//case MI_GLENDALE:
|
||||
//case MI_OCEANIC:
|
||||
case MI_GLENDALE:
|
||||
case MI_OCEANIC:
|
||||
case MI_SANCHEZ:
|
||||
//case MI_SABRE:
|
||||
//case MI_REGINA:
|
||||
//case MI_VIRGO:
|
||||
//case MI_GREENWOO:
|
||||
case MI_SABRE:
|
||||
case MI_REGINA:
|
||||
case MI_VIRGO:
|
||||
case MI_GREENWOO:
|
||||
break;
|
||||
default:
|
||||
printf("CREATE_RANDOM_CAR_FOR_CAR_PARK - Unknown car model %d\n", CStreaming::ms_vehiclesLoaded[index]);
|
||||
|
@ -1973,7 +1997,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
#else
|
||||
CTimer::Stop();
|
||||
#endif
|
||||
CStreaming::LoadScene(pos);
|
||||
CStreaming::LoadSceneCollision(pos);
|
||||
#ifdef FIX_BUGS
|
||||
CTimer::Suspend();
|
||||
#else
|
||||
|
@ -2012,8 +2036,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
case COMMAND_HAS_MISSION_AUDIO_LOADED:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
//UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(GET_INTEGER_PARAM(0) - 1) == 1);
|
||||
UpdateCompareFlag(true); // TODO
|
||||
UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(GET_INTEGER_PARAM(0) - 1) == 1);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_PLAY_MISSION_AUDIO:
|
||||
|
@ -2023,8 +2046,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||
case COMMAND_HAS_MISSION_AUDIO_FINISHED:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
//UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(GET_INTEGER_PARAM(0) - 1)); // TODO
|
||||
UpdateCompareFlag(true);
|
||||
UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(GET_INTEGER_PARAM(0) - 1));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING:
|
||||
|
@ -2264,8 +2286,10 @@ void CTheScripts::SwapNearestBuildingModel(float x, float y, float z, float radi
|
|||
}
|
||||
}
|
||||
CBuilding* pReplacedBuilding = ((CBuilding*)pClosestEntity);
|
||||
pReplacedBuilding->ReplaceWithNewModel(mi2);
|
||||
AddToBuildingSwapArray(pReplacedBuilding, mi1, mi2);
|
||||
if (pReplacedBuilding) {
|
||||
pReplacedBuilding->ReplaceWithNewModel(mi2);
|
||||
AddToBuildingSwapArray(pReplacedBuilding, mi1, mi2);
|
||||
}
|
||||
}
|
||||
|
||||
void CTheScripts::AddToBuildingSwapArray(CBuilding* pBuilding, int32 old_model, int32 new_model)
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
#include "Pools.h"
|
||||
#include "Population.h"
|
||||
#include "RpAnimBlend.h"
|
||||
#include "SaveBuf.h"
|
||||
#include "Shadows.h"
|
||||
#include "SpecialFX.h"
|
||||
#include "World.h"
|
||||
#include "main.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
// LCS: file done except TODOs
|
||||
|
||||
|
@ -1002,10 +1004,10 @@ void CRunningScript::PlayerInAngledAreaCheckCommand(int32 command, uint32* pIp)
|
|||
initAngle -= TWOPI;
|
||||
// it looks like the idea is to use a rectangle using the diagonal of the rectangle as
|
||||
// the side of new rectangle, with "length" being the length of second side
|
||||
float rotatedSupX = supX + side2length * sin(initAngle);
|
||||
float rotatedSupY = supY - side2length * cos(initAngle);
|
||||
float rotatedInfX = infX + side2length * sin(initAngle);
|
||||
float rotatedInfY = infY - side2length * cos(initAngle);
|
||||
float rotatedSupX = supX + side2length * Sin(initAngle);
|
||||
float rotatedSupY = supY - side2length * Cos(initAngle);
|
||||
float rotatedInfX = infX + side2length * Sin(initAngle);
|
||||
float rotatedInfY = infY - side2length * Cos(initAngle);
|
||||
float side1X = supX - infX;
|
||||
float side1Y = supY - infY;
|
||||
float side1Length = CVector2D(side1X, side1Y).Magnitude();
|
||||
|
@ -1382,10 +1384,12 @@ void CRunningScript::DoDeatharrestCheck()
|
|||
if (!pPlayer->IsRestartingAfterDeath() && !pPlayer->IsRestartingAfterArrest())
|
||||
return;
|
||||
#ifdef MISSION_REPLAY
|
||||
if (AllowMissionReplay != 0)
|
||||
if (AllowMissionReplay != MISSION_RETRY_STAGE_WAIT_FOR_TIMER_AFTER_RESTART && AllowMissionReplay != MISSION_RETRY_STAGE_NORMAL)
|
||||
return;
|
||||
if (AllowMissionReplay == MISSION_RETRY_STAGE_WAIT_FOR_TIMER_AFTER_RESTART)
|
||||
AllowMissionReplay = MISSION_RETRY_STAGE_NORMAL;
|
||||
if (CanAllowMissionReplay())
|
||||
AllowMissionReplay = 1;
|
||||
AllowMissionReplay = MISSION_RETRY_STAGE_WAIT_FOR_SCRIPT_TO_TERMINATE;
|
||||
#endif
|
||||
script_assert(m_nStackPointer > 0);
|
||||
while (m_nStackPointer > 1)
|
||||
|
@ -1927,7 +1931,7 @@ bool CRunningScript::CheckDamagedWeaponType(int32 actual, int32 type)
|
|||
if (type == WEAPONTYPE_ANYMELEE) {
|
||||
if (actual <= WEAPONTYPE_CHAINSAW)
|
||||
return true;
|
||||
if (actual - WEAPONTYPE_GRENADE <= WEAPONTYPE_MINIGUN)
|
||||
if (actual >= WEAPONTYPE_GRENADE && actual <= WEAPONTYPE_UNIDENTIFIED)
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
@ -2113,8 +2117,8 @@ void CTheScripts::RenderTheScriptDebugLines()
|
|||
}
|
||||
*/
|
||||
|
||||
#define SCRIPT_DATA_SIZE sizeof(CTheScripts::OnAMissionFlag) +\
|
||||
4 * sizeof(uint32) * MAX_NUM_BUILDING_SWAPS + 2 * sizeof(uint32) * MAX_NUM_INVISIBILITY_SETTINGS + 5 * sizeof(uint32)
|
||||
#define SCRIPT_DATA_SIZE sizeof(CTheScripts::OnAMissionFlag) + sizeof(tCollectiveData) * MAX_NUM_COLLECTIVES +\
|
||||
4 * sizeof(uint32) * MAX_NUM_BUILDING_SWAPS + 2 * sizeof(uint32) * MAX_NUM_INVISIBILITY_SETTINGS + 4 * sizeof(uint32)
|
||||
|
||||
void CTheScripts::SaveAllScripts(uint8* buf, uint32* size)
|
||||
{
|
||||
|
@ -2123,7 +2127,7 @@ INITSAVEBUF
|
|||
uint32 runningScripts = 0;
|
||||
for (CRunningScript* pScript = pActiveScripts; pScript; pScript = pScript->GetNext())
|
||||
runningScripts++;
|
||||
*size = CRunningScript::nSaveStructSize * runningScripts + varSpace + SCRIPT_DATA_SIZE + SAVE_HEADER_SIZE + 3 * sizeof(uint32);
|
||||
*size = CRunningScript::nSaveStructSize * runningScripts + varSpace + SCRIPT_DATA_SIZE + SAVE_HEADER_SIZE + 5 * sizeof(uint32);
|
||||
WriteSaveHeader(buf, 'S', 'C', 'R', '\0', *size - SAVE_HEADER_SIZE);
|
||||
WriteSaveBuf(buf, varSpace);
|
||||
for (uint32 i = 0; i < varSpace; i++)
|
||||
|
@ -2199,35 +2203,36 @@ INITSAVEBUF
|
|||
VALIDATESAVEBUF(*size)
|
||||
}
|
||||
|
||||
// TODO: I don't really understand how script loading works, so I leave it the VC way for now.
|
||||
bool CTheScripts::LoadAllScripts(uint8* buf, uint32 size)
|
||||
{
|
||||
Init(); // TODO: in LCS CTheScripts::Init call GenericLoad, which then calls LoadAllScripts
|
||||
INITSAVEBUF
|
||||
CheckSaveHeader(buf, 'S', 'C', 'R', '\0', size - SAVE_HEADER_SIZE);
|
||||
uint32 varSpace = ReadSaveBuf<uint32>(buf);
|
||||
uint32 varSpace, type, handle;
|
||||
uint32 tmp;
|
||||
|
||||
ReadSaveBuf(&varSpace, buf);
|
||||
if (*(int32*)&ScriptSpace[0] != *(int32*)&buf[0] || *(int32*)&ScriptSpace[4] != *(int32*)&buf[4]) {
|
||||
printf("\n===================================================\nSave Game Mismatch!!!\n");
|
||||
return false;
|
||||
}
|
||||
for (uint32 i = 0; i < varSpace; i++) { // this is not exactly what function does
|
||||
if (i < 8)
|
||||
ScriptSpace[i] = ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf(&ScriptSpace[i], buf);
|
||||
else if (GetSaveVarIndex(i / 4 * 4) != -1)
|
||||
ScriptSpace[i] = ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf(&ScriptSpace[i], buf);
|
||||
else
|
||||
ReadSaveBuf<uint8>(buf);
|
||||
SkipSaveBuf(buf, 1);
|
||||
}
|
||||
// everything else is... gone? TODO
|
||||
script_assert(ReadSaveBuf<uint32>(buf) == SCRIPT_DATA_SIZE);
|
||||
OnAMissionFlag = ReadSaveBuf<uint32>(buf);
|
||||
LastMissionPassedTime = ReadSaveBuf<uint32>(buf);
|
||||
ReadSaveBuf(&tmp, buf);
|
||||
script_assert(tmp == SCRIPT_DATA_SIZE);
|
||||
ReadSaveBuf(&OnAMissionFlag, buf);
|
||||
ReadSaveBuf(&LastMissionPassedTime, buf);
|
||||
for (uint32 i = 0; i < MAX_NUM_COLLECTIVES; i++)
|
||||
CollectiveArray[i] = ReadSaveBuf<tCollectiveData>(buf);
|
||||
NextFreeCollectiveIndex = ReadSaveBuf<int32>(buf);
|
||||
ReadSaveBuf(&CollectiveArray[i], buf);
|
||||
ReadSaveBuf(&NextFreeCollectiveIndex, buf);
|
||||
for (uint32 i = 0; i < MAX_NUM_BUILDING_SWAPS; i++) {
|
||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
||||
uint32 handle = ReadSaveBuf<uint32>(buf);
|
||||
ReadSaveBuf(&type, buf);
|
||||
ReadSaveBuf(&handle, buf);
|
||||
/*
|
||||
switch (type) {
|
||||
case 0:
|
||||
|
@ -2243,16 +2248,17 @@ INITSAVEBUF
|
|||
script_assert(false);
|
||||
}
|
||||
*/
|
||||
/*BuildingSwapArray[i].m_nNewModel = */ReadSaveBuf<uint32>(buf);
|
||||
/*BuildingSwapArray[i].m_nOldModel = */ReadSaveBuf<uint32>(buf);
|
||||
/*BuildingSwapArray[i].m_nNewModel = ReadSaveBuf<uint32>(buf);*/
|
||||
/*BuildingSwapArray[i].m_nOldModel = ReadSaveBuf<uint32>(buf);*/
|
||||
SkipSaveBuf(buf, 8);
|
||||
/*
|
||||
if (BuildingSwapArray[i].m_pBuilding)
|
||||
BuildingSwapArray[i].m_pBuilding->ReplaceWithNewModel(BuildingSwapArray[i].m_nNewModel);
|
||||
*/
|
||||
}
|
||||
for (uint32 i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
|
||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
||||
uint32 handle = ReadSaveBuf<uint32>(buf);
|
||||
ReadSaveBuf(&type, buf);
|
||||
ReadSaveBuf(&handle, buf);
|
||||
/*
|
||||
switch (type) {
|
||||
case 0:
|
||||
|
@ -2277,17 +2283,27 @@ INITSAVEBUF
|
|||
InvisibilitySettingArray[i]->bIsVisible = false;
|
||||
*/
|
||||
}
|
||||
script_assert(ReadSaveBuf<bool>(buf) == bUsingAMultiScriptFile);
|
||||
/*bPlayerHasMetDebbieHarry = */ReadSaveBuf<uint8>(buf);
|
||||
ReadSaveBuf<uint16>(buf);
|
||||
script_assert(ReadSaveBuf<uint32>(buf) == MainScriptSize);
|
||||
script_assert(ReadSaveBuf<uint32>(buf) == LargestMissionScriptSize);
|
||||
script_assert(ReadSaveBuf<uint16>(buf) == NumberOfMissionScripts);
|
||||
script_assert(ReadSaveBuf<uint16>(buf) == NumberOfExclusiveMissionScripts);
|
||||
uint32 runningScripts = ReadSaveBuf<uint32>(buf);
|
||||
bool tmpBool;
|
||||
ReadSaveBuf(&tmpBool, buf);
|
||||
script_assert(tmpBool == bUsingAMultiScriptFile);
|
||||
///*bPlayerHasMetDebbieHarry = */ReadSaveBuf<uint8>(buf);
|
||||
//ReadSaveBuf<uint16>(buf);
|
||||
|
||||
SkipSaveBuf(buf, 3);
|
||||
|
||||
ReadSaveBuf(&tmp, buf);
|
||||
script_assert(tmp == MainScriptSize);
|
||||
ReadSaveBuf(&tmp, buf);
|
||||
script_assert(tmp == LargestMissionScriptSize);
|
||||
uint16 tmp16;
|
||||
ReadSaveBuf(&tmp16, buf);
|
||||
script_assert(tmp16 == NumberOfMissionScripts);
|
||||
ReadSaveBuf(&tmp16, buf);
|
||||
script_assert(tmp16 == NumberOfExclusiveMissionScripts);
|
||||
uint32 runningScripts;
|
||||
ReadSaveBuf(&runningScripts, buf);
|
||||
for (uint32 i = 0; i < runningScripts; i++)
|
||||
CRunningScript().Load(buf);
|
||||
StartTestScript(); // <- tmp hack
|
||||
return true;
|
||||
VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
@ -2297,35 +2313,35 @@ VALIDATESAVEBUF(size)
|
|||
void CRunningScript::Save(uint8*& buf)
|
||||
{
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
SkipSaveBuf(buf, 8);
|
||||
ZeroSaveBuf(buf, 8);
|
||||
WriteSaveBuf<int32>(buf, m_nId);
|
||||
for (int i = 0; i < 8; i++)
|
||||
WriteSaveBuf<char>(buf, m_abScriptName[i]);
|
||||
WriteSaveBuf<uint32>(buf, m_nIp);
|
||||
WriteSaveBuf(buf, m_abScriptName[i]);
|
||||
WriteSaveBuf(buf, m_nIp);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||
#endif
|
||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||
WriteSaveBuf<uint32>(buf, m_anStack[i]);
|
||||
WriteSaveBuf<uint16>(buf, m_nStackPointer);
|
||||
SkipSaveBuf(buf, 2);
|
||||
WriteSaveBuf(buf, m_anStack[i]);
|
||||
WriteSaveBuf(buf, m_nStackPointer);
|
||||
ZeroSaveBuf(buf, 2);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(NUM_LOCAL_VARS + 8 + NUM_TIMERS == 106, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 106");
|
||||
#endif
|
||||
for (int i = 0; i < NUM_LOCAL_VARS + 8 + NUM_TIMERS; i++)
|
||||
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
|
||||
WriteSaveBuf<int32>(buf, m_nLocalsPointer);
|
||||
WriteSaveBuf<bool>(buf, m_bIsActive);
|
||||
WriteSaveBuf<bool>(buf, m_bCondResult);
|
||||
WriteSaveBuf<bool>(buf, m_bIsMissionScript);
|
||||
WriteSaveBuf<bool>(buf, m_bSkipWakeTime);
|
||||
WriteSaveBuf<uint32>(buf, m_nWakeTime);
|
||||
WriteSaveBuf<uint16>(buf, m_nAndOrState);
|
||||
WriteSaveBuf<bool>(buf, m_bNotFlag);
|
||||
WriteSaveBuf<bool>(buf, m_bDeatharrestEnabled);
|
||||
WriteSaveBuf<bool>(buf, m_bDeatharrestExecuted);
|
||||
WriteSaveBuf<bool>(buf, m_bMissionFlag);
|
||||
SkipSaveBuf(buf, 2);
|
||||
WriteSaveBuf(buf, m_anLocalVariables[i]);
|
||||
WriteSaveBuf(buf, m_nLocalsPointer);
|
||||
WriteSaveBuf(buf, m_bIsActive);
|
||||
WriteSaveBuf(buf, m_bCondResult);
|
||||
WriteSaveBuf(buf, m_bIsMissionScript);
|
||||
WriteSaveBuf(buf, m_bSkipWakeTime);
|
||||
WriteSaveBuf(buf, m_nWakeTime);
|
||||
WriteSaveBuf(buf, m_nAndOrState);
|
||||
WriteSaveBuf(buf, m_bNotFlag);
|
||||
WriteSaveBuf(buf, m_bDeatharrestEnabled);
|
||||
WriteSaveBuf(buf, m_bDeatharrestExecuted);
|
||||
WriteSaveBuf(buf, m_bMissionFlag);
|
||||
ZeroSaveBuf(buf, 2);
|
||||
#else
|
||||
WriteSaveBuf(buf, *this);
|
||||
#endif
|
||||
|
@ -2335,38 +2351,38 @@ void CRunningScript::Load(uint8*& buf)
|
|||
{
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
SkipSaveBuf(buf, 8);
|
||||
m_nId = ReadSaveBuf<int32>(buf);
|
||||
ReadSaveBuf(&m_nId, buf);
|
||||
for (int i = 0; i < 8; i++)
|
||||
m_abScriptName[i] = ReadSaveBuf<char>(buf);
|
||||
m_nIp = ReadSaveBuf<uint32>(buf);
|
||||
ReadSaveBuf(&m_abScriptName[i], buf);
|
||||
ReadSaveBuf(&m_nIp, buf);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||
#endif
|
||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||
m_anStack[i] = ReadSaveBuf<uint32>(buf);
|
||||
m_nStackPointer = ReadSaveBuf<uint16>(buf);
|
||||
ReadSaveBuf(&m_anStack[i], buf);
|
||||
ReadSaveBuf(&m_nStackPointer, buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(NUM_LOCAL_VARS + 8 + NUM_TIMERS == 106, "Compatibility loss: NUM_LOCAL_VARS + 8 + NUM_TIMERS != 106");
|
||||
#endif
|
||||
for (int i = 0; i < NUM_LOCAL_VARS + 8 + NUM_TIMERS; i++)
|
||||
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
|
||||
m_nLocalsPointer = ReadSaveBuf<int32>(buf);
|
||||
m_bIsActive = ReadSaveBuf<bool>(buf);
|
||||
m_bCondResult = ReadSaveBuf<bool>(buf);
|
||||
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
|
||||
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
|
||||
m_nWakeTime = ReadSaveBuf<uint32>(buf);
|
||||
m_nAndOrState = ReadSaveBuf<uint16>(buf);
|
||||
m_bNotFlag = ReadSaveBuf<bool>(buf);
|
||||
m_bDeatharrestEnabled = ReadSaveBuf<bool>(buf);
|
||||
m_bDeatharrestExecuted = ReadSaveBuf<bool>(buf);
|
||||
m_bMissionFlag = ReadSaveBuf<bool>(buf);
|
||||
ReadSaveBuf(&m_anLocalVariables[i], buf);
|
||||
ReadSaveBuf(&m_nLocalsPointer, buf);
|
||||
ReadSaveBuf(&m_bIsActive, buf);
|
||||
ReadSaveBuf(&m_bCondResult, buf);
|
||||
ReadSaveBuf(&m_bIsMissionScript, buf);
|
||||
ReadSaveBuf(&m_bSkipWakeTime, buf);
|
||||
ReadSaveBuf(&m_nWakeTime, buf);
|
||||
ReadSaveBuf(&m_nAndOrState, buf);
|
||||
ReadSaveBuf(&m_bNotFlag, buf);
|
||||
ReadSaveBuf(&m_bDeatharrestEnabled, buf);
|
||||
ReadSaveBuf(&m_bDeatharrestExecuted, buf);
|
||||
ReadSaveBuf(&m_bMissionFlag, buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#else
|
||||
CRunningScript* n = next;
|
||||
CRunningScript* p = prev;
|
||||
*this = ReadSaveBuf<CRunningScript>(buf);
|
||||
ReadSaveBuf(this, buf);
|
||||
next = n;
|
||||
prev = p;
|
||||
#endif
|
||||
|
@ -2460,7 +2476,7 @@ void CTheScripts::HighlightImportantArea(uint32 id, float x1, float y1, float x2
|
|||
center.x = (infX + supX) / 2;
|
||||
center.y = (infY + supY) / 2;
|
||||
center.z = (z <= MAP_Z_LOW_LIMIT) ? CWorld::FindGroundZForCoord(center.x, center.y) : z;
|
||||
CShadows::RenderIndicatorShadow(id, 2, gpGoalTex, ¢er, supX - center.x, 0.0f, 0.0f, center.y - supY, 0);
|
||||
CShadows::RenderIndicatorShadow(id, 2, nil, ¢er, supX - center.x, 0.0f, 0.0f, center.y - supY, 0);
|
||||
}
|
||||
|
||||
void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float z)
|
||||
|
@ -2654,7 +2670,10 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
|||
}
|
||||
else {
|
||||
pPed->bScriptObjectiveCompleted = false;
|
||||
pPed->SetObjective(objective);
|
||||
if (objective == OBJECTIVE_LEAVE_CAR)
|
||||
pPed->SetObjective(objective);
|
||||
else
|
||||
pPed->SetObjective(objective, pPed->m_pMyVehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2750,7 +2769,7 @@ void CTheScripts::CleanUpThisPed(CPed* pPed)
|
|||
flees = true;
|
||||
}
|
||||
pPed->ClearObjective();
|
||||
pPed->SetWaitState(WAITSTATE_FALSE, nil); // third parameter is 0 TODO?
|
||||
pPed->SetWaitState(WAITSTATE_FALSE, nil);
|
||||
pPed->bRespondsToThreats = true;
|
||||
pPed->bScriptObjectiveCompleted = false;
|
||||
pPed->bKindaStayInSamePlace = false;
|
||||
|
@ -2795,7 +2814,7 @@ void CTheScripts::ReadObjectNamesFromScript()
|
|||
int32 varSpace = GetSizeOfVariableSpace();
|
||||
uint32 ip = varSpace + 8;
|
||||
NumSaveVars = Read4BytesFromScript(&ip);
|
||||
SavedVarIndices = (short*)&ScriptSpace[ip];
|
||||
SavedVarIndices = (uint16*)&ScriptSpace[ip];
|
||||
ip += 2 * NumSaveVars;
|
||||
NumberOfUsedObjects = Read2BytesFromScript(&ip);
|
||||
ip += 2;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "CarAI.h"
|
||||
#include "Pickups.h"
|
||||
#include "Fluff.h"
|
||||
#include "CustomSoundTrack.h"
|
||||
|
||||
// LCS: file done except TODOs
|
||||
|
||||
|
@ -109,9 +110,12 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||
CollectParameters(&m_nIp, 2);
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
script_assert(pVehicle);
|
||||
script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
|
||||
CAutomobile* pCar = (CAutomobile*)pVehicle;
|
||||
pCar->bNotDamagedUpsideDown = (GET_INTEGER_PARAM(1) != 0);
|
||||
//assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
|
||||
// they call this for bikes again, we don't really want to destroy the structure...
|
||||
#ifdef FIX_BUGS
|
||||
if (pVehicle->m_vehType == VEHICLE_TYPE_CAR)
|
||||
#endif
|
||||
((CAutomobile*)pVehicle)->bNotDamagedUpsideDown = (GET_INTEGER_PARAM(1) != 0);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CAN_PLAYER_START_MISSION:
|
||||
|
@ -125,10 +129,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||
case COMMAND_MAKE_PLAYER_SAFE_FOR_CUTSCENE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
#ifdef MISSION_REPLAY
|
||||
AllowMissionReplay = 0;
|
||||
SaveGameForPause(3);
|
||||
#endif
|
||||
CPlayerInfo* pPlayerInfo = &CWorld::Players[GET_INTEGER_PARAM(0)];
|
||||
CPad::GetPad(GET_INTEGER_PARAM(0))->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
|
||||
pPlayerInfo->MakePlayerSafe(true);
|
||||
|
@ -372,6 +372,9 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||
return 0;
|
||||
case COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL:
|
||||
{
|
||||
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
|
||||
uint32 oldIp = m_nIp;
|
||||
#endif
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
||||
if (CTheScripts::NumberOfExclusiveMissionScripts > 0) {
|
||||
|
@ -381,8 +384,19 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||
}
|
||||
#ifdef MISSION_REPLAY
|
||||
missionRetryScriptIndex = GET_INTEGER_PARAM(0);
|
||||
if (missionRetryScriptIndex == 19)
|
||||
CStats::LastMissionPassedName[0] = '\0';
|
||||
#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
|
||||
if (CTheScripts::MissionSupportsMissionReplay(missionRetryScriptIndex)){
|
||||
if (!AlreadySavedGame) {
|
||||
m_nIp = oldIp - 2;
|
||||
SaveGameForPause(SAVE_TYPE_QUICKSAVE_FOR_SCRIPT);
|
||||
AlreadySavedGame = true;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
AlreadySavedGame = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
CTimer::Suspend();
|
||||
int offset = CTheScripts::MultiScriptArray[GET_INTEGER_PARAM(0)] + 8;
|
||||
|
@ -390,7 +404,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||
if (size <= 0)
|
||||
size = CTheScripts::LargestMissionScriptSize;
|
||||
CFileMgr::Seek(gScriptsFile, offset, 0);
|
||||
CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO
|
||||
CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size);
|
||||
CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
|
||||
CTimer::Resume();
|
||||
pMissionScript->m_bIsMissionScript = true;
|
||||
|
@ -458,8 +472,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||
return 0;
|
||||
case COMMAND_SET_RADIO_CHANNEL:
|
||||
CollectParameters(&m_nIp, 2);
|
||||
// if (base::cSingleton<cCustomSoundTrack>::Instance()->unk()) - TODO on PS2, but it's not on mobile
|
||||
DMAudio.SetRadioChannel(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
|
||||
if (!cCustomSoundTrack::Instance()->IsPlaying())
|
||||
DMAudio.SetRadioChannel(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
|
||||
return 0;
|
||||
/*
|
||||
case COMMAND_OVERRIDE_HOSPITAL_LEVEL:
|
||||
|
@ -1094,6 +1108,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||
}
|
||||
case COMMAND_FAIL_CURRENT_MISSION:
|
||||
CTheScripts::FailCurrentMission = 2;
|
||||
#ifdef MISSION_REPLAY
|
||||
MissionSkipLevel = 0;
|
||||
#endif
|
||||
return 0;
|
||||
case COMMAND_GET_CLOSEST_OBJECT_OF_TYPE:
|
||||
{
|
||||
|
@ -1768,6 +1785,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
case COMMAND_IS_CHAR_IN_ANY_BOAT:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
@ -1776,6 +1794,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
case COMMAND_IS_PLAYER_IN_ANY_BOAT:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
@ -1784,6 +1803,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
case COMMAND_IS_CHAR_IN_ANY_HELI:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
@ -1792,6 +1812,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
case COMMAND_IS_PLAYER_IN_ANY_HELI:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
@ -1800,6 +1821,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
case COMMAND_IS_CHAR_IN_ANY_PLANE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
@ -1808,6 +1830,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE);
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
case COMMAND_IS_PLAYER_IN_ANY_PLANE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
|
|
@ -373,6 +373,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
|||
}
|
||||
case COMMAND_HAS_PHOTOGRAPH_BEEN_TAKEN:
|
||||
UpdateCompareFlag(CWeapon::bPhotographHasBeenTaken);
|
||||
CWeapon::bPhotographHasBeenTaken = false;
|
||||
return 0;
|
||||
case COMMAND_GET_CHAR_ARMOUR:
|
||||
{
|
||||
|
@ -508,7 +509,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
|||
CTheScripts::ReadTextLabelFromScript(&m_nIp, key);
|
||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||
CStreaming::RemoveAnim(CAnimManager::GetAnimationBlockIndex(key));
|
||||
// + empty function on PS2
|
||||
// + empty function on PS2 (not PSP)
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CHAR_WAITING_FOR_WORLD_COLLISION:
|
||||
|
@ -570,7 +571,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
|||
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
|
||||
strncpy(onscreen_str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
|
||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(0), onscreen_str, GET_INTEGER_PARAM(1) - 1); // TODO: last params are -1, nil, 0
|
||||
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(0), onscreen_str, GET_INTEGER_PARAM(1) - 1, -1, nil, 0);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ADD_SET_PIECE:
|
||||
|
@ -636,11 +637,8 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
|||
SET_INTEGER_PARAM(1, 0);
|
||||
else if (GET_INTEGER_PARAM(1) == 3)
|
||||
SET_INTEGER_PARAM(1, 1);
|
||||
pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true);
|
||||
}
|
||||
else {
|
||||
pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true);
|
||||
}
|
||||
pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CHAR_OBJ_NO_OBJ:
|
||||
|
@ -812,7 +810,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
|||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||
// TheText.Get(key);
|
||||
CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
|
||||
SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY, PICKUP_PROPERTY_LOCKED, 0, 0, false, key)); // TODO: gpModelIndices
|
||||
SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY, PICKUP_PROPERTY_LOCKED, 0, 0, false, key));
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -825,9 +823,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
|||
char key[KEY_LENGTH_IN_SCRIPT];
|
||||
CTheScripts::ReadTextLabelFromScript(&m_nIp, key);
|
||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||
// TheText.Get(key);
|
||||
TheText.Get(key);
|
||||
CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
|
||||
SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY_FORSALE, PICKUP_PROPERTY_FORSALE, GET_INTEGER_PARAM(3), 0, false, key)); // TODO: gpModelIndices
|
||||
SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY_FORSALE, PICKUP_PROPERTY_FORSALE, GET_INTEGER_PARAM(3), 0, false, key));
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "Script.h"
|
||||
#include "ScriptCommands.h"
|
||||
|
||||
#include "Bike.h"
|
||||
#include "DMAudio.h"
|
||||
#ifdef MORE_LANGUAGES
|
||||
#include "Frontend.h"
|
||||
|
@ -378,15 +379,25 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
|
|||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
if (pVehicle->m_bombType != CARBOMB_NONE) {
|
||||
pVehicle->m_bombType = CARBOMB_NONE;
|
||||
pVehicle->m_pBombRigger = nil;
|
||||
if (pVehicle->IsCar()) {
|
||||
if (((CAutomobile*)pVehicle)->m_bombType != CARBOMB_NONE) {
|
||||
((CAutomobile*)pVehicle)->m_bombType = CARBOMB_NONE;
|
||||
((CAutomobile*)pVehicle)->m_pBombRigger = nil;
|
||||
}
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
else if (pVehicle->IsBike()) {
|
||||
if (((CBike*)pVehicle)->m_bombType != CARBOMB_NONE) {
|
||||
((CBike*)pVehicle)->m_bombType = CARBOMB_NONE;
|
||||
((CBike*)pVehicle)->m_pBombRigger = nil;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_JAPANESE_GAME:
|
||||
#ifdef MORE_LANGUAGES
|
||||
UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE);
|
||||
UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_JAPANESE);
|
||||
#elif (defined GTAVC_JP_PATCH)
|
||||
UpdateCompareFlag(true);
|
||||
#else
|
||||
|
@ -596,7 +607,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
|
|||
}
|
||||
case COMMAND_SET_RC_HELI_HEIGHT_LIMIT:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CVehicle::rcHeliHeightLimit = GET_FLOAT_PARAM(0); // TODO
|
||||
CVehicle::rcHeliHeightLimit = GET_FLOAT_PARAM(0);
|
||||
return 0;
|
||||
case COMMAND_CREATE_SCRIPT_CORONA:
|
||||
{
|
||||
|
@ -700,7 +711,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
|
|||
//case COMMAND_1491:
|
||||
case COMMAND_SET_DEBUG_MENU_ACTIVE:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// this sets two values on PS2, but not on mobile - TODO?
|
||||
// this sets two values on PS2 and PSP, but not on mobile - TODO?
|
||||
return 0;
|
||||
case COMMAND_SET_DRAW_HUD:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
#include "CarCtrl.h"
|
||||
#include "Camera.h"
|
||||
#include "CutsceneMgr.h"
|
||||
#include "Ferry.h"
|
||||
#include "Garages.h"
|
||||
#include "GameLogic.h"
|
||||
#include "Hud.h"
|
||||
#include "Messages.h"
|
||||
#include "Object.h"
|
||||
#include "OnscreenTimer.h"
|
||||
#include "Pad.h"
|
||||
#include "Ped.h"
|
||||
#include "Pools.h"
|
||||
|
@ -29,22 +31,22 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
case COMMAND_DISABLE_FERRY_PATH:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry:DissableFerryPath(GET_INTEGER_PARAM(0)); TODO
|
||||
CFerry::DissableFerryPath(GET_INTEGER_PARAM(0));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ENABLE_FERRY_PATH:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry::EnableFerryPath(GET_INTEGER_PARAM(0));
|
||||
CFerry::EnableFerryPath(GET_INTEGER_PARAM(0));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GET_CLOSEST_DOCKED_FERRY:
|
||||
{
|
||||
CollectParameters(&m_nIp, 2);
|
||||
// CFerry* pFerry = CFerry::GetClosestFerry(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1));
|
||||
CFerry* pFerry = CFerry::GetClosestFerry(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1));
|
||||
int id = -1;
|
||||
// if (pFerry && pFerry->IsDocked()
|
||||
// id = pFerry->GetId();
|
||||
if (pFerry && pFerry->IsDocked())
|
||||
id = pFerry->m_nFerryId;
|
||||
SET_INTEGER_PARAM(0, id);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
|
@ -52,43 +54,41 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
case COMMAND_OPEN_FERRY_DOOR:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
// script_assert(pFerry);
|
||||
// pFerry->OpenDoor();
|
||||
CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
script_assert(pFerry);
|
||||
pFerry->OpenDoor();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CLOSE_FERRY_DOOR:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
// script_assert(pFerry);
|
||||
// pFerry->CloseDoor();
|
||||
CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
script_assert(pFerry);
|
||||
pFerry->CloseDoor();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_FERRY_DOOR_OPEN:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
// script_assert(pFerry);
|
||||
// UpdateCompareFlag(pFerry->IsDoorOpen());
|
||||
UpdateCompareFlag(false);
|
||||
CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
script_assert(pFerry);
|
||||
UpdateCompareFlag(pFerry->IsDoorOpen());
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_FERRY_DOOR_CLOSED:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
// script_assert(pFerry);
|
||||
// UpdateCompareFlag(pFerry->IsDoorClosed());
|
||||
UpdateCompareFlag(true);
|
||||
CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
script_assert(pFerry);
|
||||
UpdateCompareFlag(pFerry->IsDoorClosed());
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SKIP_FERRY_TO_NEXT_DOCK:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
// script_assert(pFerry);
|
||||
// pFerry->SkipFerryToNextDock();
|
||||
CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
script_assert(pFerry);
|
||||
pFerry->SkipFerryToNextDock();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CHAR_DROPS_WEAPONS_ON_DEATH:
|
||||
|
@ -110,35 +110,36 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
case COMMAND_GET_FERRY_BOARDING_SPACE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 4);
|
||||
// CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
// script_assert(pFerry);
|
||||
// ? = pFerry->GetBoardingSpace((CFerry::eSpaceUse)GET_INTEGER_PARAMS(1), (CFerry::eSpaceStyle)GET_INTEGER_PARAMS(2), GET_INTEGER_PARAMS(3));
|
||||
SET_FLOAT_PARAM(0, 0.0f);
|
||||
SET_FLOAT_PARAM(1, 0.0f); // TODO
|
||||
CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
script_assert(pFerry);
|
||||
CVector space = pFerry->GetBoardingSpace((CFerry::eSpaceUse)GET_INTEGER_PARAM(1), (CFerry::eSpaceStyle)GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3));
|
||||
SET_FLOAT_PARAM(0, space.x);
|
||||
SET_FLOAT_PARAM(1, space.y);
|
||||
StoreParameters(&m_nIp, 2);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GET_FERRY_HEADING:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
// script_assert(pFerry);
|
||||
// float fHeading = CGeneral::GetATanOfXY(pFerry->GetForward().x, pFerry->GetForward().y);
|
||||
// SET_FLOAT_PARAM(0, fHeading);
|
||||
SET_FLOAT_PARAM(0, 0.0f);
|
||||
CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
script_assert(pFerry);
|
||||
float fHeading = Atan2(-pFerry->GetForward().x, pFerry->GetForward().y);
|
||||
SET_FLOAT_PARAM(0, fHeading);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_FERRIES_ENABLED:
|
||||
case COMMAND_SET_FERRIES_DISABLED:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry::SetFerriesEnabled(GET_INTEGER_PARAM(0));
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CFerry::SetFerriesDisabled(GET_INTEGER_PARAM(1));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_COMPLETE_FERRY_DOOR_MOVEMENT:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry::CompleteDorrMovement(GET_INTEGER_PARAM(0));
|
||||
CFerry* pFerry = CFerry::GetFerry(GET_INTEGER_PARAM(0));
|
||||
script_assert(pFerry);
|
||||
pFerry->CompleteDorrMovement();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_OVERRIDE_CAR_REMOTE_CONTROL:
|
||||
|
@ -157,7 +158,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
else {
|
||||
TheCamera.TakeControl(pVehicle, CCam::MODE_1STPERSON, GET_INTEGER_PARAM(1) ? INTERPOLATION : JUMP_CUT, CAMCONTROL_SCRIPT);
|
||||
script_assert(pVehicle->IsCar());
|
||||
//((CAutomobile*)pVehicle)->Damage.m_bSmashedDoorDoesntClose = true;
|
||||
((CAutomobile*)pVehicle)->Damage.m_bSmashedDoorDoesntClose = true;
|
||||
}
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CAR);
|
||||
|
@ -376,6 +377,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
}
|
||||
case COMMAND_CLEAR_OBJECT_LAST_WEAPON_DAMAGE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
|
||||
if (!pObject)
|
||||
printf("CLEAR_OBJECT_LAST_WEAPON_DAMAGE - pObject doesn\'t exist");
|
||||
|
@ -568,11 +570,11 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
}
|
||||
case COMMAND_LOAD_NON_STANDARD_PED_ANIM:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CPed::LoadNonStandardPedAnim(GET_INTEGER_PARAM(0));
|
||||
CPed::LoadNonStandardPedAnim((eWaitState)GET_INTEGER_PARAM(0));
|
||||
return 0;
|
||||
case COMMAND_UNLOAD_NON_STANDARD_PED_ANIM:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CPed::UnloadNonStandardPedAnim(SET_INTEGER_PARAM(0));
|
||||
CPed::UnloadNonStandardPedAnim((eWaitState)GET_INTEGER_PARAM(0));
|
||||
return 0;
|
||||
case COMMAND_1566:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
@ -592,13 +594,18 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
// base::cWorldGeom::GetInstance()->StoreBuildingSwap(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3) != 0);
|
||||
return 0;
|
||||
case COMMAND_IS_MULTIPLAYER_ACTIVE:
|
||||
UpdateCompareFlag(false); // TODO?
|
||||
#ifdef GTA_NETWORK
|
||||
UpdateCompareFlag(gIsMultiplayerGame);
|
||||
#else
|
||||
UpdateCompareFlag(false);
|
||||
#endif
|
||||
return 0;
|
||||
case COMMAND_GET_MULTIPLAYER_MODE:
|
||||
SET_INTEGER_PARAM(0, 0); // TODO
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
case COMMAND_MULTIPLAYER_SCRIPT_DONE:
|
||||
printf("COMMAND_MULTIPLAYER_SCRIPT_DONE\n");
|
||||
//gbStartingScriptsFromLua = false; TODO?
|
||||
return 0;
|
||||
case COMMAND_IS_MULTIPLAYER_SERVER:
|
||||
|
@ -616,11 +623,11 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
return 0;
|
||||
case COMMAND_SET_ONSCREEN_TIMER_COLOUR:
|
||||
CollectParameters(&m_nIp, 4);
|
||||
// gbColour = CRGBA(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3));
|
||||
gbColour = CRGBA(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3));
|
||||
return 0;
|
||||
case COMMAND_SET_ONSCREEN_TIMER_BACKGROUND_COLOUR:
|
||||
CollectParameters(&m_nIp, 4);
|
||||
// gbColour2 = CRGBA(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3));
|
||||
gbColour2 = CRGBA(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3));
|
||||
return 0;
|
||||
case COMMAND_REMOVE_CAR_BOOT:
|
||||
{
|
||||
|
@ -670,7 +677,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
}
|
||||
case COMMAND_SWITCH_FERRY_COLLISION:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CFerry::SwitchFerryCollision(GET_INTEGER_PARAM(0));
|
||||
CFerry::SwitchFerryCollision(GET_INTEGER_PARAM(0));
|
||||
return 0;
|
||||
case COMMAND_SET_CHAR_MAX_HEALTH:
|
||||
{
|
||||
|
@ -709,7 +716,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
|
|||
case COMMAND_SET_CRUSHER_REWARD_MULTIPLIER:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
// CGarages::CrusherRewardMultiplier = GET_INTEGER_PARAM(0);
|
||||
CGarages::CrusherRewardMultiplier = GET_INTEGER_PARAM(0);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SWAP_BUILDINGS:
|
||||
|
|
|
@ -298,7 +298,11 @@ enum {
|
|||
COMMAND_IS_PLAYER_IN_ZONE,
|
||||
COMMAND_IS_PLAYER_PRESSING_HORN,
|
||||
COMMAND_HAS_CHAR_SPOTTED_PLAYER,
|
||||
#ifdef SUPPORT_GINPUT_SCRIPT
|
||||
COMMAND_HAS_PAD_IN_HANDS,
|
||||
#else
|
||||
COMMAND_ORDER_CHAR_TO_BACKDOOR,
|
||||
#endif
|
||||
COMMAND_ADD_CHAR_TO_GANG,
|
||||
COMMAND_IS_CHAR_OBJECTIVE_PASSED,
|
||||
COMMAND_SET_CHAR_DRIVE_AGGRESSION,
|
||||
|
@ -1510,7 +1514,7 @@ enum {
|
|||
COMMAND_IS_CHAR_CROUCHING,
|
||||
COMMAND_GET_FERRY_BOARDING_SPACE,
|
||||
COMMAND_GET_FERRY_HEADING,
|
||||
COMMAND_SET_FERRIES_ENABLED,
|
||||
COMMAND_SET_FERRIES_DISABLED,
|
||||
COMMAND_COMPLETE_FERRY_DOOR_MOVEMENT,
|
||||
COMMAND_OVERRIDE_CAR_REMOTE_CONTROL,
|
||||
COMMAND_CANCEL_REMOTE_MODE,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@
|
|||
#include "Wanted.h"
|
||||
#include "World.h"
|
||||
#include "VarConsole.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
#define TIME_BETWEEN_SETPIECE_SPAWNS 20000
|
||||
|
||||
|
@ -67,9 +68,9 @@ VALIDATESAVEBUF(*size)
|
|||
void CSetPieces::Load(uint8* buf, uint32 size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
NumSetPieces = ReadSaveBuf<uint32>(buf);
|
||||
ReadSaveBuf(&NumSetPieces, buf);
|
||||
for (int i = 0; i < NUM_SETPIECES; i++)
|
||||
aSetPieces[i] = ReadSaveBuf<CSetPiece>(buf);
|
||||
ReadSaveBuf(&aSetPieces[i], buf);
|
||||
VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue