Compare commits

...

337 Commits

Author SHA1 Message Date
aap 9a7fa47857 make debug render groups optional 2021-02-19 18:41:31 +01:00
withmorten 0b1d3669bc
remove nightly 2021-02-19 18:21:04 +01:00
withmorten 8128e8e817 tiny sync with miami 2021-02-19 16:33:37 +01:00
withmorten 73fce903b8 nil -> false 2021-02-19 16:23:52 +01:00
erorcun b52356f6b5 Update librw to fix Mac hi-dpi 2021-02-19 16:56:42 +03:00
erorcun 139c6bfcf3 Fix MP3 player 2021-02-19 14:30:41 +03:00
erorcun bf7280b55b Get keyboard input from X11 on Linux 2021-02-19 02:36:47 +03:00
withmorten 48cec4a786 add NoMovies ini option, rename gDrawVersionText, always save ini after loading 2021-02-18 22:40:32 +01:00
aap 6245a17e16 update librw; render groups only if extension supported 2021-02-18 20:31:46 +01:00
nick7 1402b9ed72 CMake: MSS / mpg123 compilation fixes 2021-02-18 20:00:43 +01:00
aap 253021866c d3d9 debug render groups 2021-02-18 13:08:22 +01:00
aap e8b435a624 fix last commit 2021-02-18 12:23:26 +01:00
aap 9db87fc636 add debug render groups 2021-02-18 12:21:47 +01:00
aap 1a429bb3c4 update librw 2021-02-18 11:10:11 +01:00
aap a4412e8d63 update librw; gl cleanup 2021-02-18 01:58:36 +01:00
aap c3af33f97d add ps2 particle.txd 2021-02-18 01:19:16 +01:00
Fire-Head 68cc5fe965 remove particle 2021-02-18 00:50:39 +03:00
withmorten 6227aee863 update librw 2021-02-17 14:34:38 +01:00
Sergeanur ee6b7152c7 Fix endless vibration in pause menu 2021-02-17 15:04:53 +02:00
withmorten 53e3bc6092 update librw 2021-02-17 13:58:31 +01:00
withmorten 7db2df33e8 fix premake workflows 2021-02-17 13:33:52 +01:00
aap b4c96bca93 update librw; get rid of glew 2021-02-17 13:12:33 +01:00
aap c488ce166e add hires particle.txd 2021-02-17 11:03:05 +01:00
erorcun 4d8f340827
Merge pull request #1050 from swills/controller_config_segfault_fix
Fix seg fault when configuring controller
2021-02-16 22:29:55 +03:00
erorcun eccf87acc7
Merge pull request #1090 from AGraber/patch-1
Fix buffer overflow on re3_sem_open/close
2021-02-16 20:19:07 +03:00
Adrian Graber 19b39f49fa
Fix buffer overflow on re3_sem_open/close 2021-02-16 18:12:21 +01:00
Steve Wills e482ab6292 Fix mistake 2021-02-16 11:13:20 -05:00
Steve Wills 20d9498fdb Put fix behind ifdef 2021-02-16 10:55:11 -05:00
erorcun 1a64053da5
Merge pull request #986 from AGraber/nx-upstream
Add toggle for (un)named semaphores and prevent linux header inclusion on non-linux paltforms
2021-02-16 18:27:31 +03:00
erorcun 5ee4931fb6 Fix FindClose->closedir 2021-02-16 18:26:44 +03:00
erorcun 49fd99119d Fix rare stream deadlock on Windows 2021-02-16 17:45:29 +03:00
erorcun 179b11151e
Add PR rules to Readme 2021-02-16 16:49:42 +03:00
erorcun 3baccc9d3e
PR rules 2021-02-16 16:46:09 +03:00
aap edc77d7f00 removed some f suffixes from shaders 2021-02-15 15:06:45 +01:00
withmorten fec39e87c0 Revert "always console for windows Debug builds"
This reverts commit a826091dc9.
2021-02-15 14:57:19 +01:00
withmorten a826091dc9 always console for windows Debug builds 2021-02-15 14:24:07 +01:00
Fire-Head a3eae736e7 readme update 2021-02-15 00:58:42 +03:00
Steve Wills a666de46aa Fix seg fault when configuring controller
Since controllerAction can be -2 (line 2105)
2021-02-14 14:06:37 -05:00
erorcun e35c56ceb3 More compatible she-bang line 2021-02-14 21:09:48 +03:00
erorcun be55085303 Try to fix streams stop after a while 2021-02-14 20:45:58 +03:00
Fire-Head 0b6e46b1e4 cannon fix 2021-02-14 20:11:23 +03:00
withmorten b2b243e803
update invite link 2021-02-14 16:02:32 +01:00
aap 475a4d71d8 optimize performance -> readme to-do 2021-02-14 09:48:35 +01:00
withmorten 0dd5be788f 1 more readme fix 2021-02-14 03:09:22 +01:00
withmorten 4e8f42f6f6 1 more fix 2021-02-14 03:01:44 +01:00
withmorten 9f575a70c1 even more readme fixes 2021-02-14 02:57:14 +01:00
Sergeanur f372420dc0 Update invite link 2021-02-13 20:07:42 +02:00
withmorten 2183e25081
more readme fixes 2021-02-13 17:16:51 +01:00
withmorten 8d27dba4cd glfw window icon 2021-02-13 17:01:47 +01:00
Sergeanur 02ac7c309e Disable RANDOMSPLASH only if loading screen is disabled 2021-02-13 16:16:02 +02:00
Sergeanur 4907c56231 Disable RANDOMSPLASH 2021-02-13 16:10:14 +02:00
withmorten 42952743ba
readme fixes 2021-02-13 14:59:36 +01:00
aap 04345643a0 new icon 2021-02-13 14:54:44 +01:00
aap 80aabfe0aa Merge branch 'master' of github.com:GTAmodding/re3 2021-02-13 14:22:22 +01:00
aap 9c7d83ebc1 dbg menu again 2021-02-13 14:22:11 +01:00
aap 465f156e03
Merge pull request #1031 from aap/master
debugmenu cleanup
2021-02-13 13:51:11 +01:00
aap d0fbba19d1 debugmenu cleanup 2021-02-13 13:47:03 +01:00
aap f407c5a25f Update issue templates 2021-02-13 00:33:26 +01:00
aap c1a274d91c Update issue templates 2021-02-13 00:25:36 +01:00
aap 0f8614221b debugmenu cleanup 2021-02-13 00:00:02 +01:00
Fire-Head 291cdd4bfb iii icon fix 2021-02-13 01:35:48 +03:00
aap 2ce946584e add history section to readme 2021-02-12 21:52:33 +01:00
aap 78cc2aa9cc license information 2021-02-12 21:08:38 +01:00
aap 9553478d9c update librw 2021-02-12 20:12:43 +01:00
erorcun 6689b0be02 Fix XInput hotplug 2021-02-12 19:50:26 +03:00
erorcun a44d7d86cb
Merge pull request #1029 from erorcun/master
Remove version text, add toggleable debug info(with commit hash!)
2021-02-12 18:15:51 +03:00
erorcun 8659b9d77c Fix sha1 on premake linux 2021-02-12 17:23:29 +03:00
Filip Gawin 1b8d03f3aa Cmake version for hash 2021-02-12 16:38:03 +03:00
Sergeanur bf1db80e4f Update TXDs 2021-02-12 12:59:10 +02:00
Sergeanur e7a4a3516f Add english strings to translations as stubs, also translation notice 2021-02-12 07:52:21 +02:00
Sergeanur 2c194df591 Fix RW33 2021-02-12 05:37:30 +02:00
Sergeanur 6580ddd6cb Recompile GXTs 2021-02-12 05:32:44 +02:00
Sergeanur a3a5e5b824 Merge remote-tracking branch 'origin/master'
* origin/master:
  imrove readme; enable screenshots with F12
  better controller menu txds
  use better quality button textures, add generic.txd
2021-02-12 05:31:38 +02:00
Sergeanur 788ab8d3a8 Merge branch 'master' of https://github.com/IlDucci/re3
# Conflicts:
#	gamefiles/TEXT/french.gxt
#	gamefiles/TEXT/german.gxt
#	gamefiles/TEXT/italian.gxt
#	gamefiles/TEXT/spanish.gxt
2021-02-12 05:31:13 +02:00
erorcun 9e1c048e20 Remove version text, add toggleable debug info(with commit hash!) 2021-02-12 05:28:08 +03:00
aap a1903e025c Merge branch 'master' of github.com:GTAmodding/re3 2021-02-12 00:07:05 +01:00
aap f3bfdd7857 imrove readme; enable screenshots with F12 2021-02-12 00:06:54 +01:00
withmorten c7dae2aca6 better controller menu txds 2021-02-11 21:50:14 +01:00
withmorten 69138fc08b use better quality button textures, add generic.txd 2021-02-11 21:32:27 +01:00
Sergeanur a6b56e6b7a Merge remote-tracking branch 'origin/master'
* origin/master:
  startproject now depends on librw
  Ped jump teleport/kill fix
2021-02-11 06:53:29 +02:00
Sergeanur c9f804486d Fix setup 4 texts 2021-02-11 06:53:00 +02:00
withmorten 1d8d2bd7b7
startproject now depends on librw 2021-02-10 18:46:54 +01:00
erorcun a6d402e8fd Ped jump teleport/kill fix 2021-02-10 15:34:48 +03:00
aap 25703b04a2 fix clouds 2021-02-09 19:59:55 +01:00
Sergeanur 62f28cc4ac Use VEHICLE_FIREWEAPON in GXTs 2021-02-09 14:50:21 +02:00
erorcun d460c3863e Also check font textures for new languages 2021-02-08 18:21:00 +03:00
erorcun 0eb1913713 Merge branch 'master' of https://github.com/GTAmodding/re3 2021-02-08 13:21:53 +03:00
erorcun d224f8b7ee Don't show menu map and new languages if gamefiles isn't copied 2021-02-07 20:38:53 +03:00
aap 6662e60b63 reorganize shaders; use modulate flag; update librw 2021-02-06 16:33:17 +01:00
erorcun c7ba01b034 Detect joystick menu for XInput 2021-02-05 18:23:50 +03:00
withmorten 2bd8be5872 Fix inverted vertical camera 2021-02-05 12:08:14 +01:00
aap 5385d004ec fix generic.txd crash 2021-02-05 10:51:12 +01:00
withmorten bf299e5c17 fix MASTER crashes 2021-02-04 23:41:10 +01:00
withmorten 7aaaaa953b CHud::Draw fix 2021-02-04 18:28:24 +01:00
IlDucci ad87a6d185 And adding the missing GXT. 2021-02-04 16:59:39 +01:00
IlDucci e653f4f7dd Adding missing "AUTO" string. 2021-02-04 16:59:19 +01:00
IlDucci 95208bc3dd GXT additions for the Gamepad Menu
- Spanish: restoring LCS's name of the Red Light District. Thanks to ForeverL for pointing it out.
 - Spanish: Adding strings for the new controller menu.
 - French, German, Italian: copypastingthe official strings from the old controller menu into the new one.
2021-02-04 16:56:47 +01:00
withmorten 263a766d8e
revert Fix RW build 2021-02-04 01:40:45 +01:00
Sergeanur 61618389e1 Fix crash on changing anti aliasing 2021-02-04 01:52:57 +02:00
withmorten e6d86bfab5 fix VC_PED_PORTS build 2021-02-03 23:37:10 +01:00
withmorten f7959d5646 reduce warnings in msvc librw build 2021-02-03 23:26:19 +01:00
Sergeanur e077a6bf28 Fix RW build 2021-02-03 22:21:16 +02:00
erorcun c002dd6cba MP3 player fixes 2021-02-03 23:12:55 +03:00
withmorten f2cd511d9c
standalone windows links to premake 2021-02-03 20:55:06 +01:00
Sergeanur 3f8bf89e72
Merge pull request #851 from cirno-999/master
Updated Polish translation
2021-02-03 21:48:07 +02:00
Sergeanur 91c3bdfa15
Merge pull request #1019 from Sergeanur/ControllerMenu2
Controller menu
2021-02-03 21:43:25 +02:00
withmorten bd368b29b1 and a space 2021-02-03 20:26:59 +01:00
withmorten 2e8429858e remove accidental comment from premake workflows 2021-02-03 20:24:37 +01:00
withmorten 862f83cc40 add gamefiles and dlls to premake workflows 2021-02-03 18:37:19 +01:00
withmorten ac339f4724
Update README.md 2021-02-03 14:33:16 +01:00
Nikolay Korolev aeccd8c166 Merge remote-tracking branch 'upstream/master' 2021-02-03 15:35:14 +03:00
Nikolay Korolev f6326606b7 fix 2021-02-03 15:35:06 +03:00
erorcun f541520040 Merge branch 'master' of https://github.com/gtamodding/re3 2021-02-03 15:12:24 +03:00
erorcun 7ff899bd22 OAL Loops, fixes 2021-02-03 15:10:27 +03:00
erorcun f42f785c78
Merge pull request #1020 from erorcun/master
MusicManager fixes
2021-02-03 14:22:33 +03:00
erorcun 1667ffdd8f MusicManager fixes 2021-02-03 14:08:28 +03:00
Sergeanur a7e11d134f Add undef 2021-02-03 02:53:54 +02:00
Sergeanur adf07aab47 Fix compilation 2021-02-03 02:47:45 +02:00
Sergeanur 91612eb45a Controller menu 2021-02-03 02:41:12 +02:00
Sergeanur b47a23ab79
Merge pull request #1001 from Sergeanur/animNames
Use original animation names from VCS
2021-02-03 02:14:48 +02:00
Sergeanur e28188edd9
Merge pull request #1017 from IlDucci/master
[Master] Adding strings to re3's GXTs, recompiling GXT files
2021-02-03 02:14:35 +02:00
withmorten b65f8a3fe2 no advanced script log when log level is 0 2021-02-02 11:35:16 +01:00
IlDucci 8d4c134f80 Adding strings to re3's GXT, recompiling GXT files
- Adding the Radio Off string (thank you!) to the Spanish translation.
 - Added translations for the new languages to the French/German/Italian translations (using WordReference, no automated translation) as well as the Radio Off string (taken from LCS's official translations and uppercased). It's a bandaid, I know.
 - Recompiled the GXT files. Russian will probably have differences, but since the last recompilation was rejected because of Russian, I've removed its binary version.
2021-02-01 11:54:31 +01:00
Sergeanur 4afa7b86ae Add radio off text 2021-01-31 23:44:30 +02:00
Filip Gawin 3d4791f291 Revert "First batch of fixes (CallAndMessage)"
This reverts commit 7a3b80a9b7.
2021-01-31 21:06:38 +01:00
Filip Gawin 7a3b80a9b7 First batch of fixes (CallAndMessage) 2021-01-31 20:44:39 +01:00
shfil 5de4e88d7a
fix realloc 2021-01-31 15:00:36 +01:00
Adrian Graber b60baf46f6 Only include sys/syscall.h when __linux__ is defined 2021-01-31 14:27:06 +01:00
Adrian Graber d76b58cc72 Add unnamed semaphore define toggle for CdStreamPosix 2021-01-31 14:27:00 +01:00
withmorten da378077f7 renderer fix from miami 2021-01-31 02:08:42 +01:00
erorcun f61a91c97d Merge branch 'master' of https://github.com/GTAmodding/re3 2021-01-29 19:30:27 +03:00
erorcun d52b917c54 Some regular fixes and UB fixes 2021-01-29 19:23:02 +03:00
withmorten f7fc919d98 add NewRenderer ini read/write 2021-01-29 16:46:03 +01:00
erorcun 2e7405b76c CdStreamPosix fixes 2021-01-29 16:31:13 +03:00
shfil 3dfffdf351
Update build-cmake-conan.yml 2021-01-28 23:19:58 +01:00
shfil 1a7810efe1
Update CMakeLists.txt 2021-01-28 23:19:12 +01:00
shfil 6700c5fd46
Update README.md 2021-01-28 23:14:44 +01:00
shfil f05cfe2627
Make it look a bit nicer 2021-01-28 23:14:27 +01:00
shfil 69cb133c57
Add direct links 2021-01-28 23:04:44 +01:00
Nikolay Korolev 7c38e2db24 fix 2021-01-28 23:23:49 +03:00
aap 64a4ed6db6 fixed uninitialized nearclip 2021-01-28 17:40:15 +01:00
aap ebb615d080 fix some little UB 2021-01-28 15:30:32 +01:00
erorcun 2d0562412e Use previous naming & fix LineOfSightSectorList too 2021-01-28 03:49:50 +03:00
erorcun a74f597d45
Merge pull request #996 from withmorten/vanilla
add Vanilla config to premake and premake CI
2021-01-28 02:44:34 +03:00
erorcun 2b269ff1c0 Fix some Collision NaN/inf's 2021-01-28 02:18:04 +03:00
erorcun e9054f2980
Merge pull request #1004 from GaryOderNichts/fix1
Fix texture conversion box
2021-01-28 01:08:49 +03:00
GaryOderNichts d2cf090ace Fix texture conversion box 2021-01-27 23:06:43 +01:00
erorcun 93ffe6123d Change joystick DB with latest offical one 2021-01-27 22:14:47 +03:00
erorcun 8846f50cb7 Attempt to fix input delays on GLFW 2021-01-27 18:26:48 +03:00
erorcun 843dd9b5e1 Clean up POSIX streaming code 2021-01-27 18:26:08 +03:00
Sergeanur 0f623c2354 Use original animation names from VCS 2021-01-26 19:35:40 +02:00
Sergeanur f27e1ec818 Fix doubles in ZoneCull 2021-01-26 19:26:28 +02:00
Sergeanur d3cd707db7
Merge pull request #923 from IlDucci/master
Minor typo fixes on GXT files and updates to the Spanish re3 strings.
2021-01-25 23:48:00 +02:00
IlDucci 7afb8ff679 Attempt to restore the old GXT files. GXTS MUST BE RECOMPILED.
Attempt to restore the old GXT files.
2021-01-25 22:45:09 +01:00
Sergeanur b4e0c97469 Update OpenAL 2021-01-25 18:49:29 +02:00
erorcun cb34060f00 Support pads without L2-R2, add comments 2021-01-25 16:48:41 +03:00
aap 4564f7aeea modelinfo fixes 2021-01-24 23:24:41 +01:00
shfil 1d3b4d1e9a
Add cmake option for sanitizers 2021-01-24 21:34:53 +01:00
erorcun 5336620f5c Ped: car enter anim. fix 2021-01-24 20:05:43 +03:00
erorcun a0bf47cfd2 Fix out of bound binding orders 2021-01-24 19:39:31 +03:00
withmorten d7c00841d6 add Vanilla config to premake and premake CI 2021-01-24 17:06:50 +01:00
shfil 3e6bb267f3
Fix CCollision::DistToLine 2021-01-24 12:34:40 +01:00
withmorten 5183d7cf0f enable default resolution for vanilla defines 2021-01-23 23:18:05 +01:00
withmorten db6b7b473d whitespace fix 2021-01-23 23:02:22 +01:00
Nikolay Korolev 6bdc0365ee another backport 2021-01-23 23:15:50 +03:00
Nikolay Korolev 921ca7712e use ARRAY_SIZE 2021-01-23 23:10:59 +03:00
Nikolay Korolev 35258b9b9c added some missing functions 2021-01-23 15:29:00 +03:00
withmorten 2650fa9a92 VANILLA_BUILD fixes 2021-01-23 02:17:28 +01:00
withmorten 6f4e2ab491 get rid of unsupported LIBRW in config.h 2021-01-22 22:47:29 +01:00
withmorten 5988c0e95a fix tabs in crossplatform 2021-01-22 22:01:00 +01:00
erorcun fd461ca702 Merge branch 'master' of https://github.com/GTAmodding/re3 2021-01-22 23:59:19 +03:00
erorcun 0ea72af60c Peds reporting to phone changes for GTA3D 2021-01-22 23:58:57 +03:00
erorcun 6118ed89bb
Merge pull request #978 from erorcun/master
No more resetting bindings for joypad, create .ini at the first start…
2021-01-22 23:54:32 +03:00
erorcun 226e3b83da No more resetting bindings for joypad, create .ini at the first start, joystick hotplug for Linux 2021-01-22 23:43:49 +03:00
withmorten f6c846d27a fix 2021-01-22 21:27:18 +01:00
withmorten 3b4e79f073 small fix regarding codewarrior and AUDIO_MSS 2021-01-22 21:10:49 +01:00
withmorten 2e5898490c cw: remove extras folder 2021-01-22 20:44:11 +01:00
withmorten d58f090198 fix RW33 build, undef ANISOTROPIC_FILTERING for vanilla build 2021-01-22 20:33:29 +01:00
Filip Gawin e9adf8162b fix 2021-01-22 19:59:27 +01:00
Filip Gawin a034661bc9 Merge branch 'master' of github.com:GTAmodding/re3 2021-01-22 19:55:07 +01:00
Filip Gawin 609cad506f Better output for validating size assert 2021-01-22 19:54:43 +01:00
withmorten 950a3e82c1 cw: fix linking order 2021-01-22 19:35:24 +01:00
aap d77846bb16
Merge pull request #973 from withmorten/wantedlevel
m_nWantedLevel -> GetWantedLevel()
2021-01-22 10:34:01 +01:00
withmorten 497e0b801f m_nWantedLevel -> GetWantedLevel() 2021-01-22 00:19:44 +01:00
withmorten a511d79bf0 free cam fixes 2021-01-21 23:21:03 +01:00
aap 69500eed56 how the hell did that happen? 2021-01-21 22:35:11 +01:00
aap c67273e92a fixed anisotropic filtering; updated librw 2021-01-21 22:30:20 +01:00
withmorten ef24783bff
Merge pull request #968 from withmorten/cw
make building with Codewarrior 7 possible
2021-01-21 21:55:33 +01:00
withmorten 034df61f3c codewarrior: finishing touches 2021-01-21 19:42:51 +01:00
aap 3c221d9466 update librw 2021-01-21 10:19:43 +01:00
aap 6df52f06b6 enable screenshots for librw 2021-01-21 10:19:01 +01:00
withmorten f2596b3759 Merge remote-tracking branch 'upstream/master' into cw 2021-01-21 03:20:31 +01:00
withmorten ac0f759b27 make building with Codewarrior 7 possible 2021-01-21 03:18:15 +01:00
Nikolay Korolev 8e825fa629 fixed saving 2021-01-20 22:16:11 +03:00
Sergeanur c54f5c4b4f
Merge pull request #971 from Sergeanur/PoolFlags
Get rid of bitfields in CPool
2021-01-20 18:59:49 +02:00
Sergeanur 9b193a47a2
Merge pull request #966 from Sergeanur/matrix
Get rid of RwMatrix in CMatrix
2021-01-20 18:59:33 +02:00
aap 505438cd90 Merge branch 'master' of github.com:GTAmodding/re3 2021-01-19 21:33:17 +01:00
aap bb66028e74 pc radar fix 2021-01-19 21:33:09 +01:00
Sergeanur a9b8d30ce0 Get rid of bitfields in CPool 2021-01-19 21:32:55 +02:00
Sergeanur e6ef164441 Get rid of VuVector 2021-01-19 18:38:10 +02:00
withmorten 25d3066eae fix RWLIBS build without GTA_PS2_STUFF 2021-01-19 12:05:38 +01:00
Nikolay Korolev ef59c623fd Merge remote-tracking branch 'upstream/master' 2021-01-18 23:59:16 +03:00
Nikolay Korolev 8c1f4ba65d fix 2021-01-18 23:59:07 +03:00
Sergeanur 91093305d6 Get rid of RwMatrix in CMatrix 2021-01-18 21:06:59 +02:00
aap 7687ce84ed wrong ifdef 2021-01-18 20:03:24 +01:00
withmorten da29203219 sync milessdk with re3mss 2021-01-17 22:15:49 +01:00
withmorten a6faa0384b fix common.h d3d includes 2021-01-17 22:10:04 +01:00
erorcun deaaf3d22f Migrate from old .ini to new .ini 2021-01-17 21:33:53 +01:00
erorcun 448e41ecaa Store all settings in .INI 2021-01-17 21:33:53 +01:00
erorcun 5a47379bf5 Includes overhaul, fix some compiler warnings 2021-01-17 21:32:54 +01:00
aap 357b67e3f5 vehicle fixes 2021-01-17 10:00:34 +01:00
Sergeanur caa7d3177c Use of sized bool types for CFont 2021-01-16 16:05:27 +02:00
shfil a06bd7f735
Fix typo 2021-01-14 18:02:28 +01:00
shfil 260591cc54
Update README.md 2021-01-14 18:00:22 +01:00
Nikolay Korolev ad908f5dde fix 2021-01-14 00:16:55 +03:00
erorcun a844cbbc3d hud ammo fix 2021-01-13 23:16:25 +03:00
erorcun 011a9cc775 Merge branch 'master' of https://github.com/GTAmodding/re3 2021-01-13 16:54:45 +03:00
erorcun 7f15e11b1b fix save loading, hopefully 2021-01-13 16:54:36 +03:00
withmorten e8727cf4a1
remove scriptspath from premake 2021-01-13 14:34:58 +01:00
aap 6aab948be2 more renames 2021-01-13 13:41:24 +01:00
aap 083aa700e9 anim velocity union 2021-01-13 13:06:31 +01:00
aap 7c3e43aa2e rename m_vehEnterType -> m_vehDoor 2021-01-13 13:01:11 +01:00
erorcun d88a3cf558 Merge branch 'master' of https://github.com/GTAmodding/re3 2021-01-13 14:49:15 +03:00
shfil b9dc81d600
Update README.md 2021-01-13 12:22:55 +01:00
erorcun 57201187de Fix build without FIX_BUGS, divide to 0 fixes 2021-01-13 14:22:31 +03:00
Filip Gawin 4097c20bdd Make cmake files more generic 2021-01-13 12:15:22 +01:00
aap fb1bd1a5bd fix !FREE_CAM build 2021-01-13 10:48:55 +01:00
erorcun 4837969e09
Update README.md 2021-01-13 05:05:19 +03:00
shfil ef0b2291a0
Typo 2021-01-13 02:39:53 +01:00
shfil 29172e9ee2
Update README.md 2021-01-13 02:38:50 +01:00
shfil 66b8c870f4
Update README.md 2021-01-13 02:35:05 +01:00
withmorten 6103677914 more securom fixes 2021-01-13 00:28:07 +01:00
withmorten 005ddf26c1
Merge pull request #954 from withmorten/master
move stuff back into class; securom comments
2021-01-13 00:21:20 +01:00
withmorten c210e1bae6 move stuff back into class; securom comments 2021-01-13 00:18:34 +01:00
shfil 4fe64d1b0d
Fix 2021-01-12 23:46:11 +01:00
shfil 461e9fe5c2
Disable opus in conan file as default option 2021-01-12 23:41:11 +01:00
aap ad1d0ffc5a
Merge pull request #953 from withmorten/master
fix CreateInstance virtual overload order
2021-01-12 23:30:59 +01:00
withmorten 4a96c7c9f2 fix CreateInstance virtual overload order 2021-01-12 23:25:12 +01:00
Filip Gawin 3ae4c00562 Disable building on travis 2021-01-12 21:57:58 +01:00
Filip Gawin 13d5c5e7e6 A bit more of cleanup of CI 2021-01-12 21:57:58 +01:00
Filip Gawin 8929e55bff Shorten job name 2021-01-12 21:47:19 +01:00
Filip Gawin 11ecab3ca1 Disable opus for now (as default option) 2021-01-12 21:47:19 +01:00
aap 48ce6151f9 fix building with PED_SKIN 2021-01-12 18:55:21 +01:00
aap fe1d82c9c3
Merge pull request #945 from withmorten/master
premake: add startrpoject; add lto option; fix copying of binary to gamedir; update premake5.exe
2021-01-12 10:29:19 +01:00
Sergeanur be1e09aad4 Fix collective commands 2021-01-12 02:26:37 +02:00
Fire-Head 06fbbaa43f fix explosion jet 2021-01-11 21:12:11 +03:00
Nikolay Korolev 31dd135075 fuck 2021-01-11 20:53:03 +03:00
Nikolay Korolev 08e5c8e010 fixes 2021-01-11 17:22:07 +03:00
Anonymous Maarten 3519cbd3e5 conan: build re3 + librw with RelWithDebInfo build_type 2021-01-11 11:24:25 +01:00
Anonymous Maarten 6b8374f391 cmake: install files ready for copying in game folder 2021-01-11 11:24:25 +01:00
Anonymous Maarten 96e2ba19f8 cmake: add resource (settings windows icon) 2021-01-11 11:24:25 +01:00
Anonymous Maarten a78e4a3366 conan: allow repeated executions of `conan build` 2021-01-11 11:24:25 +01:00
Anonymous Maarten b375e20c75 cmake: opus is now optional + libsndfile only when using openal 2021-01-11 11:24:25 +01:00
Anonymous Maarten d9f6a05b7e ci: build using github actions 2021-01-11 11:24:25 +01:00
Anonymous Maarten 64b585efa1 cmake: let cpack create nice binary package 2021-01-11 11:24:25 +01:00
Anonymous Maarten 54b88cdfbe Add conanfile 2021-01-11 11:24:25 +01:00
Anonymous Maarten e9adfd8663 cmake: search for miles import library 2021-01-11 11:24:25 +01:00
Anonymous Maarten 8d0b4ede68 cmake: use openal/opusfile/mpg123/libsndfile correctly 2021-01-11 11:24:25 +01:00
Anonymous Maarten 9707eeb8cb audio: only use #pragma comment(lib, "xxx.lib") on MSVC 2021-01-11 11:24:25 +01:00
Anonymous Maarten 2f48d0c828 cmake: null audio is not possible + add cmake opus support 2021-01-11 11:24:25 +01:00
Anonymous Maarten 2ff9270279 cmake: make librw non-vendorable + rename Findmpg123 + create targets for dependencies 2021-01-11 11:24:25 +01:00
Anonymous Maarten 8a157eee0a audio: only use #pragma comment(lib, xxx.lib) on MSVC 2021-01-11 01:12:44 +01:00
erorcun 8aaa3c4884 Automobile: fix 2021-01-10 23:52:37 +01:00
withmorten 59825a5268 premake: add startrpoject; add lto option; fix copying of binary to gamedir; update premake5.exe 2021-01-10 20:55:40 +01:00
aap cc2cebffb6 update librw 2021-01-10 18:43:11 +01:00
aap 4bb6740bf4 moved new renderer, fixed a bug 2021-01-09 18:22:02 +01:00
aap 9693184cea boat fix 2021-01-09 16:13:33 +01:00
aap 822f0bd40b cam sector fix 2021-01-09 12:11:52 +01:00
Fire-Head 02f6ed7da3 fix last commit, debugmenu options 2021-01-08 23:55:13 +03:00
Fire-Head 39a121351d Merge branch 'master' of https://github.com/GTAmodding/re3 2021-01-08 23:30:35 +03:00
Fire-Head 00d23c61d9 .ini for scaling, radar, sprites 2021-01-08 23:30:30 +03:00
Sergeanur 8eed6ae179 Use original names 2021-01-08 21:50:59 +02:00
Fire_Head 6e42c791cf
Merge pull request #909 from Fire-Head/master
Sprite Scaling Option
2021-01-08 19:43:31 +03:00
Fire-Head 368d2f3279 bb .ini hello defines 2021-01-08 19:31:48 +03:00
Nikolay c594d89dc5
Merge pull request #930 from Nick007J/master
PS2 combinations for our cheats
2021-01-08 18:52:37 +03:00
aap 223b49e3be little fixes 2021-01-08 13:51:50 +01:00
aap ec61964bce unused var 2021-01-08 01:44:08 +01:00
Sergeanur d8a04c9e43 Add MPG123_QUIET to mp3 files 2021-01-07 22:15:30 +02:00
Sergeanur ef13866af6 Make opus available alongside other formats 2021-01-07 22:13:46 +02:00
Nikolay Korolev 168d3d7ddb PS2 combinations for our cheats 2021-01-07 19:30:12 +03:00
Nikolay Korolev 2173ceae95 missing changes 2021-01-07 18:36:02 +03:00
Nikolay Korolev 416a898943 minor refactoring 2021-01-07 16:33:42 +03:00
Sergeanur 02a28996f4 Cleanup and fixes for new decoders 2021-01-06 20:22:09 +02:00
Filip Gawin 36996af82b Fixes for CVbFile 2021-01-06 18:14:44 +01:00
Filip Gawin 145bd243e8 Small fixes for new wav decoder 2021-01-06 17:56:23 +01:00
Filip Gawin 4cb00d3801 Remove fastmath from premake's config 2021-01-06 17:22:05 +01:00
Fire-Head 148383ff53 upd 2021-01-06 18:56:13 +03:00
Sergeanur 493f6cb578 Implementing our own WAV decoder to replace SndFile 2021-01-06 15:46:59 +02:00
aap a6409fb445 fix 2021-01-05 20:58:39 +01:00
Sergeanur d94e8e8faf duh 2021-01-05 21:31:49 +02:00
Sergeanur fd4c2172f5 Add support of PS2 audio streams to OpenAL 2021-01-05 21:23:27 +02:00
erorcun 2e734a4750 Automobile: more pointless fixes 2021-01-05 13:45:20 +03:00
aap e6ef2f12de first version of new renderer 2021-01-05 11:12:48 +01:00
Fire-Head 11de714d9d remake 2021-01-05 04:17:18 +03:00
Sergeanur 042e21115e More audio fix 2021-01-05 00:50:51 +02:00
Sergeanur 63e9f6d826 Audio fixes 2021-01-05 00:32:03 +02:00
Sergeanur 150f5302b7 Handle stereo panning in OAL manually for streams 2021-01-04 22:48:43 +02:00
Sergeanur 047f9c49ec Fix CEntity::UpdateRwFrame 2021-01-04 22:28:44 +02:00
aap 0f43523a16
Merge pull request #925 from Cimmerian-Iter/master
Update backface culling blacklist with new object
2021-01-04 18:15:25 +01:00
Samilop Iter 8d782a1027
Update FileLoader.cpp 2021-01-04 18:07:39 +01:00
Samilop Iter c2ff171364
Update FileLoader.cpp 2021-01-04 18:04:50 +01:00
erorcun 3b1400eaed Fixes from miami Entity/Physical proof-read 1 2021-01-04 16:28:30 +03:00
erorcun 2860f6e4a9 cfo fix 2021-01-04 16:03:54 +03:00
Filip Gawin bbbfe65870 Port nerf of rain particles from miami 2021-01-04 00:16:32 +01:00
IlDucci ab788a5316 Removing some minor extra spaces, tweaking the Spanish translation for re3 strings. 2021-01-03 21:06:43 +01:00
IlDucci f1660d8e05 Revert "Fixing an original issue: removing unneeded white color codes in subtitles"
This reverts commit bb5d2c501c.
2021-01-03 21:00:38 +01:00
IlDucci eac0d0c99a Revert "Restoring original English typos."
This reverts commit 52df1e65de.
2021-01-03 21:00:32 +01:00
IlDucci 52df1e65de Restoring original English typos. 2021-01-03 20:59:02 +01:00
IlDucci bb5d2c501c Fixing an original issue: removing unneeded white color codes in subtitles
This is an original issue. It seems that certain cutscenes had a white color control code in their subtitles when
 - It's not needed for subtitles.
 - The ~w~ control code isn't pure white, but light gray, so those subtitles look different than the rest.

I've also fixed a couple of unwanted spaces found in French and German, and also tweaked one string in Spanish and added the translation for the new Waypoint string.
2021-01-03 20:59:02 +01:00
Nikolay Korolev 213a8eb905 fixed intro text line defaults 2021-01-03 18:59:03 +03:00
erorcun ee05c7fe42 Frontend: disable windowed mode selector in game 2021-01-03 18:30:50 +03:00
erorcun 28ec412369 Ped: PlayerPed: sync with master 2021-01-03 18:29:09 +03:00
Sergeanur 941e70a701 Sync miami things 2021-01-03 16:44:21 +02:00
aap 0d05be4e31 slightly better variable name 2021-01-02 20:30:12 +01:00
aap 78fed0dfe7 "clarification" of handling code 2021-01-02 20:15:01 +01:00
erorcun cdb65e9ced fix fix 2021-01-02 18:30:00 +03:00
erorcun 482ff4562f Vehicle: Automobile: fixes and style things 2021-01-02 18:27:11 +03:00
Sergeanur 38bca2332d Fix arg 2021-01-02 13:42:27 +02:00
Sergeanur c587203ebe Pad2 fix 2021-01-02 13:28:10 +02:00
aap 716e322246 increase screen droplet splash dist 2021-01-01 23:33:25 +01:00
shfil 3a0d99d24c
Merge pull request #914 from ShFil119/utf8
Encode files to UTF-8
2021-01-01 21:02:30 +01:00
Filip Gawin d3b11c2b8c Encode files to UTF-8 2021-01-01 20:55:35 +01:00
shfil e6914355dd
Merge pull request #913 from ShFil119/oal_cache
Overhaul and enable cache for openal build
2021-01-01 17:39:11 +01:00
Filip Gawin b3581bc0b4 Overhaul and enable cache for openal build 2021-01-01 16:43:26 +01:00
Sergeanur c9a7fd9435 small CWorld fixes 2021-01-01 12:47:11 +02:00
Fire-Head bc7161754f fix compiling 2020-12-31 18:10:08 +03:00
Fire-Head 7a360b1181 hud cleanup 2020-12-31 07:56:50 +03:00
Fire-Head 8fadca196b gxt key, default value 2020-12-29 22:16:52 +03:00
Fire-Head 30236a804d fix ini key 2020-12-29 21:01:36 +03:00
Fire-Head 24eb7c98f2 gxt changes 2020-12-29 20:58:15 +03:00
Fire_Head 89e2709304
Merge pull request #1 from GTAmodding/master
update
2020-12-29 20:51:37 +03:00
Fire-Head 7b9e58f7c6 master gxt 2020-12-29 20:50:29 +03:00
Fire-Head 737d41e184 Revert "fix gxt"
This reverts commit 97f83c9fb2.
2020-12-29 20:35:03 +03:00
Fire-Head 97f83c9fb2 fix gxt 2020-12-29 20:34:00 +03:00
Fire-Head 224e805fe4 Sprite Scaling option 2020-12-29 20:24:16 +03:00
Cirno 9e8faebcd6 Updated Polish TL. 2020-12-07 16:54:30 +01:00
Cirno bc4d3a32eb Updated Polish translation 2020-11-29 13:11:58 +01:00
302 changed files with 19791 additions and 5261 deletions

24
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Version**
Tell us what version you're running. Find out using the debug menu (Ctrl-M, Debug -> Version Text)
If you send a screenshot just enable it beforehand.

13
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,13 @@
As long as it's not linux/cross-platform skeleton/compatibility layer, all of the code on the repo that's not behind a preprocessor condition(like FIX_BUGS) are **completely** reversed code from original binaries.
We **don't** accept custom codes, as long as it's not wrapped via preprocessor conditions, or it's linux/cross-platform skeleton/compatibility layer.
We accept only these kinds of PRs;
- A new feature that exists in at least one of the GTAs (if it wasn't in III/VC then it doesn't have to be decompilation)
- Game, UI or UX bug fixes (if it's a fix to R* code, it should be behind FIX_BUGS)
- Platform-specific and/or unused code that's not been reversed yet
- Makes reversed code more understandable/accurate, as in "which code would produce this assembly".
- A new cross-platform skeleton/compatibility layer, or improvements to them
- Translation fixes, for languages R* supported/outsourced
- Code that increase maintainability

116
.github/workflows/build-cmake-conan.yml vendored Normal file
View File

@ -0,0 +1,116 @@
name: re3 conan+cmake
on:
pull_request:
push:
release:
types: published
jobs:
build-cmake:
strategy:
matrix:
include:
- os: 'windows-latest'
platform: 'gl3'
gl3_gfxlib: 'glfw'
audio: 'openal'
# - os: 'windows-latest'
# platform: 'gl3'
# gl3_gfxlib: 'sdl2'
# audio: 'openal'
- os: 'windows-latest'
platform: 'd3d9'
audio: 'openal'
# - os: 'windows-latest'
# platform: 'd3d9'
# audio: 'miles'
- os: 'ubuntu-latest'
platform: 'gl3'
gl3_gfxlib: 'glfw'
audio: 'openal'
# - os: 'ubuntu-latest'
# platform: 'gl3'
# gl3_gfxlib: 'sdl2'
# audio: 'openal'
- os: 'macos-latest'
platform: 'gl3'
gl3_gfxlib: 'glfw'
audio: 'openal'
# - os: 'macos-latest'
# platform: 'gl3'
# gl3_gfxlib: 'sdl2'
# audio: 'openal'
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.platform == 'ps2' || matrix.gl3_gfxlib == 'sdl2' || matrix.audio == 'miles' }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: "Checkout Miles SDK Import Library project"
uses: actions/checkout@v2
if: ${{ matrix.audio == 'miles' }}
with:
repository: 'withmorten/re3mss'
path: 're3mss'
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: "Use XCode 11 as default (conan-center-index does not provide XCode 12 binaries at the moment)"
if: startsWith(matrix.os, 'macos')
run: |
sudo xcode-select --switch /Applications/Xcode_11.7.app
- name: "Setup conan"
run: |
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
- name: "Add os=playstation2 + gcc.version=3.2 to .conan/settings.yml"
shell: python
run: |
import os, yaml
settings_path = os.path.expanduser("~/.conan/settings.yml")
yml = yaml.safe_load(open(settings_path))
yml["os"]["playstation2"] = None
yml["compiler"]["gcc"]["version"].append("3.2")
yml["compiler"]["gcc"]["version"].sort()
yaml.safe_dump(yml, open(settings_path, "w"))
- name: "Create host profile"
shell: bash
run: |
if test "${{ matrix.platform }}" = "ps2"; then
cp vendor/librw/conan/playstation2 host_profile
else
cp ~/.conan/profiles/default host_profile
fi
- name: "Export Playstation 2 CMake toolchain conan recipe"
run: |
conan export vendor/librw/cmake/ps2toolchain ps2dev-cmaketoolchain/master@
- name: "Export librw conan recipe"
run: |
conan export vendor/librw librw/master@
- name: "Export Miles SDK conan recipe"
if: ${{ matrix.audio == 'miles' }}
run: |
conan export re3mss miles-sdk/master@
- name: "Download/build dependencies (conan install)"
run: |
conan install ${{ github.workspace }} re3/master@ -if build -o re3:audio=${{ matrix.audio }} -o librw:platform=${{ matrix.platform }} -o librw:gl3_gfxlib=${{ matrix.gl3_gfxlib || 'glfw' }} --build missing -pr:h ./host_profile -pr:b default -s re3:build_type=RelWithDebInfo -s librw:build_type=RelWithDebInfo
env:
CONAN_SYSREQUIRES_MODE: enabled
- name: "Build re3 (conan build)"
run: |
conan build ${{ github.workspace }} -if build -bf build -pf package
- name: "Package re3 (conan package)"
run: |
conan package ${{ github.workspace }} -if build -bf build -pf package
- name: "Create binary package (cpack)"
working-directory: ./build
run: |
cpack -C RelWithDebInfo
- name: "Archive binary package (github artifacts)"
uses: actions/upload-artifact@v2
with:
name: "${{ matrix.os }}-${{ matrix.platform }}"
path: build/*.zip
if-no-files-found: error

View File

@ -1,4 +1,4 @@
name: re3_msvc_amd64
name: re3 premake amd64
on:
pull_request:
@ -6,13 +6,9 @@ on:
release:
types: published
env:
GLEW_VER: "2.1.0"
GLFW_VER: "3.3.2"
GLEW_BASE: "glew-2.1.0"
GLFW_BASE: "glfw-3.3.2.bin.WIN64"
GLEW_FILE: "glew-2.1.0-win32.zip"
GLFW_FILE: "glfw-3.3.2.bin.WIN64.zip"
GLEW_URL: "https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0-win32.zip"
GLFW_URL: "https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.bin.WIN64.zip"
jobs:
build:
@ -20,18 +16,13 @@ jobs:
strategy:
matrix:
platform: [win-amd64-librw_d3d9-oal, win-amd64-librw_gl3_glfw-oal]
buildtype: [Debug, Release]
buildtype: [Debug, Release, Vanilla]
steps:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- uses: actions/checkout@v2
with:
submodules: 'true'
- if: ${{ matrix.platform }} == "win-amd64-librw_gl3_glfw-mss"
name: Download glew
uses: carlosperate/download-file-action@v1.0.3
with:
file-url: ${{env.GLEW_URL}}
- if: ${{ matrix.platform }} == "win-amd64-librw_gl3_glfw-mss"
name: Download glfw
uses: carlosperate/download-file-action@v1.0.3
@ -40,22 +31,29 @@ jobs:
- if: ${{ matrix.platform }} == "win-amd64-librw_gl3_glfw-mss"
name: Unpack archives
run: |
7z x ${{env.GLEW_FILE}}
7z x ${{env.GLFW_FILE}}
- name: Configure build
run: |
./premake5 vs2019 --with-librw --glewdir=${{env.GLEW_BASE}} --glfwdir64=${{env.GLFW_BASE}}
./premake5 vs2019 --with-librw --glfwdir64=${{env.GLFW_BASE}}
- name: Build
run: |
msbuild -m build/re3.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}}
- name: Pack artifacts
# - name: Pack artifacts
# run: |
# 7z a re3_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/*
- name: Move binaries to gamefiles
run: |
7z a re3_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/*
mv ./bin/${{matrix.platform}}/${{matrix.buildtype}}/re3.exe ./gamefiles/
mv ./bin/${{matrix.platform}}/${{matrix.buildtype}}/re3.pdb ./gamefiles/
- name: Move dynamic dependencies to gamefiles
run: |
mv ./vendor/mpg123/dist/Win64/libmpg123-0.dll ./gamefiles/
mv ./vendor/openal-soft/dist/Win64/OpenAL32.dll ./gamefiles/
- name: Upload artifact to actions
uses: actions/upload-artifact@v2
with:
name: re3_${{matrix.buildtype}}_${{matrix.platform}}
path: ./bin/${{matrix.platform}}/${{matrix.buildtype}}
path: ./gamefiles/*
# - name: Upload artifact to Bintray
# uses: hpcsc/upload-bintray-docker-action@v1
# with:

View File

@ -1,4 +1,4 @@
name: re3_msvc_x86
name: re3 premake x86
on:
pull_request:
@ -6,13 +6,9 @@ on:
release:
types: published
env:
GLEW_VER: "2.1.0"
GLFW_VER: "3.3.2"
GLEW_BASE: "glew-2.1.0"
GLFW_BASE: "glfw-3.3.2.bin.WIN32"
GLEW_FILE: "glew-2.1.0-win32.zip"
GLFW_FILE: "glfw-3.3.2.bin.WIN32.zip"
GLEW_URL: "https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0-win32.zip"
GLFW_URL: "https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.bin.WIN32.zip"
jobs:
build:
@ -20,18 +16,13 @@ jobs:
strategy:
matrix:
platform: [win-x86-librw_d3d9-mss, win-x86-librw_gl3_glfw-mss, win-x86-librw_d3d9-oal, win-x86-librw_gl3_glfw-oal]
buildtype: [Debug, Release]
buildtype: [Debug, Release, Vanilla]
steps:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- uses: actions/checkout@v2
with:
submodules: 'true'
- if: ${{ matrix.platform }} == "win-x86-librw_gl3_glfw-mss"
name: Download glew
uses: carlosperate/download-file-action@v1.0.3
with:
file-url: ${{env.GLEW_URL}}
- if: ${{ matrix.platform }} == "win-x86-librw_gl3_glfw-mss"
name: Download glfw
uses: carlosperate/download-file-action@v1.0.3
@ -40,22 +31,30 @@ jobs:
- if: ${{ matrix.platform }} == "win-x86-librw_gl3_glfw-mss"
name: Unpack archives
run: |
7z x ${{env.GLEW_FILE}}
7z x ${{env.GLFW_FILE}}
- name: Configure build
run: |
./premake5 vs2019 --with-librw --glewdir=${{env.GLEW_BASE}} --glfwdir32=${{env.GLFW_BASE}}
./premake5 vs2019 --with-librw --glfwdir32=${{env.GLFW_BASE}}
- name: Build
run: |
msbuild -m build/re3.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}}
- name: Pack artifacts
# - name: Pack artifacts
# run: |
# 7z a re3_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/*
- name: Move binaries to gamefiles
run: |
7z a re3_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/*
mv ./bin/${{matrix.platform}}/${{matrix.buildtype}}/re3.exe ./gamefiles/
mv ./bin/${{matrix.platform}}/${{matrix.buildtype}}/re3.pdb ./gamefiles/
- if: contains(matrix.platform, 'oal')
name: Move dynamic dependencies to gamefiles
run: |
mv ./vendor/mpg123/dist/Win32/libmpg123-0.dll ./gamefiles/
mv ./vendor/openal-soft/dist/Win32/OpenAL32.dll ./gamefiles/
- name: Upload artifact to actions
uses: actions/upload-artifact@v2
with:
name: re3_${{matrix.buildtype}}_${{matrix.platform}}
path: re3_${{matrix.buildtype}}_${{matrix.platform}}.zip
path: ./gamefiles/*
# - name: Upload artifact to Bintray
# uses: hpcsc/upload-bintray-docker-action@v1
# with:

8
.gitignore vendored
View File

@ -353,4 +353,10 @@ vendor/glew-2.1.0/
vendor/glfw-3.3.2.bin.WIN32/
vendor/glfw-3.3.2.bin.WIN64/
sdk/
sdk/
codewarrior/re3_Data/
codewarrior/Release/
codewarrior/Debug/
src/extras/GitSHA1.cpp

View File

@ -1,44 +0,0 @@
language: cpp
dist: focal
os: linux
jobs:
include:
- env: TARGET=release_linux-amd64-librw_gl3_glfw-oal
os: linux
- env: TARGET=debug_linux-amd64-librw_gl3_glfw-oal
os: linux
- env: TARGET=release_macosx-amd64-librw_gl3_glfw-oal PREMAKE5=premake-5.0.0-alpha15
compiler: clang
os: osx
osx_image: xcode12u
- env: TARGET=debug_macosx-amd64-librw_gl3_glfw-oal PREMAKE5=premake-5.0.0-alpha15
compiler: clang
os: osx
osx_image: xcode12u
addons:
apt:
update: true
packages:
- linux-libc-dev
- libopenal-dev
- libglew-dev
- libglfw3-dev
- libsndfile1-dev
- libmpg123-dev
- gcc-8-multilib
- g++-8-multilib
homebrew:
packages:
- libsndfile
- mpg123
- glew
- glfw
- openal-soft
script:
- mkdir -p "$TRAVIS_BUILD_DIR/build"
- cd "$TRAVIS_BUILD_DIR"
- if [ "$TRAVIS_OS_NAME" = linux ]; then ./premake5Linux --with-librw gmake2; fi
- if [ "$TRAVIS_OS_NAME" = osx ]; then curl -L -o "${PREMAKE5}.zip" "https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/${PREMAKE5}-src.zip" && unzip -q "${PREMAKE5}.zip" && cd "$PREMAKE5" && make -f Bootstrap.mak osx && cd .. && "./${PREMAKE5}/bin/release/premake5" --with-librw gmake2; fi
- cd build
- if [ "$TRAVIS_OS_NAME" = linux ]; then env CC=gcc-8 CXX=g++-8 make config=$TARGET -j4 verbose=1; fi
- if [ "$TRAVIS_OS_NAME" = osx ]; then make config=$TARGET -j4 verbose=1; fi

View File

@ -1,44 +1,86 @@
cmake_minimum_required(VERSION 3.8)
project(re3 C CXX)
set(EXECUTABLE re3)
set(PROJECT RE3)
project(${EXECUTABLE} C CXX)
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(WIN32)
set(RE3_AUDIOS "NULL" "OAL" "MSS")
set(${PROJECT}_AUDIOS "OAL" "MSS")
else()
set(RE3_AUDIOS "NULL" "OAL")
set(${PROJECT}_AUDIOS "OAL")
endif()
set(RE3_AUDIO "OAL" CACHE STRING "Audio")
set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio")
set_property(CACHE RE3_AUDIO PROPERTY STRINGS ${RE3_AUDIOS})
message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})")
set("RE3_AUDIO_${RE3_AUDIO}" ON)
if(NOT RE3_AUDIO IN_LIST RE3_AUDIOS)
message(FATAL_ERROR "Illegal RE3_AUDIO=${RE3_AUDIO}")
option(${PROJECT}_WITH_OPUS "Build ${EXECUTABLE} with opus support" OFF)
option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF)
set_property(CACHE ${PROJECT}_AUDIO PROPERTY STRINGS ${${PROJECT}_AUDIOS})
message(STATUS "${PROJECT}_AUDIO = ${${PROJECT}_AUDIO} (choices=${${PROJECT}_AUDIOS})")
set("${PROJECT}_AUDIO_${${PROJECT}_AUDIO}" ON)
if(NOT ${PROJECT}_AUDIO IN_LIST ${PROJECT}_AUDIOS)
message(FATAL_ERROR "Illegal ${PROJECT}_AUDIO=${${PROJECT}_AUDIO}")
endif()
if(RE3_INSTALL)
include(GNUInstallDirs)
set(RE3_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/re3")
option(${PROJECT}_VENDORED_LIBRW "Use vendored librw" ON)
if(${PROJECT}_VENDORED_LIBRW)
add_subdirectory(vendor/librw)
else()
find_package(librw REQUIRED)
endif()
add_subdirectory("vendor/librw")
add_subdirectory(src)
if(RE3_INSTALL)
include(CMakePackageConfigHelpers)
configure_package_config_file(re3-config.cmake.in re3-config.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/re3-config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
install(
EXPORT re3-targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
if(${PROJECT}_INSTALL)
install(DIRECTORY gamefiles/ DESTINATION ".")
if(LIBRW_PLATFORM_NULL)
set(platform "-null")
elseif(LIBRW_PLATFORM_PS2)
set(platform "-ps2")
elseif(LIBRW_PLATFORM_GL3)
if(LIBRW_GL3_GFXLIB STREQUAL "GLFW")
set(platform "-gl3-glfw")
else()
set(platform "-gl3-sdl2")
endif()
elseif(LIBRW_PLATFORM_D3D9)
set(platform "-d3d9")
endif()
if(${PROJECT}_AUDIO_OAL)
set(audio "-oal")
elseif(${PROJECT}_AUDIO_MSS)
set(audio "-mss")
endif()
if(${PROJECT}_WITH_OPUS)
set(audio "${audio}-opus")
endif()
if(NOT LIBRW_PLATFORM_PS2)
if(WIN32)
set(os "-win")
elseif(APPLE)
set(os "-apple")
elseif(UNIX)
set(os "-linux")
else()
set(compiler "-UNK")
message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)")
endif()
endif()
include(CMakeCPack.cmake)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${platform}${audio}${os}${compiler}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTA III reversed")
set(CPACK_PACKAGE_VENDOR "GTAModding")
# FIXME: missing license (https://github.com/GTAmodding/re3/issues/794)
# set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE")
# set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_GENERATOR "ZIP")
include(CPack)
endif()

218
README.md
View File

@ -1,56 +1,198 @@
<img src="https://github.com/GTAmodding/re3/blob/master/logo.png?raw=true" alt="re3 logo" width="200">
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=master)
<a href="https://discord.gg/aKYAwCx92H"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
<a href="https://discord.gg/ERYg58ttcE"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
## Intro
The aim of this project is to reverse GTA III for PC by replacing
parts of the game [one by one](https://en.wikipedia.org/wiki/Ship_of_Theseus)
such that we have a working game at all times.
In this repository you'll find the fully reversed source code for GTA III ([master](https://github.com/GTAmodding/re3/tree/master/) branch) and GTA VC ([miami](https://github.com/GTAmodding/re3/tree/miami/) branch).
## How can I try it?
It has been tested and works on Windows, Linux and FreeBSD, on x86, amd64, arm and arm64.\
Rendering is handled either by original RenderWare (D3D8)
or the reimplementation [librw](https://github.com/aap/librw) (D3D9, OpenGL 2.1 or above, OpenGL ES 2.0 or above).\
Audio is done with MSS (using dlls from original GTA) or OpenAL.
- re3 requires game assets to work, so you **must** own [a copy of GTA III](https://store.steampowered.com/app/12100/Grand_Theft_Auto_III/).
- Build re3 or download it from one of the above links (Debug or Release).
- (Optional) If you want to use optional features like Russian language or menu map, copy the files in /gamefiles folder to your game root folder.
- Move re3.exe to GTA 3 directory and run it.
The project has also been ported to the [Nintendo Switch](https://github.com/AGraber/re3-nx/),
[Playstation Vita](https://github.com/Rinnegatamante/re3) and
[Nintendo Wii U](https://github.com/GaryOderNichts/re3-wiiu/).
## Preparing the environment for building
We cannot build for PS2 or Xbox yet. If you're interested in doing so, get in touch with us.
You may want to point GTA_III_RE_DIR environment variable to GTA3 root folder if you want executable to be moved there via post-build script.
## Installation
- For Linux, proceed: [Building on Linux](https://github.com/GTAmodding/re3/wiki/Building-on-Linux)
- For FreeBSD, proceed: [Building on FreeBSD](https://github.com/GTAmodding/re3/wiki/Building-on-FreeBSD)
- For Windows, assuming you have Visual Studio:
- Clone the repo using the argument `--recursive`.
- Run one of the `premake-vsXXXX.cmd` variants on root folder.
- Open the project via Visual Studio
**If you use 64-bit D3D9**: We don't ship 64-bit Dx9 SDK. You need to download it from Microsoft if you don't have it(although it should come pre-installed after some Windows version)
- re3 requires PC game assets to work, so you **must** own [a copy of GTA III](https://store.steampowered.com/app/12100/Grand_Theft_Auto_III/).
- Build re3 or download the latest build:
- [Windows D3D9 MSS 32bit](https://nightly.link/GTAmodding/re3/workflows/re3_msvc_x86/master/re3_Release_win-x86-librw_d3d9-mss.zip)
- [Windows D3D9 64bit](https://nightly.link/GTAmodding/re3/workflows/re3_msvc_amd64/master/re3_Release_win-amd64-librw_d3d9-oal.zip)
- [Windows OpenGL 64bit](https://nightly.link/GTAmodding/re3/workflows/re3_msvc_amd64/master/re3_Release_win-amd64-librw_gl3_glfw-oal.zip)
- [Linux 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/master/ubuntu-latest-gl3.zip)
- [MacOS 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/master/macos-latest-gl3.zip)
- Extract the downloaded zip over your GTA 3 directory and run re3. The zip includes the gamefiles and in case of OpenAL the required dlls.
There are various settings at the very bottom of [config.h](https://github.com/GTAmodding/re3/tree/master/src/core/config.h), you may want to take a look there. i.e. FIX_BUGS define fixes the bugs we've come across.
## Screenshots
> :information_source: **If you choose OpenAL on Windows** You must read [Running OpenAL build on Windows](https://github.com/GTAmodding/re3/wiki/Running-OpenAL-build-on-Windows).
![re3 2021-02-11 22-57-03-23](https://user-images.githubusercontent.com/1521437/107704085-fbdabd00-6cbc-11eb-8406-8951a80ccb16.png)
![re3 2021-02-11 22-43-44-98](https://user-images.githubusercontent.com/1521437/107703339-cbdeea00-6cbb-11eb-8f0b-07daa105d470.png)
![re3 2021-02-11 22-46-33-76](https://user-images.githubusercontent.com/1521437/107703343-cd101700-6cbb-11eb-9ccd-012cb90524b7.png)
![re3 2021-02-11 22-50-29-54](https://user-images.githubusercontent.com/1521437/107703348-d00b0780-6cbb-11eb-8afd-054249c2b95e.png)
> :information_source: **Did you notice librw?** re3 uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of re3, but you also can use LIBRW enviorenment variable to specify path to your own librw.
## Improvements
We have implemented a number of changes and improvements to the original game.
They can be configured in `core/config.h`.
Some of them can be toggled at runtime, some cannot.
* Fixed a lot of smaller and bigger bugs
* User files (saves and settings) stored in GTA root directory
* Settings stored in re3.ini file instead of gta3.set
* Debug menu to do and change various things (Ctrl-M to open)
* Debug camera (Ctrl-B to toggle)
* Rotatable camera
* XInput controller support (Windows)
* No loading screens between islands ("map memory usage" in menu)
* Skinned ped support (models from Xbox or Mobile)
* Rendering
* Widescreen support (properly scaled HUD, Menu and FOV)
* PS2 MatFX (vehicle reflections)
* PS2 alpha test (better rendering of transparency)
* PS2 particles
* Xbox vehicle rendering
* Xbox world lightmap rendering (needs Xbox map)
* Xbox ped rim light
* Xbox screen rain droplets
* More customizable colourfilter
* Menu
* Map
* More options
* Controller configuration menu
* ...
* Can load DFFs and TXDs from other platforms, possibly with a performance penalty
* ...
## To-Do
The following things would be nice to have/do:
* Fix physics for high FPS
* Improve performance on lower end devices, especially the OpenGL layer on the Raspberry Pi (if you have experience with this, please get in touch)
* Compare code with PS2 code (tedious, no good decompiler)
* [PS2 port](https://github.com/GTAmodding/re3/wiki/PS2-port)
* Xbox port (not quite as important)
* reverse remaining unused/debug functions
* compare CodeWarrior build with original binary for more accurate code (very tedious)
## Modding
Asset modifications (models, texture, handling, script, ...) should work the same way as with original GTA for the most part.
Mods that make changes to the code (dll/asi, CLEO, limit adjusters) will *not* work.
Some things these mods do are already implemented in re3 (much of SkyGFX, GInput, SilentPatch, Widescreen fix),
others can easily be achieved (increasing limis, see `config.h`),
others will simply have to be rewritten and integrated into the code directly.
Sorry for the inconvenience.
## Building from Source
When using premake, you may want to point GTA_III_RE_DIR environment variable to GTA3 root folder if you want the executable to be moved there via post-build script.
Clone the repository with `git clone --recursive https://github.com/GTAmodding/re3.git`. Then `cd re3` into the cloned repository.
<details><summary>Linux Premake</summary>
For Linux using premake, proceed: [Building on Linux](https://github.com/GTAmodding/re3/wiki/Building-on-Linux)
</details>
<details><summary>Linux Conan</summary>
Install python and conan, and then run build.
```
conan export vendor/librw librw/master@
mkdir build
cd build
conan install .. re3/master@ -if build -o re3:audio=openal -o librw:platform=gl3 -o librw:gl3_gfxlib=glfw --build missing -s re3:build_type=RelWithDebInfo -s librw:build_type=RelWithDebInfo
conan build .. -if build -bf build -pf package
```
</details>
<details><summary>FreeBSD</summary>
For FreeBSD using premake, proceed: [Building on FreeBSD](https://github.com/GTAmodding/re3/wiki/Building-on-FreeBSD)
</details>
<details><summary>Windows</summary>
Assuming you have Visual Studio 2015/2017/2019:
- Run one of the `premake-vsXXXX.cmd` variants on root folder.
- Open build/re3.sln with Visual Studio and compile the solution.
Microsoft recently discontinued its downloads of the DX9 SDK. You can download an archived version here: https://archive.org/details/dxsdk_jun10
**If you choose OpenAL on Windows** You must read [Running OpenAL build on Windows](https://github.com/GTAmodding/re3/wiki/Running-OpenAL-build-on-Windows).
</details>
> :information_source: premake has an `--lto` option if you want the project to be compiled with Link Time Optimization.
> :information_source: There are various settings in [config.h](https://github.com/GTAmodding/re3/tree/master/src/core/config.h), you may want to take a look there.
> :information_source: re3 uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of re3, but you also can use LIBRW enviorenment variable to specify path to your own librw.
If you feel the need, you can also use CodeWarrior 7 to compile re3 using the supplied codewarrior/re3.mcp project - this requires the original RW33 libraries, and the DX8 SDK. The build is unstable compared to the MSVC builds though, and is mostly meant to serve as a reference.
## Contributing
Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document
As long as it's not linux/cross-platform skeleton/compatibility layer, all of the code on the repo that's not behind a preprocessor condition(like FIX_BUGS) are **completely** reversed code from original binaries.
### Unreversed / incomplete classes (at least the ones we know)
The following classes have only unused or practically unused code left:
```
NameGrid.cpp - only on mobile (a player name grid, either a very early player name code ala GTA1 or a multiplayer leftover)
PedDebug.cpp - only on mobile (debug code)
HandlingMgr.cpp - debug functions from mobile
CFormationInfo - unused PedAI class that could be found on mobile
CVehicle::ProcessBikeWheel - early bike code (only on mobile)
CAutomobile::DebugCode - debug function from mobile
CBoat::DebugCode - debug function from mobile
CBoat::ModifyHandlingValue - debug function from mobile
CBoat::DisplayHandlingData - debug function from mobile
CStreaming::PrintRequestList - debug function from mobile
d3d8raster.c - only on PC (slight RW modification that we don't actually need)
```
We **don't** accept custom codes, as long as it's not wrapped via preprocessor conditions, or it's linux/cross-platform skeleton/compatibility layer.
We accept only these kinds of PRs;
- A new feature that exists in at least one of the GTAs (if it wasn't in III/VC then it doesn't have to be decompilation)
- Game, UI or UX bug fixes (if it's a fix to original code, it should be behind FIX_BUGS)
- Platform-specific and/or unused code that's not been reversed yet
- Makes reversed code more understandable/accurate, as in "which code would produce this assembly".
- A new cross-platform skeleton/compatibility layer, or improvements to them
- Translation fixes, for languages original game supported
- Code that increase maintainability
We have a [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) document that isn't followed or enforced very well.
Do not use features from C++11 or later.
## History
re3 was started sometime in the spring of 2018,
initially as a way to test reversed collision and physics code
inside the game.
This was done by replacing single functions of the game
with their reversed counterparts using a dll.
After a bit of work the project lay dormant for about a year
and was picked up again and pushed to github in May 2019.
At the time I (aap) had reversed around 10k lines of code and estimated
the final game to have around 200-250k.
Others quickly joined the effort (Fire_Head, shfil, erorcun and Nick007J
in time order, and Serge a bit later) and we made very quick progress
throughout the summer of 2019
after which the pace slowed down a bit.
Due to everyone staying home during the start of the Corona pandemic
everybody had a lot of time to work on re3 again and
we finally got a standalone exe in April 2020 (around 180k lines by then).
After the initial excitement and fixing and polishing the code further,
reVC was started in early May 2020 by starting from re3 code,
not by starting from scratch replacing functions with a dll.
After a few months of mostly steady progress we considered reVC
finished in December.
Since then we have started reLCS, which is currently work in progress.
## License
We don't feel like we're in a position to give this code a license.\
The code should only be used for educational, documentation and modding purposes.\
We do not encourage piracy or commercial use.\
Please keep derivate work open source and give proper credit.

View File

@ -1,28 +0,0 @@
# - Find mpg123
# Find the native mpg123 includes and library
#
# MPG123_INCLUDE_DIR - where to find mpg123.h
# MPG123_LIBRARIES - List of libraries when using mpg123.
# MPG123_FOUND - True if mpg123 found.
IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
# Already in cache, be silent
SET(MPG123_FIND_QUIETLY TRUE)
ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
FIND_PATH(MPG123_INCLUDE_DIR mpg123.h
PATHS "${MPG123_DIR}"
PATH_SUFFIXES include
)
FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0
PATHS "${MPG123_DIR}"
PATH_SUFFIXES lib
)
# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR)

34
cmake/FindMilesSDK.cmake Normal file
View File

@ -0,0 +1,34 @@
# - Find Miles SDK
# Find the Miles SDK header + import library
#
# MilesSDK_INCLUDE_DIR - Where to find mss.h
# MilesSDK_LIBRARIES - List of libraries when using MilesSDK.
# MilesSDK_FOUND - True if Miles SDK found.
# MilesSDK::MilesSDK - Imported library of Miles SDK
find_path(MilesSDK_INCLUDE_DIR mss.h
PATHS "${MilesSDK_DIR}"
PATH_SUFFIXES include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_miles_sdk_libname mss64)
else()
set(_miles_sdk_libname mss32)
endif()
find_library(MilesSDK_LIBRARIES NAMES ${_miles_sdk_libname}
PATHS "${MilesSDK_DIR}"
PATH_SUFFIXES lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MilesSDK DEFAULT_MSG MilesSDK_LIBRARIES MilesSDK_INCLUDE_DIR)
if(NOT TARGET MilesSDK::MilesSDK)
add_library(MilesSDK::MilesSDK UNKNOWN IMPORTED)
set_target_properties(MilesSDK::MilesSDK PROPERTIES
IMPORTED_LOCATION "${MilesSDK_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${MilesSDK_INCLUDE_DIR}"
)
endif()

View File

@ -4,9 +4,11 @@
#
# Once done this will define
#
# SNDFILE_FOUND - system has libsndfile
# SNDFILE_FOUND - system has libsndfile
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory
# SNDFILE_LIBRARIES - Link these to use libsndfile
# SNDFILE_LIBRARIES - Link these to use libsndfile
# SNDFILE_CFLAGS - Compile options to use libsndfile
# SndFile::SndFile - Imported library of libsndfile
#
# Copyright (C) 2006 Wengo
#
@ -15,53 +17,51 @@
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
# in cache already
set(SNDFILE_FOUND TRUE)
else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_search_module(PKG_SNDFILE "sndfile")
endif()
find_path(SNDFILE_INCLUDE_DIR
find_path(SNDFILE_INCLUDE_DIR
NAMES
sndfile.h
sndfile.h
HINTS
${PKG_SNDFILE_INCLUDE_DIRS}
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
find_library(SNDFILE_LIBRARY
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
find_library(SNDFILE_LIBRARY
NAMES
sndfile
sndfile
HINTS
${PKG_SNDFILE_LIBRARIES}
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
set(SNDFILE_INCLUDE_DIRS
${SNDFILE_INCLUDE_DIR}
)
set(SNDFILE_LIBRARIES
${SNDFILE_LIBRARY}
)
set(SNDFILE_CFLAGS "${PKG_SNDFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of libsndfile")
if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
set(SNDFILE_INCLUDE_DIRS "${SNDFILE_INCLUDE_DIR}")
set(SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}")
if(SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
set(SNDFILE_FOUND TRUE)
endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
endif()
if (SNDFILE_FOUND)
if (NOT SndFile_FIND_QUIETLY)
message(STATUS "Found libsndfile: ${SNDFILE_LIBRARIES}")
endif (NOT SndFile_FIND_QUIETLY)
else (SNDFILE_FOUND)
if (SndFile_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libsndfile")
endif (SndFile_FIND_REQUIRED)
endif (SNDFILE_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
# show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view
mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
if(NOT TARGET SndFile::SndFile)
add_library(__SndFile INTERFACE)
target_compile_options(__SndFile INTERFACE ${SNDFILE_CFLAGS})
target_include_directories(__SndFile INTERFACE ${SNDFILE_INCLUDE_DIRS})
target_link_libraries(__SndFile INTERFACE ${SNDFILE_LIBRARIES})
add_library(SndFile::SndFile ALIAS __SndFile)
endif()

38
cmake/Findmpg123.cmake Normal file
View File

@ -0,0 +1,38 @@
# - Find mpg123
# Find the native mpg123 includes and library
#
# mpg123_INCLUDE_DIR - Where to find mpg123.h
# mpg123_LIBRARIES - List of libraries when using mpg123.
# mpg123_CFLAGS - Compile options to use mpg123
# mpg123_FOUND - True if mpg123 found.
# MPG123::libmpg123 - Imported library of libmpg123
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_search_module(PKG_MPG123 mpg123)
endif()
find_path(mpg123_INCLUDE_DIR mpg123.h
HINTS ${PKG_MPG123_INCLUDE_DIRS}
PATHS "${mpg123_DIR}"
PATH_SUFFIXES include
)
find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0 libmpg123-0
HINTS ${PKG_MPG123_LIBRARIES}
PATHS "${mpg123_DIR}"
PATH_SUFFIXES lib
)
set(mpg123_CFLAGS "${PKG_MPG123_CFLAGS_OTHER}" CACHE STRING "CFLAGS of mpg123")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(mpg123 DEFAULT_MSG mpg123_LIBRARIES mpg123_INCLUDE_DIR)
if(NOT TARGET MPG123::libmpg123)
add_library(__libmpg123 INTERFACE)
target_compile_options(__libmpg123 INTERFACE ${mpg123_CFLAGS})
target_include_directories(__libmpg123 INTERFACE ${mpg123_INCLUDE_DIR})
target_link_libraries(__libmpg123 INTERFACE ${mpg123_LIBRARIES})
add_library(MPG123::libmpg123 ALIAS __libmpg123)
endif()

64
cmake/Findopusfile.cmake Normal file
View File

@ -0,0 +1,64 @@
# - Try to find opusfile
#
# Once done this will define
#
# OPUSFILE_FOUND - system has opusfile
# OPUSFILE_INCLUDE_DIRS - the opusfile include directories
# OPUSFILE_LIBRARIES - Link these to use opusfile
# OPUSFILE_CFLAGS - Compile options to use opusfile
# opusfile::opusfile - Imported library of opusfile
#
# FIXME: opusfile does not ship an official opusfile cmake script,
# rename this file/variables/target when/if it has.
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_search_module(PKG_OPUSFILE "opusfile")
endif()
find_path(OPUSFILE_INCLUDE_DIR
NAMES
opusfile.h
PATH_SUFFIXES
opusfile
HINTS
${PKG_OPUSFILE_INCLUDE_DIRS}
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
find_library(OPUSFILE_LIBRARY
NAMES
opusfile
HINTS
${PKG_OPUSFILE_LIBRARIES}
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
set(OPUSFILE_CFLAGS "${PKG_OPUSFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of opusfile")
set(OPUSFILE_INCLUDE_DIRS "${OPUSFILE_INCLUDE_DIR}")
set(OPUSFILE_LIBRARIES "${OPUSFILE_LIBRARY}")
if (OPUSFILE_INCLUDE_DIRS AND OPUSFILE_LIBRARIES)
set(OPUSFILE_FOUND TRUE)
endif (OPUSFILE_INCLUDE_DIRS AND OPUSFILE_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(opusfile DEFAULT_MSG OPUSFILE_INCLUDE_DIRS OPUSFILE_LIBRARIES)
if(NOT TARGET opusfile::opusfile)
add_library(__opusfile INTERFACE)
target_compile_options(__opusfile INTERFACE ${OPUSFILE_CFLAGS})
target_include_directories(__opusfile INTERFACE ${OPUSFILE_INCLUDE_DIRS})
target_link_libraries(__opusfile INTERFACE ${OPUSFILE_LIBRARIES})
add_library(opusfile::opusfile ALIAS __opusfile)
endif()

View File

@ -0,0 +1,284 @@
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the working tree (--dirty option),
# and adjusting the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
# http://academic.cleardefinition.com
#
# Copyright 2009-2013, Iowa State University.
# Copyright 2013-2020, Ryan Pavlik
# Copyright 2013-2020, Contributors
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
# Function _git_find_closest_git_dir finds the next closest .git directory
# that is part of any directory in the path defined by _start_dir.
# The result is returned in the parent scope variable whose name is passed
# as variable _git_dir_var. If no .git directory can be found, the
# function returns an empty string via _git_dir_var.
#
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
# neither foo nor bar contain a file/directory .git. This wil return
# C:/bla/.git
#
function(_git_find_closest_git_dir _start_dir _git_dir_var)
set(cur_dir "${_start_dir}")
set(git_dir "${_start_dir}/.git")
while(NOT EXISTS "${git_dir}")
# .git dir not found, search parent directories
set(git_previous_parent "${cur_dir}")
get_filename_component(cur_dir ${cur_dir} DIRECTORY)
if(cur_dir STREQUAL git_previous_parent)
# We have reached the root directory, we are not in git
set(${_git_dir_var}
""
PARENT_SCOPE)
return()
endif()
set(git_dir "${cur_dir}/.git")
endwhile()
set(${_git_dir_var}
"${git_dir}"
PARENT_SCOPE)
endfunction()
function(get_git_head_revision _refspecvar _hashvar)
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
else()
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE)
endif()
if(NOT "${GIT_DIR}" STREQUAL "")
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
"${GIT_DIR}")
if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
# We've gone above the CMake root dir.
set(GIT_DIR "")
endif()
endif()
if("${GIT_DIR}" STREQUAL "")
set(${_refspecvar}
"GITDIR-NOTFOUND"
PARENT_SCOPE)
set(${_hashvar}
"GITDIR-NOTFOUND"
PARENT_SCOPE)
return()
endif()
# Check if the current source dir is a git submodule or a worktree.
# In both cases .git is a file instead of a directory.
#
if(NOT IS_DIRECTORY ${GIT_DIR})
# The following git command will return a non empty string that
# points to the super project working tree if the current
# source dir is inside a git submodule.
# Otherwise the command will return an empty string.
#
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse
--show-superproject-working-tree
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT "${out}" STREQUAL "")
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
${submodule})
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
ABSOLUTE)
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
else()
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
file(READ ${GIT_DIR} worktree_ref)
# The .git directory contains a path to the worktree information directory
# inside the parent git repo of the worktree.
#
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
${worktree_ref})
string(STRIP ${git_worktree_dir} git_worktree_dir)
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
endif()
else()
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake" @ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar}
"${HEAD_REF}"
PARENT_SCOPE)
set(${_hashvar}
"${HEAD_HASH}"
PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var}
"HEAD-HASH-NOTFOUND"
PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_describe_working_tree _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var}
"HEAD-HASH-NOTFOUND"
PARENT_SCOPE)
return()
endif()
execute_process(
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var}
"CLEAN"
PARENT_SCOPE)
else()
set(${_var}
"DIRTY"
PARENT_SCOPE)
endif()
endfunction()

View File

@ -0,0 +1,43 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright 2009-2012, Iowa State University
# Copyright 2011-2015, Contributors
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# SPDX-License-Identifier: BSL-1.0
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View File

View File

BIN
codewarrior/re3.mcp Normal file

Binary file not shown.

135
conanfile.py Normal file
View File

@ -0,0 +1,135 @@
from conans import ConanFile, CMake, tools
from conans.errors import ConanException, ConanInvalidConfiguration
import os
import shutil
import textwrap
class Re3Conan(ConanFile):
name = "re3"
version = "master"
license = "???" # FIXME: https://github.com/GTAmodding/re3/issues/794
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package"
options = {
"audio": ["openal", "miles"],
"with_libsndfile": [True, False],
"with_opus": [True, False],
}
default_options = {
"audio": "openal",
"with_libsndfile": False,
"with_opus": False,
# "libsndfile:with_external_libs": False,
# "mpg123:flexible_resampling": False,
# "mpg123:network": False,
# "mpg123:icy": False,
# "mpg123:id3v2": False,
# "mpg123:ieeefloat": False,
# "mpg123:layer1": False,
# "mpg123:layer2": False,
# "mpg123:layer3": False,
# "mpg123:moreinfo": False,
# "sdl2:vulkan": False,
# "sdl2:opengl": True,
# "sdl2:sdl2main": True,
}
no_copy_source = True
@property
def _os_is_playstation2(self):
try:
return self.settings.os == "Playstation2"
except ConanException:
return False
def configure(self):
if self.options.audio != "openal":
self.options.with_libsndfile = False
def requirements(self):
self.requires("librw/{}".format(self.version))
self.requires("mpg123/1.26.4")
if self.options.audio == "openal":
self.requires("openal/1.21.0")
elif self.options.audio == "miles":
self.requires("miles-sdk/{}".format(self.version))
if self.options.with_libsndfile:
self.requires("libsndfile/1.0.30")
if self.options.with_opus:
self.requires("opusfile/0.12")
def export_sources(self):
for d in ("cmake", "src"):
shutil.copytree(src=d, dst=os.path.join(self.export_sources_folder, d))
self.copy("CMakeLists.txt")
def validate(self):
if self.options["librw"].platform == "gl3" and self.options["librw"].gl3_gfxlib != "glfw":
raise ConanInvalidConfiguration("Only `glfw` is supported as gl3_gfxlib.")
#if not self.options.with_opus:
# if not self.options["libsndfile"].with_external_libs:
# raise ConanInvalidConfiguration("re3 with opus support requires a libsndfile built with external libs (=ogg/flac/opus/vorbis)")
@property
def _re3_audio(self):
return {
"miles": "MSS",
"openal": "OAL",
}[str(self.options.audio)]
def build(self):
if self.source_folder == self.build_folder:
raise Exception("cannot build with source_folder == build_folder")
try:
os.unlink(os.path.join(self.install_folder, "Findlibrw.cmake"))
tools.save("FindOpenAL.cmake",
textwrap.dedent(
"""
set(OPENAL_FOUND ON)
set(OPENAL_INCLUDE_DIR ${OpenAL_INCLUDE_DIRS})
set(OPENAL_LIBRARY ${OpenAL_LIBRARIES})
set(OPENAL_DEFINITIONS ${OpenAL_DEFINITIONS})
"""), append=True)
if self.options["librw"].platform == "gl3" and self.options["librw"].gl3_gfxlib == "glfw":
tools.save("Findglfw3.cmake",
textwrap.dedent(
"""
if(NOT TARGET glfw)
message(STATUS "Creating glfw TARGET")
add_library(glfw INTERFACE IMPORTED)
set_target_properties(glfw PROPERTIES
INTERFACE_LINK_LIBRARIES CONAN_PKG::glfw)
endif()
"""), append=True)
tools.save("CMakeLists.txt",
textwrap.dedent(
"""
cmake_minimum_required(VERSION 3.0)
project(cmake_wrapper)
include("{}/conanbuildinfo.cmake")
conan_basic_setup(TARGETS NO_OUTPUT_DIRS)
add_subdirectory("{}" re3)
""").format(self.install_folder.replace("\\", "/"),
self.source_folder.replace("\\", "/")))
except FileNotFoundError:
pass
cmake = CMake(self)
cmake.definitions["RE3_AUDIO"] = self._re3_audio
cmake.definitions["RE3_WITH_OPUS"] = self.options.with_opus
cmake.definitions["RE3_INSTALL"] = True
cmake.definitions["RE3_VENDORED_LIBRW"] = False
env = {}
if self._os_is_playstation2:
cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = self.deps_user_info["ps2dev-cmaketoolchain"].cmake_toolchain_file
env["PS2SDK"] = self.deps_cpp_info["ps2dev-ps2sdk"].rootpath
with tools.environment_append(env):
cmake.configure(source_folder=self.build_folder)
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()

Binary file not shown.

BIN
gamefiles/TEXT/english.gxt Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
gamefiles/TEXT/polish.gxt Normal file → Executable file

Binary file not shown.

Binary file not shown.

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,10 +1,3 @@
newoption {
trigger = "glewdir",
value = "PATH",
description = "Directory of GLEW",
default = "vendor/glew-2.1.0"
}
newoption {
trigger = "glfwdir64",
value = "PATH",
@ -34,6 +27,11 @@ newoption {
description = "Build with opus"
}
newoption {
trigger = "lto",
description = "Use link time optimization"
}
if(_OPTIONS["with-librw"]) then
Librw = "vendor/librw"
else
@ -60,7 +58,8 @@ end
workspace "re3"
language "C++"
configurations { "Debug", "Release" }
configurations { "Debug", "Release", "Vanilla" }
startproject "re3"
location "build"
symbols "Full"
staticruntime "off"
@ -107,9 +106,15 @@ workspace "re3"
filter "configurations:Debug"
defines { "DEBUG" }
filter "configurations:Release"
filter "configurations:not Debug"
defines { "NDEBUG" }
optimize "On"
optimize "Speed"
if(_OPTIONS["lto"]) then
flags { "LinkTimeOptimization" }
end
filter "configurations:Vanilla"
defines { "VANILLA_DEFINES" }
filter { "platforms:win*" }
system "windows"
@ -125,11 +130,9 @@ workspace "re3"
filter { "platforms:*x86*" }
architecture "x86"
floatingpoint "Fast"
filter { "platforms:*amd64*" }
architecture "amd64"
floatingpoint "Fast"
filter { "platforms:*arm*" }
architecture "ARM"
@ -148,7 +151,6 @@ workspace "re3"
filter "platforms:*librw_gl3_glfw*"
defines { "RW_GL3" }
includedirs { path.join(_OPTIONS["glewdir"], "include") }
if(not _OPTIONS["with-librw"]) then
libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") }
end
@ -159,16 +161,12 @@ workspace "re3"
filter "platforms:*amd64-librw_gl3_glfw*"
includedirs { path.join(_OPTIONS["glfwdir64"], "include") }
filter "platforms:win*librw_gl3_glfw*"
defines { "GLEW_STATIC" }
filter {}
function setpaths (gamepath, exepath, scriptspath)
scriptspath = scriptspath or ""
function setpaths (gamepath, exepath)
if (gamepath) then
postbuildcommands {
'{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"'
'{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. '%{cfg.buildtarget.name}"'
}
debugdir (gamepath)
if (exepath) then
@ -178,7 +176,6 @@ workspace "re3"
debugdir (gamepath .. (dir or ""))
end
end
--targetdir ("bin/%{prj.name}/" .. scriptspath)
end
if(_OPTIONS["with-librw"]) then
@ -188,16 +185,16 @@ project "librw"
targetdir(path.join(Librw, "lib/%{cfg.platform}/%{cfg.buildcfg}"))
files { path.join(Librw, "src/*.*") }
files { path.join(Librw, "src/*/*.*") }
files { path.join(Librw, "src/gl/*/*.*") }
filter { "platforms:*x86*" }
architecture "x86"
floatingpoint "Fast"
filter { "platforms:*amd64*" }
architecture "amd64"
floatingpoint "Fast"
filter "platforms:win*"
defines { "_CRT_SECURE_NO_WARNINGS", "_CRT_NONSTDC_NO_DEPRECATE" }
staticruntime "on"
buildoptions { "/Zc:sizedDealloc-" }
@ -229,6 +226,10 @@ project "re3"
targetname "re3"
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
if(_OPTIONS["with-librw"]) then
dependson "librw"
end
files { addSrcFiles("src") }
files { addSrcFiles("src/animation") }
files { addSrcFiles("src/audio") }
@ -252,6 +253,7 @@ project "re3"
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
includedirs { "src" }
includedirs { "src/animation" }
@ -302,7 +304,7 @@ project "re3"
filter {}
if(os.getenv("GTA_III_RE_DIR")) then
setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "")
setpaths(os.getenv("GTA_III_RE_DIR") .. "/", "%(cfg.buildtarget.name)")
end
filter "platforms:win*"
@ -316,6 +318,10 @@ project "re3"
-- external librw is dynamic
staticruntime "on"
end
prebuildcommands { '"%{prj.location}..\\printHash.bat" "%{prj.location}..\\src\\extras\\GitSHA1.cpp"' }
filter "platforms:not win*"
prebuildcommands { '"%{prj.location}/../printHash.sh" "%{prj.location}/../src/extras/GitSHA1.cpp"' }
filter "platforms:win*glfw*"
staticruntime "off"
@ -336,10 +342,10 @@ project "re3"
libdirs { "vendor/openal-soft/libs/Win64" }
filter "platforms:linux*oal"
links { "openal", "mpg123", "sndfile", "pthread" }
links { "openal", "mpg123", "sndfile", "pthread", "X11" }
filter "platforms:bsd*oal"
links { "openal", "mpg123", "sndfile", "pthread" }
links { "openal", "mpg123", "sndfile", "pthread", "X11" }
filter "platforms:macosx*oal"
links { "openal", "mpg123", "sndfile", "pthread" }
@ -356,7 +362,7 @@ project "re3"
filter "platforms:*RW33*"
includedirs { "sdk/rwsdk/include/d3d8" }
libdirs { "sdk/rwsdk/lib/d3d8/release" }
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" }
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse", "rpanisot" }
defines { "RWLIBS" }
linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
@ -379,25 +385,23 @@ project "re3"
libdirs { "sdk/dx8sdk/lib" }
filter "platforms:win-x86*gl3_glfw*"
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }
libdirs { path.join(_OPTIONS["glfwdir32"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) }
links { "opengl32", "glew32s", "glfw3" }
links { "opengl32", "glfw3" }
filter "platforms:win-amd64*gl3_glfw*"
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") }
libdirs { path.join(_OPTIONS["glfwdir64"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) }
links { "opengl32", "glew32s", "glfw3" }
links { "opengl32", "glfw3" }
filter "platforms:linux*gl3_glfw*"
links { "GL", "GLEW", "glfw" }
links { "GL", "glfw" }
filter "platforms:bsd*gl3_glfw*"
links { "GL", "GLEW", "glfw", "sysinfo" }
links { "GL", "glfw", "sysinfo" }
includedirs { "/usr/local/include" }
libdirs { "/usr/local/lib" }
filter "platforms:macosx*gl3_glfw*"
links { "GLEW", "glfw" }
links { "glfw" }
linkoptions { "-framework OpenGL" }
includedirs { "/opt/local/include" }
includedirs { "/usr/local/include" }

Binary file not shown.

26
printHash.bat Normal file
View File

@ -0,0 +1,26 @@
@echo off
REM creates version.h with HEAD commit hash
REM params: $1=full path to output file (usually points version.h)
setlocal enableextensions enabledelayedexpansion
cd /d "%~dp0"
break> %1
<nul set /p=^"#define GIT_SHA1 ^"^"> %1
where git
if "%errorlevel%" == "0" ( goto :havegit ) else ( goto :writeending )
:havegit
for /f %%v in ('git rev-parse --short HEAD') do set version=%%v
<nul set /p="%version%" >> %1
:writeending
echo ^" >> %1
echo const char* g_GIT_SHA1 = GIT_SHA1; >> %1
EXIT /B

12
printHash.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
> $1
echo -n "#define GIT_SHA1 \"" > $1
if (command -v "git" >/dev/null) then
git rev-parse --short HEAD | tr -d '\n' >> $1
fi
echo "\"" >> $1
echo "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1

View File

@ -1,92 +1,125 @@
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
if(${RE3_AUDIO} STREQUAL "OAL")
find_package(OpenAL REQUIRED)
find_package(MPG123 REQUIRED)
find_package(SndFile REQUIRED)
endif()
file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
file(GLOB_RECURSE Sources "*.cpp" "*.h")
function(header_directories RETURN_LIST)
file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c)
set(RELDIRS)
foreach(SRC ${ALL_SRCS})
file(RELATIVE_PATH RELSRC "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}")
get_filename_component(RELDIR "${RELSRC}" DIRECTORY)
list(APPEND RELDIRS ${RELDIR})
endforeach()
list(REMOVE_DUPLICATES RELDIRS)
set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE)
endfunction()
MACRO(HEADER_DIRECTORIES return_list)
FILE(GLOB_RECURSE new_list *.cpp)
SET(dir_list "animation"
"audio"
"collision"
"control"
"core"
"entities"
"extras"
"fakerw"
"math"
"modelinfo"
"objects"
"peds"
"render"
"rw"
"save"
"skel"
"text"
"vehicles"
"weapons")
FOREACH(file_path ${new_list})
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
SET(dir_list ${dir_list} ${dir_path})
ENDFOREACH()
LIST(REMOVE_DUPLICATES dir_list)
SET(${return_list} ${dir_list})
ENDMACRO()
header_directories(${PROJECT}_INCLUDES)
HEADER_DIRECTORIES(header_list)
include_directories(${header_list})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/extras/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/extras/GitSHA1.cpp" @ONLY)
list(APPEND ${PROJECT}_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/extras/GitSHA1.cpp")
add_executable(${EXECUTABLE} WIN32
${${PROJECT}_SOURCES}
)
add_executable(re3 ${Sources})
target_link_libraries(re3 librw)
target_link_libraries(re3 Threads::Threads)
target_link_libraries(${EXECUTABLE} PRIVATE
librw::librw
Threads::Threads
)
if(${RE3_AUDIO} STREQUAL "OAL")
target_link_libraries(re3 ${OPENAL_LIBRARY})
target_link_libraries(re3 ${MPG123_LIBRARIES})
target_link_libraries(re3 ${SNDFILE_LIBRARIES})
endif()
target_include_directories(re3
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
)
target_compile_definitions(re3
target_include_directories(${EXECUTABLE}
PRIVATE
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
PUBLIC
"RW_${RE3_PLATFORM}"
)
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${${PROJECT}_INCLUDES}>
)
target_compile_definitions(re3 PRIVATE LIBRW=1 AUDIO_OAL=1)
target_compile_definitions(${EXECUTABLE}
PRIVATE
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
LIBRW
${PROJECT}_NO_AUTOLINK
)
if(LIBRW_PLATFORM_D3D9)
target_compile_definitions(${EXECUTABLE}
PUBLIC
USE_D3D9
)
endif()
target_compile_definitions(${EXECUTABLE} PRIVATE CMAKE_BUILD)
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})
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
elseif(${PROJECT}_AUDIO STREQUAL "MSS")
find_package(MilesSDK REQUIRED)
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_MSS)
target_link_libraries(${EXECUTABLE} PRIVATE MilesSDK::MilesSDK)
endif()
find_package(mpg123 REQUIRED)
target_link_libraries(${EXECUTABLE} PRIVATE
MPG123::libmpg123
)
if(${PROJECT}_WITH_OPUS)
find_package(opusfile REQUIRED)
target_link_libraries(${EXECUTABLE} PRIVATE
opusfile::opusfile
)
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OPUS)
endif()
if(${PROJECT}_WITH_LIBSNDFILE)
find_package(SndFile REQUIRED)
target_link_libraries(${EXECUTABLE} PRIVATE
SndFile::SndFile
)
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL_USE_SNDFILE)
endif()
target_compile_definitions(${EXECUTABLE} PRIVATE )
option(${PROJECT}_WITH_SANITIZERS "Use UB sanitizers (better crash log)" OFF)
option(${PROJECT}_WITH_ASAN "Use Address sanitizer (better crash log)" OFF)
if(${PROJECT}_WITH_SANITIZERS)
target_compile_options(${EXECUTABLE} PUBLIC
-fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability
-g3 -fno-omit-frame-pointer)
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability)
endif()
if(${PROJECT}_WITH_ASAN)
target_compile_options(${EXECUTABLE} PUBLIC -fsanitize=address -g3 -fno-omit-frame-pointer)
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=address)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(re3
target_compile_options(${EXECUTABLE}
PRIVATE
"-Wall"
)
if (NOT RE3_PLATFORM_PS2)
target_compile_options(re3
)
if (NOT LIBRW_PLATFORM_PS2)
target_compile_options(${EXECUTABLE}
PRIVATE
"-Wextra"
"-Wdouble-promotion"
"-Wpedantic"
)
-Wextra
-Wdouble-promotion
-Wpedantic
)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(re3
target_compile_options(${EXECUTABLE}
PUBLIC
/wd4996 /wd4244
)
/Zc:sizedDealloc-
)
endif()
set_target_properties(re3
set_target_properties(${EXECUTABLE}
PROPERTIES
C_STANDARD 11
C_EXTENSIONS OFF
@ -94,20 +127,15 @@ set_target_properties(re3
CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
)
if(RE3_INSTALL)
target_include_directories(re3
INTERFACE
$<INSTALL_INTERFACE:${RE3_INSTALL_INCLUDEDIR}>
)
)
if(${PROJECT}_INSTALL)
install(
TARGETS re3
EXPORT re3-targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
TARGETS ${EXECUTABLE}
EXPORT ${EXECUTABLE}-targets
RUNTIME DESTINATION "."
)
if(MSVC)
install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
endif()
endif()

View File

@ -1,7 +1,11 @@
#include "common.h"
#if defined _WIN32 && !defined __MINGW32__
#if defined __MWERKS__
#include <wctype.h>
#else
#include "ctype.h"
#endif
#else
#include <cwctype>
#endif
@ -83,18 +87,18 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
if(c1) s1++;
if(c2) s2++;
if(c1 == '\0' && c2 == '\0') return true;
#if defined _WIN32 && !defined __MINGW32__
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#else
#ifndef ASCII_STRCMP
if(iswdigit(c1) && iswdigit(c2))
#else
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#endif
continue;
#if defined _WIN32 && !defined __MINGW32__
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#else
#ifndef ASCII_STRCMP
c1 = toupper(c1);
c2 = toupper(c2);
#else
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#endif
if(c1 != c2)
@ -111,7 +115,7 @@ GetModelFromName(const char *name)
for(i = 0; i < MODELINFOSIZE; i++){
mi = CModelInfo::GetModelInfo(i);
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
strcmpIgnoringDigits(mi->GetName(), name))
strcmpIgnoringDigits(mi->GetModelName(), name))
return mi;
}
return nil;
@ -134,7 +138,7 @@ CAnimBlendAssocGroup::CreateAssociations(const char *name)
CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i);
CBaseModelInfo *model = GetModelFromName(anim->name);
assert(model);
printf("Associated anim %s with model %s\n", anim->name, model->GetName());
printf("Associated anim %s with model %s\n", anim->name, model->GetModelName());
RpClump *clump = (RpClump*)model->CreateInstance();
#ifdef PED_SKIN
if(IsClumpSkinned(clump))

View File

@ -7,7 +7,7 @@
CAnimBlendClumpData::CAnimBlendClumpData(void)
{
numFrames = 0;
velocity = nil;
velocity2d = nil;
frames = nil;
link.Init();
}

View File

@ -3,7 +3,6 @@
#include "AnimBlendList.h"
// TODO: put somewhere else
struct AnimBlendFrameData
{
enum {
@ -38,7 +37,10 @@ public:
#ifdef PED_SKIN
int32 modelNumber; // doesn't seem to be used
#endif
CVector *velocity;
union {
CVector2D *velocity2d;
CVector *velocity3d;
};
// order of frames is determined by RW hierarchy
AnimBlendFrameData *frames;

View File

@ -19,68 +19,68 @@ CAnimBlendAssocGroup *CAnimManager::ms_aAnimAssocGroups;
CLinkList<CAnimBlendHierarchy*> CAnimManager::ms_animCache;
AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
{ ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
{ ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
{ ANIM_IDLE_STANCE, ASSOC_REPEAT },
{ ANIM_WALK_START, ASSOC_HAS_TRANSLATION },
{ ANIM_RUN_STOP, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
{ ANIM_RUN_STOP_R, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
{ ANIM_IDLE_CAM, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_IDLE_HBHB, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_IDLE_TIRED, ASSOC_REPEAT },
{ ANIM_IDLE_ARMED, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_IDLE_CHAT, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_IDLE_TAXI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_KO_SHOT_FRONT1, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_FRONT2, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_FRONT3, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_FRONT4, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_FACE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_STOM, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_KO_SHOT_ARML, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_ARMR, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_KO_SHOT_LEGL, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_KO_SHOT_LEGR, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_KD_LEFT, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_KD_RIGHT, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_KO_SKID_FRONT, ASSOC_PARTIAL },
{ ANIM_KO_SPIN_R, ASSOC_PARTIAL },
{ ANIM_KO_SKID_BACK, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_KO_SPIN_L, ASSOC_PARTIAL },
{ ANIM_SHOT_FRONT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_SHOT_LEFT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_SHOT_BACK_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_SHOT_RIGHT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_HIT_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FLOOR_HIT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
{ ANIM_STD_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
{ ANIM_STD_RUNFAST, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
{ ANIM_STD_IDLE, ASSOC_REPEAT },
{ ANIM_STD_STARTWALK, ASSOC_HAS_TRANSLATION },
{ ANIM_STD_RUNSTOP1, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_RUNSTOP2, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_IDLE_CAM, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_STD_IDLE_HBHB, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_STD_IDLE_TIRED, ASSOC_REPEAT },
{ ANIM_STD_IDLE_BIGGUN, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_STD_CHAT, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_STD_HAILTAXI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_KO_FRONT, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_STD_KO_LEFT, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_STD_KO_BACK, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_STD_KO_RIGHT, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_STD_KO_SHOT_FACE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_STD_KO_SHOT_STOMACH, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_KO_SHOT_ARM_L, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_STD_KO_SHOT_ARM_R, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_STD_KO_SHOT_LEG_L, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_KO_SHOT_LEG_R, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_SPINFORWARD_LEFT, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_STD_SPINFORWARD_RIGHT, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_STD_HIGHIMPACT_FRONT, ASSOC_PARTIAL },
{ ANIM_STD_HIGHIMPACT_LEFT, ASSOC_PARTIAL },
{ ANIM_STD_HIGHIMPACT_BACK, ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_STD_HIGHIMPACT_RIGHT, ASSOC_PARTIAL },
{ ANIM_STD_HITBYGUN_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_HITBYGUN_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_HITBYGUN_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_HITBYGUN_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_HIT_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_HIT_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_HIT_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_HIT_FLOOR, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
#if GTA_VERSION <= GTA3_PS2_160
{ ANIM_HIT_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_HIT_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
#endif
{ ANIM_HIT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_CHEST, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_WALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_WALL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FLOOR_HIT_F, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_HIT_BEHIND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_PUNCH_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_KICK_FLOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_BAT_H, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_BAT_V, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_HGUN_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_WEAPON_AK_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_PUMP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_SNIPER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_THROWU, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_WEAPON_START_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_HGUN_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_HIT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_HIT_CHEST, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_HIT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_HIT_WALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_HIT_WALL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_HIT_FLOOR_FRONT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL },
{ ANIM_STD_HIT_BEHIND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_KICKGROUND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_WEAPON_BAT_H, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_WEAPON_BAT_V, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_WEAPON_HGUN_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_WEAPON_AK_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_WEAPON_PUMP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_WEAPON_SNIPER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_WEAPON_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_THROW_UNDER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_START_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_DETONATE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_HGUN_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
#ifdef PC_PLAYER_CONTROLS
// maybe wrong define, but unused anyway
{ ANIM_FPS_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
@ -91,121 +91,121 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_FPS_M16, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_ROCKET, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
#endif
{ ANIM_FIGHT_IDLE, ASSOC_REPEAT },
{ ANIM_FIGHT2_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_SH_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FIGHT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_KICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_KNEE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_LHOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_ROUNDHOUSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FIGHT_LONGKICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FIGHT_PPUNCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_CAR_JACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_LJACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_JACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_LJACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_QJACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_QJACKED, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_ALIGN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_ALIGNHI_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_OPEN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_DOORLOCKED_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_PULLOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_PULLOUT_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_GETIN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_GETIN_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CLOSEDOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CLOSEDOOR_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_ROLLDOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_ROLLDOOR_LOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_GETOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_GETOUT_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CLOSE_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_ALIGN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_ALIGNHI_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_OPEN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_DOORLOCKED_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_PULLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_PULLOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_GETIN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_GETIN_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CLOSEDOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CLOSEDOOR_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_SHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_LSHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_SIT, ASSOC_DELETEFADEDOUT },
{ ANIM_CAR_LSIT, ASSOC_DELETEFADEDOUT },
{ ANIM_CAR_SITP, ASSOC_DELETEFADEDOUT },
{ ANIM_CAR_SITPLO, ASSOC_DELETEFADEDOUT },
{ ANIM_DRIVE_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DRIVE_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DRIVE_LOW_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DRIVE_LOW_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DRIVEBY_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DRIVEBY_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_CAR_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DRIVE_BOAT, ASSOC_DELETEFADEDOUT },
{ ANIM_CAR_GETOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_GETOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CLOSE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_HOOKERTALK, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_COACH_OPEN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_COACH_OPEN_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_COACH_IN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_COACH_IN_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_COACH_OUT_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_TRAIN_GETIN, ASSOC_PARTIAL },
{ ANIM_TRAIN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CRAWLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_CAR_CRAWLOUT_RHS2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_VAN_OPEN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_VAN_GETIN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_VAN_CLOSE_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_VAN_GETOUT_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_VAN_OPEN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_VAN_GETIN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_VAN_CLOSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_VAN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_GETUP1, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_GETUP2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_GETUP3, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_GETUP_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_JUMP_LAUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_JUMP_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_JUMP_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FALL_FALL, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_FALL_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_FALL_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FALL_COLLAPSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_EV_STEP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_EV_DIVE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_XPRESS_SCRATCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE },
{ ANIM_ROAD_CROSS, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_TURN_180, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_ARREST_GUN, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_DROWN, ASSOC_PARTIAL },
{ ANIM_CPR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_DUCK_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_DUCK_LOW, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_RBLOCK_CSHOOT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_WEAPON_THROWU2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_HANDSUP, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HANDSCOWER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_FUCKU, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_PHONE_IN, ASSOC_PARTIAL },
{ ANIM_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_FIGHT_IDLE, ASSOC_REPEAT },
{ ANIM_STD_FIGHT_2IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_FIGHT_SHUFFLE_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_FIGHT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_FIGHT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_FIGHT_KICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_FIGHT_KNEE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_FIGHT_LHOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_FIGHT_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_FIGHT_ROUNDHOUSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_FIGHT_LONGKICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_PARTIAL_PUNCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_JACKEDCAR_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_JACKEDCAR_LO_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_JACKEDCAR_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_JACKEDCAR_LO_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_QUICKJACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_QUICKJACKED, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_CAR_ALIGN_DOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_ALIGNHI_DOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_OPEN_DOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CARDOOR_LOCKED_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_PULL_OUT_PED_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_PULL_OUT_PED_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_GET_IN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_GET_IN_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_CLOSE_DOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_CLOSE_DOOR_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_GETOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_GETOUT_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_CLOSE_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_ALIGN_DOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_ALIGNHI_DOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_OPEN_DOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CARDOOR_LOCKED_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_PULL_OUT_PED_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_PULL_OUT_PED_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_GET_IN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_GET_IN_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_CLOSE_DOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_CLOSE_DOOR_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_SHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_SHUFFLE_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_SIT, ASSOC_DELETEFADEDOUT },
{ ANIM_STD_CAR_SIT_LO, ASSOC_DELETEFADEDOUT },
{ ANIM_STD_CAR_SIT_P, ASSOC_DELETEFADEDOUT },
{ ANIM_STD_CAR_SIT_P_LO, ASSOC_DELETEFADEDOUT },
{ ANIM_STD_CAR_DRIVE_LEFT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_CAR_DRIVE_RIGHT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_CAR_DRIVE_LEFT_LO, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_CAR_DRIVE_RIGHT_LO, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_CAR_DRIVEBY_LEFT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_CAR_DRIVEBY_RIGHT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_CAR_LOOKBEHIND, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_BOAT_DRIVE, ASSOC_DELETEFADEDOUT },
{ ANIM_STD_GETOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_GETOUT_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_CLOSE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CAR_HOOKERTALK, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_STD_COACH_OPEN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_COACH_OPEN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_COACH_GET_IN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_COACH_GET_IN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_COACH_GET_OUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_TRAIN_GETIN, ASSOC_PARTIAL },
{ ANIM_STD_TRAIN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CRAWLOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_CRAWLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_VAN_OPEN_DOOR_REAR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_VAN_GET_IN_REAR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_VAN_CLOSE_DOOR_REAR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_VAN_GET_OUT_REAR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_VAN_OPEN_DOOR_REAR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_VAN_GET_IN_REAR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_VAN_CLOSE_DOOR_REAR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_VAN_GET_OUT_REAR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_GET_UP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_GET_UP_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_GET_UP_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_GET_UP_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_JUMP_LAUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_JUMP_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_JUMP_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_FALL, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_FALL_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_FALL_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_FALL_COLLAPSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_EVADE_STEP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_EVADE_DIVE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
{ ANIM_STD_XPRESS_SCRATCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE },
{ ANIM_STD_ROADCROSS, ASSOC_REPEAT | ASSOC_PARTIAL },
{ ANIM_STD_TURN180, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_ARREST, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_DROWN, ASSOC_PARTIAL },
{ ANIM_MEDIC_CPR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_DUCK_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_DUCK_LOW, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_RBLOCK_SHOOT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
{ ANIM_STD_THROW_UNDER2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_HANDSUP, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_HANDSCOWER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_STD_PARTIAL_FUCKU, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_STD_PHONE_IN, ASSOC_PARTIAL },
{ ANIM_STD_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_STD_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
};
#ifdef PC_PLAYER_CONTROLS
AnimAssocDesc aStdAnimDescsSide[] = {
{ ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_IDLE_STANCE, ASSOC_REPEAT },
{ ANIM_WALK_START, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
{ ANIM_STD_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_STD_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_STD_RUNFAST, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_STD_IDLE, ASSOC_REPEAT },
{ ANIM_STD_STARTWALK, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
};
#endif
char const *aStdAnimations[] = {

View File

@ -2,68 +2,82 @@
enum AnimationId
{
ANIM_WALK,
ANIM_RUN,
ANIM_SPRINT,
ANIM_IDLE_STANCE,
ANIM_WALK_START,
ANIM_RUN_STOP,
ANIM_RUN_STOP_R,
ANIM_IDLE_CAM,
ANIM_IDLE_HBHB,
ANIM_IDLE_TIRED,
ANIM_IDLE_ARMED,
ANIM_IDLE_CHAT,
ANIM_IDLE_TAXI,
ANIM_KO_SHOT_FRONT1,
ANIM_KO_SHOT_FRONT2,
ANIM_KO_SHOT_FRONT3,
ANIM_KO_SHOT_FRONT4,
ANIM_KO_SHOT_FACE,
ANIM_KO_SHOT_STOM,
ANIM_KO_SHOT_ARML,
ANIM_KO_SHOT_ARMR,
ANIM_KO_SHOT_LEGL,
ANIM_KO_SHOT_LEGR,
ANIM_KD_LEFT,
ANIM_KD_RIGHT,
ANIM_KO_SKID_FRONT,
ANIM_KO_SPIN_R, // named left in VC
ANIM_KO_SKID_BACK,
ANIM_KO_SPIN_L, // named right in VC
ANIM_SHOT_FRONT_PARTIAL,
ANIM_SHOT_LEFT_PARTIAL,
ANIM_SHOT_BACK_PARTIAL,
ANIM_SHOT_RIGHT_PARTIAL,
ANIM_HIT_FRONT,
ANIM_HIT_LEFT,
ANIM_HIT_BACK,
ANIM_HIT_RIGHT,
ANIM_FLOOR_HIT,
ANIM_STD_WALK,
ANIM_STD_RUN,
ANIM_STD_RUNFAST,
ANIM_STD_IDLE,
ANIM_STD_STARTWALK,
ANIM_STD_RUNSTOP1,
ANIM_STD_RUNSTOP2,
ANIM_STD_IDLE_CAM,
ANIM_STD_IDLE_HBHB,
ANIM_STD_IDLE_TIRED,
ANIM_STD_IDLE_BIGGUN,
ANIM_STD_CHAT,
ANIM_STD_HAILTAXI,
ANIM_STD_KO_FRONT,
ANIM_STD_KO_LEFT,
ANIM_STD_KO_BACK,
ANIM_STD_KO_RIGHT,
ANIM_STD_KO_SHOT_FACE,
ANIM_STD_KO_SHOT_STOMACH,
ANIM_STD_KO_SHOT_ARM_L,
ANIM_STD_KO_SHOT_ARM_R,
ANIM_STD_KO_SHOT_LEG_L,
ANIM_STD_KO_SHOT_LEG_R,
ANIM_STD_SPINFORWARD_LEFT,
ANIM_STD_SPINFORWARD_RIGHT,
ANIM_STD_HIGHIMPACT_FRONT,
ANIM_STD_HIGHIMPACT_LEFT,
ANIM_STD_HIGHIMPACT_BACK,
ANIM_STD_HIGHIMPACT_RIGHT,
ANIM_STD_HITBYGUN_FRONT,
ANIM_STD_HITBYGUN_LEFT,
ANIM_STD_HITBYGUN_BACK,
ANIM_STD_HITBYGUN_RIGHT,
ANIM_STD_HIT_FRONT,
ANIM_STD_HIT_LEFT,
ANIM_STD_HIT_BACK,
ANIM_STD_HIT_RIGHT,
ANIM_STD_HIT_FLOOR,
/* names made up */
#if GTA_VERSION <= GTA3_PS2_160
ANIM_HIT_BODY,
ANIM_STD_HIT_BODY,
#endif
ANIM_HIT_BODYBLOW,
ANIM_HIT_CHEST,
ANIM_HIT_HEAD,
ANIM_HIT_WALK,
ANIM_HIT_WALL,
ANIM_FLOOR_HIT_F,
ANIM_HIT_BEHIND,
ANIM_PUNCH_R,
ANIM_KICK_FLOOR,
ANIM_WEAPON_BAT_H,
ANIM_WEAPON_BAT_V,
ANIM_WEAPON_HGUN_BODY,
ANIM_WEAPON_AK_BODY,
ANIM_WEAPON_PUMP,
ANIM_WEAPON_SNIPER,
ANIM_WEAPON_THROW,
ANIM_WEAPON_THROWU,
ANIM_WEAPON_START_THROW,
ANIM_BOMBER,
ANIM_HGUN_RELOAD,
ANIM_AK_RELOAD,
ANIM_STD_HIT_BODYBLOW,
ANIM_STD_HIT_CHEST,
ANIM_STD_HIT_HEAD,
ANIM_STD_HIT_WALK,
/**/
ANIM_STD_HIT_WALL,
ANIM_STD_HIT_FLOOR_FRONT,
ANIM_STD_HIT_BEHIND,
ANIM_STD_PUNCH,
ANIM_STD_KICKGROUND,
/* names made up */
ANIM_STD_WEAPON_BAT_H,
ANIM_STD_WEAPON_BAT_V,
ANIM_STD_WEAPON_HGUN_BODY,
ANIM_STD_WEAPON_AK_BODY,
ANIM_STD_WEAPON_PUMP,
ANIM_STD_WEAPON_SNIPER,
ANIM_STD_WEAPON_THROW,
/**/
ANIM_STD_THROW_UNDER,
/* names made up */
ANIM_STD_START_THROW,
/**/
ANIM_STD_DETONATE,
/* names made up */
ANIM_STD_HGUN_RELOAD,
ANIM_STD_AK_RELOAD,
#ifdef PC_PLAYER_CONTROLS
// maybe wrong define, but unused anyway
ANIM_FPS_PUNCH,
@ -74,113 +88,123 @@ enum AnimationId
ANIM_FPS_M16,
ANIM_FPS_ROCKET,
#endif
ANIM_FIGHT_IDLE,
ANIM_FIGHT2_IDLE,
ANIM_FIGHT_SH_F,
ANIM_FIGHT_BODYBLOW,
ANIM_FIGHT_HEAD,
ANIM_FIGHT_KICK,
ANIM_FIGHT_KNEE,
ANIM_FIGHT_LHOOK,
ANIM_FIGHT_PUNCH,
ANIM_FIGHT_ROUNDHOUSE,
ANIM_FIGHT_LONGKICK,
ANIM_FIGHT_PPUNCH,
ANIM_CAR_JACKED_RHS,
ANIM_CAR_LJACKED_RHS,
ANIM_CAR_JACKED_LHS,
ANIM_CAR_LJACKED_LHS,
ANIM_CAR_QJACK,
ANIM_CAR_QJACKED,
ANIM_CAR_ALIGN_LHS,
ANIM_CAR_ALIGNHI_LHS,
ANIM_CAR_OPEN_LHS,
ANIM_CAR_DOORLOCKED_LHS,
ANIM_CAR_PULLOUT_LHS,
ANIM_CAR_PULLOUT_LOW_LHS,
ANIM_CAR_GETIN_LHS,
ANIM_CAR_GETIN_LOW_LHS,
ANIM_CAR_CLOSEDOOR_LHS,
ANIM_CAR_CLOSEDOOR_LOW_LHS,
ANIM_CAR_ROLLDOOR,
ANIM_CAR_ROLLDOOR_LOW,
ANIM_CAR_GETOUT_LHS,
ANIM_CAR_GETOUT_LOW_LHS,
ANIM_CAR_CLOSE_LHS,
ANIM_CAR_ALIGN_RHS,
ANIM_CAR_ALIGNHI_RHS,
ANIM_CAR_OPEN_RHS,
ANIM_CAR_DOORLOCKED_RHS,
ANIM_CAR_PULLOUT_RHS,
ANIM_CAR_PULLOUT_LOW_RHS,
ANIM_CAR_GETIN_RHS,
ANIM_CAR_GETIN_LOW_RHS,
ANIM_CAR_CLOSEDOOR_RHS,
ANIM_CAR_CLOSEDOOR_LOW_RHS,
ANIM_CAR_SHUFFLE_RHS,
ANIM_CAR_LSHUFFLE_RHS,
ANIM_CAR_SIT,
ANIM_CAR_LSIT,
ANIM_CAR_SITP,
ANIM_CAR_SITPLO,
ANIM_DRIVE_L,
ANIM_DRIVE_R,
ANIM_DRIVE_LOW_L,
ANIM_DRIVE_LOW_R,
ANIM_DRIVEBY_L,
ANIM_DRIVEBY_R,
ANIM_CAR_LB,
ANIM_DRIVE_BOAT,
ANIM_CAR_GETOUT_RHS,
ANIM_CAR_GETOUT_LOW_RHS,
ANIM_CAR_CLOSE_RHS,
ANIM_CAR_HOOKERTALK,
ANIM_COACH_OPEN_L,
ANIM_COACH_OPEN_R,
ANIM_COACH_IN_L,
ANIM_COACH_IN_R,
ANIM_COACH_OUT_L,
ANIM_TRAIN_GETIN,
ANIM_TRAIN_GETOUT,
ANIM_CAR_CRAWLOUT_RHS,
ANIM_CAR_CRAWLOUT_RHS2,
ANIM_VAN_OPEN_L,
ANIM_VAN_GETIN_L,
ANIM_VAN_CLOSE_L,
ANIM_VAN_GETOUT_L,
ANIM_VAN_OPEN,
ANIM_VAN_GETIN,
ANIM_VAN_CLOSE,
ANIM_VAN_GETOUT,
ANIM_GETUP1,
ANIM_GETUP2,
ANIM_GETUP3,
ANIM_GETUP_FRONT,
ANIM_JUMP_LAUNCH,
ANIM_JUMP_GLIDE,
ANIM_JUMP_LAND,
ANIM_FALL_FALL,
ANIM_FALL_GLIDE,
ANIM_FALL_LAND,
ANIM_FALL_COLLAPSE,
ANIM_EV_STEP,
ANIM_EV_DIVE,
ANIM_XPRESS_SCRATCH,
ANIM_ROAD_CROSS,
ANIM_TURN_180,
ANIM_ARREST_GUN,
ANIM_DROWN,
ANIM_CPR,
ANIM_DUCK_DOWN,
ANIM_DUCK_LOW,
ANIM_RBLOCK_CSHOOT,
ANIM_WEAPON_THROWU2,
ANIM_HANDSUP,
ANIM_HANDSCOWER,
ANIM_FUCKU,
ANIM_PHONE_IN,
ANIM_PHONE_OUT,
ANIM_PHONE_TALK,
/**/
NUM_ANIMS
ANIM_STD_FIGHT_IDLE,
ANIM_STD_FIGHT_2IDLE,
ANIM_STD_FIGHT_SHUFFLE_F,
/* names made up */
ANIM_STD_FIGHT_BODYBLOW,
ANIM_STD_FIGHT_HEAD,
ANIM_STD_FIGHT_KICK,
ANIM_STD_FIGHT_KNEE,
ANIM_STD_FIGHT_LHOOK,
ANIM_STD_FIGHT_PUNCH,
ANIM_STD_FIGHT_ROUNDHOUSE,
ANIM_STD_FIGHT_LONGKICK,
/**/
ANIM_STD_PARTIAL_PUNCH,
ANIM_STD_JACKEDCAR_RHS,
ANIM_STD_JACKEDCAR_LO_RHS,
ANIM_STD_JACKEDCAR_LHS,
ANIM_STD_JACKEDCAR_LO_LHS,
ANIM_STD_QUICKJACK,
ANIM_STD_QUICKJACKED,
ANIM_STD_CAR_ALIGN_DOOR_LHS,
ANIM_STD_CAR_ALIGNHI_DOOR_LHS,
ANIM_STD_CAR_OPEN_DOOR_LHS,
ANIM_STD_CARDOOR_LOCKED_LHS,
ANIM_STD_CAR_PULL_OUT_PED_LHS,
ANIM_STD_CAR_PULL_OUT_PED_LO_LHS,
ANIM_STD_CAR_GET_IN_LHS,
ANIM_STD_CAR_GET_IN_LO_LHS,
ANIM_STD_CAR_CLOSE_DOOR_LHS,
ANIM_STD_CAR_CLOSE_DOOR_LO_LHS,
ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LHS,
ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LO_LHS,
ANIM_STD_GETOUT_LHS,
ANIM_STD_GETOUT_LO_LHS,
ANIM_STD_CAR_CLOSE_LHS,
ANIM_STD_CAR_ALIGN_DOOR_RHS,
ANIM_STD_CAR_ALIGNHI_DOOR_RHS,
ANIM_STD_CAR_OPEN_DOOR_RHS,
ANIM_STD_CARDOOR_LOCKED_RHS,
ANIM_STD_CAR_PULL_OUT_PED_RHS,
ANIM_STD_CAR_PULL_OUT_PED_LO_RHS,
ANIM_STD_CAR_GET_IN_RHS,
ANIM_STD_CAR_GET_IN_LO_RHS,
ANIM_STD_CAR_CLOSE_DOOR_RHS,
ANIM_STD_CAR_CLOSE_DOOR_LO_RHS,
ANIM_STD_CAR_SHUFFLE_RHS,
ANIM_STD_CAR_SHUFFLE_LO_RHS,
ANIM_STD_CAR_SIT,
ANIM_STD_CAR_SIT_LO,
ANIM_STD_CAR_SIT_P,
ANIM_STD_CAR_SIT_P_LO,
ANIM_STD_CAR_DRIVE_LEFT,
ANIM_STD_CAR_DRIVE_RIGHT,
ANIM_STD_CAR_DRIVE_LEFT_LO,
ANIM_STD_CAR_DRIVE_RIGHT_LO,
ANIM_STD_CAR_DRIVEBY_LEFT,
ANIM_STD_CAR_DRIVEBY_RIGHT,
ANIM_STD_CAR_LOOKBEHIND,
ANIM_STD_BOAT_DRIVE,
ANIM_STD_GETOUT_RHS,
ANIM_STD_GETOUT_LO_RHS,
ANIM_STD_CAR_CLOSE_RHS,
ANIM_STD_CAR_HOOKERTALK,
ANIM_STD_COACH_OPEN_LHS,
ANIM_STD_COACH_OPEN_RHS,
ANIM_STD_COACH_GET_IN_LHS,
ANIM_STD_COACH_GET_IN_RHS,
ANIM_STD_COACH_GET_OUT_LHS,
ANIM_STD_TRAIN_GETIN,
ANIM_STD_TRAIN_GETOUT,
ANIM_STD_CRAWLOUT_LHS,
ANIM_STD_CRAWLOUT_RHS,
ANIM_STD_VAN_OPEN_DOOR_REAR_LHS,
ANIM_STD_VAN_GET_IN_REAR_LHS,
ANIM_STD_VAN_CLOSE_DOOR_REAR_LHS,
ANIM_STD_VAN_GET_OUT_REAR_LHS,
ANIM_STD_VAN_OPEN_DOOR_REAR_RHS,
ANIM_STD_VAN_GET_IN_REAR_RHS,
ANIM_STD_VAN_CLOSE_DOOR_REAR_RHS,
ANIM_STD_VAN_GET_OUT_REAR_RHS,
ANIM_STD_GET_UP,
ANIM_STD_GET_UP_LEFT,
ANIM_STD_GET_UP_RIGHT,
ANIM_STD_GET_UP_FRONT,
ANIM_STD_JUMP_LAUNCH,
ANIM_STD_JUMP_GLIDE,
ANIM_STD_JUMP_LAND,
ANIM_STD_FALL,
ANIM_STD_FALL_GLIDE,
ANIM_STD_FALL_LAND,
ANIM_STD_FALL_COLLAPSE,
ANIM_STD_EVADE_STEP,
ANIM_STD_EVADE_DIVE,
ANIM_STD_XPRESS_SCRATCH,
ANIM_STD_ROADCROSS,
ANIM_STD_TURN180,
ANIM_STD_ARREST,
ANIM_STD_DROWN,
ANIM_MEDIC_CPR,
ANIM_STD_DUCK_DOWN,
ANIM_STD_DUCK_LOW,
ANIM_STD_RBLOCK_SHOOT,
/* names made up */
ANIM_STD_THROW_UNDER2,
/**/
ANIM_STD_HANDSUP,
ANIM_STD_HANDSCOWER,
ANIM_STD_PARTIAL_FUCKU,
ANIM_STD_PHONE_IN,
ANIM_STD_PHONE_OUT,
ANIM_STD_PHONE_TALK,
ANIM_STD_NUM
};

View File

@ -29,7 +29,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){
gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
else
@ -138,11 +138,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
gpAnimBlendClump->velocity->x = transx - curx;
gpAnimBlendClump->velocity->y = transy - cury;
gpAnimBlendClump->velocity2d->x = transx - curx;
gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){
gpAnimBlendClump->velocity->x += endx;
gpAnimBlendClump->velocity->y += endy;
gpAnimBlendClump->velocity2d->x += endx;
gpAnimBlendClump->velocity2d->y += endy;
}
mat->pos.x = pos.x - transx;
mat->pos.y = pos.y - transy;
@ -218,9 +218,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame,
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur;
*gpAnimBlendClump->velocity3d = trans - cur;
if(looped)
*gpAnimBlendClump->velocity += end;
*gpAnimBlendClump->velocity3d += end;
mat->pos.x = (pos - trans).x + frame->resetPos.x;
mat->pos.y = (pos - trans).y + frame->resetPos.y;
mat->pos.z = (pos - trans).z + frame->resetPos.z;
@ -241,7 +241,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){
gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
else
@ -353,11 +353,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
gpAnimBlendClump->velocity->x = transx - curx;
gpAnimBlendClump->velocity->y = transy - cury;
gpAnimBlendClump->velocity2d->x = transx - curx;
gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){
gpAnimBlendClump->velocity->x += endx;
gpAnimBlendClump->velocity->y += endy;
gpAnimBlendClump->velocity2d->x += endx;
gpAnimBlendClump->velocity2d->y += endy;
}
xform->t.x = pos.x - transx;
xform->t.y = pos.y - transy;
@ -433,9 +433,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur;
*gpAnimBlendClump->velocity3d = trans - cur;
if(looped)
*gpAnimBlendClump->velocity += end;
*gpAnimBlendClump->velocity3d += end;
xform->t.x = (pos - trans).x + frame->resetPos.x;
xform->t.y = (pos - trans).y + frame->resetPos.y;
xform->t.z = (pos - trans).z + frame->resetPos.z;

View File

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "AudioManager.h"
#include "audio_enums.h"
@ -38,7 +38,7 @@
#include "ZoneCull.h"
#include "sampman.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1;
const int allChannels = channels + 2;
@ -3038,109 +3038,109 @@ cAudioManager::ProcessPedOneShots(cPedParams &params)
switch (sound) {
case SOUND_STEP_START:
case SOUND_STEP_END:
if (!params.m_pPed->bIsLooking) {
emittingVol = m_anRandomTable[3] % 15 + 45;
if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
emittingVol /= 2;
maxDist = 400.f;
switch (params.m_pPed->m_nSurfaceTouched) {
case SURFACE_GRASS:
sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
break;
case SURFACE_GRAVEL:
case SURFACE_MUD_DRY:
sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
break;
case SURFACE_CAR:
case SURFACE_GARAGE_DOOR:
case SURFACE_CAR_PANEL:
case SURFACE_THICK_METAL_PLATE:
case SURFACE_SCAFFOLD_POLE:
case SURFACE_LAMP_POST:
case SURFACE_FIRE_HYDRANT:
case SURFACE_GIRDER:
case SURFACE_METAL_CHAIN_FENCE:
case SURFACE_CONTAINER:
case SURFACE_NEWS_VENDOR:
sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
break;
case SURFACE_SAND:
sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
break;
case SURFACE_WATER:
sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
break;
case SURFACE_WOOD_CRATES:
case SURFACE_WOOD_BENCH:
case SURFACE_WOOD_SOLID:
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
break;
case SURFACE_HEDGE:
sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
break;
default:
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
break;
}
m_sQueueSample.m_nSampleIndex = sampleIndex;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - 28;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
switch (params.m_pPed->m_nMoveState) {
case PEDMOVE_WALK:
emittingVol /= 4;
m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
break;
case PEDMOVE_RUN:
emittingVol /= 2;
m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
break;
case PEDMOVE_SPRINT:
m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10;
break;
default:
break;
}
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = 20.0f;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bRequireReflection = true;
if (params.m_pPed->bIsInTheAir)
continue;
emittingVol = m_anRandomTable[3] % 15 + 45;
if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
emittingVol /= 2;
maxDist = 400.f;
switch (params.m_pPed->m_nSurfaceTouched) {
case SURFACE_GRASS:
sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
break;
case SURFACE_GRAVEL:
case SURFACE_MUD_DRY:
sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
break;
case SURFACE_CAR:
case SURFACE_GARAGE_DOOR:
case SURFACE_CAR_PANEL:
case SURFACE_THICK_METAL_PLATE:
case SURFACE_SCAFFOLD_POLE:
case SURFACE_LAMP_POST:
case SURFACE_FIRE_HYDRANT:
case SURFACE_GIRDER:
case SURFACE_METAL_CHAIN_FENCE:
case SURFACE_CONTAINER:
case SURFACE_NEWS_VENDOR:
sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
break;
case SURFACE_SAND:
sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
break;
case SURFACE_WATER:
sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
break;
case SURFACE_WOOD_CRATES:
case SURFACE_WOOD_BENCH:
case SURFACE_WOOD_SOLID:
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
break;
case SURFACE_HEDGE:
sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
break;
default:
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
break;
}
m_sQueueSample.m_nSampleIndex = sampleIndex;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - SOUND_STEP_START + 1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
switch (params.m_pPed->m_nMoveState) {
case PEDMOVE_WALK:
emittingVol /= 4;
m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
break;
case PEDMOVE_RUN:
emittingVol /= 2;
m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
break;
case PEDMOVE_SPRINT:
m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10;
break;
default:
break;
}
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = 20.0f;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bRequireReflection = true;
break;
case SOUND_FALL_LAND:
case SOUND_FALL_COLLAPSE:
if (!ped->bIsLooking) {
maxDist = SQR(30);
emittingVol = m_anRandomTable[3] % 20 + 80;
if (ped->m_nSurfaceTouched == SURFACE_WATER) {
m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
} else if (sound == SOUND_FALL_LAND) {
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND;
} else {
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL;
}
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bRequireReflection = true;
if (ped->bIsInTheAir)
continue;
maxDist = SQR(30);
emittingVol = m_anRandomTable[3] % 20 + 80;
if (ped->m_nSurfaceTouched == SURFACE_WATER) {
m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
} else if (sound == SOUND_FALL_LAND) {
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND;
} else {
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL;
}
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
m_sQueueSample.m_nReleasingVolumeModificator = 2;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bRequireReflection = true;
break;
case SOUND_FIGHT_PUNCH_33:
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
@ -5788,7 +5788,7 @@ cAudioManager::GetCasualMaleOldTalkSfx(int16 sound)
uint32
cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
{
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName();
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetModelName();
if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) {
return GetEightTalkSfx(sound);
}
@ -7927,7 +7927,7 @@ cAudioManager::ProcessFrontEnd()
frontendBank = true;
stereo = true;
break;
case SOUND_FRONTEND_NO_RADIO:
case SOUND_FRONTEND_RADIO_TURN_OFF:
case SOUND_FRONTEND_RADIO_CHANGE:
m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK;
break;

View File

@ -13,16 +13,19 @@
cAudioManager AudioManager;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1;
const int allChannels = channels + 2;
#define SPEED_OF_SOUND 343.f
#define TIME_SPENT 50
cAudioManager::cAudioManager()
{
m_bIsInitialised = false;
field_1 = 1;
m_fSpeedOfSound = 6.86f;
m_nTimeSpent = 50;
m_bReverb = true;
m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT;
m_nTimeSpent = TIME_SPENT;
m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
m_nActiveSampleQueue = 1;
ClearRequestedQueue();
@ -945,7 +948,7 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_nCalculatedVolume = 0;
m_asActiveSamples[i].m_nReleasingVolumeDivider = 0;
m_asActiveSamples[i].m_nVolumeChange = -1;
m_asActiveSamples[i].m_vecPos = {0.0f, 0.0f, 0.0f};
m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f);
m_asActiveSamples[i].m_bReverbFlag = false;
m_asActiveSamples[i].m_nLoopsRemaining = 0;
m_asActiveSamples[i].m_bRequireReflection = false;

View File

@ -185,7 +185,7 @@ class cAudioManager
{
public:
bool m_bIsInitialised;
uint8 field_1; // unused
bool m_bReverb; // unused
bool m_bFifthFrameFlag;
uint8 m_nActiveSamples;
uint8 field_4; // unused

View File

@ -15,6 +15,9 @@
#include "World.h"
#include "sampman.h"
#if !defined FIX_BUGS && (defined RADIO_SCROLL_TO_PREV_STATION || defined RADIO_OFF_TEXT)
static_assert(false, "RADIO_SCROLL_TO_PREV_STATION and RADIO_OFF_TEXT won't work correctly without FIX_BUGS");
#endif
cMusicManager MusicManager;
int32 gNumRetunePresses;
@ -26,8 +29,8 @@ cMusicManager::cMusicManager()
m_bIsInitialised = false;
m_bDisabled = false;
m_nMusicMode = MUSICMODE_DISABLED;
m_nCurrentStreamedSound = NO_TRACK;
m_nPreviousStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
m_nPlayingTrack = NO_TRACK;
m_bFrontendTrackFinished = false;
m_bPlayInFrontend = false;
m_bSetNextStation = false;
@ -35,7 +38,7 @@ cMusicManager::cMusicManager()
m_bPreviousPlayerInCar = false;
m_bPlayerInCar = false;
m_bAnnouncementInProgress = false;
m_bDontServiceAmbienceTrack = false;
m_bVerifyAmbienceTrackStartedToPlay = false;
bHasStarted = false;
}
@ -83,16 +86,15 @@ cMusicManager::DisplayRadioStationName()
if(m_bPlayerInCar && !m_bPreviousPlayerInCar)
pCurrentStation = nil;
#ifdef FIX_BUGS
const int curRadio = GetCarTuning();
#else
const int curRadio = m_nNextTrack;
#endif
#ifdef RADIO_SCROLL_TO_PREV_STATION
if(gNumRetunePresses < 0) {
gStreamedSound = m_nCurrentStreamedSound;
if(gStreamedSound == STREAMED_SOUND_CITY_AMBIENT ||
gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) {
gStreamedSound = POLICE_RADIO; // which means OFF
} else if(gStreamedSound > STREAMED_SOUND_RADIO_MP3_PLAYER)
return;
gStreamedSound = curRadio;
gRetuneCounter = gNumRetunePresses;
pRetune = gStreamedSound;
@ -100,7 +102,7 @@ cMusicManager::DisplayRadioStationName()
while(gRetuneCounter < 0) {
if(pRetune == HEAD_RADIO) {
pRetune = RADIO_OFF;
} else if(pRetune == RADIO_OFF || pRetune == POLICE_RADIO) {
} else if(pRetune == RADIO_OFF || pRetune == NUM_RADIOS) {
pRetune = SampleManager.IsMP3RadioChannelAvailable() ? USERTRACK : USERTRACK - 1;
} else
pRetune--;
@ -110,31 +112,38 @@ cMusicManager::DisplayRadioStationName()
} else
#endif
if(SampleManager.IsMP3RadioChannelAvailable()) {
gStreamedSound = m_nCurrentStreamedSound;
gStreamedSound = curRadio;
if(gStreamedSound == STREAMED_SOUND_CITY_AMBIENT ||
gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) {
gStreamedSound = POLICE_RADIO; // which means OFF
gStreamedSound == STREAMED_SOUND_WATER_AMBIENT) { // which means OFF
gStreamedSound = NUM_RADIOS;
} else if(gStreamedSound > STREAMED_SOUND_RADIO_MP3_PLAYER)
return;
pRetune = gNumRetunePresses + gStreamedSound;
if(pRetune == POLICE_RADIO) {
#ifdef FIX_BUGS
while(pRetune > NUM_RADIOS)
pRetune -= (NUM_RADIOS + 1);
#endif
if(pRetune == NUM_RADIOS) {
pRetune = RADIO_OFF;
} else if(pRetune > POLICE_RADIO) {
pRetune = pRetune - RADIO_OFF;
}
#ifndef FIX_BUGS
else if(pRetune > NUM_RADIOS) {
pRetune = pRetune - (NUM_RADIOS + 1);
}
#endif
} else {
gStreamedSound = m_nCurrentStreamedSound;
gStreamedSound = curRadio;
pRetune = gNumRetunePresses + gStreamedSound;
if(pRetune >= USERTRACK) {
gRetuneCounter = gNumRetunePresses;
pRetune = m_nCurrentStreamedSound;
pRetune = curRadio;
if(gStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
pRetune = RADIO_OFF;
pRetune = STREAMED_SOUND_CITY_AMBIENT; // which is RADIO_OFF
while(gRetuneCounter) {
if(pRetune == RADIO_OFF) {
@ -149,7 +158,7 @@ cMusicManager::DisplayRadioStationName()
}
}
wchar *string = nil;
wchar *string;
switch(pRetune) {
case HEAD_RADIO: string = TheText.Get("FEA_FM0"); break;
@ -161,22 +170,27 @@ cMusicManager::DisplayRadioStationName()
case MSX_FM: string = TheText.Get("FEA_FM6"); break;
case FLASHBACK: string = TheText.Get("FEA_FM7"); break;
case CHATTERBOX: string = TheText.Get("FEA_FM8"); break;
case USERTRACK: string = TheText.Get("FEA_FM9"); break;
case USERTRACK:
if (!SampleManager.IsMP3RadioChannelAvailable())
return;
string = TheText.Get("FEA_FM9"); break;
#ifdef RADIO_OFF_TEXT
case RADIO_OFF: case POLICE_RADIO: string = TheText.Get("FEM_OFF"); break;
case RADIO_OFF: {
extern wchar WideErrorString[];
string = TheText.Get("FEA_FMN");
if(string == WideErrorString) {
pCurrentStation = nil;
return;
}
break;
}
#endif
default: return;
};
#ifdef RADIO_OFF_TEXT
if(pRetune == USERTRACK && !SampleManager.IsMP3RadioChannelAvailable()) { string = TheText.Get("FEM_OFF"); }
#else
if(pRetune > CHATTERBOX && !SampleManager.IsMP3RadioChannelAvailable()) { return; }
#endif
if(string && pCurrentStation != string ||
m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_MP3_PLAYER &&
m_nPreviousStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER) {
if(pCurrentStation != string ||
m_nNextTrack == STREAMED_SOUND_RADIO_MP3_PLAYER && m_nPlayingTrack != STREAMED_SOUND_RADIO_MP3_PLAYER) {
pCurrentStation = string;
cDisplay = 60;
} else {
@ -257,7 +271,7 @@ cMusicManager::Initialise()
m_bDoTrackService = false;
m_bIgnoreTimeDelay = false;
m_bRadioSetByScript = false;
m_nRadioStation = HEAD_RADIO;
m_nRadioStationScript = HEAD_RADIO;
m_nRadioPosition = -1;
m_nRadioInCar = NO_TRACK;
gNumRetunePresses = 0;
@ -274,8 +288,8 @@ cMusicManager::Terminate()
if (SampleManager.IsStreamPlaying(0)) {
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_TRACK;
m_nPreviousStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
m_nPlayingTrack = NO_TRACK;
}
m_bIsInitialised = false;
}
@ -303,14 +317,14 @@ cMusicManager::ChangeMusicMode(uint8 mode)
case MUSICMODE_CUTSCENE:
case MUSICMODE_DISABLED:
if (SampleManager.IsStreamPlaying(0)) {
if (m_nCurrentStreamedSound < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
if (m_nNextTrack < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nNextTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nNextTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
SampleManager.StopStreamedFile(0);
}
m_nCurrentStreamedSound = NO_TRACK;
m_nPreviousStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
m_nPlayingTrack = NO_TRACK;
m_bFrontendTrackFinished = false;
m_bPlayInFrontend = false;
m_bSetNextStation = false;
@ -320,7 +334,7 @@ cMusicManager::ChangeMusicMode(uint8 mode)
m_nTimer = m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode();
m_bDoTrackService = false;
m_bIgnoreTimeDelay = true;
m_bDontServiceAmbienceTrack = false;
m_bVerifyAmbienceTrackStartedToPlay = false;
m_nMusicMode = mode2;
break;
default: return;
@ -370,7 +384,7 @@ cMusicManager::SetRadioChannelByScript(uint8 station, int32 pos)
{
if (m_bIsInitialised && station < RADIO_OFF) {
m_bRadioSetByScript = true;
m_nRadioStation = station;
m_nRadioStationScript = station;
m_nRadioPosition = pos == -1 ? -1 : pos % m_aTracks[station].m_nLength;
}
}
@ -380,7 +394,7 @@ void
cMusicManager::ResetMusicAfterReload()
{
m_bRadioSetByScript = false;
m_nRadioStation = 0;
m_nRadioStationScript = 0;
m_nRadioPosition = -1;
m_nAnnouncement = NO_TRACK;
m_bAnnouncementInProgress = false;
@ -419,7 +433,7 @@ cMusicManager::Service()
m_nLastTrackServiceTime = m_nTimer;
} else m_bDoTrackService = false;
if (m_nCurrentStreamedSound == NO_TRACK && SampleManager.IsStreamPlaying(0))
if (m_nNextTrack == NO_TRACK && SampleManager.IsStreamPlaying(0))
SampleManager.StopStreamedFile(0);
else switch (m_nMusicMode) {
case MUSICMODE_FRONTEND: ServiceFrontEndMode(); break;
@ -430,10 +444,10 @@ cMusicManager::Service()
void
cMusicManager::ServiceFrontEndMode()
{
if (m_nCurrentStreamedSound < TOTAL_STREAMED_SOUNDS) {
if (m_nNextTrack < TOTAL_STREAMED_SOUNDS) {
if (m_bFrontendTrackFinished) {
if (!SampleManager.IsStreamPlaying(0)) {
switch (m_nCurrentStreamedSound)
switch (m_nNextTrack)
{
case STREAMED_SOUND_MISSION_COMPLETED:
if (!AudioManager.m_nUserPause)
@ -445,15 +459,15 @@ cMusicManager::ServiceFrontEndMode()
default:
break;
}
m_nCurrentStreamedSound = NO_TRACK;
m_nPreviousStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
m_nPlayingTrack = NO_TRACK;
}
} else if (bHasStarted) {
if (!SampleManager.IsStreamPlaying(0))
SampleManager.StartStreamedFile(m_nCurrentStreamedSound, 0, 0);
SampleManager.StartStreamedFile(m_nNextTrack, 0, 0);
} else {
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, m_nCurrentStreamedSound < STREAMED_SOUND_RADIO_POLICE ? GetTrackStartPos(m_nCurrentStreamedSound) : 0, 0))
if (!SampleManager.StartStreamedFile(m_nNextTrack, m_nNextTrack < NUM_RADIOS ? GetTrackStartPos(m_nNextTrack) : 0, 0))
return;
SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0);
if (m_bPlayInFrontend) bHasStarted = true;
@ -473,7 +487,7 @@ cMusicManager::ServiceGameMode()
m_bPreviousPlayerInCar = m_bPlayerInCar;
m_bPlayerInCar = PlayerInCar();
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nPlayingTrack = m_nNextTrack;
if (m_bPlayerInCar) {
if (FindPlayerPed() != nil
&& !FindPlayerPed()->DyingOrDead()
@ -485,10 +499,13 @@ cMusicManager::ServiceGameMode()
gRetuneCounter = 30;
gNumRetunePresses++;
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 1.0f);
// This needs loop, and this is not the right place. Now done elsewhere.
#ifndef FIX_BUGS
if (SampleManager.IsMP3RadioChannelAvailable()) {
if (gNumRetunePresses > RADIO_OFF)
gNumRetunePresses -= RADIO_OFF;
}
#endif
}
#ifdef RADIO_SCROLL_TO_PREV_STATION
else if(CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown()) {
@ -511,8 +528,8 @@ cMusicManager::ServiceGameMode()
m_bPreviousPlayerInCar = false;
if (!m_bPlayerInCar) {
if (m_bPreviousPlayerInCar) {
if (m_nCurrentStreamedSound != STREAMED_SOUND_RADIO_POLICE)
m_nRadioInCar = m_nCurrentStreamedSound;
if (m_nNextTrack != STREAMED_SOUND_RADIO_POLICE)
m_nRadioInCar = m_nNextTrack;
}
ServiceAmbience();
return;
@ -520,22 +537,22 @@ cMusicManager::ServiceGameMode()
if (m_bPreviousPlayerInCar) {
if (m_nAnnouncement < TOTAL_STREAMED_SOUNDS
&& (m_nCurrentStreamedSound < STREAMED_SOUND_CITY_AMBIENT || m_bAnnouncementInProgress)
&& (m_nNextTrack < RADIO_OFF || m_bAnnouncementInProgress)
&& ServiceAnnouncement())
{
if (m_bAnnouncementInProgress) {
m_bSetNextStation = false;
return;
}
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = GetCarTuning();
m_nPlayingTrack = m_nNextTrack;
m_nNextTrack = GetCarTuning();
}
if (SampleManager.IsMP3RadioChannelAvailable()
&& m_nCurrentStreamedSound != STREAMED_SOUND_RADIO_MP3_PLAYER
&& m_nNextTrack != STREAMED_SOUND_RADIO_MP3_PLAYER
&& ControlsManager.GetIsKeyboardKeyJustDown(rsF9))
{
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = STREAMED_SOUND_RADIO_MP3_PLAYER;
m_nPlayingTrack = m_nNextTrack;
m_nNextTrack = STREAMED_SOUND_RADIO_MP3_PLAYER;
if (FindPlayerVehicle() != nil)
FindPlayerVehicle()->m_nRadioStation = STREAMED_SOUND_RADIO_MP3_PLAYER;
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 1.0f);
@ -563,22 +580,22 @@ cMusicManager::ServiceGameMode()
AudioManager.DoPoliceRadioCrackle();
if (m_bSetNextStation) {
m_bSetNextStation = false;
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = GetNextCarTuning();
if (m_nCurrentStreamedSound == STREAMED_SOUND_CITY_AMBIENT || m_nCurrentStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
m_nPlayingTrack = m_nNextTrack;
m_nNextTrack = GetNextCarTuning();
if (m_nNextTrack == STREAMED_SOUND_CITY_AMBIENT || m_nNextTrack == STREAMED_SOUND_WATER_AMBIENT)
bRadioOff = true;
if (m_nPreviousStreamedSound == STREAMED_SOUND_CITY_AMBIENT || m_nPreviousStreamedSound == STREAMED_SOUND_WATER_AMBIENT)
if (m_nPlayingTrack == STREAMED_SOUND_CITY_AMBIENT || m_nPlayingTrack == STREAMED_SOUND_WATER_AMBIENT)
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_CHANGE, 0.0f);
}
if (m_nCurrentStreamedSound < STREAMED_SOUND_CITY_AMBIENT) {
if (m_nNextTrack < RADIO_OFF) {
if (ChangeRadioChannel()) {
ServiceTrack();
} else {
m_bPlayerInCar = false;
if (FindPlayerVehicle())
FindPlayerVehicle()->m_nRadioStation = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = NO_TRACK;
FindPlayerVehicle()->m_nRadioStation = m_nNextTrack;
m_nNextTrack = NO_TRACK;
}
if (CTimer::GetIsSlowMotionActive()) {
if (TheCamera.pTargetEntity != nil) {
@ -631,56 +648,56 @@ cMusicManager::ServiceGameMode()
return;
}
if (bRadioOff) {
m_nCurrentStreamedSound = m_nPreviousStreamedSound;
m_nNextTrack = m_nPlayingTrack;
if (FindPlayerVehicle() != nil)
FindPlayerVehicle()->m_nRadioStation = RADIO_OFF;
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_NO_RADIO, 0.0f);
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_RADIO_TURN_OFF, 0.0f);
}
ServiceAmbience();
return;
}
if (m_bRadioSetByScript) {
if (UsesPoliceRadio(FindPlayerVehicle())) {
m_nCurrentStreamedSound = STREAMED_SOUND_RADIO_POLICE;
m_nNextTrack = STREAMED_SOUND_RADIO_POLICE;
} else {
m_nCurrentStreamedSound = m_nRadioStation;
if (FindPlayerVehicle()->m_nRadioStation == m_nCurrentStreamedSound) {
m_nPreviousStreamedSound = NO_TRACK;
m_nNextTrack = m_nRadioStationScript;
if (FindPlayerVehicle()->m_nRadioStation == m_nNextTrack) {
m_nPlayingTrack = NO_TRACK;
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
SampleManager.StopStreamedFile(0);
}
if (m_nRadioPosition != -1) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = m_nRadioPosition;
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
m_aTracks[m_nNextTrack].m_nPosition = m_nRadioPosition;
m_aTracks[m_nNextTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
}
} else {
m_nCurrentStreamedSound = GetCarTuning();
m_nNextTrack = GetCarTuning();
}
if (m_nCurrentStreamedSound >= RADIO_OFF) {
if (m_nNextTrack >= RADIO_OFF) {
ServiceAmbience();
return;
}
if (ChangeRadioChannel()) {
if (m_bRadioSetByScript) {
m_bRadioSetByScript = false;
FindPlayerVehicle()->m_nRadioStation = m_nCurrentStreamedSound;
FindPlayerVehicle()->m_nRadioStation = m_nNextTrack;
}
} else {
m_bPlayerInCar = false;
m_nCurrentStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
}
}
void
cMusicManager::StopFrontEndTrack()
{
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_FRONTEND && m_nCurrentStreamedSound != NO_TRACK) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_FRONTEND && m_nNextTrack != NO_TRACK) {
m_aTracks[m_nNextTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nNextTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
m_nPreviousStreamedSound = NO_TRACK;
m_nCurrentStreamedSound = NO_TRACK;
m_nPlayingTrack = NO_TRACK;
m_nNextTrack = NO_TRACK;
}
}
@ -696,30 +713,30 @@ cMusicManager::PlayFrontEndTrack(uint8 track, uint8 bPlayInFrontend)
{
if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS) {
if (m_nMusicMode == MUSICMODE_GAME) {
if (m_nCurrentStreamedSound != NO_TRACK) {
if (m_nNextTrack != NO_TRACK) {
if (m_bAnnouncementInProgress) {
m_nAnnouncement = NO_TRACK;
m_bAnnouncementInProgress = false;
}
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
m_aTracks[m_nNextTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nNextTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
SampleManager.StopStreamedFile(0);
} else if (m_nMusicMode == MUSICMODE_FRONTEND) {
if (m_nCurrentStreamedSound != NO_TRACK) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
if (m_nNextTrack != NO_TRACK) {
m_aTracks[m_nNextTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nNextTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
SampleManager.StopStreamedFile(0);
}
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = track;
m_nPlayingTrack = m_nNextTrack;
m_nNextTrack = track;
m_bPlayInFrontend = !!bPlayInFrontend;
m_bFrontendTrackFinished = false;
m_bDoTrackService = true;
bHasStarted = false;
if (m_nCurrentStreamedSound < STREAMED_SOUND_RADIO_POLICE) {
if (m_nNextTrack < NUM_RADIOS) {
gRetuneCounter = 0;
gNumRetunePresses = 0;
}
@ -735,7 +752,7 @@ cMusicManager::PreloadCutSceneMusic(uint8 track)
SampleManager.StopStreamedFile(0);
SampleManager.PreloadStreamedFile(track, 0);
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0);
m_nCurrentStreamedSound = track;
m_nNextTrack = track;
}
}
@ -751,7 +768,7 @@ cMusicManager::StopCutSceneMusic(void)
{
if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_CUTSCENE) {
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
}
}
@ -795,45 +812,45 @@ cMusicManager::ServiceAmbience()
m_nAnnouncement = NO_TRACK;
m_bAnnouncementInProgress = false;
}
if (m_nCurrentStreamedSound < STREAMED_SOUND_CITY_AMBIENT) {
if (m_nNextTrack < RADIO_OFF) {
if (SampleManager.IsStreamPlaying(0)) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
m_aTracks[m_nNextTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nNextTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
m_nCurrentStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
return;
}
m_nCurrentStreamedSound = STREAMED_SOUND_CITY_AMBIENT;
m_nNextTrack = RADIO_OFF;
}
if (CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING && !SampleManager.IsStreamPlaying(0)) {
m_nCurrentStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
return;
}
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = TheCamera.DistanceToWater <= 45.0f ? STREAMED_SOUND_WATER_AMBIENT : STREAMED_SOUND_CITY_AMBIENT;
m_nPlayingTrack = m_nNextTrack;
m_nNextTrack = TheCamera.DistanceToWater <= 45.0f ? STREAMED_SOUND_WATER_AMBIENT : STREAMED_SOUND_CITY_AMBIENT;
if (m_nCurrentStreamedSound == m_nPreviousStreamedSound) {
if (m_nNextTrack == m_nPlayingTrack) {
ComputeAmbienceVol(false, volume);
SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0);
if (m_bDontServiceAmbienceTrack) {
if (m_bVerifyAmbienceTrackStartedToPlay) {
if (SampleManager.IsStreamPlaying(0))
m_bDontServiceAmbienceTrack = false;
m_bVerifyAmbienceTrackStartedToPlay = false;
} else ServiceTrack();
} else {
if (m_nPreviousStreamedSound < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nPreviousStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nPreviousStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
if (m_nPlayingTrack < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
}
uint32 pos = GetTrackStartPos(m_nCurrentStreamedSound);
uint32 pos = GetTrackStartPos(m_nNextTrack);
SampleManager.SetStreamedVolumeAndPan(0, 63, 1, 0);
if (SampleManager.StartStreamedFile(m_nCurrentStreamedSound, pos, 0)) {
if (SampleManager.StartStreamedFile(m_nNextTrack, pos, 0)) {
ComputeAmbienceVol(true, volume);
SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0);
m_bDontServiceAmbienceTrack = true;
m_bVerifyAmbienceTrackStartedToPlay = true;
} else
m_nCurrentStreamedSound = NO_TRACK;
m_nNextTrack = NO_TRACK;
}
}
@ -862,7 +879,7 @@ cMusicManager::ServiceTrack()
{
if (m_bDoTrackService) {
if (!SampleManager.IsStreamPlaying(0))
SampleManager.StartStreamedFile(m_nCurrentStreamedSound, 0, 0);
SampleManager.StartStreamedFile(m_nNextTrack, 0, 0);
}
}
@ -882,9 +899,9 @@ cMusicManager::ServiceAnnouncement()
cCheck = 0;
int pos = SampleManager.GetStreamedFilePosition(0);
if (SampleManager.IsStreamPlaying(0)) {
if (m_nCurrentStreamedSound != NO_TRACK) {
m_aTracks[m_nCurrentStreamedSound].m_nPosition = pos;
m_aTracks[m_nCurrentStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
if (m_nNextTrack != NO_TRACK) {
m_aTracks[m_nNextTrack].m_nPosition = pos;
m_aTracks[m_nNextTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.StopStreamedFile(0);
}
}
@ -893,8 +910,8 @@ cMusicManager::ServiceAnnouncement()
if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) {
SampleManager.SetStreamedVolumeAndPan(AudioManager.ShouldDuckMissionAudio() ? 25 : 100, 63, 0, 0);
m_bAnnouncementInProgress = true;
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = m_nAnnouncement;
m_nPlayingTrack = m_nNextTrack;
m_nNextTrack = m_nAnnouncement;
return true;
}
@ -929,7 +946,7 @@ cMusicManager::GetNextCarTuning()
while (gNumRetunePresses < 0) {
if(veh->m_nRadioStation == HEAD_RADIO) {
veh->m_nRadioStation = RADIO_OFF;
} else if(veh->m_nRadioStation == RADIO_OFF || veh->m_nRadioStation == POLICE_RADIO) {
} else if(veh->m_nRadioStation == RADIO_OFF || veh->m_nRadioStation == NUM_RADIOS) {
veh->m_nRadioStation = SampleManager.IsMP3RadioChannelAvailable() ? USERTRACK : USERTRACK - 1;
} else
veh->m_nRadioStation--;
@ -940,12 +957,18 @@ cMusicManager::GetNextCarTuning()
#endif
if (SampleManager.IsMP3RadioChannelAvailable()) {
if (veh->m_nRadioStation == RADIO_OFF)
veh->m_nRadioStation = POLICE_RADIO;
veh->m_nRadioStation = NUM_RADIOS;
veh->m_nRadioStation += gNumRetunePresses;
if (veh->m_nRadioStation == POLICE_RADIO)
#ifdef FIX_BUGS
while (veh->m_nRadioStation > NUM_RADIOS)
veh->m_nRadioStation -= (NUM_RADIOS + 1);
#endif
if (veh->m_nRadioStation == NUM_RADIOS)
veh->m_nRadioStation = RADIO_OFF;
else if (veh->m_nRadioStation > POLICE_RADIO)
veh->m_nRadioStation -= RADIO_OFF;
#ifndef FIX_BUGS
else if (veh->m_nRadioStation > NUM_RADIOS)
veh->m_nRadioStation -= (NUM_RADIOS + 1);
#endif
} else if (gNumRetunePresses + veh->m_nRadioStation >= USERTRACK) {
while (gNumRetunePresses) {
if (veh->m_nRadioStation == RADIO_OFF)
@ -967,16 +990,16 @@ cMusicManager::GetNextCarTuning()
bool
cMusicManager::ChangeRadioChannel()
{
if (m_nCurrentStreamedSound != m_nPreviousStreamedSound) {
if (m_nPreviousStreamedSound < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nPreviousStreamedSound].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nPreviousStreamedSound].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
if (m_nNextTrack != m_nPlayingTrack) {
if (m_nPlayingTrack < TOTAL_STREAMED_SOUNDS) {
m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0);
m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
SampleManager.StopStreamedFile(0);
}
if (SampleManager.IsStreamPlaying(0))
return false;
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0))
if (!SampleManager.StartStreamedFile(m_nNextTrack, GetTrackStartPos(m_nNextTrack), 0))
return false;
SampleManager.SetStreamedVolumeAndPan(AudioManager.ShouldDuckMissionAudio() ? 25 : 100, 63, 0, 0);
}

View File

@ -18,8 +18,8 @@ public:
bool m_bIsInitialised;
bool m_bDisabled;
uint8 m_nMusicMode;
uint8 m_nCurrentStreamedSound;
uint8 m_nPreviousStreamedSound;
uint8 m_nNextTrack;
uint8 m_nPlayingTrack;
bool m_bFrontendTrackFinished;
bool m_bPlayInFrontend;
bool m_bSetNextStation;
@ -34,9 +34,9 @@ public:
uint32 m_nTimer;
bool m_bDoTrackService;
bool m_bIgnoreTimeDelay;
bool m_bDontServiceAmbienceTrack;
bool m_bVerifyAmbienceTrackStartedToPlay;
bool m_bRadioSetByScript;
uint8 m_nRadioStation;
uint8 m_nRadioStationScript;
int32 m_nRadioPosition;
uint8 m_nRadioInCar;
@ -44,7 +44,7 @@ public:
cMusicManager();
bool IsInitialised() { return m_bIsInitialised; }
uint32 GetMusicMode() { return m_nMusicMode; }
uint8 GetCurrentTrack() { return m_nCurrentStreamedSound; }
uint8 GetNextTrack() { return m_nNextTrack; }
bool Initialise();
void Terminate();

View File

@ -13,8 +13,9 @@
#include "World.h"
#include "Zones.h"
#include "sampman.h"
#include "Wanted.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1;
struct tPoliceRadioZone {
@ -160,7 +161,7 @@ cAudioManager::ServicePoliceRadio()
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
return;
#endif
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
wantedLevel = FindPlayerPed()->m_pWanted->GetWantedLevel();
if(!crimeReport) {
if(wantedLevel != 0) {
if(nLastSeen != 0) {
@ -678,7 +679,7 @@ 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->m_nWantedLevel > 0 &&
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) {

View File

@ -1,6 +1,6 @@
#pragma once
#include "Wanted.h"
#include "Crime.h"
struct cAMCrime {
int32 type;

View File

@ -12,8 +12,9 @@ enum eRadioStation
FLASHBACK,
CHATTERBOX,
USERTRACK,
POLICE_RADIO,
RADIO_OFF,
POLICE_RADIO = 10,
NUM_RADIOS = 10,
RADIO_OFF = 11,
};
enum eMusicMode

View File

@ -15,6 +15,8 @@ ALuint alFilters[MAXCHANNELS+MAX2DCHANNELS];
ALuint alBuffers[MAXCHANNELS+MAX2DCHANNELS];
bool bChannelsCreated = false;
int32 CChannel::channelsThatNeedService = 0;
void
CChannel::InitChannels()
{
@ -59,7 +61,9 @@ void CChannel::SetDefault()
Position[0] = 0.0f; Position[1] = 0.0f; Position[2] = 0.0f;
Distances[0] = 0.0f; Distances[1] = FLT_MAX;
LoopCount = 1;
LoopCount = 1;
LastProcessedOffset = UINT32_MAX;
LoopPoints[0] = 0; LoopPoints[1] = -1;
Frequency = MAX_FREQ;
@ -67,6 +71,10 @@ void CChannel::SetDefault()
void CChannel::Reset()
{
// Here is safe because ctor don't call this
if (LoopCount > 1)
channelsThatNeedService--;
ClearBuffer();
SetDefault();
}
@ -165,10 +173,51 @@ void CChannel::SetCurrentFreq(uint32 freq)
SetPitch(ALfloat(freq) / Frequency);
}
void CChannel::SetLoopCount(int32 loopCount) // fake. TODO:
void CChannel::SetLoopCount(int32 count)
{
if ( !HasSource() ) return;
alSourcei(alSources[id], AL_LOOPING, loopCount == 1 ? AL_FALSE : AL_TRUE);
// 0: loop indefinitely, 1: play one time, 2: play two times etc...
// only > 1 needs manual processing
if (LoopCount > 1 && count < 2)
channelsThatNeedService--;
else if (LoopCount < 2 && count > 1)
channelsThatNeedService++;
alSourcei(alSources[id], AL_LOOPING, count == 1 ? AL_FALSE : AL_TRUE);
LoopCount = count;
}
bool CChannel::Update()
{
if (!HasSource()) return false;
if (LoopCount < 2) return false;
ALint state;
alGetSourcei(alSources[id], AL_SOURCE_STATE, &state);
if (state == AL_STOPPED) {
debug("Looping channels(%d in this case) shouldn't report AL_STOPPED, but nvm\n", id);
SetLoopCount(1);
return true;
}
assert(channelsThatNeedService > 0 && "Ref counting is broken");
ALint offset;
alGetSourcei(alSources[id], AL_SAMPLE_OFFSET, &offset);
// Rewound
if (offset < LastProcessedOffset) {
LoopCount--;
if (LoopCount == 1) {
// Playing last tune...
channelsThatNeedService--;
alSourcei(alSources[id], AL_LOOPING, AL_FALSE);
}
}
LastProcessedOffset = offset;
return true;
}
void CChannel::SetLoopPoints(ALint start, ALint end)
@ -200,6 +249,7 @@ void CChannel::SetPan(int32 pan)
void CChannel::ClearBuffer()
{
if ( !HasSource() ) return;
alSourcei(alSources[id], AL_LOOPING, AL_FALSE);
alSourcei(alSources[id], AL_BUFFER, AL_NONE);
Data = nil;
DataSize = 0;

View File

@ -19,7 +19,10 @@ class CChannel
float Distances[2];
int32 LoopCount;
ALint LoopPoints[2];
ALint LastProcessedOffset;
public:
static int32 channelsThatNeedService;
static void InitChannels();
static void DestroyChannels();
@ -37,7 +40,7 @@ public:
void SetVolume(int32 vol);
void SetSampleData(void *_data, size_t _DataSize, int32 freq);
void SetCurrentFreq(uint32 freq);
void SetLoopCount(int32 loopCount); // fake
void SetLoopCount(int32 count);
void SetLoopPoints(ALint start, ALint end);
void SetPosition(float x, float y, float z);
void SetDistances(float max, float min);
@ -45,6 +48,7 @@ public:
void ClearBuffer();
void SetReverbMix(ALuint slot, float mix);
void UpdateReverb(ALuint slot);
bool Update();
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
#ifdef AUDIO_OAL
#include <AL/al.h>
#define NUM_STREAMBUFFERS 4
#define NUM_STREAMBUFFERS 8
class IDecoder
{
@ -57,7 +57,7 @@ public:
class CStream
{
char m_aFilename[128];
ALuint &m_alSource;
ALuint *m_pAlSources;
ALuint (&m_alBuffers)[NUM_STREAMBUFFERS];
bool m_bPaused;
@ -69,24 +69,25 @@ class CStream
uint32 m_nVolume;
uint8 m_nPan;
uint32 m_nPosBeforeReset;
int32 m_nLoopCount;
IDecoder *m_pSoundFile;
bool HasSource();
void SetPosition(float x, float y, float z);
void SetPosition(int i, float x, float y, float z);
void SetPitch(float pitch);
void SetGain(float gain);
void Pause();
void SetPlay(bool state);
bool FillBuffer(ALuint alBuffer);
bool FillBuffer(ALuint *alBuffer);
int32 FillBuffers();
void ClearBuffers();
public:
static void Initialise();
static void Terminate();
CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUFFERS]);
CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS], uint32 overrideSampleRate = 32000);
~CStream();
void Delete();
@ -99,10 +100,12 @@ public:
uint32 GetPosMS();
uint32 GetLengthMS();
bool Setup();
bool Setup(bool imSureQueueIsEmpty = false);
void Start();
void Stop();
void Update(void);
void SetLoopCount(int32);
void ProviderInit();
void ProviderTerm();

View File

@ -1,5 +1,4 @@
#pragma once
#include "common.h"
#include "AudioSamples.h"
#define MAX_VOLUME 127
@ -218,7 +217,7 @@ extern uint32 BankStartOffset[MAX_SFX_BANKS];
extern int defaultProvider;
#endif
#ifdef AUDIO_OPUS
#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",
@ -254,9 +253,9 @@ static char StreamedNameTable[][25] = {
"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"};
#else
#if defined(PS2_AUDIO_PATHS)
static char StreamedNameTable[][25]=
{
#ifdef PS2_AUDIO
"AUDIO\\MUSIC\\HEAD.VB",
"AUDIO\\MUSIC\\CLASS.VB",
"AUDIO\\MUSIC\\KJAH.VB",
@ -353,6 +352,8 @@ static char StreamedNameTable[][25]=
"AUDIO\\MUSIC\\MISCOM.VB",
"AUDIO\\MUSIC\\END.VB",
#else
static char StreamedNameTable[][25] =
{
"AUDIO\\HEAD.WAV",
"AUDIO\\CLASS.WAV",
"AUDIO\\KJAH.WAV",

View File

@ -1,8 +1,7 @@
#include "common.h"
#ifdef AUDIO_MSS
#include <windows.h>
#include <shobjidl.h>
#include <shlobj.h>
#include <shlguid.h>
#include <time.h>
@ -1515,7 +1514,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
case MUSICMODE_FRONTEND:
{
if ( MusicManager.GetCurrentTrack() == STREAMED_SOUND_GAME_COMPLETED )
if ( MusicManager.GetNextTrack() == STREAMED_SOUND_GAME_COMPLETED )
return false;
break;
@ -1754,8 +1753,8 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
// increase the volume for JB.MP3 and S4_BDBD.MP3
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
&& MusicManager.GetNextTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetNextTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
{
nChannelVolume[nChannel] >>= 2;
}
@ -1793,8 +1792,8 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
// increase the volume for JB.MP3 and S4_BDBD.MP3
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
&& MusicManager.GetNextTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetNextTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
{
nChannelVolume[nChannel] >>= 2;
}
@ -2047,141 +2046,131 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
bool
cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
{
int i = 0;
uint32 position = nPos;
char filename[MAX_PATH];
if ( m_bInitialised && nFile < TOTAL_STREAMED_SOUNDS )
if ( !m_bInitialised || nFile >= TOTAL_STREAMED_SOUNDS )
return false;
if ( mp3Stream[nStream] )
{
if ( mp3Stream[nStream] )
AIL_pause_stream(mp3Stream[nStream], 1);
AIL_close_stream(mp3Stream[nStream]);
}
if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER )
{
do
{
AIL_pause_stream(mp3Stream[nStream], 1);
AIL_close_stream(mp3Stream[nStream]);
}
if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER )
{
uint32 i = 0;
do {
if(i != 0 || _bIsMp3Active) {
if(++_CurMP3Index >= nNumMP3s) _CurMP3Index = 0;
// Just switched to MP3 player
if ( !_bIsMp3Active && i == 0 )
{
if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] )
position = 0;
tMP3Entry *e = _pMP3List;
_CurMP3Pos = 0;
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
if(mp3) {
mp3 = _pMP3List;
if(mp3 == NULL) {
_bIsMp3Active = false;
nFile = 0;
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(
mp3Stream[nStream], 1);
AIL_set_stream_ms_position(
mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream],
0);
return true;
}
return false;
}
}
if(mp3->pLinkPath != NULL)
mp3Stream[nStream] =
AIL_open_stream(DIG, mp3->pLinkPath, 0);
else {
strcpy(filename, _mp3DirectoryPath);
strcat(filename, mp3->aFilename);
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
}
if(mp3Stream[nStream]) {
// Try to continue from previous song, if already started
if(!_GetMP3PosFromStreamPos(&position, &e) && !e) {
nFile = 0;
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
if ( mp3Stream[nStream] )
{
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
AIL_set_stream_ms_position(mp3Stream[nStream], 0);
AIL_set_stream_ms_position(mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream], 0);
return true;
}
return false;
_bIsMp3Active = false;
continue;
}
if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] )
position = 0;
} else {
if ( e->pLinkPath != NULL )
mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0);
else {
strcpy(filename, _mp3DirectoryPath);
strcat(filename, e->aFilename);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
}
if ( mp3Stream[nStream] ) {
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
AIL_set_stream_ms_position(mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream], 0);
_bIsMp3Active = true;
tMP3Entry *e;
if ( !_GetMP3PosFromStreamPos(&position, &e) )
return true;
}
// fall through, start playing from another song
}
} else {
if(++_CurMP3Index >= nNumMP3s) _CurMP3Index = 0;
_CurMP3Pos = 0;
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
if ( !mp3 )
{
if ( e == NULL )
mp3 = _pMP3List;
if ( !_pMP3List )
{
nFile = 0;
_bIsMp3Active = 0;
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(
mp3Stream[nStream], 1);
AIL_set_stream_ms_position(
mp3Stream[nStream], position);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
if ( mp3Stream[nStream] )
{
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
AIL_set_stream_ms_position(mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream], 0);
return true;
}
return false;
}
}
if ( e->pLinkPath != NULL )
mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0);
else
{
if(mp3->pLinkPath != NULL)
mp3Stream[nStream] = AIL_open_stream(DIG, mp3->pLinkPath, 0);
else {
strcpy(filename, _mp3DirectoryPath);
strcat(filename, e->aFilename);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
strcat(filename, mp3->aFilename);
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
}
if ( mp3Stream[nStream] )
{
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
AIL_set_stream_ms_position(mp3Stream[nStream], position);
AIL_set_stream_ms_position(mp3Stream[nStream], 0);
AIL_pause_stream(mp3Stream[nStream], 0);
#ifdef FIX_BUGS
_bIsMp3Active = true;
#endif
return true;
}
_bIsMp3Active = false;
} while(++i < nNumMP3s);
position = 0;
nFile = 0;
}
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
if ( mp3Stream[nStream] )
{
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
AIL_set_stream_ms_position(mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream], 0);
return true;
}
_bIsMp3Active = 0;
}
while ( ++i < nNumMP3s );
position = 0;
nFile = 0;
}
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
if ( mp3Stream[nStream] )
{
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
AIL_set_stream_ms_position(mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream], 0);
return true;
}
return false;
}

View File

@ -1,17 +1,11 @@
//#define JUICY_OAL
#ifdef AUDIO_OAL
#include "sampman.h"
#include <time.h>
#include "eax.h"
#include "eax-util.h"
#define WITHWINDOWS
#include "common.h"
#include "crossplatform.h"
#ifdef _WIN32
#include <io.h>
#include <AL/al.h>
@ -19,8 +13,24 @@
#include <AL/alext.h>
#include <AL/efx.h>
#include <AL/efx-presets.h>
// for user MP3s
#include <direct.h>
#include <shlobj.h>
#include <shlguid.h>
#else
#define _getcwd getcwd
#endif
#if defined _MSC_VER && !defined CMAKE_NO_AUTOLINK
#pragma comment( lib, "OpenAL32.lib" )
#endif
#include "common.h"
#include "crossplatform.h"
#include "sampman.h"
#include "oal/oal_utils.h"
#include "oal/aldlist.h"
#include "oal/channel.h"
@ -30,26 +40,12 @@
#include "MusicManager.h"
#include "Frontend.h"
#include "Timer.h"
#ifdef AUDIO_OPUS
#ifdef AUDIO_OAL_USE_OPUS
#include <opusfile.h>
#endif
//TODO: fix eax3 reverb
//TODO: max channels
//TODO: loop count
#ifdef _WIN32
#pragma comment( lib, "OpenAL32.lib" )
#endif
// for user MP3s
#ifdef _WIN32
#include <direct.h>
#include <shobjidl.h>
#include <shlguid.h>
#else
#define _getcwd getcwd
#endif
cSampleManager SampleManager;
bool _bSampmanInitialised = false;
@ -83,7 +79,7 @@ char SampleBankDescFilename[] = "audio/sfx.SDT";
char SampleBankDataFilename[] = "audio/sfx.RAW";
FILE *fpSampleDescHandle;
#ifdef AUDIO_OPUS
#ifdef OPUS_SFX
OggOpusFile *fpSampleDataHandle;
#else
FILE *fpSampleDataHandle;
@ -102,7 +98,7 @@ CChannel aChannel[MAXCHANNELS+MAX2DCHANNELS];
uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
uint32 nStreamLength[TOTAL_STREAMED_SOUNDS];
ALuint ALStreamSources[MAX_STREAMS];
ALuint ALStreamSources[MAX_STREAMS][2];
ALuint ALStreamBuffers[MAX_STREAMS][NUM_STREAMBUFFERS];
struct tMP3Entry
@ -122,7 +118,6 @@ char _mp3DirectoryPath[MAX_PATH];
CStream *aStream[MAX_STREAMS];
uint8 nStreamPan [MAX_STREAMS];
uint8 nStreamVolume[MAX_STREAMS];
uint8 nStreamLoopedFlag[MAX_STREAMS];
uint32 _CurMP3Index;
int32 _CurMP3Pos;
bool _bIsMp3Active;
@ -245,9 +240,9 @@ release_existing()
if (stream)
stream->ProviderTerm();
alDeleteSources(1, &ALStreamSources[i]);
alDeleteBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]);
}
alDeleteSources(MAX_STREAMS*2, ALStreamSources[0]);
CChannel::DestroyChannels();
@ -287,7 +282,10 @@ set_new_provider(int index)
//TODO:
_maxSamples = MAXCHANNELS;
ALCint attr[] = {ALC_FREQUENCY,MAX_FREQ,0};
ALCint attr[] = {ALC_FREQUENCY,MAX_FREQ,
ALC_MONO_SOURCES, MAX_STREAMS * 2 + MAXCHANNELS,
0,
};
ALDevice = alcOpenDevice(providers[index].id);
ASSERT(ALDevice != NULL);
@ -319,11 +317,17 @@ set_new_provider(int index)
alGenAuxiliaryEffectSlots(1, &ALEffectSlot);
alGenEffects(1, &ALEffect);
}
alGenSources(MAX_STREAMS*2, ALStreamSources[0]);
for ( int32 i = 0; i < MAX_STREAMS; i++ )
{
alGenSources(1, &ALStreamSources[i]);
alGenBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]);
alGenBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]);
alSourcei(ALStreamSources[i][0], AL_SOURCE_RELATIVE, AL_TRUE);
alSource3f(ALStreamSources[i][0], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSourcef(ALStreamSources[i][0], AL_GAIN, 1.0f);
alSourcei(ALStreamSources[i][1], AL_SOURCE_RELATIVE, AL_TRUE);
alSource3f(ALStreamSources[i][1], AL_POSITION, 0.0f, 0.0f, 0.0f);
alSourcef(ALStreamSources[i][1], AL_GAIN, 1.0f);
CStream *stream = aStream[i];
if (stream)
@ -384,6 +388,12 @@ set_new_provider(int index)
return false;
}
static bool
IsThisTrackAt16KHz(uint32 track)
{
return track == STREAMED_SOUND_RADIO_CHAT;
}
cSampleManager::cSampleManager(void)
{
;
@ -720,8 +730,6 @@ _FindMP3s(void)
delete aStream[0];
aStream[0] = NULL;
OutputDebugString(fd.cFileName);
pList->pNext = new tMP3Entry;
tMP3Entry *e = pList->pNext;
@ -956,33 +964,37 @@ cSampleManager::Initialise(void)
#ifdef AUDIO_CACHE
FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb");
if (cacheFile) {
debug("Loadind audio cache (If game crashes around here, then your cache is corrupted, remove audio/sound.cache)\n");
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
fclose(cacheFile);
} else
#endif
{
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
{
aStream[0] = new CStream(StreamedNameTable[i], ALStreamSources[0], ALStreamBuffers[0]);
if ( aStream[0] && aStream[0]->IsOpened() )
{
debug("Cannot load audio cache\n");
#endif
for(int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++) {
aStream[0] = new CStream(StreamedNameTable[i], ALStreamSources[0], ALStreamBuffers[0], IsThisTrackAt16KHz(i) ? 16000 : 32000);
if(aStream[0] && aStream[0]->IsOpened()) {
uint32 tatalms = aStream[0]->GetLengthMS();
delete aStream[0];
aStream[0] = NULL;
nStreamLength[i] = tatalms;
}
else
} else
USERERROR("Can't open '%s'\n", StreamedNameTable[i]);
}
#ifdef AUDIO_CACHE
cacheFile = fcaseopen("audio\\sound.cache", "wb");
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
fclose(cacheFile);
#endif
if(cacheFile) {
debug("Saving audio cache\n");
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
fclose(cacheFile);
} else {
debug("Cannot save audio cache\n");
}
}
#endif
{
if ( !InitialiseSampleBanks() )
@ -1199,7 +1211,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
return false;
}
#ifdef AUDIO_OPUS
#ifdef OPUS_SFX
int samplesRead = 0;
int samplesSize = nSampleBankSize[nBank] / 2;
op_pcm_seek(fpSampleDataHandle, 0);
@ -1304,7 +1316,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
case MUSICMODE_FRONTEND:
{
if ( MusicManager.GetCurrentTrack() == STREAMED_SOUND_GAME_COMPLETED )
if ( MusicManager.GetNextTrack() == STREAMED_SOUND_GAME_COMPLETED )
return false;
break;
@ -1312,7 +1324,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
}
}
#ifdef AUDIO_OPUS
#ifdef OPUS_SFX
int samplesRead = 0;
int samplesSize = m_aSamples[nComment].nSize / 2;
op_pcm_seek(fpSampleDataHandle, m_aSamples[nComment].nOffset / 2);
@ -1519,8 +1531,8 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
// reduce channel volume when JB.MP3 or S4_BDBD.MP3 playing
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
&& MusicManager.GetNextTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetNextTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
{
nChannelVolume[nChannel] = vol / 4;
}
@ -1561,8 +1573,8 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
// reduce the volume for JB.MP3 and S4_BDBD.MP3
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
&& MusicManager.GetNextTrack() != STREAMED_SOUND_NEWS_INTRO
&& MusicManager.GetNextTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
{
nChannelVolume[nChannel] = vol / 4;
}
@ -1648,11 +1660,11 @@ cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
strcpy(filename, StreamedNameTable[nFile]);
CStream *stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
CStream *stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
ASSERT(stream != NULL);
aStream[nStream] = stream;
if ( !stream->IsOpened() )
if ( !stream->Setup() )
{
delete stream;
aStream[nStream] = NULL;
@ -1682,7 +1694,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
if ( stream )
{
if ( stream->Setup() )
if ( stream->IsOpened() )
{
stream->Start();
}
@ -1692,170 +1704,152 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
bool
cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
{
int i = 0;
uint32 position = nPos;
char filename[256];
ASSERT( nStream < MAX_STREAMS );
if ( nFile < TOTAL_STREAMED_SOUNDS )
char filename[MAX_PATH];
if ( nFile >= TOTAL_STREAMED_SOUNDS )
return false;
if ( aStream[nStream] )
{
if ( aStream[nStream] )
delete aStream[nStream];
aStream[nStream] = NULL;
}
if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER )
{
do
{
delete aStream[nStream];
aStream[nStream] = NULL;
}
if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER )
{
uint32 i = 0;
do {
if(i != 0 || _bIsMp3Active) {
if(++_CurMP3Index >= nNumMP3s) _CurMP3Index = 0;
// Switched to MP3 player just now
if ( !_bIsMp3Active && i == 0 )
{
if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] )
position = 0;
tMP3Entry *e = _pMP3List;
_CurMP3Pos = 0;
// Try to continue from previous song, if already started
if(!_GetMP3PosFromStreamPos(&position, &e) && !e) {
nFile = 0;
strcpy(filename, StreamedNameTable[nFile]);
CStream* stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
aStream[nStream] = stream;
if(mp3) {
mp3 = _pMP3List;
if(mp3 == NULL) {
_bIsMp3Active = false;
nFile = 0;
strcat(filename, StreamedNameTable[nFile]);
if (stream->Setup()) {
if (position != 0)
stream->SetPosMS(position);
CStream* stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
ASSERT(stream != NULL);
stream->Start();
aStream[nStream] = stream;
if (stream->IsOpened()) {
if (stream->Setup()) {
if (position != 0)
stream->SetPosMS(position);
stream->Start();
}
return true;
} else {
delete stream;
aStream[nStream] = NULL;
}
return false;
}
return true;
} else {
delete stream;
aStream[nStream] = NULL;
}
return false;
if (mp3->pLinkPath != NULL)
aStream[nStream] = new CStream(mp3->pLinkPath, ALStreamSources[nStream], ALStreamBuffers[nStream]);
} else {
if ( e->pLinkPath != NULL )
aStream[nStream] = new CStream(e->pLinkPath, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
else {
strcpy(filename, _mp3DirectoryPath);
strcat(filename, mp3->aFilename);
strcat(filename, e->aFilename);
aStream[nStream] = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
}
if (aStream[nStream]->Setup()) {
if (position != 0)
aStream[nStream]->SetPosMS(position);
if (aStream[nStream]->IsOpened()) {
if (aStream[nStream]->Setup()) {
aStream[nStream]->Start();
}
aStream[nStream]->Start();
_bIsMp3Active = true;
return true;
} else {
delete aStream[nStream];
aStream[nStream] = NULL;
}
_bIsMp3Active = false;
continue;
// fall through, start playing from another song
}
if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] )
position = 0;
tMP3Entry *e;
if ( !_GetMP3PosFromStreamPos(&position, &e) )
} else {
if(++_CurMP3Index >= nNumMP3s) _CurMP3Index = 0;
_CurMP3Pos = 0;
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
if ( !mp3 )
{
if ( e == NULL )
mp3 = _pMP3List;
if ( !_pMP3List )
{
nFile = 0;
strcat(filename, StreamedNameTable[nFile]);
CStream* stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
ASSERT(stream != NULL);
_bIsMp3Active = 0;
strcpy(filename, StreamedNameTable[nFile]);
CStream* stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
aStream[nStream] = stream;
if (stream->IsOpened()) {
if (stream->Setup()) {
if (position != 0)
stream->SetPosMS(position);
if (stream->Setup()) {
if (position != 0)
stream->SetPosMS(position);
stream->Start();
}
stream->Start();
return true;
} else {
delete stream;
aStream[nStream] = NULL;
}
return false;
}
}
if (e->pLinkPath != NULL)
aStream[nStream] = new CStream(e->pLinkPath, ALStreamSources[nStream], ALStreamBuffers[nStream]);
if(mp3->pLinkPath != NULL)
aStream[nStream] = new CStream(mp3->pLinkPath, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
else {
strcpy(filename, _mp3DirectoryPath);
strcat(filename, e->aFilename);
strcat(filename, mp3->aFilename);
aStream[nStream] = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
}
if (aStream[nStream]->IsOpened()) {
if (aStream[nStream]->Setup()) {
if (position != 0)
aStream[nStream]->SetPosMS(position);
aStream[nStream]->Start();
}
if (aStream[nStream]->Setup()) {
aStream[nStream]->Start();
#ifdef FIX_BUGS
_bIsMp3Active = true;
#endif
return true;
} else {
delete aStream[nStream];
aStream[nStream] = NULL;
}
_bIsMp3Active = false;
} while(++i < nNumMP3s);
position = 0;
nFile = 0;
}
strcpy(filename, StreamedNameTable[nFile]);
CStream *stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
ASSERT(stream != NULL);
aStream[nStream] = stream;
if ( stream->IsOpened() ) {
if ( stream->Setup() ) {
if (position != 0)
stream->SetPosMS(position);
stream->Start();
}
return true;
} else {
delete stream;
aStream[nStream] = NULL;
_bIsMp3Active = 0;
}
while ( ++i < nNumMP3s );
position = 0;
nFile = 0;
}
strcpy(filename, StreamedNameTable[nFile]);
CStream *stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
aStream[nStream] = stream;
if ( stream->Setup() ) {
if (position != 0)
stream->SetPosMS(position);
stream->Start();
return true;
} else {
delete stream;
aStream[nStream] = NULL;
}
return false;
}
@ -1870,6 +1864,9 @@ cSampleManager::StopStreamedFile(uint8 nStream)
{
delete stream;
aStream[nStream] = NULL;
if ( nStream == 0 )
_bIsMp3Active = false;
}
}
@ -1882,7 +1879,21 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream)
if ( stream )
{
return stream->GetPosMS();
if ( _bIsMp3Active )
{
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
if ( mp3 != NULL )
{
return stream->GetPosMS() + mp3->nTrackStreamPos;
}
else
return 0;
}
else
{
return stream->GetPosMS();
}
}
return 0;
@ -1949,6 +1960,12 @@ cSampleManager::Service(void)
if ( stream )
stream->Update();
}
int refCount = CChannel::channelsThatNeedService;
for ( int32 i = 0; refCount && i < MAXCHANNELS+MAX2DCHANNELS; i++ )
{
if ( aChannel[i].Update() )
refCount--;
}
}
bool
@ -1959,7 +1976,7 @@ cSampleManager::InitialiseSampleBanks(void)
fpSampleDescHandle = fcaseopen(SampleBankDescFilename, "rb");
if ( fpSampleDescHandle == NULL )
return false;
#ifndef AUDIO_OPUS
#ifndef OPUS_SFX
fpSampleDataHandle = fcaseopen(SampleBankDataFilename, "rb");
if ( fpSampleDataHandle == NULL )
{
@ -1977,7 +1994,7 @@ cSampleManager::InitialiseSampleBanks(void)
fpSampleDataHandle = op_open_file(SampleBankDataFilename, &e);
#endif
fread(m_aSamples, sizeof(tSample), TOTAL_AUDIO_SAMPLES, fpSampleDescHandle);
#ifdef AUDIO_OPUS
#ifdef OPUS_SFX
int32 _nSampleDataEndOffset = m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nOffset + m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nSize;
#endif
fclose(fpSampleDescHandle);

View File

@ -160,7 +160,7 @@ enum eSound
SOUND_FRONTEND_MONO,
SOUND_FRONTEND_AUDIO_TEST,
SOUND_FRONTEND_FAIL,
SOUND_FRONTEND_NO_RADIO,
SOUND_FRONTEND_RADIO_TURN_OFF,
SOUND_FRONTEND_RADIO_CHANGE,
SOUND_HUD,
SOUND_AMMUNATION_WELCOME_1,

View File

@ -477,8 +477,16 @@ CCollision::TestLineTriangle(const CColLine &line, const CompressedVector *verts
if(plane.CalcPoint(line.p0) * plane.CalcPoint(line.p1) > 0.0f)
return false;
float p0dist = DotProduct(line.p1 - line.p0, normal);
#ifdef FIX_BUGS
// line lines in the plane, assume no collision
if (p0dist == 0.0f)
return false;
#endif
// intersection parameter on line
t = -plane.CalcPoint(line.p0) / DotProduct(line.p1 - line.p0, normal);
t = -plane.CalcPoint(line.p0) / p0dist;
// find point of intersection
CVector p = line.p0 + (line.p1-line.p0)*t;
@ -1286,8 +1294,17 @@ CCollision::ProcessLineTriangle(const CColLine &line,
if(plane.CalcPoint(line.p0) * plane.CalcPoint(line.p1) > 0.0f)
return false;
float p0dist = DotProduct(line.p1 - line.p0, normal);
#ifdef FIX_BUGS
// line lines in the plane, assume no collision
if (p0dist == 0.0f)
return false;
#endif
// intersection parameter on line
t = -plane.CalcPoint(line.p0) / DotProduct(line.p1 - line.p0, normal);
t = -plane.CalcPoint(line.p0) / p0dist;
// early out if we're beyond the mindist
if(t >= mindist)
return false;
@ -2245,12 +2262,12 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin
float dot = DotProduct(*point - *l0, *l1 - *l0);
// Between 0 and len we're above the line.
// if not, calculate distance to endpoint
if(dot <= 0.0f)
return (*point - *l0).Magnitude();
if(dot >= lensq)
return (*point - *l1).Magnitude();
if(dot <= 0.0f) return (*point - *l0).Magnitude();
if(dot >= lensq) return (*point - *l1).Magnitude();
// distance to line
return Sqrt((*point - *l0).MagnitudeSqr() - dot*dot/lensq);
float distSqr = (*point - *l0).MagnitudeSqr() - dot * dot / lensq;
if(distSqr <= 0.f) return 0.f;
return Sqrt(distSqr);
}
// same as above but also return the point on the line
@ -2733,4 +2750,4 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
}
}

View File

@ -1,6 +1,7 @@
#include "common.h"
#include "TempColModels.h"
#include "Game.h"
CColModel CTempColModels::ms_colModelPed1;
CColModel CTempColModels::ms_colModelPed2;

View File

@ -1,6 +1,6 @@
#pragma once
#include "Collision.h"
#include "ColModel.h"
class CTempColModels
{

View File

@ -52,8 +52,8 @@ void CAutoPilot::Save(uint8*& buf)
WriteSaveBuf<int32>(buf, m_nCurrentRouteNode);
WriteSaveBuf<int32>(buf, m_nNextRouteNode);
WriteSaveBuf<int32>(buf, m_nPrevRouteNode);
WriteSaveBuf<uint32>(buf, m_nTimeEnteredCurve);
WriteSaveBuf<uint32>(buf, m_nTimeToSpendOnCurrentCurve);
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);
@ -91,8 +91,8 @@ void CAutoPilot::Load(uint8*& buf)
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
m_nNextRouteNode = ReadSaveBuf<int32>(buf);
m_nPrevRouteNode = ReadSaveBuf<int32>(buf);
m_nTimeEnteredCurve = ReadSaveBuf<uint32>(buf);
m_nTimeToSpendOnCurrentCurve = ReadSaveBuf<uint32>(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);

View File

@ -57,8 +57,8 @@ public:
int32 m_nCurrentRouteNode;
int32 m_nNextRouteNode;
int32 m_nPrevRouteNode;
uint32 m_nTimeEnteredCurve;
uint32 m_nTimeToSpendOnCurrentCurve;
int32 m_nTimeEnteredCurve;
int32 m_nTimeToSpendOnCurrentCurve;
uint32 m_nCurrentPathNodeInfo;
uint32 m_nNextPathNodeInfo;
uint32 m_nPreviousPathNodeInfo;

View File

@ -68,7 +68,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->m_bSirenOrAlarm = true;
}
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
@ -110,7 +110,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
pVehicle->m_bSirenOrAlarm = false;
}
}
@ -121,7 +121,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->m_nCarHornTimer = 0;
}
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())){
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())){
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
@ -141,7 +141,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->m_bSirenOrAlarm = true;
}
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
@ -169,7 +169,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
pVehicle->m_bSirenOrAlarm = false;
}
}
@ -179,7 +179,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->m_nCarHornTimer = 0;
}
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
@ -283,7 +283,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
(FindPlayerVehicle() == pVehicle->AutoPilot.m_pTargetCar &&
#endif
(FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice()))
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice()))
#ifdef FIX_BUGS
)
#endif
@ -337,7 +337,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
}
break;
default:
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && !CCullZones::NoPolice()){
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 && !CCullZones::NoPolice()){
if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f ||
ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
@ -351,7 +351,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
pVehicle->m_bSirenOrAlarm = false;
}
}
@ -486,7 +486,7 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
case MI_RHINO:
case MI_BARRACKS:
pVehicle->SetUpDriver();
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 1)
if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 1)
pVehicle->SetupPassenger(0);
return;
default:
@ -541,7 +541,7 @@ void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
uint8 CCarAI::FindPoliceCarMissionForWantedLevel()
{
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel){
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel()){
case 0:
case 1: return MISSION_BLOCKPLAYER_FARAWAY;
case 2: return (CGeneral::GetRandomNumber() & 3) >= 3 ? MISSION_RAMPLAYER_FARAWAY : MISSION_BLOCKPLAYER_FARAWAY;
@ -555,7 +555,7 @@ uint8 CCarAI::FindPoliceCarMissionForWantedLevel()
int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
{
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) {
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel()) {
case 0: return CGeneral::GetRandomNumberInRange(12, 16);
case 1: return 25;
case 2: return 34;
@ -569,7 +569,7 @@ int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
{
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel == 1){
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() == 1){
float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude();
if (FindPlayerVehicle()){
if (distanceToPlayer < 10.0f)
@ -586,7 +586,7 @@ void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
else
pVehicle->AutoPilot.m_nCruiseSpeed = 25;
}
}else if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel == 2){
}else if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() == 2){
float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude();
if (FindPlayerVehicle()) {
if (distanceToPlayer < 10.0f)

View File

@ -124,18 +124,18 @@ CCarCtrl::GenerateOneRandomCar()
CWanted* pWanted = pPlayer->m_pPed->m_pWanted;
int carClass;
int carModel;
if (pWanted->m_nWantedLevel > 1 && NumLawEnforcerCars < pWanted->m_MaximumLawEnforcerVehicles &&
if (pWanted->GetWantedLevel() > 1 && NumLawEnforcerCars < pWanted->m_MaximumLawEnforcerVehicles &&
pWanted->m_CurrentCops < pWanted->m_MaxCops && (
pWanted->m_nWantedLevel > 3 ||
pWanted->m_nWantedLevel > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 ||
pWanted->m_nWantedLevel > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) {
/* Last pWanted->m_nWantedLevel > 1 is unnecessary but I added it for better readability. */
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{
carModel = ChooseModel(&zone, &vecTargetPos, &carClass);
if (carClass == COPS && pWanted->m_nWantedLevel >= 1)
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. */
return;
@ -267,7 +267,7 @@ CCarCtrl::GenerateOneRandomCar()
}
if (!ThePaths.NewGenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId,
&positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1))
&positionBetweenNodes, carClass == COPS && pWanted->GetWantedLevel() >= 1))
return;
int16 colliding;
CWorld::FindObjectsKindaColliding(spawnPosition, 10.0f, true, &colliding, 2, nil, false, true, true, false, false);
@ -331,7 +331,7 @@ CCarCtrl::GenerateOneRandomCar()
}
case COPS:
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel != 0){
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() != 0){
pVehicle->AutoPilot.m_nCruiseSpeed = CCarAI::FindPoliceCarSpeedForWantedLevel(pVehicle);
pVehicle->AutoPilot.m_fMaxTrafficSpeed = pVehicle->AutoPilot.m_nCruiseSpeed / 2;
pVehicle->AutoPilot.m_nCarMission = CCarAI::FindPoliceCarMissionForWantedLevel();
@ -2415,7 +2415,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
*pHandbrake = true;
float maxAngle = FindMaxSteerAngle(pVehicle);
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward,
float speedMultiplier = FindSpeedMultiplier(CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y) - angleForward,
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;
@ -2654,7 +2654,7 @@ void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
void CCarCtrl::GenerateEmergencyServicesCar(void)
{
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 3)
if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 3)
return;
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars +
NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse)
@ -2718,7 +2718,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);

View File

@ -126,7 +126,7 @@ CDarkel::DrawMessages()
#if defined(PS2_HUD) || defined(FIX_BUGS)
#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f - 1.0f), SCREEN_SCALE_Y(108.0f + 1.0f), gUString);
#else -
#else
CFont::PrintString(SCREEN_WIDTH-(34.0f - 1.0f), 108.0f + 1.0f, gUString);
#endif
#else

View File

@ -159,7 +159,7 @@ CGameLogic::Update()
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
int takeMoney;
switch (pPlayerInfo.m_pPed->m_pWanted->m_nWantedLevel) {
switch (pPlayerInfo.m_pPed->m_pWanted->GetWantedLevel()) {
case 0:
case 1:
takeMoney = 100;

View File

@ -111,6 +111,8 @@ const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLL
{ MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }
};
const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO };
int32 CGarages::BankVansCollected;
bool CGarages::BombsAreFree;
bool CGarages::RespraysAreFree;
@ -387,7 +389,7 @@ void CGarage::Update()
m_eGarageState = GS_OPENING;
DMAudio.PlayFrontEndSound(SOUND_GARAGE_OPENING, 1);
bool bTakeMoney = false;
if (FindPlayerPed()->m_pWanted->m_nWantedLevel != 0)
if (FindPlayerPed()->m_pWanted->GetWantedLevel() != 0)
bTakeMoney = true;
FindPlayerPed()->m_pWanted->Reset();
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE);
@ -1539,7 +1541,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
m_bRecreateDoorOnNextRefresh = false;
if (m_pDoor1) {
if (m_bDoor1IsDummy) {
if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1)))
if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1)))
bNeedToFindDoorEntities = true;
else {
if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F))
@ -1549,7 +1551,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
}
}
else {
if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1)))
if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1)))
bNeedToFindDoorEntities = true;
else {
if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F))
@ -1561,7 +1563,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
}
if (m_pDoor2) {
if (m_bDoor2IsDummy) {
if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2)))
if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2)))
bNeedToFindDoorEntities = true;
else {
if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F))
@ -1571,7 +1573,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
}
}
else {
if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2)))
if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2)))
bNeedToFindDoorEntities = true;
else {
if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F))
@ -2032,7 +2034,11 @@ float CGarages::FindDoorHeightForMI(int32 mi)
void CGarage::TidyUpGarage()
{
uint32 i = CPools::GetVehiclePool()->GetSize();
#ifdef FIX_BUGS
while (i--) {
#else
while (--i) {
#endif
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (!pVehicle || !pVehicle->IsCar())
continue;
@ -2050,7 +2056,11 @@ void CGarage::TidyUpGarage()
void CGarage::TidyUpGarageClose()
{
uint32 i = CPools::GetVehiclePool()->GetSize();
#ifdef FIX_BUGS
while (i--) {
#else
while (--i) {
#endif
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (!pVehicle || !pVehicle->IsCar())
continue;
@ -2424,3 +2434,41 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_CRUSHERBODY ||
id == MI_CRUSHERLID;
}
void CGarages::StopCarFromBlowingUp(CAutomobile* pCar)
{
pCar->m_fFireBlowUpTimer = 0.0f;
pCar->m_fHealth = Max(pCar->m_fHealth, 300.0f);
pCar->Damage.SetEngineStatus(Max(pCar->Damage.GetEngineStatus(), 275));
}
bool CGarage::Does60SecondsNeedThisCarAtAll(int mi)
{
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
if (gaCarsToCollectIn60Seconds[i] == mi)
return true;
}
return false;
}
bool CGarage::Does60SecondsNeedThisCar(int mi)
{
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
if (gaCarsToCollectIn60Seconds[i] == mi)
return m_bCollectedCarsState & BIT(i);
}
return false;
}
void CGarage::MarkThisCarAsCollectedFor60Seconds(int mi)
{
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
if (gaCarsToCollectIn60Seconds[i] == mi)
m_bCollectedCarsState |= BIT(i);
}
}
bool CGarage::IsPlayerEntirelyInsideGarage()
{
return IsEntityEntirelyInside3D(FindPlayerVehicle() ? (CEntity*)FindPlayerVehicle() : (CEntity*)FindPlayerPed(), 0.0f);
}

View File

@ -1,11 +1,10 @@
#pragma once
#include "Automobile.h"
#include "audio_enums.h"
#include "Camera.h"
#include "config.h"
#include "Lists.h"
class CVehicle;
class CCamera;
enum eGarageState
{
@ -81,6 +80,7 @@ VALIDATE_SIZE(CStoredCar, 0x28);
class CGarage
{
public:
uint8 m_eGarageType;
uint8 m_eGarageState;
bool field_2; // unused
@ -166,10 +166,11 @@ class CGarage
void FindDoorsEntities();
void FindDoorsEntitiesSectorList(CPtrList&, bool);
void PlayerArrestedOrDied();
bool Does60SecondsNeedThisCarAtAll(int mi);
bool Does60SecondsNeedThisCar(int mi);
void MarkThisCarAsCollectedFor60Seconds(int mi);
bool IsPlayerEntirelyInsideGarage();
friend class CGarages;
friend class cAudioManager;
friend class CCamera;
};
VALIDATE_SIZE(CGarage, 140);
@ -179,6 +180,7 @@ class CGarages
enum {
MESSAGE_LENGTH = 8
};
public:
static int32 BankVansCollected;
static bool BombsAreFree;
static bool RespraysAreFree;
@ -200,7 +202,6 @@ class CGarages
static CStoredCar aCarsInSafeHouse3[NUM_GARAGE_STORED_CARS];
static bool bCamShouldBeOutisde;
public:
static void Init(void);
#ifndef PS2
static void Shutdown(void);
@ -239,8 +240,8 @@ public:
static bool IsModelIndexADoor(uint32 id);
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
static void StopCarFromBlowingUp(CAutomobile*);
private:
static bool IsCarSprayable(CVehicle*);
static float FindDoorHeightForMI(int32);
static void CloseHideOutGaragesBeforeSave(void);
@ -249,9 +250,4 @@ private:
static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 1; }
static int32 GetCarsCollectedIndexForGarageType(uint8 type) { return type - GARAGE_COLLECTCARS_1; }
friend class cAudioManager;
friend class CGarage;
#ifdef FIX_BUGS
friend class CReplay;
#endif
};

View File

@ -40,7 +40,6 @@ bool
isPhoneAvailable(int m_phoneId)
{
return crimeReporters[m_phoneId] == nil || !crimeReporters[m_phoneId]->IsPointerValid() || crimeReporters[m_phoneId]->m_objective > OBJECTIVE_WAIT_ON_FOOT ||
crimeReporters[m_phoneId]->m_nLastPedState != PED_SEEK_POS &&
(crimeReporters[m_phoneId]->m_nPedState != PED_MAKE_CALL && crimeReporters[m_phoneId]->m_nPedState != PED_FACE_PHONE && crimeReporters[m_phoneId]->m_nPedState != PED_SEEK_POS);
}
#endif
@ -59,9 +58,9 @@ CPhoneInfo::Update(void)
TheCamera.SetWideScreenOff();
pPhoneDisplayingMessages = nil;
bDisplayingPhoneMessage = false;
CAnimBlendAssociation *talkAssoc = RpAnimBlendClumpGetAssociation(player->GetClump(), ANIM_PHONE_TALK);
CAnimBlendAssociation *talkAssoc = RpAnimBlendClumpGetAssociation(player->GetClump(), ANIM_STD_PHONE_TALK);
if (talkAssoc && talkAssoc->blendAmount > 0.5f) {
CAnimBlendAssociation *endAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_OUT, 8.0f);
CAnimBlendAssociation *endAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_OUT, 8.0f);
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
endAssoc->SetFinishCallback(PhonePutDownCB, player);
} else {
@ -118,7 +117,7 @@ CPhoneInfo::Update(void)
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
TheCamera.SetWideScreenOn();
playerInfo->MakePlayerSafe(true);
CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f);
CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_IN, 4.0f);
phonePickAssoc->SetFinishCallback(PhonePickUpCB, &m_aPhones[phoneId]);
bPickingUpPhone = true;
pCallBackPed = player;
@ -443,10 +442,10 @@ PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg)
CPed *ped = CPhoneInfo::pCallBackPed;
ped->m_nMoveState = PEDMOVE_STILL;
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_IDLE_STANCE, 8.0f);
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_STD_IDLE, 8.0f);
if (assoc->blendAmount > 0.5f && ped)
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_PHONE_TALK, 8.0f);
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_TALK, 8.0f);
CPhoneInfo::pCallBackPed = nil;
}

View File

@ -129,7 +129,7 @@ CPickup::CanBePickedUp(CPlayerPed *player)
bool cannotBePickedUp =
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > 99.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->m_nWantedLevel == 0)
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->GetWantedLevel() == 0)
|| (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
return !cannotBePickedUp;
}
@ -456,7 +456,7 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
return true;
} else if (modelIndex == MI_PICKUP_BRIBE) {
int32 level = FindPlayerPed()->m_pWanted->m_nWantedLevel - 1;
int32 level = FindPlayerPed()->m_pWanted->GetWantedLevel() - 1;
if (level < 0) level = 0;
player->SetWantedLevel(level);
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
@ -1330,6 +1330,8 @@ CPacManPickups::Render()
{
if (!bPMActive) return;
PUSH_RENDERGROUP("CPacManPickups::Render");
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
@ -1363,6 +1365,8 @@ CPacManPickups::Render()
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE);
POP_RENDERGROUP();
}
void

View File

@ -120,7 +120,7 @@ public:
class CPacManPickups
{
friend CPacManPickup;
friend class CPacManPickup;
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
static CVector LastPickUpCoors;

View File

@ -305,7 +305,7 @@ void CReplay::RecordThisFrame(void)
#endif
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
general->type = REPLAYPACKET_GENERAL;
general->camera_pos.CopyOnlyMatrix(&TheCamera.GetMatrix());
general->camera_pos.CopyOnlyMatrix(TheCamera.GetMatrix());
general->player_pos = FindPlayerCoors();
general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false;
Record.m_nOffset += sizeof(*general);
@ -457,7 +457,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
state->aFunctionCallbackID[i] = 0;
}
}else{
state->aAnimId[i] = NUM_ANIMS;
state->aAnimId[i] = ANIM_STD_NUM;
state->aCurTime[i] = 0;
state->aSpeed[i] = 85;
state->aFunctionCallbackID[i] = 0;
@ -484,7 +484,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
}
}
else {
state->aAnimId2[i] = NUM_ANIMS;
state->aAnimId2[i] = ANIM_STD_NUM;
state->aCurTime2[i] = 0;
state->aSpeed2[i] = 85;
state->aFunctionCallbackID2[i] = 0;
@ -558,7 +558,7 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
float time = state->partAnimTime * 4.0f / 255.0f;
float speed = state->partAnimSpeed * 3.0f / 255.0f;
float blend = state->partBlendAmount * 2.0f / 255.0f;
if (blend > 0.0f && state->partAnimId != ANIM_IDLE_STANCE){
if (blend > 0.0f && state->partAnimId != ANIM_STD_IDLE){
CAnimBlendAssociation* anim3 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject, ASSOCGRP_STD, (AnimationId)state->partAnimId, 1000.0f);
anim3->SetCurrentTime(time);
@ -578,7 +578,7 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
assoc->SetBlend(0.0f, -1.0f);
#endif
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++) {
if (state->aAnimId[i] == NUM_ANIMS)
if (state->aAnimId[i] == ANIM_STD_NUM)
continue;
#ifdef FIX_REPLAY_BUGS
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
@ -607,7 +607,7 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
}
for (int i = 0; i < NUM_PARTIAL_ANIMS_IN_REPLAY; i++) {
if (state->aAnimId2[i] == NUM_ANIMS)
if (state->aAnimId2[i] == ANIM_STD_NUM)
continue;
#ifdef FIX_REPLAY_BUGS
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
@ -1457,7 +1457,7 @@ void CReplay::SaveReplayToHD(void)
CFileMgr::SetDir("");
}
void PlayReplayFromHD(void)
void CReplay::PlayReplayFromHD(void)
{
CFileMgr::SetDirMyDocuments();
int fr = CFileMgr::OpenFile("replay.rep", "rb");
@ -1476,17 +1476,17 @@ void PlayReplayFromHD(void)
return;
}
int slot;
for (slot = 0; CFileMgr::Read(fr, (char*)CReplay::Buffers[slot], sizeof(CReplay::Buffers[slot])); slot++)
CReplay::BufferStatus[slot] = CReplay::REPLAYBUFFER_PLAYBACK;
CReplay::BufferStatus[slot - 1] = CReplay::REPLAYBUFFER_RECORD;
while (slot < CReplay::NUM_REPLAYBUFFERS)
CReplay::BufferStatus[slot++] = CReplay::REPLAYBUFFER_UNUSED;
for (slot = 0; CFileMgr::Read(fr, (char*)Buffers[slot], sizeof(Buffers[slot])); slot++)
BufferStatus[slot] = REPLAYBUFFER_PLAYBACK;
BufferStatus[slot - 1] = REPLAYBUFFER_RECORD;
while (slot < NUM_REPLAYBUFFERS)
BufferStatus[slot++] = REPLAYBUFFER_UNUSED;
CFileMgr::CloseFile(fr);
CFileMgr::SetDir("");
CReplay::TriggerPlayback(CReplay::REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false);
CReplay::bPlayingBackFromFile = true;
CReplay::bAllowLookAroundCam = true;
CReplay::StreamAllNecessaryCarsAndPeds();
TriggerPlayback(REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false);
bPlayingBackFromFile = true;
bAllowLookAroundCam = true;
StreamAllNecessaryCarsAndPeds();
}
void CReplay::StreamAllNecessaryCarsAndPeds(void)

View File

@ -61,8 +61,6 @@ struct CStoredDetailedAnimationState
uint16 aFlags2[NUM_PARTIAL_ANIMS_IN_REPLAY];
};
void PlayReplayFromHD(void);
#ifdef GTA_REPLAY
#define REPLAY_STUB
#else
@ -323,11 +321,9 @@ private:
static void EmptyAllPools(void);
static void MarkEverythingAsNew(void);
static void SaveReplayToHD(void);
static void PlayReplayFromHD(void); // out of class in III PC and later because of SecuROM
static void FindFirstFocusCoordinate(CVector *coord);
static void ProcessLookAroundCam(void);
static size_t FindSizeOfPacket(uint8);
/* Absolute nonsense, but how could this function end up being outside of class? */
friend void PlayReplayFromHD(void);
#endif
};

View File

@ -46,8 +46,8 @@ CRoadBlocks::Init(void)
void
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode)
{
static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f},
{1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} };
static const CVector vecRoadBlockOffets[6] = { CVector(-1.5, 1.8f, 0.0f), CVector(-1.5f, -1.8f, 0.0f), CVector(1.5f, 1.8f, 0.0f),
CVector(1.5f, -1.8f, 0.0f), CVector(-1.5f, 0.0f, 0.0f), CVector(1.5, 0.0, 0.0) };
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
if (!pEntityToAttack)
pEntityToAttack = (CEntity*)FindPlayerPed();

View File

@ -329,7 +329,7 @@ void CSceneEdit::Draw(void)
#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
#else
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT, wstr);
#endif
if (nCommandDrawn == m_nCurrentCommand)
CFont::SetColor(CRGBA(156, 91, 40, 255));
@ -338,7 +338,7 @@ void CSceneEdit::Draw(void)
#ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
#else
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr);
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT, wstr);
#endif
}
}

View File

@ -73,7 +73,7 @@ uint16 CTheScripts::NumScriptDebugLines;
uint16 CTheScripts::NumberOfIntroRectanglesThisFrame;
uint16 CTheScripts::NumberOfIntroTextLinesThisFrame;
uint8 CTheScripts::UseTextCommands;
CMissionCleanup CTheScripts::MissionCleanup;
CMissionCleanup CTheScripts::MissionCleanUp;
CUpsideDownCarCheck CTheScripts::UpsideDownCars;
CStuckCarCheck CTheScripts::StuckCars;
uint16 CTheScripts::CommandsExecuted;
@ -260,12 +260,12 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
@ -1225,7 +1225,7 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_LOAD_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_ENABLE_PLAYER_CONTROL_CAMERA, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
#ifndef GTA_PS2
#if GTA_VERSION > GTA3_PS2_160
REGISTER_COMMAND(COMMAND_SET_OBJECT_ROTATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
@ -1444,10 +1444,16 @@ void CUpsideDownCarCheck::Init()
bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id)
{
CVehicle* v = CPools::GetVehiclePool()->GetAt(id);
return v->GetUp().z <= -0.97f &&
v->GetMoveSpeed().Magnitude() < 0.01f &&
v->GetTurnSpeed().Magnitude() < 0.02f;
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(id);
return IsCarUpsideDown(pVehicle);
}
bool CUpsideDownCarCheck::IsCarUpsideDown(CVehicle* pVehicle)
{
assert(pVehicle);
return pVehicle->GetUp().z <= UPSIDEDOWN_UP_THRESHOLD &&
pVehicle->GetMoveSpeed().Magnitude() < UPSIDEDOWN_MOVE_SPEED_THRESHOLD &&
pVehicle->GetTurnSpeed().Magnitude() < UPSIDEDOWN_TURN_SPEED_THRESHOLD;
}
void CUpsideDownCarCheck::UpdateTimers()
@ -1470,7 +1476,7 @@ void CUpsideDownCarCheck::UpdateTimers()
bool CUpsideDownCarCheck::AreAnyCarsUpsideDown()
{
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
if (m_sCars[i].m_nVehicleIndex >= 0 && m_sCars[i].m_nUpsideDownTimer > 1000)
if (m_sCars[i].m_nVehicleIndex >= 0 && m_sCars[i].m_nUpsideDownTimer > UPSIDEDOWN_TIMER_THRESHOLD)
return true;
}
return false;
@ -1481,8 +1487,10 @@ void CUpsideDownCarCheck::AddCarToCheck(int32 id)
uint16 index = 0;
while (index < MAX_UPSIDEDOWN_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
index++;
#ifdef FIX_BUGS
if (index >= MAX_UPSIDEDOWN_CAR_CHECKS)
return;
#endif
m_sCars[index].m_nVehicleIndex = id;
m_sCars[index].m_nUpsideDownTimer = 0;
}
@ -1501,7 +1509,7 @@ bool CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile(int32 id)
{
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
if (m_sCars[i].m_nVehicleIndex == id)
return m_sCars[i].m_nUpsideDownTimer > 1000;
return m_sCars[i].m_nUpsideDownTimer > UPSIDEDOWN_TIMER_THRESHOLD;
}
return false;
}
@ -1551,7 +1559,10 @@ void CStuckCarCheck::AddCarToCheck(int32 id, float radius, uint32 time)
int index = 0;
while (index < MAX_STUCK_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
index++;
/* Would be nice to return if index >= MAX_STUCK_CAR_CHECKS... */
#ifdef FIX_BUGS
if (index >= MAX_STUCK_CAR_CHECKS)
return;
#endif
m_sCars[index].m_nVehicleIndex = id;
m_sCars[index].m_vecPos = pv->GetPosition();
m_sCars[index].m_nLastCheck = CTimer::GetTimeInMilliseconds();
@ -1790,7 +1801,7 @@ void CTheScripts::Init()
ScriptsArray[i].Init();
ScriptsArray[i].AddScriptToList(&pIdleScripts);
}
MissionCleanup.Init();
MissionCleanUp.Init();
UpsideDownCars.Init();
StuckCars.Init();
CFileMgr::SetDir("data");
@ -2048,7 +2059,9 @@ int8 CRunningScript::ProcessOneCommand()
uint32 ip = m_nIp;
if (command < ARRAY_SIZE(commands)) {
script_assert(commands[command].id == command);
m_nIp -= 2;
sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp);
m_nIp += 2;
if (m_bNotFlag)
strcat(commandInfo, "NOT ");
if (commands[command].position == -1)
@ -2098,7 +2111,7 @@ int8 CRunningScript::ProcessOneCommand()
retval = ProcessCommands800To899(command);
else if (command < 1000)
retval = ProcessCommands900To999(command);
#ifdef GTA_PS2
#if GTA_VERSION <= GTA3_PS2_160
else if (command < 1200)
retval = ProcessCommands1000To1099(command);
#else
@ -3206,7 +3219,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_DELETE_CHAR:
@ -3232,7 +3245,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
--CPopulation::ms_nTotalMissionPeds;
}
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_CHAR_WANDER_DIR:
@ -3451,7 +3464,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
ScriptParams[0] = handle;
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
return 0;
}
case COMMAND_DELETE_CAR:
@ -3464,7 +3477,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
delete car;
}
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
return 0;
}
case COMMAND_CAR_GOTO_COORDINATES:
@ -3582,9 +3595,9 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1];
if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo
car->AutoPilot.m_nCruiseSpeed = 8 * car->AutoPilot.m_nCruiseSpeed / 10;
car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity);
#else
car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity);
#endif
return 0;
}
@ -3781,7 +3794,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return 0;
if (strcmp(m_abScriptName, "love3") == 0) /* A Drop in the Ocean */
CPickups::RemoveAllFloatingPickups();
CTheScripts::MissionCleanup.Process();
CTheScripts::MissionCleanUp.Process();
return 0;
}
case COMMAND_STORE_CAR_CHAR_IS_IN:
@ -3804,7 +3817,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pOld->bIsLocked = false;
CCarCtrl::NumRandomCars++;
CCarCtrl::NumMissionCars--;
CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
}
}
@ -3815,14 +3828,14 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
CCarCtrl::NumMissionCars++;
CCarCtrl::NumRandomCars--;
CTheScripts::StoreVehicleWasRandom = true;
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
break;
case PARKED_VEHICLE:
pCurrent->VehicleCreatedBy = MISSION_VEHICLE;
CCarCtrl::NumMissionCars++;
CCarCtrl::NumParkedCars--;
CTheScripts::StoreVehicleWasRandom = true;
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
break;
case MISSION_VEHICLE:
case PERMANENT_VEHICLE:
@ -3855,7 +3868,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pOld->bIsLocked = false;
CCarCtrl::NumRandomCars++;
CCarCtrl::NumMissionCars--;
CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
}
}
@ -3866,14 +3879,14 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
CCarCtrl::NumMissionCars++;
CCarCtrl::NumRandomCars--;
CTheScripts::StoreVehicleWasRandom = true;
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
break;
case PARKED_VEHICLE:
pCurrent->VehicleCreatedBy = MISSION_VEHICLE;
CCarCtrl::NumMissionCars++;
CCarCtrl::NumParkedCars--;
CTheScripts::StoreVehicleWasRandom = true;
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
break;
case MISSION_VEHICLE:
case PERMANENT_VEHICLE:
@ -4024,7 +4037,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
return 0;
}
case COMMAND_DELETE_OBJECT:
@ -4037,7 +4050,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
delete pObj;
}
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
return 0;
}
case COMMAND_ADD_SCORE:
@ -4072,7 +4085,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return 0;
case COMMAND_IS_WANTED_LEVEL_GREATER:
CollectParameters(&m_nIp, 2);
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->m_pWanted->m_nWantedLevel > ScriptParams[1]);
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->m_pWanted->GetWantedLevel() > ScriptParams[1]);
return 0;
case COMMAND_CLEAR_WANTED_LEVEL:
CollectParameters(&m_nIp, 1);
@ -4253,7 +4266,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
#ifdef FIX_BUGS
AnimationId anim = pVehicle->GetDriverAnim();
#else
AnimationId anim = pVehicle->bLowVehicle ? ANIM_CAR_LSIT : ANIM_CAR_SIT;
AnimationId anim = pVehicle->bLowVehicle ? ANIM_STD_CAR_SIT_LO : ANIM_STD_CAR_SIT;
#endif
pPed->m_pVehicleAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, anim, 100.0f);
pPed->StopNonPartialAnims();
@ -4262,7 +4275,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_WARP_PLAYER_FROM_CAR_TO_COORD:
@ -4296,7 +4309,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPlayer->m_pPed->m_pVehicleAnim->blendDelta = -1000.0f;
pPlayer->m_pPed->m_pVehicleAnim = nil;
pPlayer->m_pPed->SetMoveState(PEDMOVE_NONE);
CAnimManager::BlendAnimation(pPlayer->m_pPed->GetClump(), pPlayer->m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
CAnimManager::BlendAnimation(pPlayer->m_pPed->GetClump(), pPlayer->m_pPed->m_animGroup, ANIM_STD_IDLE, 100.0f);
pPlayer->m_pPed->RestartNonPartialAnims();
AudioManager.PlayerJustLeftCar();
pos.z += pPlayer->m_pPed->GetDistanceFromCentreOfMassToBaseOfModel();
@ -4314,81 +4327,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return -1;
}
void CRunningScript::Save(uint8*& buf)
{
#ifdef COMPATIBLE_SAVES
SkipSaveBuf(buf, 8);
for (int i = 0; i < 8; i++)
WriteSaveBuf<char>(buf, m_abScriptName[i]);
WriteSaveBuf<uint32>(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);
#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
WriteSaveBuf<bool>(buf, m_bCondResult);
WriteSaveBuf<bool>(buf, m_bIsMissionScript);
WriteSaveBuf<bool>(buf, m_bSkipWakeTime);
SkipSaveBuf(buf, 1);
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);
#else
WriteSaveBuf(buf, *this);
#endif
}
void CRunningScript::Load(uint8*& buf)
{
#ifdef COMPATIBLE_SAVES
SkipSaveBuf(buf, 8);
for (int i = 0; i < 8; i++)
m_abScriptName[i] = ReadSaveBuf<char>(buf);
m_nIp = ReadSaveBuf<uint32>(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);
SkipSaveBuf(buf, 2);
#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
m_bCondResult = ReadSaveBuf<bool>(buf);
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
SkipSaveBuf(buf, 1);
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);
SkipSaveBuf(buf, 2);
#else
CRunningScript* n = next;
CRunningScript* p = prev;
*this = ReadSaveBuf<CRunningScript>(buf);
next = n;
prev = p;
#endif
}
#ifdef MISSION_REPLAY
bool CRunningScript::CanAllowMissionReplay()
@ -4423,7 +4361,7 @@ void RetryMission(int type, int unk)
else if (type == 2) {
doingMissionRetry = false;
AllowMissionReplay = 6;
CTheScripts::MissionCleanup.Process();
CTheScripts::MissionCleanUp.Process();
}
}

View File

@ -1,6 +1,5 @@
#pragma once
#include "common.h"
#include "Ped.h"
#include "Font.h"
#include "PedType.h"
#include "Text.h"
#include "Sprite2d.h"
@ -19,27 +18,34 @@ extern int32 ScriptParams[32];
void FlushLog();
#define script_assert(_Expression) FlushLog(); assert(_Expression);
#define PICKUP_PLACEMENT_OFFSET 0.5f
#define PED_FIND_Z_OFFSET 5.0f
#define PICKUP_PLACEMENT_OFFSET (0.5f)
#define PED_FIND_Z_OFFSET (5.0f)
#define SPHERE_MARKER_R 0
#define SPHERE_MARKER_G 128
#define SPHERE_MARKER_B 255
#define SPHERE_MARKER_A 128
#define SPHERE_MARKER_PULSE_PERIOD 2048
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
#define UPSIDEDOWN_UP_THRESHOLD (-0.97f)
#define UPSIDEDOWN_MOVE_SPEED_THRESHOLD (0.01f)
#define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f)
#define UPSIDEDOWN_TIMER_THRESHOLD (1000)
#define SPHERE_MARKER_R (0)
#define SPHERE_MARKER_G (128)
#define SPHERE_MARKER_B (255)
#define SPHERE_MARKER_A (128)
#define SPHERE_MARKER_PULSE_PERIOD (2048)
#define SPHERE_MARKER_PULSE_FRACTION (0.1f)
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
#define METERS_IN_FOOT 0.3048f
#define FEET_IN_METER 3.28084f
#define MILES_IN_METER (0.000621371192f)
#define METERS_IN_FOOT (0.3048f)
#define FEET_IN_METER (3.28084f)
#else
#define METERS_IN_FOOT 0.3f
#define FEET_IN_METER 3.33f
#define MILES_IN_METER (1 / 1670.f)
#define METERS_IN_FOOT (0.3f)
#define FEET_IN_METER (3.33f)
#endif
#define KEY_LENGTH_IN_SCRIPT 8
#define KEY_LENGTH_IN_SCRIPT (8)
#if GTA_VERSION <= GTA_PS2_160
#if GTA_VERSION <= GTA3_PS2_160
#define GTA_SCRIPT_COLLECTIVE
#endif
@ -94,12 +100,12 @@ struct intro_text_line
m_bCentered = false;
m_bBackground = false;
m_bBackgroundOnly = false;
m_fWrapX = 182.0f; /* TODO: scaling as bugfix */
m_fCenterSize = 640.0f; /* --||-- */
m_fWrapX = 182.0f;
m_fCenterSize = DEFAULT_SCREEN_WIDTH;
m_sBackgroundColor = CRGBA(128, 128, 128, 128);
m_bTextProportional = true;
m_bTextBeforeFade = false;
m_nFont = 2; /* enum? */
m_nFont = FONT_HEADING;
m_fAtX = 0.0f;
m_fAtY = 0.0f;
memset(&m_Text, 0, sizeof(m_Text));
@ -148,10 +154,10 @@ enum {
class CMissionCleanup
{
public:
cleanup_entity_struct m_sEntities[MAX_CLEANUP];
uint8 m_nCount;
public:
CMissionCleanup();
void Init();
@ -161,7 +167,7 @@ public:
void Process();
};
struct CUpsideDownCarCheckEntry
struct upsidedown_car_data
{
int32 m_nVehicleIndex;
uint32 m_nUpsideDownTimer;
@ -169,11 +175,12 @@ struct CUpsideDownCarCheckEntry
class CUpsideDownCarCheck
{
CUpsideDownCarCheckEntry m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
upsidedown_car_data m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
public:
void Init();
bool IsCarUpsideDown(int32);
bool IsCarUpsideDown(CVehicle*);
void UpdateTimers();
bool AreAnyCarsUpsideDown();
void AddCarToCheck(int32);
@ -191,7 +198,7 @@ struct stuck_car_data
bool m_bStuck;
stuck_car_data() { }
inline void Reset();
void Reset();
};
class CStuckCarCheck
@ -240,6 +247,156 @@ struct tBuildingSwap
};
enum {
#if GTA_VERSION > GTA3_PS2_160
MAX_STACK_DEPTH = 6,
#else
MAX_STACK_DEPTH = 4,
#endif
NUM_LOCAL_VARS = 16,
NUM_TIMERS = 2
};
class CRunningScript
{
enum {
ANDOR_NONE = 0,
ANDS_1 = 1,
ANDS_2,
ANDS_3,
ANDS_4,
ANDS_5,
ANDS_6,
ANDS_7,
ANDS_8,
ORS_1 = 21,
ORS_2,
ORS_3,
ORS_4,
ORS_5,
ORS_6,
ORS_7,
ORS_8
};
public:
CRunningScript* next;
CRunningScript* prev;
char m_abScriptName[8];
uint32 m_nIp;
uint32 m_anStack[MAX_STACK_DEPTH];
uint16 m_nStackPointer;
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
bool m_bCondResult;
bool m_bIsMissionScript;
bool m_bSkipWakeTime;
uint32 m_nWakeTime;
uint16 m_nAndOrState;
bool m_bNotFlag;
bool m_bDeatharrestEnabled;
bool m_bDeatharrestExecuted;
bool m_bMissionFlag;
public:
void SetIP(uint32 ip) { m_nIp = ip; }
CRunningScript* GetNext() const { return next; }
void Save(uint8*& buf);
void Load(uint8*& buf);
void UpdateTimers(float timeStep) {
m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
}
void Init();
void Process();
void RemoveScriptFromList(CRunningScript**);
void AddScriptToList(CRunningScript**);
static const uint32 nSaveStructSize;
void CollectParameters(uint32*, int16);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
void StoreParameters(uint32*, int16);
int8 ProcessOneCommand();
void DoDeatharrestCheck();
void UpdateCompareFlag(bool);
int16 GetPadState(uint16, uint16);
int8 ProcessCommands0To99(int32);
int8 ProcessCommands100To199(int32);
int8 ProcessCommands200To299(int32);
int8 ProcessCommands300To399(int32);
int8 ProcessCommands400To499(int32);
int8 ProcessCommands500To599(int32);
int8 ProcessCommands600To699(int32);
int8 ProcessCommands700To799(int32);
int8 ProcessCommands800To899(int32);
int8 ProcessCommands900To999(int32);
int8 ProcessCommands1000To1099(int32);
#if GTA_VERSION > GTA3_PS2_160
int8 ProcessCommands1100To1199(int32);
#endif
void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*);
void LocatePlayerCarCommand(int32, uint32*);
void LocateCharCommand(int32, uint32*);
void LocateCharCharCommand(int32, uint32*);
void LocateCharCarCommand(int32, uint32*);
void LocateCharObjectCommand(int32, uint32*);
void LocateCarCommand(int32, uint32*);
void LocateSniperBulletCommand(int32, uint32*);
void PlayerInAreaCheckCommand(int32, uint32*);
void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
#ifdef GTA_SCRIPT_COLLECTIVE
void LocateCollectiveCommand(int32, uint32*);
void LocateCollectiveCharCommand(int32, uint32*);
void LocateCollectiveCarCommand(int32, uint32*);
void LocateCollectivePlayerCommand(int32, uint32*);
void CollectiveInAreaCheckCommand(int32, uint32*);
#endif
#ifdef MISSION_REPLAY
bool CanAllowMissionReplay();
#endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CollectParameterForDebug(char* buf, bool& var);
void GetStoredParameterForDebug(char* buf);
#endif
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype) {
switch (pedtype) {
case PEDTYPE_CIVMALE:
case PEDTYPE_CIVFEMALE:
case PEDTYPE_GANG1:
case PEDTYPE_GANG2:
case PEDTYPE_GANG3:
case PEDTYPE_GANG4:
case PEDTYPE_GANG5:
case PEDTYPE_GANG6:
case PEDTYPE_GANG7:
case PEDTYPE_GANG8:
case PEDTYPE_GANG9:
case PEDTYPE_CRIMINAL:
case PEDTYPE_PROSTITUTE:
return true;
default:
return false;
}
}
};
enum {
VAR_LOCAL = 1,
VAR_GLOBAL = 2,
@ -268,6 +425,7 @@ enum {
class CTheScripts
{
public:
static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
static int32 BaseBriefIdForContact[MAX_NUM_CONTACTS];
@ -284,7 +442,7 @@ class CTheScripts
static CStoredLine aStoredLines[MAX_NUM_STORED_LINES];
static bool DbgFlag;
static uint32 OnAMissionFlag;
static CMissionCleanup MissionCleanup;
static CMissionCleanup MissionCleanUp;
static CStuckCarCheck StuckCars;
static CUpsideDownCarCheck UpsideDownCars;
static int32 StoreVehicleIndex;
@ -309,7 +467,6 @@ class CTheScripts
static uint16 CommandsExecuted;
static uint16 ScriptsUpdated;
public:
static void Init();
static void Process();
@ -366,8 +523,6 @@ public:
return Read4BytesFromScript(&tmp);
}
private:
static CRunningScript* StartNewScript(uint32);
static void CleanUpThisVehicle(CVehicle*);
@ -417,167 +572,12 @@ private:
static void SetObjectiveForAllPedsInCollective(int, eObjective);
#endif
friend class CRunningScript;
friend class CHud;
friend void CMissionCleanup::Process();
#ifdef MISSION_REPLAY
friend void RetryMission(int, int);
#endif
#ifdef MISSION_SWITCHER
public:
static void SwitchToMission(int32 mission);
#endif
};
enum {
MAX_STACK_DEPTH = 6, // 4 PS2
NUM_LOCAL_VARS = 16,
NUM_TIMERS = 2
};
class CRunningScript
{
enum {
ANDOR_NONE = 0,
ANDS_1 = 1,
ANDS_2,
ANDS_3,
ANDS_4,
ANDS_5,
ANDS_6,
ANDS_7,
ANDS_8,
ORS_1 = 21,
ORS_2,
ORS_3,
ORS_4,
ORS_5,
ORS_6,
ORS_7,
ORS_8
};
CRunningScript* next;
CRunningScript* prev;
char m_abScriptName[8];
uint32 m_nIp;
uint32 m_anStack[MAX_STACK_DEPTH];
uint16 m_nStackPointer;
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
bool m_bCondResult;
bool m_bIsMissionScript;
bool m_bSkipWakeTime;
uint32 m_nWakeTime;
uint16 m_nAndOrState;
bool m_bNotFlag;
bool m_bDeatharrestEnabled;
bool m_bDeatharrestExecuted;
bool m_bMissionFlag;
public:
void SetIP(uint32 ip) { m_nIp = ip; }
CRunningScript* GetNext() const { return next; }
void Save(uint8*& buf);
void Load(uint8*& buf);
void UpdateTimers(float timeStep) {
m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
}
void Init();
void Process();
void RemoveScriptFromList(CRunningScript**);
void AddScriptToList(CRunningScript**);
static const uint32 nSaveStructSize;
private:
void CollectParameters(uint32*, int16);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
void StoreParameters(uint32*, int16);
int8 ProcessOneCommand();
void DoDeatharrestCheck();
void UpdateCompareFlag(bool);
int16 GetPadState(uint16, uint16);
int8 ProcessCommands0To99(int32);
int8 ProcessCommands100To199(int32);
int8 ProcessCommands200To299(int32);
int8 ProcessCommands300To399(int32);
int8 ProcessCommands400To499(int32);
int8 ProcessCommands500To599(int32);
int8 ProcessCommands600To699(int32);
int8 ProcessCommands700To799(int32);
int8 ProcessCommands800To899(int32);
int8 ProcessCommands900To999(int32);
int8 ProcessCommands1000To1099(int32);
#ifndef GTA_PS2
int8 ProcessCommands1100To1199(int32);
#endif
void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*);
void LocatePlayerCarCommand(int32, uint32*);
void LocateCharCommand(int32, uint32*);
void LocateCharCharCommand(int32, uint32*);
void LocateCharCarCommand(int32, uint32*);
void LocateCharObjectCommand(int32, uint32*);
void LocateCarCommand(int32, uint32*);
void LocateSniperBulletCommand(int32, uint32*);
void PlayerInAreaCheckCommand(int32, uint32*);
void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
#ifdef GTA_SCRIPT_COLLECTIVE
void LocateCollectiveCommand(int32, uint32*);
void LocateCollectiveCharCommand(int32, uint32*);
void LocateCollectiveCarCommand(int32, uint32*);
void LocateCollectivePlayerCommand(int32, uint32*);
void CollectiveInAreaCheckCommand(int32, uint32*);
#endif
#ifdef MISSION_REPLAY
bool CanAllowMissionReplay();
#endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CollectParameterForDebug(char* buf, bool& var);
void GetStoredParameterForDebug(char* buf);
#endif
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype) {
switch (pedtype) {
case PEDTYPE_CIVMALE:
case PEDTYPE_CIVFEMALE:
case PEDTYPE_GANG1:
case PEDTYPE_GANG2:
case PEDTYPE_GANG3:
case PEDTYPE_GANG4:
case PEDTYPE_GANG5:
case PEDTYPE_GANG6:
case PEDTYPE_GANG7:
case PEDTYPE_GANG8:
case PEDTYPE_GANG9:
case PEDTYPE_CRIMINAL:
case PEDTYPE_PROSTITUTE:
return true;
default:
return false;
}
}
friend class CTheScripts;
};
#ifdef MISSION_REPLAY
extern int AllowMissionReplay;
extern uint32 WaitForMissionActivate;

View File

@ -913,7 +913,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
if (strcmp(m_abScriptName, "camera") == 0){
pPlayer->m_pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f);
pPlayer->m_pPed->SetTurnSpeed(0.0f, 0.0f, 0.0f);
CAnimManager::BlendAnimation((RpClump*)pPlayer->m_pPed->m_rwObject, pPlayer->m_pPed->m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
CAnimManager::BlendAnimation((RpClump*)pPlayer->m_pPed->m_rwObject, pPlayer->m_pPed->m_animGroup, ANIM_STD_IDLE, 1000.0f);
}
}
return 0;
@ -1033,7 +1033,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
script_assert(pPed);
ScriptParams[0] = pPed->m_pWanted->m_nWantedLevel;
ScriptParams[0] = pPed->m_pWanted->GetWantedLevel();
StoreParameters(&m_nIp, 1);
return 0;
}
@ -1051,7 +1051,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
CTheScripts::CleanUpThisPed(pPed);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_MARK_CAR_AS_NO_LONGER_NEEDED:
@ -1060,7 +1060,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
CTheScripts::CleanUpThisVehicle(pVehicle);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
return 0;
}
case COMMAND_MARK_OBJECT_AS_NO_LONGER_NEEDED:
@ -1069,7 +1069,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
CTheScripts::CleanUpThisObject(pObject);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
return 0;
}
case COMMAND_DONT_REMOVE_CHAR:
@ -1077,7 +1077,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
script_assert(pPed);
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_DONT_REMOVE_CAR:
@ -1085,7 +1085,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
script_assert(pVehicle);
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
return 0;
}
case COMMAND_DONT_REMOVE_OBJECT:
@ -1093,7 +1093,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
script_assert(pObject);
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
return 0;
}
case COMMAND_CREATE_CHAR_AS_PASSENGER:
@ -1156,7 +1156,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
#ifdef FIX_BUGS
AnimationId anim = pVehicle->GetDriverAnim();
#else
AnimationId anim = pVehicle->bLowVehicle ? ANIM_CAR_LSIT : ANIM_CAR_SIT;
AnimationId anim = pVehicle->bLowVehicle ? ANIM_STD_CAR_SIT_LO : ANIM_STD_CAR_SIT;
#endif
pPed->m_pVehicleAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, anim, 100.0f);
pPed->StopNonPartialAnims();
@ -1165,7 +1165,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_SET_CHAR_OBJ_KILL_CHAR_ON_FOOT:

View File

@ -32,6 +32,7 @@
#include "WaterLevel.h"
#include "Weather.h"
#include "Zones.h"
#include "Wanted.h"
int8 CRunningScript::ProcessCommands500To599(int32 command)
{
@ -342,7 +343,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
CollectParameters(&m_nIp, 1);
CGarages::SetFreeBombs(ScriptParams[0] != 0);
return 0;
#ifdef GTA_PS2
#if GTA_VERSION <= GTA3_PS2_160
case COMMAND_SET_POWERPOINT:
{
CollectParameters(&m_nIp, 7);
@ -376,7 +377,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
return 0;
}
#endif // GTA_PS2
#endif // GTA_VERSION <= GTA3_PS2_160
case COMMAND_SET_ALL_TAXI_LIGHTS:
CollectParameters(&m_nIp, 1);
CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0);
@ -416,7 +417,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
pPed->FlagToDestroyWhenNextProcessed();
}
else {
pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
pPed->SetDie(ANIM_STD_KO_FRONT, 4.0f, 0.0f);
}
return 0;
}
@ -1263,7 +1264,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
return 0;
}
case COMMAND_IS_BOAT:
@ -1670,6 +1671,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS;
pBoat->AutoPilot.m_vecDestinationCoors = pos;
pBoat->SetStatus(STATUS_PHYSICS);
pBoat->bEngineOn = true;
pBoat->AutoPilot.m_nCruiseSpeed = Max(6, pBoat->AutoPilot.m_nCruiseSpeed);
pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0;
@ -1799,7 +1801,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
pPed->bRespondsToThreats = false;
++CPopulation::ms_nTotalMissionPeds;
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
}
ScriptParams[0] = ped_handle;
StoreParameters(&m_nIp, 1);
@ -1848,7 +1850,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
pPed->bRespondsToThreats = false;
++CPopulation::ms_nTotalMissionPeds;
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
}
ScriptParams[0] = ped_handle;
StoreParameters(&m_nIp, 1);

View File

@ -38,6 +38,7 @@
#include "WaterLevel.h"
#include "World.h"
#include "Zones.h"
#include "Wanted.h"
int8 CRunningScript::ProcessCommands800To899(int32 command)
{
@ -67,7 +68,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true);
}
else {
pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
pPed->SetDie(ANIM_STD_KO_FRONT, 4.0f, 0.0f);
}
return 0;
}
@ -80,7 +81,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true);
}
else {
pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
pPed->SetDie(ANIM_STD_KO_FRONT, 4.0f, 0.0f);
}
return 0;
}
@ -148,7 +149,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
++CCarCtrl::NumMissionCars;
--CCarCtrl::NumRandomCars;
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
}
ScriptParams[0] = handle;
StoreParameters(&m_nIp, 1);
@ -180,7 +181,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
++CCarCtrl::NumMissionCars;
--CCarCtrl::NumRandomCars;
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
}
ScriptParams[0] = handle;
StoreParameters(&m_nIp, 1);
@ -594,7 +595,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
}
}
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_SET_CHAR_STAY_IN_SAME_PLACE:
@ -792,7 +793,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->m_pVehicleAnim = nil;
pPed->RestartNonPartialAnims();
pPed->SetMoveState(PEDMOVE_NONE);
CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_STD_IDLE, 100.0f);
pos.z += pPed->GetDistanceFromCentreOfMassToBaseOfModel();
pPed->Teleport(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, pPed);
@ -1002,7 +1003,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
case COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR:
@ -1417,7 +1418,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
script_assert(pVehicle);
const CVector& pos = pVehicle->GetPosition();
float heading = CGeneral::GetATanOfXY(pos.y - *(float*)&ScriptParams[2], pos.x - *(float*)&ScriptParams[1]) + HALFPI;
float heading = CGeneral::GetATanOfXY(pos.x - *(float*)&ScriptParams[1], pos.y - *(float*)&ScriptParams[2]) + HALFPI;
if (heading > TWOPI)
heading -= TWOPI;
pVehicle->SetHeading(heading);

View File

@ -2075,6 +2075,80 @@ VALIDATESAVEBUF(size)
#undef SCRIPT_DATA_SIZE
void CRunningScript::Save(uint8*& buf)
{
#ifdef COMPATIBLE_SAVES
SkipSaveBuf(buf, 8);
for (int i = 0; i < 8; i++)
WriteSaveBuf<char>(buf, m_abScriptName[i]);
WriteSaveBuf<uint32>(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);
#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
WriteSaveBuf<bool>(buf, m_bCondResult);
WriteSaveBuf<bool>(buf, m_bIsMissionScript);
WriteSaveBuf<bool>(buf, m_bSkipWakeTime);
SkipSaveBuf(buf, 1);
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);
#else
WriteSaveBuf(buf, *this);
#endif
}
void CRunningScript::Load(uint8*& buf)
{
#ifdef COMPATIBLE_SAVES
SkipSaveBuf(buf, 8);
for (int i = 0; i < 8; i++)
m_abScriptName[i] = ReadSaveBuf<char>(buf);
m_nIp = ReadSaveBuf<uint32>(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);
SkipSaveBuf(buf, 2);
#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
m_bCondResult = ReadSaveBuf<bool>(buf);
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
SkipSaveBuf(buf, 1);
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);
SkipSaveBuf(buf, 2);
#else
CRunningScript* n = next;
CRunningScript* p = prev;
*this = ReadSaveBuf<CRunningScript>(buf);
next = n;
prev = p;
#endif
}
void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntity)
{
static CColPoint aTempColPoints[MAX_COLLISION_POINTS];
@ -2281,7 +2355,7 @@ int CTheScripts::FindFreeSlotInCollectiveArray()
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
if (CollectiveArray[i].colIndex = colIndex) {
if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@ -2298,7 +2372,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
if (CollectiveArray[i].colIndex = colIndex) {
if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@ -2315,7 +2389,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
if (CollectiveArray[i].colIndex = colIndex) {
if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@ -2332,7 +2406,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
if (CollectiveArray[i].colIndex = colIndex) {
if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@ -2349,7 +2423,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
if (CollectiveArray[i].colIndex = colIndex) {
if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@ -2368,7 +2442,7 @@ bool CTheScripts::IsPedStopped(CPed* pPed)
{
if (pPed->bInVehicle)
return IsVehicleStopped(pPed->m_pMyVehicle);
return pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL;
return pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL;
}
bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
@ -2376,12 +2450,12 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
CPed* pPed = pPlayer->m_pPed;
if (pPed->bInVehicle)
return IsVehicleStopped(pPed->m_pMyVehicle);
if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP_R) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_RUNSTOP1) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_RUNSTOP2) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_JUMP_LAUNCH) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_JUMP_GLIDE))
return false;
return pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL;
return pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL;
}
bool CTheScripts::IsVehicleStopped(CVehicle* pVehicle)
@ -2482,7 +2556,7 @@ void CTheScripts::UpdateObjectIndices()
CBaseModelInfo* pModel = CModelInfo::GetModelInfo(j);
if (!pModel)
continue;
strcpy(name, pModel->GetName());
strcpy(name, pModel->GetModelName());
#ifdef FIX_BUGS
for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
#else

View File

@ -33,9 +33,12 @@
#include "Zones.h"
#include "main.h"
// NB: on PS2 this file did not exist; ProcessCommands1000To1099 was in Script5.cpp and ProcessCommands1100To1199 was only added on PC
// however to avoid redundant copies of code, Script6.cpp is used with PS2 defines
int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
#ifdef GTA_PS2
#if GTA_VERSION <= GTA3_PS2_160
char tmp[48];
#endif
switch (command) {
@ -423,7 +426,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
#ifdef USE_MEASUREMENTS_IN_METERS
UpdateCompareFlag(true);
#else
UpdateCompareFlag(false)
UpdateCompareFlag(false);
#endif
return 0;
case COMMAND_CONVERT_METRES_TO_FEET:
@ -604,7 +607,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
ScriptParams[0] = CPools::GetVehiclePool()->GetIndex(pVehicle);
StoreParameters(&m_nIp, 1);
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CAR);
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CAR);
return 0;
}
case COMMAND_START_BOAT_FOAM_ANIMATION:
@ -746,7 +749,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER);
return 0;
}
#ifndef GTA_PS2
#if GTA_VERSION > GTA3_PS2_160
default:
script_assert(0);
}
@ -838,8 +841,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA:
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
return 0;
#ifndef GTA_PS2
// To be precise, on PS2 previous handlers were in 1000-1099 function
#if GTA_VERSION > GTA3_PS2_160
// These are "beta" VC commands (with bugs)
case COMMAND_SET_OBJECT_ROTATION:
{
@ -1119,7 +1121,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
pPed->bRespondsToThreats = false;
++CPopulation::ms_nTotalMissionPeds;
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
}
ScriptParams[0] = ped_handle;
StoreParameters(&m_nIp, 1);
@ -1166,7 +1168,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
pPed->bRespondsToThreats = false;
++CPopulation::ms_nTotalMissionPeds;
if (m_bIsMissionScript)
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
}
ScriptParams[0] = ped_handle;
StoreParameters(&m_nIp, 1);

View File

@ -1108,7 +1108,7 @@ enum {
COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER,
COMMAND_LOAD_END_OF_GAME_TUNE,
COMMAND_ENABLE_PLAYER_CONTROL_CAMERA,
#ifndef GTA_PS2
#if GTA_VERSION > GTA3_PS2_160
COMMAND_SET_OBJECT_ROTATION,
COMMAND_GET_DEBUG_CAMERA_COORDINATES,
COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR,

View File

@ -230,7 +230,7 @@ CAnimViewer::Update(void)
if (modelInfo->GetModelType() == MITYPE_PED) {
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
if (animId > ANIM_IDLE_STANCE)
if (animId > ANIM_STD_IDLE)
animGroup = ASSOCGRP_STD;
if (reloadIFP) {
@ -318,14 +318,14 @@ CAnimViewer::Update(void)
CMessages::AddMessage(gUString, 1000, 0);
} else if (pad->GetCircleJustDown()) {
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE);
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_STD_IDLE);
AsciiToUnicode("Idle animation playing", gUString);
CMessages::AddMessage(gUString, 1000, 0);
} else if (pad->GetDPadUpJustDown()) {
animId--;
if (animId < 0) {
animId = NUM_ANIMS - 1;
animId = ANIM_STD_NUM - 1;
}
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
@ -334,7 +334,7 @@ CAnimViewer::Update(void)
CMessages::AddMessage(gUString, 1000, 0);
} else if (pad->GetDPadDownJustDown()) {
animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1);
animId = (animId == (ANIM_STD_NUM - 1) ? 0 : animId + 1);
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
sprintf(gString, "Current anim: %d", animId);

View File

@ -193,7 +193,7 @@ CCam::Process(void)
break;
case MODE_CAM_ON_A_STRING:
#ifdef FREE_CAM
if(CCamera::bFreeCam)
if(CCamera::bFreeCam && !CVehicle::bCheat5)
Process_FollowCar_SA(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#endif
@ -946,7 +946,7 @@ CVector
CCam::DoAverageOnVector(const CVector &vec)
{
int i;
CVector Average = { 0.0f, 0.0f, 0.0f };
CVector Average(0.0f, 0.0f, 0.0f);
if(ResetStatics){
m_iRunningVectorArrayPos = 0;
@ -1644,10 +1644,10 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(CamTargetEntity->m_rwObject){
// what's going on here?
if(RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_PUMP) ||
RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_THROW) ||
RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_THROWU) ||
RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_START_THROW)){
if(RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_STD_WEAPON_PUMP) ||
RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_STD_WEAPON_THROW) ||
RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_STD_THROW_UNDER) ||
RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_STD_START_THROW)){
CPed *player = FindPlayerPed();
float PlayerDist = (Source - player->GetPosition()).Magnitude();
if(PlayerDist < 2.75f)
@ -3829,11 +3829,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
}
// stay inside sectors
while(CWorld::GetSectorX(Source.x) > 95.0f)
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
Source.x -= 1.0f;
while(CWorld::GetSectorX(Source.x) < 5.0f)
Source.x += 1.0f;
while(CWorld::GetSectorY(Source.y) > 95.0f)
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
Source.y -= 1.0f;
while(CWorld::GetSectorY(Source.y) < 5.0f)
Source.y += 1.0f;
@ -3900,11 +3900,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
}
// stay inside sectors
while(CWorld::GetSectorX(Source.x) > 95.0f)
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
Source.x -= 1.0f;
while(CWorld::GetSectorX(Source.x) < 5.0f)
Source.x += 1.0f;
while(CWorld::GetSectorY(Source.y) > 95.0f)
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
Source.y -= 1.0f;
while(CWorld::GetSectorY(Source.y) < 5.0f)
Source.y += 1.0f;
@ -3981,11 +3981,11 @@ CCam::Process_Editor(const CVector&, float, float, float)
}
// stay inside sectors
while(CWorld::GetSectorX(Source.x) > 95.0f)
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
Source.x -= 1.0f;
while(CWorld::GetSectorX(Source.x) < 5.0f)
Source.x += 1.0f;
while(CWorld::GetSectorY(Source.y) > 95.0f)
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
Source.y -= 1.0f;
while(CWorld::GetSectorY(Source.y) < 5.0f)
Source.y += 1.0f;
@ -4631,7 +4631,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
*/
{
LookLeftRight = -CPad::GetPad(0)->LookAroundLeftRight();
LookUpDown = -CPad::GetPad(0)->LookAroundUpDown();
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
}
float AlphaOffset, BetaOffset;
if(UseMouse){
@ -5039,11 +5039,15 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA
float stickX = -(pad->GetCarGunLeftRight());
float stickY = pad->GetCarGunUpDown();
float stickY = -pad->GetCarGunUpDown();
// In SA this is for not let num2/num8 move camera when Keyboard & Mouse controls are used.
// if (CCamera::m_bUseMouse3rdPerson)
// stickY = 0.0f;
#ifdef INVERT_LOOK_FOR_PAD
if (CPad::bInvertLook4Pad)
stickY = -stickY;
#endif
float xMovement = Abs(stickX) * (FOV / 80.0f * 5.f / 70.f) * stickX * 0.007f * 0.007f;
float yMovement = Abs(stickY) * (FOV / 80.0f * 3.f / 70.f) * stickY * 0.007f * 0.007f;

View File

@ -2212,7 +2212,7 @@ CCamera::StartTransition(int16 newMode)
while(deltaBeta < -PI) deltaBeta += 2*PI;
deltaBeta = Abs(deltaBeta);
door = FindPlayerPed()->m_vehEnterType;
door = FindPlayerPed()->m_vehDoor;
if(deltaBeta > HALFPI){
if(((CPed*)pTargetEntity)->m_carInObjective){
if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){
@ -2293,7 +2293,7 @@ CCamera::StartTransition(int16 newMode)
}
#endif
door = FindPlayerPed()->m_vehEnterType;
door = FindPlayerPed()->m_vehDoor;
if(deltaBeta > HALFPI){
if(((CVehicle*)pTargetEntity)->IsUpsideDown()){
if(door == CAR_DOOR_LF || door == CAR_DOOR_LR) // BUG: game checks LF twice
@ -2783,7 +2783,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
if (CReplay::IsPlayingBack())
return false;
#endif
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
if(FindPlayerPed()->m_pWanted->GetWantedLevel() < 1)
return false;
if(FindPlayerVehicle() == nil)
return false;
@ -2811,7 +2811,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
if (CReplay::IsPlayingBack())
return false;
#endif
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
if(FindPlayerPed()->m_pWanted->GetWantedLevel() < 1)
return false;
if(FindPlayerVehicle() == nil)
return false;
@ -3629,9 +3629,17 @@ CCamera::CalculateDerivedValues(void)
bool
CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
{
RwV3d c;
c = center;
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
#ifdef GTA_PS2
CVuVector c;
TransformPoint(c, *mat, center);
#else
CVector c = center;
#ifdef FIX_BUGS
c = *mat * center;
#else
RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
#endif
#endif
if(c.y < CDraw::GetNearClipZ()) return false;
if(c.y > CDraw::GetFarClipZ()) return false;
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > 0.0f) return false;
@ -3644,9 +3652,17 @@ CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
{
RwV3d c;
c = center;
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
#ifdef GTA_PS2
CVuVector c;
TransformPoint(c, *mat, center);
#else
CVector c = center;
#ifdef FIX_BUGS
c = *mat * center;
#else
RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
#endif
#endif
if(c.y + radius < CDraw::GetNearClipZ()) return false;
if(c.y - radius > CDraw::GetFarClipZ()) return false;
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > radius) return false;
@ -3664,11 +3680,24 @@ CCamera::IsSphereVisible(const CVector &center, float radius)
}
bool
CCamera::IsBoxVisible(RwV3d *box, const CMatrix *mat)
#ifdef GTA_PS2
CCamera::IsBoxVisible(CVuVector *box, const CMatrix *mat)
#else
CCamera::IsBoxVisible(CVector *box, const CMatrix *mat)
#endif
{
int i;
int frustumTests[6] = { 0 };
RwV3dTransformPoints(box, box, 8, &mat->m_matrix);
#ifdef GTA_PS2
TransformPoints(box, 8, *mat, box);
#else
#ifdef FIX_BUGS
for (i = 0; i < 8; i++)
box[i] = *mat * box[i];
#else
RwV3dTransformPoints(box, box, 8, (RwMatrix*)mat);
#endif
#endif
for(i = 0; i < 8; i++){
if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++;

View File

@ -641,7 +641,11 @@ public:
bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
#ifdef GTA_PS2
bool IsBoxVisible(CVuVector *box, const CMatrix *mat);
#else
bool IsBoxVisible(CVector *box, const CMatrix *mat);
#endif
};
VALIDATE_SIZE(CCamera, 0xE9D8);

View File

@ -7,9 +7,6 @@
#include "RwHelper.h"
#include "MemoryMgr.h"
#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
struct CdReadInfo
{
uint32 nSectorOffset;
@ -17,9 +14,9 @@ struct CdReadInfo
void *pBuffer;
char field_C;
bool bLocked;
bool bInUse;
bool bReading;
int32 nStatus;
HANDLE hSemaphore; // used for CdStreamSync
HANDLE pDoneSemaphore; // used for CdStreamSync
HANDLE hFile;
OVERLAPPED Overlapped;
};
@ -56,11 +53,11 @@ CdStreamInitThread(void)
{
for ( int32 i = 0; i < gNumChannels; i++ )
{
gpReadInfo[i].hSemaphore = CreateSemaphore(nil, 0, 2, nil);
gpReadInfo[i].pDoneSemaphore = CreateSemaphore(nil, 0, 2, nil);
if ( gpReadInfo[i].hSemaphore == nil )
if ( gpReadInfo[i].pDoneSemaphore == nil )
{
CDTRACE("failed to create sync semaphore");
printf("%s: failed to create sync semaphore\n", "cdvd_stream");
ASSERT(0);
return;
}
@ -81,7 +78,7 @@ CdStreamInitThread(void)
if ( gCdStreamSema == nil )
{
CDTRACE("failed to create stream semaphore");
printf("%s: failed to create stream semaphore\n", "cdvd_stream");
ASSERT(0);
return;
}
@ -90,7 +87,7 @@ CdStreamInitThread(void)
if ( _gCdStreamThread == nil )
{
CDTRACE("failed to create streaming thread");
printf("%s: failed to create streaming thread\n", "cdvd_stream");
ASSERT(0);
return;
}
@ -138,7 +135,7 @@ CdStreamInit(int32 numChannels)
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
ASSERT( gpReadInfo != nil );
CDDEBUG("read info %p", gpReadInfo);
debug("%s: read info %p\n", "cdvd_stream", gpReadInfo);
CdStreamAddImage("MODELS\\GTA3.IMG");
@ -186,7 +183,7 @@ CdStreamShutdown(void)
CloseHandle(_gCdStreamThread);
for ( int32 i = 0; i < gNumChannels; i++ )
CloseHandle(gpReadInfo[i].hSemaphore);
CloseHandle(gpReadInfo[i].pDoneSemaphore);
}
LocalFree(gpReadInfo);
@ -216,7 +213,7 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
if ( _gbCdStreamAsync )
{
if ( pChannel->nSectorsToRead != 0 || pChannel->bInUse )
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading )
return STREAM_NONE;
pChannel->nStatus = STREAM_NONE;
@ -274,7 +271,7 @@ CdStreamGetStatus(int32 channel)
if ( _gbCdStreamAsync )
{
if ( pChannel->bInUse )
if ( pChannel->bReading )
return STREAM_READING;
if ( pChannel->nSectorsToRead != 0 )
@ -324,12 +321,21 @@ CdStreamSync(int32 channel)
{
pChannel->bLocked = true;
ASSERT( pChannel->hSemaphore != nil );
ASSERT( pChannel->pDoneSemaphore != nil );
WaitForSingleObject(pChannel->hSemaphore, INFINITE);
// Deadlock fix 1
#ifdef FIX_BUGS
// This is while loop on Posix streamer, for spurious wakeups
if (pChannel->bLocked && pChannel->nSectorsToRead != 0){
WaitForSingleObject(pChannel->pDoneSemaphore, INFINITE);
}
pChannel->bLocked = false;
#else
WaitForSingleObject(pChannel->pDoneSemaphore, INFINITE);
#endif
}
pChannel->bInUse = false;
pChannel->bReading = false;
return pChannel->nStatus;
}
@ -401,7 +407,7 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != nil );
pChannel->bInUse = true;
pChannel->bReading = true;
if ( pChannel->nStatus == STREAM_NONE )
{
@ -458,11 +464,15 @@ WINAPI CdStreamThread(LPVOID lpThreadParameter)
if ( pChannel->bLocked )
{
ASSERT( pChannel->hSemaphore != nil );
ReleaseSemaphore(pChannel->hSemaphore, 1, NULL);
ASSERT( pChannel->pDoneSemaphore != nil );
// Deadlock fix 2
#ifdef FIX_BUGS
pChannel->bLocked = 0;
#endif
ReleaseSemaphore(pChannel->pDoneSemaphore, 1, NULL);
}
pChannel->bInUse = false;
pChannel->bReading = false;
}
}

View File

@ -43,6 +43,6 @@ char *CdStreamGetImageName(int32 cd);
void CdStreamRemoveImages(void);
int32 CdStreamGetNumImages(void);
#ifndef _WIN32
#ifdef FLUSHABLE_STREAMING
extern bool flushStream[MAX_CDCHANNELS];
#endif

View File

@ -1,8 +1,8 @@
#ifndef _WIN32
#include "common.h"
#include "crossplatform.h"
#include <pthread.h>
#include <signal.h>
#include <pthread.h>
#include <semaphore.h>
#include <sys/types.h>
#include <unistd.h>
@ -12,7 +12,11 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/resource.h>
#include <stdarg.h>
#ifdef __linux__
#include <sys/syscall.h>
#endif
#include "CdStream.h"
#include "rwcore.h"
@ -21,9 +25,61 @@
#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
// #define ONE_THREAD_PER_CHANNEL // Don't use if you're not on SSD/Flash. (Also you may want to benefit from this via using all channels in Streaming.cpp)
#ifdef FLUSHABLE_STREAMING
bool flushStream[MAX_CDCHANNELS];
#endif
#ifdef USE_UNNAMED_SEM
#define RE3_SEM_OPEN(name, ...) re3_sem_open()
sem_t*
re3_sem_open(void)
{
sem_t* sem = (sem_t*)malloc(sizeof(sem_t));
if (sem_init(sem, 0, 1) == -1) {
sem = SEM_FAILED;
}
return sem;
}
#define RE3_SEM_CLOSE(sem, format, ...) re3_sem_close(sem)
void
re3_sem_close(sem_t* sem)
{
sem_destroy(sem);
free(sem);
}
#else
#define RE3_SEM_OPEN re3_sem_open
sem_t*
re3_sem_open(const char* format, ...)
{
char semName[21];
va_list va;
va_start(va, format);
vsprintf(semName, format, va);
return sem_open(semName, O_CREAT, 0644, 1);
}
#define RE3_SEM_CLOSE re3_sem_close
void
re3_sem_close(sem_t* sem, const char* format, ...)
{
sem_close(sem);
char semName[21];
va_list va;
va_start(va, format);
vsprintf(semName, format, va);
sem_unlink(semName);
}
#endif
struct CdReadInfo
{
@ -69,14 +125,13 @@ void
CdStreamInitThread(void)
{
int status;
char semName[20];
#ifndef ONE_THREAD_PER_CHANNEL
gChannelRequestQ.items = (int32 *)calloc(gNumChannels + 1, sizeof(int32));
gChannelRequestQ.head = 0;
gChannelRequestQ.tail = 0;
gChannelRequestQ.size = gNumChannels + 1;
ASSERT(gChannelRequestQ.items != nil );
gCdStreamSema = sem_open("/semaphore_cd_stream", O_CREAT, 0644, 1);
gCdStreamSema = RE3_SEM_OPEN("/semaphore_cd_stream");
if (gCdStreamSema == SEM_FAILED) {
@ -90,8 +145,7 @@ CdStreamInitThread(void)
{
for ( int32 i = 0; i < gNumChannels; i++ )
{
sprintf(semName,"/semaphore_done%d",i);
gpReadInfo[i].pDoneSemaphore = sem_open(semName, O_CREAT, 0644, 1);
gpReadInfo[i].pDoneSemaphore = RE3_SEM_OPEN("/semaphore_done%d", i);
if (gpReadInfo[i].pDoneSemaphore == SEM_FAILED)
{
@ -99,9 +153,9 @@ CdStreamInitThread(void)
ASSERT(0);
return;
}
#ifdef ONE_THREAD_PER_CHANNEL
sprintf(semName,"/semaphore_start%d",i);
gpReadInfo[i].pStartSemaphore = sem_open(semName, O_CREAT, 0644, 1);
gpReadInfo[i].pStartSemaphore = RE3_SEM_OPEN("/semaphore_start%d", i);
if (gpReadInfo[i].pStartSemaphore == SEM_FAILED)
{
@ -170,6 +224,7 @@ CdStreamInit(int32 numChannels)
gNumImages = 0;
gNumChannels = numChannels;
ASSERT( gNumChannels != 0 );
gpReadInfo = (CdReadInfo *)calloc(numChannels, sizeof(CdReadInfo));
ASSERT( gpReadInfo != nil );
@ -245,10 +300,12 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
if (pChannel->hFile == hImage - 1 && pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
return STREAM_SUCCESS;
#ifdef FLUSHABLE_STREAMING
flushStream[channel] = 1;
CdStreamSync(channel);
//return STREAM_NONE;
#else
return STREAM_NONE;
#endif
}
pChannel->hFile = hImage - 1;
@ -316,34 +373,34 @@ CdStreamSync(int32 channel)
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != nil );
#ifdef FLUSHABLE_STREAMING
if (flushStream[channel]) {
#ifdef ONE_THREAD_PER_CHANNEL
pChannel->nSectorsToRead = 0;
#ifdef ONE_THREAD_PER_CHANNEL
pthread_kill(pChannel->pChannelThread, SIGUSR1);
if (pChannel->bReading) {
pChannel->bLocked = true;
while (pChannel->bLocked)
sem_wait(pChannel->pDoneSemaphore);
}
#else
pChannel->nSectorsToRead = 0;
if (pChannel->bReading) {
pChannel->bLocked = true;
pthread_kill(_gCdStreamThread, SIGUSR1);
#endif
while (pChannel->bLocked)
sem_wait(pChannel->pDoneSemaphore);
}
#endif
pChannel->bReading = false;
flushStream[channel] = false;
return STREAM_NONE;
}
#endif
if ( pChannel->nSectorsToRead != 0 )
{
pChannel->bLocked = true;
while (pChannel->bLocked)
while (pChannel->bLocked && pChannel->nSectorsToRead != 0){
sem_wait(pChannel->pDoneSemaphore);
}
pChannel->bLocked = false;
}
pChannel->bReading = false;
@ -395,7 +452,12 @@ void *CdStreamThread(void *param)
#ifndef ONE_THREAD_PER_CHANNEL
while (gCdStreamThreadStatus != 2) {
sem_wait(gCdStreamSema);
int32 channel = GetFirstInQueue(&gChannelRequestQ);
// spurious wakeup
if (channel == -1)
continue;
#else
int channel = *((int*)param);
while (gpReadInfo[channel].nThreadStatus != 2){
@ -447,7 +509,7 @@ void *CdStreamThread(void *param)
if ( pChannel->bLocked )
{
pChannel->bLocked = 0;
sem_post(pChannel->pDoneSemaphore);
sem_post(pChannel->pDoneSemaphore);
}
pChannel->bReading = false;
}
@ -455,21 +517,14 @@ void *CdStreamThread(void *param)
#ifndef ONE_THREAD_PER_CHANNEL
for ( int32 i = 0; i < gNumChannels; i++ )
{
sem_close(gpReadInfo[i].pDoneSemaphore);
sprintf(semName,"/semaphore_done%d",i);
sem_unlink(semName);
RE3_SEM_CLOSE(gpReadInfo[i].pDoneSemaphore, "/semaphore_done%d", i);
}
sem_close(gCdStreamSema);
sem_unlink("/semaphore_cd_stream");
RE3_SEM_CLOSE(gCdStreamSema, "/semaphore_cd_stream");
free(gChannelRequestQ.items);
#else
sem_close(gpReadInfo[channel].pStartSemaphore);
sprintf(semName,"/semaphore_start%d",channel);
sem_unlink(semName);
RE3_SEM_CLOSE(gpReadInfo[channel].pStartSemaphore, "/semaphore_start%d", channel);
sem_close(gpReadInfo[channel].pDoneSemaphore);
sprintf(semName,"/semaphore_done%d",channel);
sem_unlink(semName);
RE3_SEM_CLOSE(gpReadInfo[channel].pDoneSemaphore, "/semaphore_done%d", channel);
#endif
if (gpReadInfo)
free(gpReadInfo);
@ -524,7 +579,9 @@ void
CdStreamRemoveImages(void)
{
for ( int32 i = 0; i < gNumChannels; i++ ) {
#ifdef FLUSHABLE_STREAMING
flushStream[i] = 1;
#endif
CdStreamSync(i);
}

View File

@ -1,11 +1,7 @@
#if defined RW_D3D9 || defined RWLIBS
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#endif
#define WITHDINPUT
#include "common.h"
#include "platform.h"
#include "crossplatform.h" // for Windows version
#include "crossplatform.h"
#include "ControllerConfig.h"
#include "Pad.h"
#include "FileMgr.h"
@ -35,6 +31,9 @@ CControllerConfigManager::CControllerConfigManager()
void CControllerConfigManager::MakeControllerActionsBlank()
{
#ifdef LOAD_INI_SETTINGS
ms_padButtonsInited = 0;
#endif
for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++)
{
for (int32 j = 0; j < MAX_CONTROLLERACTIONS; j++)
@ -349,14 +348,39 @@ void CControllerConfigManager::InitDefaultControlConfigMouse(CMouseControllerSta
}
}
#ifdef LOAD_INI_SETTINGS
uint32 CControllerConfigManager::ms_padButtonsInited = 0;
#endif
void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
{
#ifdef XINPUT
// No manual bindings for you, honey.
return;
#endif
m_bFirstCapture = true;
uint32 btn = buttons;
if (buttons > 16)
btn = 16;
#ifdef LOAD_INI_SETTINGS
uint32 buttonMin = ms_padButtonsInited;
if (buttonMin >= btn)
return;
ms_padButtonsInited = btn;
#define IF_BTN_IN_RANGE(n) \
case n: \
if (n <= buttonMin) \
return;
#else
#define IF_BTN_IN_RANGE(n) \
case n:
#endif
// Now we use SDL Game Controller DB
#if defined RW_D3D9 || defined RWLIBS
if ( AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
@ -369,49 +393,49 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
switch (btn)
{
case 16:
IF_BTN_IN_RANGE(16)
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
case 15:
IF_BTN_IN_RANGE(15)
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
case 14:
IF_BTN_IN_RANGE(14)
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
case 13:
IF_BTN_IN_RANGE(13)
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
case 12:
case 11:
IF_BTN_IN_RANGE(12)
IF_BTN_IN_RANGE(11)
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
case 10:
IF_BTN_IN_RANGE(10)
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
case 9:
IF_BTN_IN_RANGE(9)
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
case 8:
IF_BTN_IN_RANGE(8)
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
case 7:
IF_BTN_IN_RANGE(7)
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
case 6:
IF_BTN_IN_RANGE(6)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
case 5:
IF_BTN_IN_RANGE(5)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
/*******************************************************************************************/
case 4:
IF_BTN_IN_RANGE(4)
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 4, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_JUMPING, 4, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 4, JOYSTICK);
case 3:
IF_BTN_IN_RANGE(3)
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SPRINT, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 3, JOYSTICK);
case 2:
IF_BTN_IN_RANGE(2)
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 2, JOYSTICK);
#ifdef BIND_VEHICLE_FIREWEAPON
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 2, JOYSTICK);
#endif
case 1:
IF_BTN_IN_RANGE(1)
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 1, JOYSTICK);
/*******************************************************************************************/
}
@ -420,46 +444,46 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
{
switch (btn)
{
case 16:
IF_BTN_IN_RANGE(16)
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
case 15:
IF_BTN_IN_RANGE(15)
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
case 14:
IF_BTN_IN_RANGE(14)
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
case 13:
IF_BTN_IN_RANGE(13)
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
case 12:
case 11:
IF_BTN_IN_RANGE(12)
IF_BTN_IN_RANGE(11)
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
case 10:
IF_BTN_IN_RANGE(10)
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
case 9:
IF_BTN_IN_RANGE(9)
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
case 8:
IF_BTN_IN_RANGE(8)
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
case 7:
IF_BTN_IN_RANGE(7)
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
case 6:
IF_BTN_IN_RANGE(6)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
case 5:
IF_BTN_IN_RANGE(5)
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
/*******************************************************************************************/
case 4:
IF_BTN_IN_RANGE(4)
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 4, JOYSTICK);
case 3:
IF_BTN_IN_RANGE(3)
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_JUMPING, 3, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 3, JOYSTICK);
case 2:
IF_BTN_IN_RANGE(2)
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 2, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SPRINT, 2, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 2, JOYSTICK);
case 1:
IF_BTN_IN_RANGE(1)
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 1, JOYSTICK);
#ifdef BIND_VEHICLE_FIREWEAPON
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 1, JOYSTICK);
@ -2600,11 +2624,6 @@ const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("~T~", "~O
#define PS2_CIRCLE "|"
#define PS2_CROSS "/"
#define PS2_SQUARE "^"
#elif defined(BUTTON_ICONS)
#define PS2_TRIANGLE "~T~"
#define PS2_CIRCLE "~O~"
#define PS2_CROSS "~X~"
#define PS2_SQUARE "~Q~"
#else
#define PS2_TRIANGLE "TRIANGLE"
#define PS2_CIRCLE "CIRCLE"
@ -2617,7 +2636,7 @@ const char *PlayStationButtons_noIcons[][MAX_CONTROLLERACTIONS] =
#ifdef BUTTON_ICONS
const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "SELECT");
CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "SELECT");
#endif
#undef PS2_TRIANGLE
@ -2634,11 +2653,36 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *
if (CPad::GetPad(0)->IsAffectedByController) {
wchar wstr[16];
// TODO: INI and/or menu setting for Xbox/PS switch
const char* (*Buttons)[MAX_CONTROLLERACTIONS];
#ifdef BUTTON_ICONS
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons;
#ifdef GAMEPAD_MENU
switch (FrontEndMenuManager.m_PrefsControllerType)
{
case CMenuManager::CONTROLLER_DUALSHOCK2:
case CMenuManager::CONTROLLER_DUALSHOCK3:
case CMenuManager::CONTROLLER_DUALSHOCK4:
Buttons = CFont::ButtonsSlot != -1 ? PlayStationButtons : PlayStationButtons_noIcons;
break;
default:
#endif
Buttons = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons;
#ifdef GAMEPAD_MENU
break;
}
#endif
#else
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = XboxButtons_noIcons;
switch (FrontEndMenuManager.m_PrefsControllerType)
{
case CMenuManager::CONTROLLER_DUALSHOCK2:
case CMenuManager::CONTROLLER_DUALSHOCK3:
case CMenuManager::CONTROLLER_DUALSHOCK4:
Buttons = PlayStationButtons_noIcons;
break;
default:
Buttons = XboxButtons_noIcons;
break;
}
#endif
assert(Buttons[CPad::GetPad(0)->Mode][action] != nil); // we cannot use these
@ -2765,9 +2809,10 @@ wchar *CControllerConfigManager::GetButtonComboText(e_ControllerAction action)
void CControllerConfigManager::SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type)
{
ResetSettingOrder(action);
int numOfSettings = GetNumOfSettingsForAction(action);
m_aSettings[action][type].m_Key = key;
m_aSettings[action][type].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1;
m_aSettings[action][type].m_ContSetOrder = numOfSettings + 1;
}
int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerAction action)
@ -2777,8 +2822,10 @@ int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerA
void CControllerConfigManager::SetMouseButtonAssociatedWithAction(e_ControllerAction action, int32 button)
{
int numOfSettings = GetNumOfSettingsForAction(action);
m_aSettings[action][MOUSE].m_Key = button;
m_aSettings[action][MOUSE].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1;
m_aSettings[action][MOUSE].m_ContSetOrder = numOfSettings + 1;
}
void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
@ -2801,7 +2848,7 @@ void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++)
{
int32 setorder = m_aSettings[action][k].m_ContSetOrder;
if (setorder > i && setorder != KEYBOARD)
if (setorder > i && setorder != 0)
{
if (init)
{

View File

@ -141,6 +141,10 @@ public:
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
bool m_bMouseAssociated;
#ifdef LOAD_INI_SETTINGS
static uint32 ms_padButtonsInited;
#endif
CControllerConfigManager();

Some files were not shown because too many files have changed in this diff Show More