summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2020-06-29 08:37:53 +0200
committerGitHub <noreply@github.com>2020-06-29 08:37:53 +0200
commit860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb (patch)
tree6a8f83b0d46e97b198f095b7624deecca75051e7
parentrestore Text.cpp (diff)
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadre3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.gz
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.bz2
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.lz
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.xz
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.tar.zst
re3-860f75d66ce51f2f5f3ea2b4b2b582f6d161a2bb.zip
Diffstat (limited to '')
-rw-r--r--.travis.yml15
-rw-r--r--eax/eax.h8
m---------librw0
-rw-r--r--premake5.lua64
-rw-r--r--src/animation/AnimManager.cpp53
-rw-r--r--src/animation/CutsceneMgr.cpp4
-rw-r--r--src/audio/AudioCollision.cpp74
-rw-r--r--src/audio/AudioLogic.cpp8861
-rw-r--r--src/audio/AudioManager.cpp9841
-rw-r--r--src/audio/AudioManager.h30
-rw-r--r--src/audio/AudioSamples.h89
-rw-r--r--src/audio/AudioScriptObject.cpp2
-rw-r--r--src/audio/AudioScriptObject.h130
-rw-r--r--src/audio/DMAudio.cpp8
-rw-r--r--src/audio/DMAudio.h4
-rw-r--r--src/audio/MusicManager.cpp20
-rw-r--r--src/audio/PoliceRadio.cpp3
-rw-r--r--src/audio/audio_enums.h28
-rw-r--r--src/audio/oal/aldlist.cpp113
-rw-r--r--src/audio/oal/aldlist.h46
-rw-r--r--src/audio/oal/channel.cpp4
-rw-r--r--src/audio/oal/channel.h1
-rw-r--r--src/audio/oal/oal_utils.cpp1
-rw-r--r--src/audio/oal/oal_utils.h1
-rw-r--r--src/audio/oal/stream.cpp8
-rw-r--r--src/audio/oal/stream.h1
-rw-r--r--src/audio/sampman.h76
-rw-r--r--src/audio/sampman_miles.cpp8
-rw-r--r--src/audio/sampman_oal.cpp16
-rw-r--r--src/audio/soundlist.h586
-rw-r--r--src/control/CarCtrl.cpp30
-rw-r--r--src/control/GameLogic.cpp26
-rw-r--r--src/control/Garages.cpp9
-rw-r--r--src/control/PathFind.cpp7
-rw-r--r--src/control/Phones.cpp11
-rw-r--r--src/control/RoadBlocks.cpp100
-rw-r--r--src/control/Script.cpp2440
-rw-r--r--src/control/Script.h29
-rw-r--r--src/control/ScriptCommands.h35
-rw-r--r--src/core/AnimViewer.cpp163
-rw-r--r--src/core/Cam.cpp503
-rw-r--r--src/core/Camera.cpp578
-rw-r--r--src/core/Camera.h28
-rw-r--r--src/core/Collision.cpp28
-rw-r--r--src/core/FileLoader.cpp4
-rw-r--r--src/core/Frontend.cpp453
-rw-r--r--src/core/Frontend.h27
-rw-r--r--src/core/Game.cpp6
-rw-r--r--src/core/MenuScreens.cpp (renamed from src/core/MenuScreens.h)92
-rw-r--r--src/core/Pad.cpp4
-rw-r--r--src/core/Pad.h15
-rw-r--r--src/core/PlayerInfo.cpp6
-rw-r--r--src/core/Pools.cpp43
-rw-r--r--src/core/Radar.h44
-rw-r--r--src/core/Range2D.cpp28
-rw-r--r--src/core/Range2D.h11
-rw-r--r--src/core/Range3D.cpp30
-rw-r--r--src/core/Range3D.h11
-rw-r--r--src/core/Stats.h18
-rw-r--r--src/core/SurfaceTable.cpp128
-rw-r--r--src/core/SurfaceTable.h98
-rw-r--r--src/core/TempColModels.cpp30
-rw-r--r--src/core/Timer.h4
-rw-r--r--src/core/World.cpp70
-rw-r--r--src/core/World.h4
-rw-r--r--src/core/common.h8
-rw-r--r--src/core/config.h26
-rw-r--r--src/core/main.cpp26
-rw-r--r--src/core/main.h3
-rw-r--r--src/core/re3.cpp115
-rw-r--r--src/entities/Entity.cpp12
-rw-r--r--src/entities/Physical.cpp112
-rw-r--r--src/entities/Physical.h7
-rw-r--r--src/extras/debugmenu.cpp12
-rw-r--r--src/extras/frontendoption.cpp168
-rw-r--r--src/extras/frontendoption.h87
-rw-r--r--src/fakerw/fake.cpp14
-rw-r--r--src/math/Matrix.h5
-rw-r--r--src/math/Quaternion.h1
-rw-r--r--src/math/math.cpp17
-rw-r--r--src/modelinfo/ModelIndices.cpp6
-rw-r--r--src/modelinfo/ModelIndices.h322
-rw-r--r--src/modelinfo/PedModelInfo.cpp7
-rw-r--r--src/modelinfo/PedModelInfo.h9
-rw-r--r--src/modelinfo/SimpleModelInfo.cpp7
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp21
-rw-r--r--src/modelinfo/VehicleModelInfo.h38
-rw-r--r--src/objects/Object.cpp9
-rw-r--r--src/objects/Object.h9
-rw-r--r--src/peds/Ped.cpp547
-rw-r--r--src/peds/Ped.h17
-rw-r--r--src/peds/PedChat.cpp153
-rw-r--r--src/peds/PedDebug.cpp310
-rw-r--r--src/peds/PedIK.cpp160
-rw-r--r--src/peds/PedIK.h12
-rw-r--r--src/peds/PlayerPed.cpp22
-rw-r--r--src/peds/Population.cpp20
-rw-r--r--src/render/2dEffect.h8
-rw-r--r--src/render/Clouds.cpp5
-rw-r--r--src/render/Coronas.cpp6
-rw-r--r--src/render/Draw.cpp6
-rw-r--r--src/render/Draw.h12
-rw-r--r--src/render/Fluff.cpp35
-rw-r--r--src/render/Font.cpp2
-rw-r--r--src/render/Glass.cpp11
-rw-r--r--src/render/Hud.cpp74
-rw-r--r--src/render/Particle.cpp5
-rw-r--r--src/render/Shadows.cpp8
-rw-r--r--src/render/Skidmarks.h2
-rw-r--r--src/render/Sprite.cpp4
-rw-r--r--src/render/Timecycle.cpp2
-rw-r--r--src/render/Timecycle.h4
-rw-r--r--src/render/WaterLevel.cpp7
-rw-r--r--src/render/WaterLevel.h1
-rw-r--r--src/rw/RwHelper.cpp21
-rw-r--r--src/save/GenericGameStorage.cpp45
-rw-r--r--src/save/GenericGameStorage.h8
-rw-r--r--src/save/PCSave.cpp5
-rw-r--r--src/skel/glfw/glfw.cpp10
-rw-r--r--src/skel/platform.h2
-rw-r--r--src/skel/skeleton.cpp14
-rw-r--r--src/skel/skeleton.h18
-rw-r--r--src/skel/win/win.cpp8
-rw-r--r--src/text/Text.cpp16
-rw-r--r--src/text/Text.h8
-rw-r--r--src/vehicles/Automobile.cpp222
-rw-r--r--src/vehicles/Automobile.h17
-rw-r--r--src/vehicles/Boat.cpp4
-rw-r--r--src/vehicles/CarGen.cpp2
-rw-r--r--src/vehicles/Cranes.cpp11
-rw-r--r--src/vehicles/DamageManager.cpp10
-rw-r--r--src/vehicles/DamageManager.h2
-rw-r--r--src/vehicles/HandlingMgr.cpp2
-rw-r--r--src/vehicles/HandlingMgr.h6
-rw-r--r--src/vehicles/Heli.cpp6
-rw-r--r--src/vehicles/Plane.cpp4
-rw-r--r--src/vehicles/Plane.h7
-rw-r--r--src/vehicles/Train.cpp51
-rw-r--r--src/vehicles/Train.h9
-rw-r--r--src/vehicles/Vehicle.cpp137
-rw-r--r--src/vehicles/Vehicle.h18
-rw-r--r--src/weapons/BulletInfo.cpp3
-rw-r--r--src/weapons/Weapon.cpp67
-rw-r--r--src/weapons/Weapon.h4
-rw-r--r--src/weapons/WeaponInfo.h4
145 files changed, 15776 insertions, 12647 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..51ef58eb
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,15 @@
+language: cpp
+os: linux
+dist: focal
+matrix:
+ include:
+ - env: TARGET=release_linux-amd64-librw_gl3_glfw-oal
+ - env: TARGET=debug_linux-amd64-librw_gl3_glfw-oal
+script:
+ - sudo apt-get update
+ - sudo apt-get -y install linux-libc-dev libopenal-dev libglew-dev libglfw3-dev libsndfile1-dev libmpg123-dev gcc-8-multilib g++-8-multilib
+ - mkdir -p "$TRAVIS_BUILD_DIR/build"
+ - cd "$TRAVIS_BUILD_DIR"
+ - ./premake5Linux --with-librw gmake2
+ - cd build
+ - CC=gcc-8 CXX=g++-8 make config=$TARGET -j4 verbose=1
diff --git a/eax/eax.h b/eax/eax.h
index 0e2201db..b2210936 100644
--- a/eax/eax.h
+++ b/eax/eax.h
@@ -12,7 +12,7 @@
extern "C" {
#endif // __cplusplus
-#ifndef OPENAL
+#ifndef AUDIO_OAL
#include <dsound.h>
/*
@@ -49,13 +49,9 @@ extern "C" {
typedef void (CDECL *LPGETCURRENTVERSION)(LPDWORD major, LPDWORD minor);
-#else // OPENAL
-#ifndef _WIN32
+#else // AUDIO_OAL
#include <AL/al.h>
#include <string.h>
-#else
- #include <al.h>
-#endif
#ifndef GUID_DEFINED
#define GUID_DEFINED
diff --git a/librw b/librw
-Subproject 661feeabf4a4f0a8b0bee23b53ba557a14352d0
+Subproject 6ff378bb16007ad003b1a71996944a20f2e7655
diff --git a/premake5.lua b/premake5.lua
index 64b12d3a..2331c0b3 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -23,6 +23,22 @@ else
Librw = os.getenv("LIBRW") or "librw"
end
+function getsys(a)
+ if a == 'windows' then
+ return 'win'
+ end
+ return a
+end
+
+function getarch(a)
+ if a == 'x86_64' then
+ return 'amd64'
+ elseif a == 'ARM' then
+ return 'arm'
+ end
+ return a
+end
+
workspace "re3"
language "C++"
configurations { "Debug", "Release" }
@@ -35,11 +51,16 @@ workspace "re3"
"win-x86-RW33_d3d8-mss",
"win-x86-librw_d3d9-mss",
"win-x86-librw_gl3_glfw-mss",
+ "win-x86-RW33_d3d8-oal",
+ "win-x86-librw_d3d9-oal",
+ "win-x86-librw_gl3_glfw-oal",
}
filter { "system:linux" }
platforms {
"linux-x86-librw_gl3_glfw-oal",
+ "linux-amd64-librw_gl3_glfw-oal",
+ "linux-arm-librw_gl3_glfw-oal",
}
filter "configurations:Debug"
@@ -58,6 +79,12 @@ workspace "re3"
filter { "platforms:*x86*" }
architecture "x86"
+ filter { "platforms:*amd64*" }
+ architecture "amd64"
+
+ filter { "platforms:*arm*" }
+ architecture "ARM"
+
filter { "platforms:*librw_d3d9*" }
defines { "RW_D3D9" }
if(not _OPTIONS["with-librw"]) then
@@ -68,17 +95,12 @@ workspace "re3"
defines { "RW_GL3" }
includedirs { path.join(_OPTIONS["glfwdir"], "include") }
includedirs { path.join(_OPTIONS["glewdir"], "include") }
-
- filter "platforms:win*librw_gl3_glfw*"
- defines { "GLEW_STATIC" }
if(not _OPTIONS["with-librw"]) then
- libdirs { path.join(Librw, "lib/win-x86-gl3/%{cfg.buildcfg}") }
+ libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") }
end
- filter "platforms:linux*librw_gl3_glfw*"
- if(not _OPTIONS["with-librw"]) then
- libdirs { path.join(Librw, "lib/linux-x86-gl3/%{cfg.buildcfg}") }
- end
+ filter "platforms:win*librw_gl3_glfw*"
+ defines { "GLEW_STATIC" }
filter {}
@@ -163,12 +185,16 @@ project "re3"
includedirs { "src/weapons" }
includedirs { "src/extras" }
includedirs { "eax" }
-
- includedirs { "milessdk/include" }
- includedirs { "eax" }
-
- libdirs { "milessdk/lib" }
+ filter "platforms:*mss"
+ defines { "AUDIO_MSS" }
+ includedirs { "milessdk/include" }
+ libdirs { "milessdk/lib" }
+
+ filter "platforms:*oal"
+ defines { "AUDIO_OAL" }
+
+ filter {}
if(os.getenv("GTA_III_RE_DIR")) then
setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "")
end
@@ -180,9 +206,15 @@ project "re3"
characterset ("MBCS")
targetextension ".exe"
- filter "platforms:linux*"
- targetextension ".elf"
- defines { "OPENAL" }
+ filter "platforms:win*oal"
+ includedirs { "openal-soft/include" }
+ includedirs { "libsndfile/include" }
+ includedirs { "mpg123/include" }
+ libdirs { "openal-soft/libs/Win32" }
+ libdirs { "libsndfile/lib" }
+ libdirs { "mpg123/lib" }
+
+ filter "platforms:linux*oal"
links { "openal", "mpg123", "sndfile", "pthread" }
filter "platforms:*RW33*"
diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp
index 8fb1576c..444b6d45 100644
--- a/src/animation/AnimManager.cpp
+++ b/src/animation/AnimManager.cpp
@@ -530,33 +530,36 @@ char const *aRocketStrafeRightAnimations[] = {
"idle_rocket",
"walkst_rocket_right",
};
+
+#define awc(a) ARRAY_SIZE(a), a
const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS] = {
- { "man", "ped", MI_COP, 173, aStdAnimations, aStdAnimDescs },
- { "player", "ped", MI_COP, 5, aPlayerAnimations, aStdAnimDescs },
- { "playerrocket", "ped", MI_COP, 5, aPlayerWithRocketAnimations, aStdAnimDescs },
- { "player1armed", "ped", MI_COP, 5, aPlayer1ArmedAnimations, aStdAnimDescs },
- { "player2armed", "ped", MI_COP, 5, aPlayer2ArmedAnimations, aStdAnimDescs },
- { "playerBBBat", "ped", MI_COP, 5, aPlayerBBBatAnimations, aStdAnimDescs },
- { "shuffle", "ped", MI_COP, 4, aShuffleAnimations, aStdAnimDescs },
- { "oldman", "ped", MI_COP, 4, aOldAnimations, aStdAnimDescs },
- { "gang1", "ped", MI_COP, 4, aGang1Animations, aStdAnimDescs },
- { "gang2", "ped", MI_COP, 4, aGang2Animations, aStdAnimDescs },
- { "fatman", "ped", MI_COP, 4, aFatAnimations, aStdAnimDescs },
- { "oldfatman", "ped", MI_COP, 4, aOldFatAnimations, aStdAnimDescs },
- { "woman", "ped", MI_COP, 4, aStdWomanAnimations, aStdAnimDescs },
- { "shopping", "ped", MI_COP, 4, aWomanShopAnimations, aStdAnimDescs },
- { "busywoman", "ped", MI_COP, 4, aBusyWomanAnimations, aStdAnimDescs },
- { "sexywoman", "ped", MI_COP, 4, aSexyWomanAnimations, aStdAnimDescs },
- { "oldwoman", "ped", MI_COP, 4, aOldWomanAnimations, aStdAnimDescs },
- { "fatwoman", "ped", MI_COP, 4, aFatWomanAnimations, aStdAnimDescs },
- { "panicchunky", "ped", MI_COP, 4, aPanicChunkyAnimations, aStdAnimDescs },
- { "playerback", "ped", MI_COP, 5, aPlayerStrafeBackAnimations, aStdAnimDescs },
- { "playerleft", "ped", MI_COP, 5, aPlayerStrafeLeftAnimations, aStdAnimDescsSide },
- { "playerright", "ped", MI_COP, 5, aPlayerStrafeRightAnimations, aStdAnimDescsSide },
- { "rocketback", "ped", MI_COP, 5, aRocketStrafeBackAnimations, aStdAnimDescs },
- { "rocketleft", "ped", MI_COP, 5, aRocketStrafeLeftAnimations, aStdAnimDescsSide },
- { "rocketright", "ped", MI_COP, 5, aRocketStrafeRightAnimations, aStdAnimDescsSide },
+ { "man", "ped", MI_COP, awc(aStdAnimations), aStdAnimDescs },
+ { "player", "ped", MI_COP, awc(aPlayerAnimations), aStdAnimDescs },
+ { "playerrocket", "ped", MI_COP, awc(aPlayerWithRocketAnimations), aStdAnimDescs },
+ { "player1armed", "ped", MI_COP, awc(aPlayer1ArmedAnimations), aStdAnimDescs },
+ { "player2armed", "ped", MI_COP, awc(aPlayer2ArmedAnimations), aStdAnimDescs },
+ { "playerBBBat", "ped", MI_COP, awc(aPlayerBBBatAnimations), aStdAnimDescs },
+ { "shuffle", "ped", MI_COP, awc(aShuffleAnimations), aStdAnimDescs },
+ { "oldman", "ped", MI_COP, awc(aOldAnimations), aStdAnimDescs },
+ { "gang1", "ped", MI_COP, awc(aGang1Animations), aStdAnimDescs },
+ { "gang2", "ped", MI_COP, awc(aGang2Animations), aStdAnimDescs },
+ { "fatman", "ped", MI_COP, awc(aFatAnimations), aStdAnimDescs },
+ { "oldfatman", "ped", MI_COP, awc(aOldFatAnimations), aStdAnimDescs },
+ { "woman", "ped", MI_COP, awc(aStdWomanAnimations), aStdAnimDescs },
+ { "shopping", "ped", MI_COP, awc(aWomanShopAnimations), aStdAnimDescs },
+ { "busywoman", "ped", MI_COP, awc(aBusyWomanAnimations), aStdAnimDescs },
+ { "sexywoman", "ped", MI_COP, awc(aSexyWomanAnimations), aStdAnimDescs },
+ { "oldwoman", "ped", MI_COP, awc(aOldWomanAnimations), aStdAnimDescs },
+ { "fatwoman", "ped", MI_COP, awc(aFatWomanAnimations), aStdAnimDescs },
+ { "panicchunky", "ped", MI_COP, awc(aPanicChunkyAnimations), aStdAnimDescs },
+ { "playerback", "ped", MI_COP, awc(aPlayerStrafeBackAnimations), aStdAnimDescs },
+ { "playerleft", "ped", MI_COP, awc(aPlayerStrafeLeftAnimations), aStdAnimDescsSide },
+ { "playerright", "ped", MI_COP, awc(aPlayerStrafeRightAnimations), aStdAnimDescsSide },
+ { "rocketback", "ped", MI_COP, awc(aRocketStrafeBackAnimations), aStdAnimDescs },
+ { "rocketleft", "ped", MI_COP, awc(aRocketStrafeLeftAnimations), aStdAnimDescsSide },
+ { "rocketright", "ped", MI_COP, awc(aRocketStrafeRightAnimations), aStdAnimDescsSide },
};
+#undef awc
void
CAnimManager::Initialise(void)
diff --git a/src/animation/CutsceneMgr.cpp b/src/animation/CutsceneMgr.cpp
index 230e22fb..9f76e7a1 100644
--- a/src/animation/CutsceneMgr.cpp
+++ b/src/animation/CutsceneMgr.cpp
@@ -230,7 +230,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
pPlayerPed->m_pWanted->ClearQdCrimes();
pPlayerPed->bIsVisible = false;
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
- CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80;
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true);
}
@@ -365,7 +365,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
ms_loaded = false;
FindPlayerPed()->bIsVisible = true;
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
if (CGeneral::faststricmp(ms_cutsceneName, "end")) {
diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp
index ecd0299c..55d64714 100644
--- a/src/audio/AudioCollision.cpp
+++ b/src/audio/AudioCollision.cpp
@@ -70,36 +70,36 @@ cAudioManager::GetCollisionOneShotRatio(int32 a, float b) const
case SURFACE_DEFAULT:
case SURFACE_TARMAC:
case SURFACE_PAVEMENT:
- case SURFACE_STONE:
- case SURFACE_BOLLARD: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break;
+ case SURFACE_STEEP_CLIFF:
+ case SURFACE_TRANSPARENT_STONE: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break;
case SURFACE_GRASS:
- case SURFACE_LOOSE30: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
- case SURFACE_DIRT: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
- case SURFACE_DIRTTRACK: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
- case SURFACE_METAL6: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break;
+ case SURFACE_CARDBOARDBOX: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
+ case SURFACE_GRAVEL: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
+ case SURFACE_MUD_DRY: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
+ case SURFACE_CAR: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break;
case SURFACE_GLASS: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
- case SURFACE_SCAFFOLD:
- case SURFACE_STEEL: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break;
- case SURFACE_METAL_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break;
- case SURFACE_BILLBOARD: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break;
- case SURFACE_METAL_POLE:
- case SURFACE_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
- case SURFACE_STREET_LIGHT: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
- case SURFACE_METAL14: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break;
- case SURFACE_METAL15: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break;
- case SURFACE_METAL_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
- case SURFACE_FLESH: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break;
+ case SURFACE_TRANSPARENT_CLOTH:
+ case SURFACE_THICK_METAL_PLATE: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break;
+ case SURFACE_GARAGE_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break;
+ case SURFACE_CAR_PANEL: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break;
+ case SURFACE_SCAFFOLD_POLE:
+ case SURFACE_METAL_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
+ case SURFACE_LAMP_POST: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
+ case SURFACE_FIRE_HYDRANT: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break;
+ case SURFACE_GIRDER: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break;
+ case SURFACE_METAL_CHAIN_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
+ case SURFACE_PED: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break;
case SURFACE_SAND: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
- case SURFACE_PUDDLE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
- case SURFACE_WOOD: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break;
- case SURFACE_WOOD_BOX: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break;
- case SURFACE_WOOD_PLANK: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break;
- case SURFACE_TIRE:
- case SURFACE_RUBBER29: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
- case SURFACE_HARD24: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break;
+ case SURFACE_WATER: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
+ case SURFACE_WOOD_CRATES: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break;
+ case SURFACE_WOOD_BENCH: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break;
+ case SURFACE_WOOD_SOLID: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break;
+ case SURFACE_RUBBER:
+ case SURFACE_WHEELBASE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
+ case SURFACE_PLASTIC: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break;
case SURFACE_HEDGE: result = GetCollisionRatio(b, 0.f, 0.5f, 0.5f); break;
- case SURFACE_METAL27: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break;
- case SURFACE_METAL28: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break;
+ case SURFACE_CONTAINER: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break;
+ case SURFACE_NEWS_VENDOR: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break;
default: result = 0.f; break;
}
@@ -130,18 +130,18 @@ cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollisio
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
vol = 50.f * ratio;
- } else if(surface1 == SURFACE_PUDDLE || surface2 == SURFACE_PUDDLE) {
+ } else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
vol = 30.f * ratio;
- } else if(surface1 == SURFACE_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK ||
- surface2 == SURFACE_DIRTTRACK || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
+ } else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY ||
+ surface2 == SURFACE_MUD_DRY || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
vol = 50.f * ratio;
- } else if(surface1 == SURFACE_FLESH || surface2 == SURFACE_FLESH) {
+ } else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
return 0;
} else {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
@@ -240,9 +240,9 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
s2 = col.m_bSurface2;
}
ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1);
- if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio /= 4.0f;
- if(s1 == SURFACE_METAL6 && ratio < 0.6f) {
- s1 = SURFACE_BILLBOARD;
+ if(s1 == SURFACE_CAR && s2 == SURFACE_PED) ratio /= 4.0f;
+ if(s1 == SURFACE_CAR && ratio < 0.6f) {
+ s1 = SURFACE_CAR_PANEL;
ratio = Min(1.f, 2.f * ratio);
}
emittingVol = 40.f * ratio;
@@ -290,13 +290,13 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
}
switch(s1) {
case SURFACE_GLASS: m_sQueueSample.m_nFrequency = 13500; break;
- case SURFACE_METAL15: m_sQueueSample.m_nFrequency = 8819; break;
- case SURFACE_PUDDLE:
+ case SURFACE_GIRDER: m_sQueueSample.m_nFrequency = 8819; break;
+ case SURFACE_WATER:
m_sQueueSample.m_nFrequency =
2 * SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
break;
- case SURFACE_TIRE: m_sQueueSample.m_nFrequency = 6000; break;
- case SURFACE_HARD24: m_sQueueSample.m_nFrequency = 8000; break;
+ case SURFACE_RUBBER: m_sQueueSample.m_nFrequency = 6000; break;
+ case SURFACE_PLASTIC: m_sQueueSample.m_nFrequency = 8000; break;
default:
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
new file mode 100644
index 00000000..58fd9ef3
--- /dev/null
+++ b/src/audio/AudioLogic.cpp
@@ -0,0 +1,8861 @@
+#include "common.h"
+
+#include "AudioManager.h"
+#include "audio_enums.h"
+
+#include "Automobile.h"
+#include "Boat.h"
+#include "Bridge.h"
+#include "Camera.h"
+#include "Cranes.h"
+#include "DMAudio.h"
+#include "Entity.h"
+#include "Explosion.h"
+#include "Fire.h"
+#include "Garages.h"
+#include "General.h"
+#include "HandlingMgr.h"
+#include "Heli.h"
+#include "ModelIndices.h"
+#include "MusicManager.h"
+#include "Pad.h"
+#include "Ped.h"
+#include "Physical.h"
+#include "Placeable.h"
+#include "Plane.h"
+#include "PlayerPed.h"
+#include "Pools.h"
+#include "Projectile.h"
+#include "ProjectileInfo.h"
+#include "Replay.h"
+#include "Stats.h"
+#include "SurfaceTable.h"
+#include "Train.h"
+#include "Transmission.h"
+#include "Vehicle.h"
+#include "WaterCannon.h"
+#include "Weather.h"
+#include "ZoneCull.h"
+#include "sampman.h"
+
+const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
+const int policeChannel = channels + 1;
+const int allChannels = channels + 2;
+
+uint32 gPornNextTime;
+uint32 gSawMillNextTime;
+uint32 gShopNextTime;
+uint32 gAirportNextTime;
+uint32 gCinemaNextTime;
+uint32 gDocksNextTime;
+uint32 gHomeNextTime;
+uint32 gCellNextTime;
+uint32 gNextCryTime;
+
+enum PLAY_STATUS : uint8 { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING, PLAY_STATUS_FINISHED };
+enum LOADING_STATUS : uint8 { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_FAILED };
+
+void
+cAudioManager::PreInitialiseGameSpecificSetup() const
+{
+ BankStartOffset[SAMPLEBANK_MAIN] = SAMPLEBANK_START;
+#ifdef GTA_PS2
+ BankStartOffset[SAMPLEBANK_CAR_PACARD] = SFX_CAR_ACCEL_1;
+ BankStartOffset[SAMPLEBANK_CAR_PATHFINDER] = SFX_CAR_ACCEL_2;
+ BankStartOffset[SAMPLEBANK_CAR_PORSCHE] = SFX_CAR_ACCEL_3;
+ BankStartOffset[SAMPLEBANK_CAR_SPIDER] = SFX_CAR_ACCEL_4;
+ BankStartOffset[SAMPLEBANK_CAR_MERC] = SFX_CAR_ACCEL_5;
+ BankStartOffset[SAMPLEBANK_CAR_MACKTRUCK] = SFX_CAR_ACCEL_6;
+ BankStartOffset[SAMPLEBANK_CAR_HOTROD] = SFX_CAR_ACCEL_7;
+ BankStartOffset[SAMPLEBANK_CAR_COBRA] = SFX_CAR_ACCEL_8;
+ BankStartOffset[SAMPLEBANK_CAR_NONE] = SFX_CAR_ACCEL_9;
+ BankStartOffset[SAMPLEBANK_FRONTEND] = SFX_PAGE_CHANGE_AND_BACK_LEFT;
+ BankStartOffset[SAMPLEBANK_TRAIN] = SFX_TRAIN_STATION_AMBIENCE_LOOP;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_1] = SFX_CLUB_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_2] = SFX_CLUB_2;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_3] = SFX_CLUB_3;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_4] = SFX_CLUB_4;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_5] = SFX_CLUB_5;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_6] = SFX_CLUB_6;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_7] = SFX_CLUB_7;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_8] = SFX_CLUB_8;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_9] = SFX_CLUB_9;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_10] = SFX_CLUB_10;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_11] = SFX_CLUB_11;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_12] = SFX_CLUB_12;
+ BankStartOffset[SAMPLEBANK_BUILDING_CLUB_RAGGA] = SFX_CLUB_RAGGA;
+ BankStartOffset[SAMPLEBANK_BUILDING_STRIP_CLUB_1] = SFX_STRIP_CLUB_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_STRIP_CLUB_2] = SFX_STRIP_CLUB_2;
+ BankStartOffset[SAMPLEBANK_BUILDING_WORKSHOP] = SFX_WORKSHOP_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_PIANO_BAR] = SFX_PIANO_BAR_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_SAWMILL] = SFX_SAWMILL_LOOP;
+ BankStartOffset[SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY] = SFX_DOG_FOOD_FACTORY;
+ BankStartOffset[SAMPLEBANK_BUILDING_LAUNDERETTE] = SFX_LAUNDERETTE_LOOP;
+ BankStartOffset[SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN] = SFX_RESTAURANT_CHINATOWN;
+ BankStartOffset[SAMPLEBANK_BUILDING_RESTAURANT_ITALY] = SFX_RESTAURANT_ITALY;
+ BankStartOffset[SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1] = SFX_RESTAURANT_GENERIC_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2] = SFX_RESTAURANT_GENERIC_2;
+ BankStartOffset[SAMPLEBANK_BUILDING_AIRPORT] = SFX_AIRPORT_ANNOUNCEMENT_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_SHOP] = SFX_SHOP_LOOP;
+ BankStartOffset[SAMPLEBANK_BUILDING_CINEMA] = SFX_CINEMA_BASS_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_DOCKS] = SFX_DOCKS_FOGHORN;
+ BankStartOffset[SAMPLEBANK_BUILDING_HOME] = SFX_HOME_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_PORN_1] = SFX_PORN_1_LOOP;
+ BankStartOffset[SAMPLEBANK_BUILDING_PORN_2] = SFX_PORN_2_LOOP;
+ BankStartOffset[SAMPLEBANK_BUILDING_PORN_3] = SFX_PORN_3_LOOP;
+ BankStartOffset[SAMPLEBANK_BUILDING_POLICE_BALL] = SFX_POLICE_BALL_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_BANK_ALARM] = SFX_BANK_ALARM_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL] = SFX_RAVE_INDUSTRIAL;
+ BankStartOffset[SAMPLEBANK_BUILDING_RAVE_COMMERCIAL] = SFX_RAVE_COMMERCIAL;
+ BankStartOffset[SAMPLEBANK_BUILDING_RAVE_SUBURBAN] = SFX_RAVE_SUBURBAN;
+ BankStartOffset[SAMPLEBANK_BUILDING_RAVE_COMMERCIAL_2] = SFX_RAVE_COMMERCIAL_2;
+ BankStartOffset[SAMPLEBANK_BUILDING_39] = SFX_CLUB_1_1;
+ BankStartOffset[SAMPLEBANK_BUILDING_40] = SFX_CLUB_1_2;
+ BankStartOffset[SAMPLEBANK_BUILDING_41] = SFX_CLUB_1_3;
+ BankStartOffset[SAMPLEBANK_BUILDING_42] = SFX_CLUB_1_4;
+ BankStartOffset[SAMPLEBANK_BUILDING_43] = SFX_CLUB_1_5;
+ BankStartOffset[SAMPLEBANK_BUILDING_44] = SFX_CLUB_1_6;
+ BankStartOffset[SAMPLEBANK_BUILDING_45] = SFX_CLUB_1_7;
+ BankStartOffset[SAMPLEBANK_BUILDING_46] = SFX_CLUB_1_8;
+ BankStartOffset[SAMPLEBANK_BUILDING_47] = SFX_CLUB_1_9;
+ BankStartOffset[SAMPLEBANK_EXTRAS] = SFX_EXPLOSION_1;
+#endif // GTA_PS2
+ BankStartOffset[SAMPLEBANK_PED] = SAMPLEBANK_PED_START;
+}
+
+void
+cAudioManager::PostInitialiseGameSpecificSetup()
+{
+ m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager);
+ if (m_nFireAudioEntity >= 0)
+ SetEntityStatus(m_nFireAudioEntity, 1);
+
+ m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1);
+ if (m_nCollisionEntity >= 0)
+ SetEntityStatus(m_nCollisionEntity, 1);
+
+ m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1);
+ if (m_nFrontEndEntity >= 0)
+ SetEntityStatus(m_nFrontEndEntity, 1);
+
+ m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1);
+ if (m_nProjectileEntity >= 0)
+ SetEntityStatus(m_nProjectileEntity, 1);
+
+ m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1);
+ if (m_nWaterCannonEntity >= 0)
+ SetEntityStatus(m_nWaterCannonEntity, 1);
+
+ m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1);
+ if (m_nPoliceChannelEntity >= 0)
+ SetEntityStatus(m_nPoliceChannelEntity, 1);
+
+ m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void *)1);
+ if (m_nBridgeEntity >= 0)
+ SetEntityStatus(m_nBridgeEntity, 1);
+
+ m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
+ m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
+ m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
+ m_sMissionAudio.field_22 = 0;
+ m_sMissionAudio.m_bIsPlayed = false;
+ m_sMissionAudio.m_bPredefinedProperties = true;
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
+ ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds());
+}
+void
+cAudioManager::PreTerminateGameSpecificShutdown()
+{
+ if (m_nBridgeEntity >= 0) {
+ DestroyEntity(m_nBridgeEntity);
+ m_nBridgeEntity = AEHANDLE_NONE;
+ }
+ if (m_nPoliceChannelEntity >= 0) {
+ DestroyEntity(m_nPoliceChannelEntity);
+ m_nPoliceChannelEntity = AEHANDLE_NONE;
+ }
+ if (m_nWaterCannonEntity >= 0) {
+ DestroyEntity(m_nWaterCannonEntity);
+ m_nWaterCannonEntity = AEHANDLE_NONE;
+ }
+ if (m_nFireAudioEntity >= 0) {
+ DestroyEntity(m_nFireAudioEntity);
+ m_nFireAudioEntity = AEHANDLE_NONE;
+ }
+ if (m_nCollisionEntity >= 0) {
+ DestroyEntity(m_nCollisionEntity);
+ m_nCollisionEntity = AEHANDLE_NONE;
+ }
+ if (m_nFrontEndEntity >= 0) {
+ DestroyEntity(m_nFrontEndEntity);
+ m_nFrontEndEntity = AEHANDLE_NONE;
+ }
+ if (m_nProjectileEntity >= 0) {
+ DestroyEntity(m_nProjectileEntity);
+ m_nProjectileEntity = AEHANDLE_NONE;
+ }
+}
+
+void
+cAudioManager::PostTerminateGameSpecificShutdown()
+{
+ ;
+}
+
+void
+cAudioManager::ResetAudioLogicTimers(uint32 timer)
+{
+ gPornNextTime = timer;
+ gNextCryTime = timer;
+ gSawMillNextTime = timer;
+ gCellNextTime = timer;
+ gShopNextTime = timer;
+ gHomeNextTime = timer;
+ gAirportNextTime = timer;
+ gDocksNextTime = timer;
+ gCinemaNextTime = timer;
+ for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) {
+ if (m_asAudioEntities[m_anAudioEntityIndices[i]].m_nType == AUDIOTYPE_PHYSICAL) {
+ CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity;
+ if (ped->IsPed()) {
+ ped->m_lastSoundStart = timer;
+ ped->m_soundStart = timer + m_anRandomTable[0] % 3000;
+ }
+ }
+ }
+ ClearMissionAudio();
+ SampleManager.StopChannel(policeChannel);
+}
+
+void
+cAudioManager::ProcessReverb() const
+{
+ if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
+ for (uint32 i = 0; i <
+#ifdef FIX_BUGS
+ channels
+#else
+ 28
+#endif
+ ;
+ i++) {
+ if (m_asActiveSamples[i].m_bReverbFlag)
+ SampleManager.SetChannelReverbFlag(i, 1);
+ }
+ }
+}
+
+float
+cAudioManager::GetDistanceSquared(const CVector &v) const
+{
+ const CVector &c = TheCamera.GetPosition();
+ return sq(v.x - c.x) + sq(v.y - c.y) + sq((v.z - c.z) * 0.2f);
+}
+
+void
+cAudioManager::CalculateDistance(bool &distCalculated, float dist)
+{
+ if (!distCalculated) {
+ m_sQueueSample.m_fDistance = Sqrt(dist);
+ distCalculated = true;
+ }
+}
+
+void
+cAudioManager::ProcessSpecial()
+{
+ if (m_nUserPause) {
+ if (!m_nPreviousUserPause) {
+ MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND);
+ SampleManager.SetEffectsFadeVolume(MAX_VOLUME);
+ SampleManager.SetMusicFadeVolume(MAX_VOLUME);
+ }
+ } else {
+ if (m_nPreviousUserPause) {
+ MusicManager.StopFrontEndTrack();
+ MusicManager.ChangeMusicMode(MUSICMODE_GAME);
+ }
+ CPlayerPed *playerPed = FindPlayerPed();
+ if (playerPed) {
+ const PedState &state = playerPed->m_nPedState;
+ if (state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle)
+ SampleManager.StopChannel(m_nActiveSamples);
+ }
+ }
+}
+
+void
+cAudioManager::ProcessEntity(int32 id)
+{
+ if (m_asAudioEntities[id].m_nStatus) {
+ m_sQueueSample.m_nEntityIndex = id;
+ switch (m_asAudioEntities[id].m_nType) {
+ case AUDIOTYPE_PHYSICAL:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessPhysical(id);
+ }
+ break;
+ case AUDIOTYPE_EXPLOSION:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessExplosions(id);
+ }
+ break;
+ case AUDIOTYPE_FIRE:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessFires(id);
+ }
+ break;
+ case AUDIOTYPE_WEATHER:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessWeather(id);
+ }
+ break;
+ case AUDIOTYPE_CRANE:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessCrane();
+ }
+ break;
+ case AUDIOTYPE_SCRIPTOBJECT:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessScriptObject(id);
+ }
+ break;
+ case AUDIOTYPE_BRIDGE:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessBridge();
+ }
+ break;
+ case AUDIOTYPE_FRONTEND:
+ m_sQueueSample.m_bReverbFlag = false;
+ ProcessFrontEnd();
+ break;
+ case AUDIOTYPE_PROJECTILE:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessProjectiles();
+ }
+ break;
+ case AUDIOTYPE_GARAGE:
+ if (!m_nUserPause)
+ ProcessGarages();
+ break;
+ case AUDIOTYPE_FIREHYDRANT:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessFireHydrant();
+ }
+ break;
+ case AUDIOTYPE_WATERCANNON:
+ if (!m_nUserPause) {
+ m_sQueueSample.m_bReverbFlag = true;
+ ProcessWaterCannon(id);
+ }
+ break;
+ default:
+ return;
+ }
+ }
+}
+
+void
+cAudioManager::ProcessPhysical(int32 id)
+{
+ CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity;
+ if (entity) {
+ switch (entity->GetType()) {
+ case ENTITY_TYPE_VEHICLE:
+ ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity);
+ break;
+ case ENTITY_TYPE_PED:
+ ProcessPed((CPhysical *)m_asAudioEntities[id].m_pEntity);
+ break;
+ default:
+ return;
+ }
+ }
+}
+
+#pragma region VEHICLE AUDIO
+enum eVehicleModel {
+ LANDSTAL,
+ IDAHO,
+ STINGER,
+ LINERUN,
+ PEREN,
+ SENTINEL,
+ PATRIOT,
+ FIRETRUK,
+ TRASH,
+ STRETCH,
+ MANANA,
+ INFERNUS,
+ BLISTA,
+ PONY,
+ MULE,
+ CHEETAH,
+ AMBULAN,
+ FBICAR,
+ MOONBEAM,
+ ESPERANT,
+ TAXI,
+ KURUMA,
+ BOBCAT,
+ MRWHOOP,
+ BFINJECT,
+ CORPSE,
+ POLICE,
+ ENFORCER,
+ SECURICA,
+ BANSHEE,
+ PREDATOR,
+ BUS,
+ RHINO,
+ BARRACKS,
+ TRAIN,
+ CHOPPER,
+ DODO,
+ COACH,
+ CABBIE,
+ STALLION,
+ RUMPO,
+ RCBANDIT,
+ BELLYUP,
+ MRWONGS,
+ MAFIA,
+ YARDIE,
+ YAKUZA,
+ DIABLOS,
+ COLUMB,
+ HOODS,
+ AIRTRAIN,
+ DEADDODO,
+ SPEEDER,
+ REEFER,
+ PANLANT,
+ FLATBED,
+ YANKEE,
+ ESCAPE,
+ BORGNINE,
+ TOYZ,
+ GHOST,
+ CAR151,
+ CAR152,
+ CAR153,
+ CAR154,
+ CAR155,
+ CAR156,
+ CAR157,
+ CAR158,
+ CAR159,
+ MAX_CARS
+};
+
+enum
+{
+ DOOR_TYPE_OLD = 0,
+ DOOR_TYPE_NEW,
+ DOOR_TYPE_TRUCK,
+ DOOR_TYPE_AIRBREAK,
+};
+
+
+struct tVehicleSampleData {
+ eSfxSample m_nAccelerationSampleIndex;
+ uint8 m_nBank;
+ eSfxSample m_nHornSample;
+ int32 m_nHornFrequency;
+ uint8 m_nSirenOrAlarmSample;
+ int32 m_nSirenOrAlarmFrequency;
+ uint8 m_bDoorType;
+};
+
+const tVehicleSampleData aVehicleSettings[MAX_CARS] = {
+ {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_8, SAMPLEBANK_CAR_COBRA, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_ALARM_1, 8941, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_ALARM_1, 11922, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 7948, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_ALARM_1, 8941, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_ALARM_1, 12220, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_3, SAMPLEBANK_CAR_PORSCHE, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_ALARM_1, 12200, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_3, SAMPLEBANK_CAR_PORSCHE, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 13600, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_ALARM_1, 8000, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_ALARM_1, 8543, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_7, SAMPLEBANK_CAR_HOTROD, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 10000, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_8, SAMPLEBANK_CAR_COBRA, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_ALARM_1, 10123, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_ALARM_1, 10554, DOOR_TYPE_AIRBREAK},
+ {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 8000, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_AIRBREAK},
+ {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CESNA_IDLE, SAMPLEBANK_MAIN, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_BUS, 16291, SFX_CAR_ALARM_1, 7500, DOOR_TYPE_AIRBREAK},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_ALARM_1, 8935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 8935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_ALARM_1, 17000, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_7, SAMPLEBANK_CAR_HOTROD, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_7, SAMPLEBANK_CAR_HOTROD, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9000, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, DOOR_TYPE_NEW},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD},
+ {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}};
+
+
+bool bPlayerJustEnteredCar;
+
+const bool hornPatternsArray[8][44] = {
+ {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false,
+ false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false},
+ {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false},
+ {false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false,
+ false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false},
+ {false, false, true, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true,
+ true, true, true, true, true, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false},
+ {false, false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
+ {false, false, true, true, true, false, false, false, true, true, true, false, false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
+ {false, false, true, true, true, true, false, false, false, false, true, true, true, false, false, true, true, true, false, false, true, true,
+ true, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false},
+ {false, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true,
+ false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false},
+};
+
+
+void
+cAudioManager::ProcessVehicle(CVehicle *veh)
+{
+ tHandlingData *handling = veh->pHandling;
+ float velChange;
+ cVehicleParams params;
+ m_sQueueSample.m_vecPos = veh->GetPosition();
+
+ params.m_bDistanceCalculated = false;
+ params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ params.m_pVehicle = veh;
+ params.m_pTransmission = nil;
+ params.m_nIndex = 0;
+ params.m_fVelocityChange = 0.0f;
+
+ if (handling != nil)
+ params.m_pTransmission = &handling->Transmission;
+
+ params.m_nIndex = veh->GetModelIndex() - MI_FIRST_VEHICLE;
+ if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE)
+ velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f;
+ else
+ velChange = DotProduct(params.m_pVehicle->m_vecMoveSpeed, params.m_pVehicle->GetForward());
+ params.m_fVelocityChange = velChange;
+ switch (params.m_pVehicle->m_vehType) {
+ case VEHICLE_TYPE_CAR:
+ UpdateGasPedalAudio((CAutomobile *)veh);
+ if (params.m_nIndex == RCBANDIT) {
+ ProcessModelCarEngine(&params);
+ ProcessVehicleOneShots(&params);
+ ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
+ break;
+ }
+ if (params.m_nIndex == DODO) {
+ if (!ProcessVehicleRoadNoise(&params)) {
+ ProcessVehicleOneShots(&params);
+ ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
+ break;
+ }
+ if (CWeather::WetRoads > 0.f)
+ ProcessWetRoadNoise(&params);
+ ProcessVehicleSkidding(&params);
+ } else {
+ if (!ProcessVehicleRoadNoise(&params)) {
+ ProcessVehicleOneShots(&params);
+ ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
+ break;
+ }
+ ProcessReverseGear(&params);
+ if (CWeather::WetRoads > 0.f)
+ ProcessWetRoadNoise(&params);
+ ProcessVehicleSkidding(&params);
+ ProcessVehicleHorn(&params);
+ ProcessVehicleSirenOrAlarm(&params);
+ if (UsesReverseWarning(params.m_nIndex))
+ ProcessVehicleReverseWarning(&params);
+ if (HasAirBrakes(params.m_nIndex))
+ ProcessAirBrakes(&params);
+ }
+ ProcessCarBombTick(&params);
+ ProcessVehicleEngine(&params);
+ ProcessEngineDamage(&params);
+ ProcessVehicleDoors(&params);
+
+ ProcessVehicleOneShots(&params);
+ ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
+ break;
+ case VEHICLE_TYPE_BOAT:
+ ProcessBoatEngine(&params);
+ ProcessBoatMovingOverWater(&params);
+ ProcessVehicleOneShots(&params);
+ break;
+ case VEHICLE_TYPE_TRAIN:
+ ProcessTrainNoise(&params);
+ ProcessVehicleOneShots(&params);
+ break;
+ case VEHICLE_TYPE_HELI:
+ ProcessHelicopter(&params);
+ ProcessVehicleOneShots(&params);
+ break;
+ case VEHICLE_TYPE_PLANE:
+ ProcessPlane(&params);
+ ProcessVehicleOneShots(&params);
+ break;
+ default:
+ break;
+ }
+ ProcessRainOnVehicle(&params);
+}
+
+void
+cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
+{
+ const int rainOnVehicleIntensity = 22;
+ if (params->m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
+ CVehicle *veh = params->m_pVehicle;
+ ++veh->m_bRainAudioCounter;
+ if (veh->m_bRainAudioCounter >= 2) {
+ veh->m_bRainAudioCounter = 0;
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ float emittingVol = 30.f * CWeather::Rain;
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++;
+ if (veh->m_bRainSamplesCounter > 4)
+ veh->m_bRainSamplesCounter = 68;
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_CAR_RAIN_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 9;
+ m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nEmittingVolume = (uint8)emittingVol;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = rainOnVehicleIntensity;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bReverbFlag = false;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+}
+
+bool
+cAudioManager::ProcessReverseGear(cVehicleParams *params)
+{
+ const int reverseGearIntensity = 30;
+
+ CVehicle *veh;
+ CAutomobile *automobile;
+ int32 emittingVol;
+ float modificator;
+
+ if (params->m_fDistance >= SQR(reverseGearIntensity))
+ return false;
+ veh = params->m_pVehicle;
+ if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || veh->m_nCurrentGear == 0)) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ automobile = (CAutomobile *)params->m_pVehicle;
+ if (automobile->m_nWheelsOnGround != 0) {
+ modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity;
+ } else {
+ if (automobile->m_nDriveWheelsOnGround != 0)
+ automobile->m_fGasPedalAudio *= 0.4f;
+ modificator = automobile->m_fGasPedalAudio;
+ }
+ modificator = Abs(modificator);
+ emittingVol = (24.f * modificator);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ if (params->m_pVehicle->m_fGasPedal >= 0.0f) {
+ m_sQueueSample.m_nCounter = 62;
+ m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2;
+ } else {
+ m_sQueueSample.m_nCounter = 61;
+ m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR;
+ }
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nFrequency = (6000.f * modificator) + 7000;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 3.0f;
+ m_sQueueSample.m_fSoundIntensity = reverseGearIntensity;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 5;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ return true;
+}
+
+void
+cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 30.0f;
+ CAutomobile *automobile;
+ float allowedVelocity;
+ int32 emittingVol;
+ float velocityChange;
+
+ if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
+ automobile = (CAutomobile *)params->m_pVehicle;
+ if (automobile->bEngineOn) {
+ if (automobile->m_nWheelsOnGround == 0) {
+ if (automobile->m_nDriveWheelsOnGround != 0)
+ automobile->m_fGasPedalAudio *= 0.4f;
+ velocityChange = automobile->m_fGasPedalAudio * params->m_pTransmission->fMaxVelocity;
+ } else {
+ velocityChange = Abs(params->m_fVelocityChange);
+ }
+ if (velocityChange > 0.001f) {
+ allowedVelocity = 0.5f * params->m_pTransmission->fMaxVelocity;
+ if (velocityChange < allowedVelocity)
+ emittingVol = (90.f * velocityChange / allowedVelocity);
+ else
+ emittingVol = 90;
+ if (emittingVol) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 2;
+ m_sQueueSample.m_nSampleIndex = SFX_REMOTE_CONTROLLED_CAR;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nFrequency = (11025.f * velocityChange / params->m_pTransmission->fMaxVelocity + 11025.f);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 3.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+ }
+}
+
+
+
+bool
+cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 95.0f;
+
+ int32 emittingVol;
+ uint32 freq;
+ float modificator;
+ int sampleFreq;
+ float velocity;
+
+ if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ return false;
+ if (params->m_pTransmission != nil) {
+ if (((CAutomobile*)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) {
+ velocity = Abs(params->m_fVelocityChange);
+ if (velocity > 0.0f) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ emittingVol = 30.f * Min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ if (params->m_pVehicle->m_nSurfaceTouched == SURFACE_WATER) {
+ m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
+ freq = 6050 * emittingVol / 30 + 16000;
+ } else {
+ m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
+ modificator = m_sQueueSample.m_fDistance / 190.f;
+ sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
+ freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4);
+ }
+ m_sQueueSample.m_nFrequency = freq;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 6.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 4;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+ return true;
+}
+
+bool
+cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 30.0f;
+
+ float relativeVelocity;
+ int32 emittingVol;
+ float modificator;
+ int freq;
+ float velChange;
+
+ if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ return false;
+ if (params->m_pTransmission != nil) {
+ if (((CAutomobile *)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) {
+ velChange = Abs(params->m_fVelocityChange);
+ if (velChange > 0.f) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ relativeVelocity = Min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity));
+ emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 1;
+ m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ modificator = m_sQueueSample.m_fDistance / 6.f;
+ freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
+ m_sQueueSample.m_nFrequency = freq + freq * modificator;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 6.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 4;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+ return true;
+}
+
+void
+cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 50.0f;
+
+ CVehicle *playerVeh;
+ CVehicle *veh;
+ CAutomobile *automobile;
+ float relativeGearChange;
+ float relativeChange;
+ uint8 volume;
+ int32 freq = 0; // uninitialized variable
+ uint8 emittingVol;
+ cTransmission *transmission;
+ uint8 currentGear;
+ float modificator;
+ float traction = 0.f;
+
+ if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
+ playerVeh = FindPlayerVehicle();
+ veh = params->m_pVehicle;
+ if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) {
+ SampleManager.StopChannel(m_nActiveSamples);
+ return;
+ }
+ if (veh->bEngineOn) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ automobile = (CAutomobile *)params->m_pVehicle;
+ if (params->m_nIndex == DODO) {
+ ProcessCesna(params);
+ return;
+ }
+ if (FindPlayerVehicle() == veh) {
+ ProcessPlayersVehicleEngine(params, automobile);
+ return;
+ }
+ transmission = params->m_pTransmission;
+ if (transmission != nil) {
+ currentGear = params->m_pVehicle->m_nCurrentGear;
+ if (automobile->m_nWheelsOnGround != 0) {
+ if (automobile->bIsHandbrakeOn) {
+ if (params->m_fVelocityChange == 0.0f)
+ traction = 0.9f;
+ } else if (params->m_pVehicle->GetStatus() == STATUS_SIMPLE) {
+ traction = 0.0f;
+ } else {
+ switch (transmission->nDriveType) {
+ case '4':
+ for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
+ if (automobile->m_aWheelState[i] == WHEEL_STATE_SPINNING)
+ traction += 0.05f;
+ }
+ break;
+ case 'F':
+ if (automobile->m_aWheelState[VEHWHEEL_FRONT_LEFT] == WHEEL_STATE_SPINNING)
+ traction += 0.1f;
+ if (automobile->m_aWheelState[VEHWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING)
+ traction += 0.1f;
+ break;
+ case 'R':
+ if (automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] == WHEEL_STATE_SPINNING)
+ traction += 0.1f;
+ if (automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING)
+ traction += 0.1f;
+ break;
+ }
+ }
+ if (transmission->fMaxVelocity <= 0.f) {
+ relativeChange = 0.f;
+ } else if (currentGear != 0) {
+ relativeGearChange =
+ Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f);
+ if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE &&
+ params->m_fVelocityChange >= transmission->Gears[1].fShiftUpVelocity) {
+ traction = 0.7f;
+ }
+ relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange;
+ } else
+ relativeChange =
+ Min(1.0f, 1.0f - Abs((params->m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity));
+ } else {
+ if (automobile->m_nDriveWheelsOnGround != 0)
+ automobile->m_fGasPedalAudio *= 0.4f;
+ relativeChange = automobile->m_fGasPedalAudio;
+ }
+ modificator = relativeChange;
+ if (currentGear || !automobile->m_nWheelsOnGround)
+ freq = 1200 * currentGear + 18000.f * modificator + 14000;
+ else
+ freq = 13000.f * modificator + 14000;
+ if (modificator >= 0.75f) {
+ emittingVol = 120;
+ volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ } else {
+ emittingVol = modificator * 4.0f / 3.0f * 40.f + 80.f;
+ volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ }
+ } else {
+ modificator = 0.f;
+ emittingVol = 80;
+ volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ }
+ m_sQueueSample.m_nVolume = volume;
+ if (m_sQueueSample.m_nVolume != 0) {
+ if (automobile->GetStatus() == STATUS_SIMPLE) {
+ if (modificator < 0.02f) {
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nBank - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_IDLE_1;
+ freq = modificator * 10000 + 22050;
+ m_sQueueSample.m_nCounter = 52;
+ } else {
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex;
+ m_sQueueSample.m_nCounter = 2;
+ }
+ } else {
+ if (automobile->m_fGasPedal < 0.05f) {
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nBank - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_IDLE_1;
+ freq = modificator * 10000 + 22050;
+ m_sQueueSample.m_nCounter = 52;
+ } else {
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex;
+ m_sQueueSample.m_nCounter = 2;
+ }
+ }
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nFrequency = freq + 100 * m_sQueueSample.m_nEntityIndex % 1000;
+ if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6)
+ m_sQueueSample.m_nFrequency /= 2;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 6.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 8;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+}
+
+void
+cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile)
+{
+ float gasPedal = Abs(automobile->m_fGasPedal);
+ float gasPedalAudio = automobile->m_fGasPedalAudio;
+
+ if (gasPedalAudio < gasPedal)
+ automobile->m_fGasPedalAudio = Min(gasPedalAudio + 0.09f, gasPedal);
+ else
+ automobile->m_fGasPedalAudio = Max(gasPedalAudio - 0.07f, gasPedal);
+}
+
+void
+cAudioManager::PlayerJustGotInCar() const
+{
+ if (m_bIsInitialised)
+ bPlayerJustEnteredCar = true;
+}
+
+void
+cAudioManager::PlayerJustLeftCar(void) const
+{
+ // UNUSED: This is a perfectly empty function.
+}
+
+void
+cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank, uint8 counter, bool notLooping)
+{
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = counter;
+ m_sQueueSample.m_nSampleIndex = sample;
+#ifdef GTA_PS2
+ m_sQueueSample.m_nBankIndex = bank;
+#else
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+#endif // GTA_PS2
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nFrequency = freq;
+ if (notLooping) {
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nReleasingVolumeDivider = 8;
+ } else {
+ m_sQueueSample.m_nLoopCount = 1;
+ }
+ m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 6.0f;
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+}
+
+void
+cAudioManager::ProcessCesna(cVehicleParams *params)
+{
+ static uint8 nAccel = 0;
+
+ //((CAutomobile *)params->m_pVehicle)->Damage.GetEngineStatus();
+
+ if (FindPlayerVehicle() == params->m_pVehicle) {
+ if (params->m_nIndex == DODO) {
+ if (Pads[0].GetAccelerate() <= 0) {
+ if (nAccel != 0)
+ --nAccel;
+ } else if (nAccel < 60) {
+ ++nAccel;
+ }
+ AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, SAMPLEBANK_MAIN, 52, true);
+ AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, SAMPLEBANK_MAIN, 2, true);
+ }
+ } else if (params->m_nIndex == DODO) {
+ AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, SAMPLEBANK_MAIN, 52, true);
+ } else if (params->m_fDistance < SQR(200)) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 52;
+ m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nFrequency = 12500;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nReleasingVolumeDivider = 8;
+ m_sQueueSample.m_nEmittingVolume = 80;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 8.0f;
+ m_sQueueSample.m_fSoundIntensity = 200.0f;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ if (params->m_fDistance < SQR(90)) {
+ m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 2;
+ m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nFrequency = 25000;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nReleasingVolumeDivider = 4;
+ m_sQueueSample.m_nEmittingVolume = 80;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 8.0f;
+ m_sQueueSample.m_fSoundIntensity = 90.0f;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile)
+{
+ static int32 GearFreqAdj[] = {6000, 6000, 3400, 1200, 0, -1000};
+
+ cTransmission *transmission;
+ float velocityChange;
+ float relativeVelocityChange;
+ float accelerationMultipler;
+ uint8 wheelInUseCounter;
+ float time;
+ int baseFreq;
+ uint8 vol;
+ int gearNr;
+ int32 freq;
+
+ int freqModifier;
+ int soundOffset;
+ uint8 engineSoundType;
+ int16 accelerateState;
+ bool channelUsed;
+ bool lostTraction;
+ bool processedAccelSampleStopped;
+ uint8 currentGear;
+ float gasPedalAudio;
+ CVector pos;
+
+ static int16 LastAccel = 0;
+ static int16 LastBrake = 0;
+ static uint8 CurrentPretendGear = 1;
+ static bool bLostTractionLastFrame = false;
+ static bool bHandbrakeOnLastFrame = false;
+ static int32 nCruising = 0;
+ static bool bAccelSampleStopped = true;
+
+ lostTraction = false;
+ processedAccelSampleStopped = false;
+ if (bPlayerJustEnteredCar) {
+ bAccelSampleStopped = true;
+ bPlayerJustEnteredCar = false;
+ nCruising = 0;
+ LastAccel = 0;
+ bLostTractionLastFrame = false;
+ LastBrake = 0;
+ bHandbrakeOnLastFrame = false;
+ CurrentPretendGear = 1;
+ }
+ if (CReplay::IsPlayingBack())
+ accelerateState = 255.f * clamp(automobile->m_fGasPedal, 0.0f, 1.0f);
+ else
+ accelerateState = Pads[0].GetAccelerate();
+
+ channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples);
+ transmission = params->m_pTransmission;
+ velocityChange = params->m_fVelocityChange;
+ relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
+
+ accelerationMultipler = clamp(relativeVelocityChange, 0.0f, 1.0f);
+ gasPedalAudio = accelerationMultipler;
+ currentGear = params->m_pVehicle->m_nCurrentGear;
+
+ switch (transmission->nDriveType)
+ {
+ case '4':
+ wheelInUseCounter = 0;
+ for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
+ if (automobile->m_aWheelState[i] != WHEEL_STATE_NORMAL)
+ ++wheelInUseCounter;
+ }
+ if (wheelInUseCounter > 2)
+ lostTraction = true;
+ break;
+ case 'F':
+ if ((automobile->m_aWheelState[VEHWHEEL_FRONT_LEFT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[VEHWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL) &&
+ (automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL))
+ lostTraction = true;
+ break;
+ case 'R':
+ if ((automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL) || (automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL))
+ lostTraction = true;
+ break;
+ }
+
+ if (velocityChange != 0.0f) {
+ time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange;
+ if (time > 0.0f)
+ freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f);
+ else
+ freqModifier = -(Max(-0.2f, time) * 3000.0f * 5.0f);
+ if (params->m_fVelocityChange < -0.001f)
+ freqModifier = -freqModifier;
+ } else
+ freqModifier = 0;
+
+ engineSoundType = aVehicleSettings[params->m_nIndex].m_nBank;
+ soundOffset = 3 * (engineSoundType - CAR_SAMPLEBANKS_OFFSET);
+ if (accelerateState <= 0) {
+ if (params->m_fVelocityChange < -0.001f) {
+ if (channelUsed) {
+ SampleManager.StopChannel(m_nActiveSamples);
+ bAccelSampleStopped = true;
+ }
+ if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction)
+ gasPedalAudio = automobile->m_fGasPedalAudio;
+ else
+ gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity);
+
+ gasPedalAudio = Max(0.0f, gasPedalAudio);
+ automobile->m_fGasPedalAudio = gasPedalAudio;
+ } else if (LastAccel > 0) {
+ if (channelUsed) {
+ SampleManager.StopChannel(m_nActiveSamples);
+ bAccelSampleStopped = true;
+ }
+ nCruising = 0;
+ if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction ||
+ params->m_fVelocityChange >= 0.01f && automobile->m_fGasPedalAudio > 0.2f) {
+ automobile->m_fGasPedalAudio *= 0.6f;
+ gasPedalAudio = automobile->m_fGasPedalAudio;
+ }
+ if (gasPedalAudio > 0.05f) {
+ freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000;
+ if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK)
+ freq /= 2;
+ AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63,
+ false);
+ }
+ }
+ freq = (10000.f * gasPedalAudio) + 22050;
+ if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK)
+ freq /= 2;
+ AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_IDLE_1), SAMPLEBANK_MAIN, 52, true);
+
+ CurrentPretendGear = Max(1, currentGear);
+ } else {
+ while (nCruising == 0) {
+ if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction ||
+ currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs
+ if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) {
+ if (!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround ||
+ (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround) {
+ automobile->m_fGasPedalAudio *= 0.6f;
+ }
+ freqModifier = 0;
+ baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000;
+ vol = (25.0f * automobile->m_fGasPedalAudio) + 60;
+ } else {
+ baseFreq = (8000.f * accelerationMultipler) + 16000;
+ vol = (25.0f * accelerationMultipler) + 60;
+ automobile->m_fGasPedalAudio = accelerationMultipler;
+ }
+ freq = freqModifier + baseFreq;
+ if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK)
+ freq /= 2;
+ if (channelUsed) {
+ SampleManager.StopChannel(m_nActiveSamples);
+ bAccelSampleStopped = true;
+ }
+ AddPlayerCarSample(vol, freq, (engineSoundType - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_REV_1), SAMPLEBANK_MAIN, 2, true);
+ } else {
+ TranslateEntity(&m_sQueueSample.m_vecPos, &pos);
+ if (bAccelSampleStopped) {
+ if (CurrentPretendGear != 1 || currentGear != 2) {
+ gearNr = currentGear - 1;
+ if (gearNr < 1)
+ gearNr = 1;
+ CurrentPretendGear = gearNr;
+ }
+ processedAccelSampleStopped = true;
+ bAccelSampleStopped = false;
+ }
+
+ if (!channelUsed) {
+ if (!processedAccelSampleStopped) {
+ if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1)
+ ++CurrentPretendGear;
+ else {
+ nCruising = 1;
+ break; // while was used just for this fucking place
+ }
+ }
+
+ if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SAMPLEBANK_MAIN))
+ return;
+ SampleManager.SetChannelLoopCount(m_nActiveSamples, 1);
+ SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1);
+ }
+
+ SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85);
+ SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z);
+ SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f);
+ freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
+ if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK)
+ freq /= 2;
+ SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
+ if (!channelUsed) {
+ SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false);
+ SampleManager.StartChannel(m_nActiveSamples);
+ }
+ }
+ break;
+ }
+ if (nCruising != 0) {
+ bAccelSampleStopped = true;
+ if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction ||
+ currentGear < params->m_pTransmission->nNumberOfGears - 1) {
+ nCruising = 0;
+ } else {
+ if (accelerateState >= 220 && 0.001f + params->m_fVelocityChange < automobile->m_fVelocityChangeForAudio) {
+ if (nCruising < 800)
+ ++nCruising;
+ } else if (nCruising > 3) {
+ --nCruising;
+ }
+ freq = 27 * nCruising + freqModifier + 22050;
+ if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK)
+ freq /= 2;
+ AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, true);
+ }
+ }
+ }
+ LastAccel = accelerateState;
+
+ bHandbrakeOnLastFrame = !!automobile->bIsHandbrakeOn;
+ bLostTractionLastFrame = lostTraction;
+}
+
+void
+cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 40.0f;
+
+ CAutomobile *automobile;
+ cTransmission *transmission;
+ int32 emittingVol;
+ float newSkidVal = 0.0f;
+ float skidVal = 0.0f;
+
+ if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ return;
+ automobile = (CAutomobile *)params->m_pVehicle;
+ if (!automobile->m_nWheelsOnGround)
+ return;
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
+ if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING)
+ continue;
+ transmission = params->m_pTransmission;
+ switch (transmission->nDriveType) {
+ case '4':
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ break;
+ case 'F':
+ if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT)
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ else
+ newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ break;
+ case 'R':
+ if (i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT)
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ else
+ newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ break;
+ default:
+ break;
+ }
+ skidVal = Max(skidVal, newSkidVal);
+ }
+
+ if (skidVal > 0.0f) {
+ emittingVol = 50.f * skidVal;
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 3;
+ switch (params->m_pVehicle->m_nSurfaceTouched) {
+ case SURFACE_GRASS:
+ case SURFACE_HEDGE:
+ m_sQueueSample.m_nSampleIndex = SFX_RAIN;
+ emittingVol /= 4;
+ m_sQueueSample.m_nFrequency = 13000.f * skidVal + 35000.f;
+ m_sQueueSample.m_nVolume /= 4;
+ break;
+ case SURFACE_GRAVEL:
+ case SURFACE_MUD_DRY:
+ case SURFACE_SAND:
+ case SURFACE_WATER:
+ m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
+ m_sQueueSample.m_nFrequency = 6000.f * skidVal + 10000.f;
+ break;
+
+ default:
+ m_sQueueSample.m_nSampleIndex = SFX_SKID;
+ m_sQueueSample.m_nFrequency = 5000.f * skidVal + 11000.f;
+ break;
+ }
+
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 8;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 3.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+float
+cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange)
+{
+ tWheelState wheelState;
+ float relativeVelChange;
+ float gasPedalAudio = automobile->m_fGasPedalAudio;
+ float modificator;
+ float velChange;
+ float relativeVel;
+
+ wheelState = automobile->m_aWheelState[wheel];
+ if (wheelState == WHEEL_STATE_SPINNING && gasPedalAudio > 0.4f) {
+ relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f;
+
+ } else if (wheelState == WHEEL_STATE_SKIDDING) {
+ relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
+ } else if (wheelState == WHEEL_STATE_FIXED) {
+ modificator = 0.4f;
+ relativeVelChange = gasPedalAudio;
+ if (relativeVelChange > 0.4f) {
+ relativeVelChange = relativeVelChange - 0.4f;
+ modificator = 5.f / 3.f;
+ }
+ velChange = Abs(velocityChange);
+ if (relativeVelChange > 0.4f)
+ relativeVelChange = relativeVelChange * modificator;
+ if (velChange > 0.04f) {
+ relativeVel = Min(1.0f, velChange / transmission->fMaxVelocity);
+ } else {
+ relativeVel = 0.0f;
+ }
+ if (relativeVel >= relativeVelChange)
+ relativeVelChange = relativeVel;
+ } else {
+ relativeVelChange = 0.0f;
+ }
+
+ return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
+}
+
+float
+cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange)
+{
+ float relativeVelChange;
+
+ if (automobile->m_aWheelState[wheel] == WHEEL_STATE_SKIDDING)
+ relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
+ else
+ relativeVelChange = 0.0f;
+
+ return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
+}
+
+void
+cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 40.0f;
+
+ CAutomobile *automobile;
+
+ if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
+ automobile = (CAutomobile *)params->m_pVehicle;
+ if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) {
+ if (automobile->m_nCarHornTimer) {
+ if (params->m_pVehicle->GetStatus() != STATUS_PLAYER) {
+ automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer);
+ if (automobile->m_nCarHornTimer == 44)
+ automobile->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7;
+ if (!hornPatternsArray[automobile->m_nCarHornPattern][44 - automobile->m_nCarHornTimer])
+ return;
+ }
+
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 4;
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nHornSample;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nHornFrequency;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = 80;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 5.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+}
+
+bool
+cAudioManager::UsesSiren(int32 model) const
+{
+ switch (model) {
+ case FIRETRUK:
+ case AMBULAN:
+ case FBICAR:
+ case POLICE:
+ case ENFORCER:
+ case PREDATOR:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool
+cAudioManager::UsesSirenSwitching(int32 model) const
+{
+ switch (model) {
+ case AMBULAN:
+ case POLICE:
+ case ENFORCER:
+ case PREDATOR:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool
+cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 110.0f;
+
+ if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
+ CVehicle *veh = params->m_pVehicle;
+ if (veh->m_bSirenOrAlarm == false && !veh->IsAlarmOn())
+ return true;
+
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 5;
+ if (UsesSiren(params->m_nIndex)) {
+ if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED)
+ return true;
+ if (veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) {
+ m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST;
+ if (params->m_nIndex == FBICAR)
+ m_sQueueSample.m_nFrequency = 16113;
+ else
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST);
+ m_sQueueSample.m_nCounter = 60;
+ } else {
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample;
+ m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency;
+ }
+ } else {
+ m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample;
+ m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency;
+ }
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = 80;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 7.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 5;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ return true;
+ } else
+ return true;
+ } else
+ return false;
+}
+
+bool
+cAudioManager::UsesReverseWarning(int32 model) const
+{
+ return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH;
+}
+
+bool
+cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 50.0f;
+
+ CVehicle *veh = params->m_pVehicle;
+
+ if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ return false;
+
+ if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 12;
+ m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_nFrequency = (100 * m_sQueueSample.m_nEntityIndex & 1023) + SampleManager.GetSampleBaseFrequency(SFX_REVERSE_WARNING);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = 60;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 3.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ return true;
+}
+
+bool
+cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 40.0f;
+
+ CAutomobile *automobile;
+ int8 doorState;
+ int32 emittingVol;
+ float velocity;
+
+ if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ return false;
+
+ automobile = (CAutomobile *)params->m_pVehicle;
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) {
+ if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) {
+ doorState = automobile->Doors[i].m_nDoorState;
+ if (doorState == DOORST_OPEN || doorState == DOORST_CLOSED) {
+ velocity = Min(0.3f, Abs(automobile->Doors[i].m_fAngVel));
+ if (velocity > 0.0035f) {
+ emittingVol = (100.f * velocity * 10.f / 3.f);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = i + 6;
+ m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000);
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 10;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_fSpeedMultiplier = 1.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = true;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+ }
+ return true;
+}
+
+bool
+cAudioManager::ProcessAirBrakes(cVehicleParams *params)
+{
+ CAutomobile *automobile;
+ uint8 rand;
+
+ if (params->m_fDistance > SQR(30))
+ return false;
+ automobile = (CAutomobile *)params->m_pVehicle;
+ if (!automobile->bEngineOn)
+ return true;
+
+ if ((automobile->m_fVelocityChangeForAudio < 0.025f || params->m_fVelocityChange >= 0.025f) &&
+ (automobile->m_fVelocityChangeForAudio > -0.025f || params->m_fVelocityChange <= 0.025f))
+ return true;
+
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ rand = m_anRandomTable[0] % 10 + 70;
+ m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 13;
+ m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 10;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nEmittingVolume = rand;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+
+ return true;
+}
+
+bool
+cAudioManager::HasAirBrakes(int32 model) const
+{
+ return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH;
+}
+
+bool
+cAudioManager::ProcessEngineDamage(cVehicleParams *params)
+{
+ const int engineDamageIntensity = 40;
+
+ CAutomobile *veh;
+ uint8 engineStatus;
+ uint8 emittingVolume;
+
+ if (params->m_fDistance >= SQR(engineDamageIntensity))
+ return false;
+ veh = (CAutomobile *)params->m_pVehicle;
+ if (veh->bEngineOn) {
+ engineStatus = veh->Damage.GetEngineStatus();
+ if (engineStatus > 250 || engineStatus < 100)
+ return true;
+ if (engineStatus < 225) {
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
+ emittingVolume = 6;
+ m_sQueueSample.m_nReleasingVolumeModificator = 7;
+ m_sQueueSample.m_nFrequency = 40000;
+ } else {
+ emittingVolume = 60;
+ m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
+ m_sQueueSample.m_nReleasingVolumeModificator = 7;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
+ }
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 28;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = engineDamageIntensity;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ return true;
+}
+
+bool
+cAudioManager::ProcessCarBombTick(cVehicleParams *params)
+{
+ CAutomobile *automobile;
+
+ if (params->m_fDistance >= SQR(40.f))
+ return false;
+ automobile = (CAutomobile *)params->m_pVehicle;
+ if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 35;
+ m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = 60;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = 40.0f;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ return true;
+}
+
+void
+cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
+{
+ int16 event;
+ uint8 emittingVol;
+ float relVol;
+ float vol;
+ bool noReflections;
+ float maxDist;
+ cPedParams pedParams;
+
+ static uint8 WaveIndex = 41;
+ static uint8 GunIndex = 53;
+ static uint8 iWheelIndex = 82;
+ static uint8 CrunchOffset = 0;
+
+ for (int i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
+ noReflections = 0;
+ m_sQueueSample.m_bRequireReflection = false;
+ event = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
+ switch (event) {
+ case SOUND_CAR_DOOR_CLOSE_BONNET:
+ case SOUND_CAR_DOOR_CLOSE_BUMPER:
+ case SOUND_CAR_DOOR_CLOSE_FRONT_LEFT:
+ case SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT:
+ case SOUND_CAR_DOOR_CLOSE_BACK_LEFT:
+ case SOUND_CAR_DOOR_CLOSE_BACK_RIGHT: {
+ const float SOUND_INTENSITY = 50.0f;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[2] % 5 + 122;
+ switch (aVehicleSettings[params->m_nIndex].m_bDoorType) {
+ case DOOR_TYPE_OLD:
+ m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_CLOSE;
+ break;
+ case DOOR_TYPE_NEW:
+ default:
+ m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE;
+ break;
+ case DOOR_TYPE_TRUCK:
+ m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_CLOSE;
+ break;
+ case DOOR_TYPE_AIRBREAK:
+ m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
+ break;
+ }
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 22;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ }
+ case SOUND_CAR_DOOR_OPEN_BONNET:
+ case SOUND_CAR_DOOR_OPEN_BUMPER:
+ case SOUND_CAR_DOOR_OPEN_FRONT_LEFT:
+ case SOUND_CAR_DOOR_OPEN_FRONT_RIGHT:
+ case SOUND_CAR_DOOR_OPEN_BACK_LEFT:
+ case SOUND_CAR_DOOR_OPEN_BACK_RIGHT: {
+ const float SOUND_INTENSITY = 50.0f;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[1] % 10 + 117;
+ switch (aVehicleSettings[params->m_nIndex].m_bDoorType) {
+ case DOOR_TYPE_OLD:
+ m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_OPEN;
+ break;
+ case DOOR_TYPE_NEW:
+ default:
+ m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_OPEN;
+ break;
+ case DOOR_TYPE_TRUCK:
+ m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_OPEN;
+ break;
+ case DOOR_TYPE_AIRBREAK:
+ m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
+ break;
+ }
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 10;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ }
+ case SOUND_CAR_WINDSHIELD_CRACK: {
+ const float SOUND_INTENSITY = 30.0f;
+ maxDist = SQR(SOUND_INTENSITY);
+ m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 68;
+ emittingVol = m_anRandomTable[1] % 30 + 60;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK);
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ } break;
+ case SOUND_CAR_JUMP: {
+ const float SOUND_INTENSITY = 35.0f;
+ emittingVol = Max(80.f, 2 * (100.f * m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]));
+ maxDist = SQR(SOUND_INTENSITY);
+ m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iWheelIndex++;
+ if (iWheelIndex > 85)
+ iWheelIndex = 82;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ if (params->m_nIndex == RCBANDIT) {
+ m_sQueueSample.m_nFrequency *= 2;
+ emittingVol /= 2;
+ }
+ m_sQueueSample.m_nReleasingVolumeModificator = 6;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ break;
+ }
+ case SOUND_CAR_ENGINE_START: {
+ const float SOUND_INTENSITY = 40.0f;
+ emittingVol = 60;
+ maxDist = SQR(SOUND_INTENSITY);
+ m_sQueueSample.m_nSampleIndex = SFX_CAR_STARTER;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 33;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_STARTER);
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ }
+ case SOUND_CAR_LIGHT_BREAK: {
+ const float SOUND_INTENSITY = 30.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_GLASS_SHARD_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 37;
+ m_sQueueSample.m_nFrequency = 9 * SampleManager.GetSampleBaseFrequency(SFX_GLASS_SHARD_1) / 10;
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[4] % 10 + 30;
+ break;
+ }
+ case SOUND_CAR_HYDRAULIC_1:
+ case SOUND_CAR_HYDRAULIC_2: {
+ const float SOUND_INTENSITY = 35.0f;
+ if (event == SOUND_CAR_HYDRAULIC_1)
+ m_sQueueSample.m_nFrequency = 15600;
+ else
+ m_sQueueSample.m_nFrequency = 13118;
+ m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_FAST_MOVE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 51;
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[0] % 15 + 55;
+ break;
+ }
+ case SOUND_CAR_HYDRAULIC_3: {
+ const float SOUND_INTENSITY = 35.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_SLOW_MOVE_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 86;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SUSPENSION_SLOW_MOVE_LOOP);
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_nReleasingVolumeDivider = 7;
+ noReflections = true;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[0] % 15 + 55;
+ break;
+ }
+ case SOUND_CAR_JERK: {
+ const float SOUND_INTENSITY = 35.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_SHAG_SUSPENSION;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 87;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHAG_SUSPENSION);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[1] % 15 + 55;
+ break;
+ }
+ case SOUND_CAR_SPLASH: {
+ const float SOUND_INTENSITY = 40.0f;
+ vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
+ if (vol <= 300.f)
+ continue;
+ if (vol > 1200.f)
+ m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] = 1200.0f;
+ relVol = (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] - 300.f) / 900.f;
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[0] & 1) + SFX_BOAT_SPLASH_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = WaveIndex++;
+ if (WaveIndex > 46)
+ WaveIndex = 41;
+ m_sQueueSample.m_nFrequency = (7000.f * relVol) + 6000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ emittingVol = (55.f * relVol);
+ maxDist = SQR(SOUND_INTENSITY);
+ break;
+ }
+ case SOUND_BOAT_SLOWDOWN: {
+ const float SOUND_INTENSITY = 50.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_THUMB_OFF;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 47;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BOAT_THUMB_OFF) + RandomDisplacement(600);
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ emittingVol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
+ maxDist = SQR(SOUND_INTENSITY);
+ break;
+ }
+ case SOUND_TRAIN_DOOR_CLOSE:
+ case SOUND_TRAIN_DOOR_OPEN: {
+ const float SOUND_INTENSITY = 35.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 59;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 11025;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 5.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[1] % 20 + 70;
+ break;
+ }
+ case SOUND_CAR_TANK_TURRET_ROTATE: {
+ const float SOUND_INTENSITY = 40.0f;
+ vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
+ if (vol > 96.0f / 2500.0f)
+ vol = 96.0f / 2500.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_TANK_TURRET;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 79;
+ m_sQueueSample.m_nFrequency = (3000.f * vol * 2500.0f / 96.0f) + 9000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ emittingVol = (37.f * vol * 2500.0f / 96.0f) + 90;
+ maxDist = SQR(SOUND_INTENSITY);
+ noReflections = true;
+ break;
+ }
+ case SOUND_CAR_BOMB_TICK: {
+ const float SOUND_INTENSITY = 30.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_BOMB_BEEP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 80;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BOMB_BEEP);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVol = 60;
+ break;
+ }
+ case SOUND_PLANE_ON_GROUND: {
+ const float SOUND_INTENSITY = 180.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_LAND_WHEELS;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 81;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_LAND_WHEELS);
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[4] % 25 + 75;
+ break;
+ }
+ case SOUND_WEAPON_SHOT_FIRED: {
+ const float SOUND_INTENSITY = 120.0f;
+ emittingVol = m_anRandomTable[2];
+ maxDist = SQR(SOUND_INTENSITY);
+ m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = GunIndex++;
+ emittingVol = emittingVol % 15 + 65;
+ if (GunIndex > 58)
+ GunIndex = 53;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ break;
+ }
+ case SOUND_WEAPON_HIT_VEHICLE: {
+ const float SOUND_INTENSITY = 40.0f;
+ m_sQueueSample.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex % ARRAY_SIZE(m_anRandomTable)] % 6 + SFX_BULLET_CAR_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 34;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 7;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[3] % 20 + 90;
+ break;
+ }
+ case SOUND_BOMB_TIMED_ACTIVATED:
+ case SOUND_55:
+ case SOUND_BOMB_ONIGNITION_ACTIVATED:
+ case SOUND_BOMB_TICK: {
+ const float SOUND_INTENSITY = 50.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_ARM_BOMB;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 36;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARM_BOMB);
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVol = 50;
+ maxDist = SQR(SOUND_INTENSITY);
+ break;
+ }
+ case SOUND_PED_HELI_PLAYER_FOUND:
+ pedParams.m_pPed = nil;
+ pedParams.m_bDistanceCalculated = false;
+ pedParams.m_fDistance = 0.0f;
+ pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated;
+ pedParams.m_fDistance = params->m_fDistance;
+ SetupPedComments(&pedParams, SOUND_PED_HELI_PLAYER_FOUND);
+ continue;
+ case SOUND_PED_BODYCAST_HIT:
+ pedParams.m_pPed = nil;
+ pedParams.m_bDistanceCalculated = false;
+ pedParams.m_fDistance = 0.0f;
+ pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated;
+ pedParams.m_fDistance = params->m_fDistance;
+ SetupPedComments(&pedParams, SOUND_PED_BODYCAST_HIT);
+ continue;
+ case SOUND_WATER_FALL: {
+ const float SOUND_INTENSITY = 40.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 15;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 16000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVol = m_anRandomTable[4] % 20 + 90;
+ break;
+ }
+ case SOUND_SPLATTER: {
+ const float SOUND_INTENSITY = 40.0f;
+ m_sQueueSample.m_nSampleIndex = CrunchOffset + SFX_PED_CRUNCH_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 48;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_CRUNCH_1) + RandomDisplacement(600);
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 40.0f;
+ ++CrunchOffset;
+ maxDist = SQR(SOUND_INTENSITY);
+ emittingVol = m_anRandomTable[4] % 20 + 55;
+ CrunchOffset %= 2;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ }
+ case SOUND_CAR_PED_COLLISION: {
+ const float SOUND_INTENSITY = 40.0f;
+ vol = Min(20.0f, m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]);
+ emittingVol = (vol / 20.0f * 127.f);
+ if (!emittingVol)
+ continue;
+
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[2] & 3) + SFX_FIGHT_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 50;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ maxDist = SQR(SOUND_INTENSITY);
+ break;
+ }
+ default:
+ continue;
+ }
+ if (params->m_fDistance < maxDist) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ if (noReflections) {
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ } else {
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ }
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bIs2D = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+}
+
+bool
+cAudioManager::ProcessTrainNoise(cVehicleParams *params)
+{
+ const float SOUND_INTENSITY = 300.0f;
+
+ CTrain *train;
+ uint8 emittingVol;
+ float speedMultipler;
+
+ if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ return false;
+
+ if (params->m_fVelocityChange > 0.0f) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ train = (CTrain *)params->m_pVehicle;
+ speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f);
+ emittingVol = (75.f * speedMultipler);
+ if (train->m_fWagonPosition == 0.0f) {
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 32;
+ m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_FAR);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 3.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ const float SOUND_INTENSITY = 70.0f;
+ if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 33;
+ m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 6.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ return true;
+}
+
+bool
+cAudioManager::ProcessBoatEngine(cVehicleParams *params)
+{
+ CBoat *boat;
+ float padRelativeAccerate;
+ float gasPedal;
+ int32 padAccelerate;
+ uint8 emittingVol;
+ float oneShotVol;
+
+ static uint16 LastAccel = 0;
+ static uint8 LastVol = 0;
+
+ static const int intensity = 50;
+
+ if (params->m_fDistance < SQR(intensity)) {
+ boat = (CBoat *)params->m_pVehicle;
+ if (params->m_nIndex == REEFER) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 39;
+ m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
+ m_sQueueSample.m_nFrequency = 10386;
+ m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = 80;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = intensity;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 7;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ if (FindPlayerVehicle() == params->m_pVehicle) {
+ if (Pads[0].GetAccelerate() <= Pads[0].GetBrake())
+ padAccelerate = Pads[0].GetBrake();
+ else
+ padAccelerate = Pads[0].GetAccelerate();
+ padRelativeAccerate = padAccelerate / 255;
+ emittingVol = (100.f * padRelativeAccerate) + 15;
+ m_sQueueSample.m_nFrequency = (3000.f * padRelativeAccerate) + 6000;
+ if (!boat->m_bIsAnchored)
+ m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
+ } else {
+ gasPedal = Abs(boat->m_fGasPedal);
+ if (gasPedal > 0.0f) {
+ m_sQueueSample.m_nFrequency = 6000;
+ emittingVol = 15;
+ } else {
+ emittingVol = (100.f * gasPedal) + 15;
+ m_sQueueSample.m_nFrequency = (3000.f * gasPedal) + 6000;
+ if (!boat->m_bIsAnchored)
+ m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
+ }
+ }
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
+ if (!m_sQueueSample.m_nVolume)
+ return true;
+ m_sQueueSample.m_nCounter = 40;
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
+ m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = intensity;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 7;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ } else {
+ if (FindPlayerVehicle() == params->m_pVehicle) {
+ if (Pads[0].GetAccelerate() <= Pads[0].GetBrake())
+ padAccelerate = Pads[0].GetBrake();
+ else
+ padAccelerate = Pads[0].GetAccelerate();
+ if (padAccelerate <= 20) {
+ emittingVol = 45 - 45 * padAccelerate / 40;
+ m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025;
+ m_sQueueSample.m_nCounter = 39;
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE;
+ if (LastAccel > 20) {
+ oneShotVol = LastVol;
+ PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_BOAT_SLOWDOWN, oneShotVol);
+ }
+ } else {
+ emittingVol = 105 * padAccelerate / 255 + 15;
+ m_sQueueSample.m_nFrequency = 4000 * padAccelerate / 255 + 8000;
+ if (!boat->m_bIsAnchored)
+ m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
+ m_sQueueSample.m_nCounter = 40;
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
+ }
+ LastVol = emittingVol;
+ LastAccel = padAccelerate;
+ } else {
+ gasPedal = Abs(boat->m_fGasPedal);
+ if (gasPedal > 0.0f) {
+ m_sQueueSample.m_nFrequency = 11025;
+ emittingVol = 45;
+ m_sQueueSample.m_nCounter = 39;
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE;
+ } else {
+ emittingVol = (105.f * gasPedal) + 15;
+ m_sQueueSample.m_nFrequency = (4000.f * gasPedal) + 8000;
+ if (!boat->m_bIsAnchored)
+ m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
+ m_sQueueSample.m_nCounter = 40;
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
+ }
+ }
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
+ if (!m_sQueueSample.m_nVolume)
+ return true;
+ m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = intensity;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 7;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ }
+ AddSampleToRequestedQueue();
+ return true;
+ }
+ return false;
+}
+
+bool
+cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
+{
+ float velocityChange;
+ int32 vol;
+ float multiplier;
+
+ if (params->m_fDistance > SQR(50))
+ return false;
+
+ velocityChange = Abs(params->m_fVelocityChange);
+ if (velocityChange <= 0.0005f && ((CBoat*)params->m_pVehicle)->bBoatInWater)
+ return true;
+
+ velocityChange = Min(0.75f, velocityChange);
+ multiplier = (velocityChange - 0.0005f) * 1.3342f;
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ vol = (30.f * multiplier);
+ m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 38;
+ m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = vol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+
+ return true;
+}
+
+struct tHelicopterSampleData {
+ float m_fMaxDistance;
+ float m_fBaseDistance;
+ uint8 m_bBaseVolume;
+};
+
+bool
+cAudioManager::ProcessHelicopter(cVehicleParams *params)
+{
+ CHeli *heli;
+ float MaxDist;
+ float dist;
+ float baseDist;
+ int32 emittingVol;
+ static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, MAX_VOLUME}, {60.f, 30.f, MAX_VOLUME}};
+
+ if (SQR(gHeliSfxRanges[0].m_fMaxDistance) <= params->m_fDistance)
+ return false;
+
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ heli = (CHeli *)params->m_pVehicle;
+ for (uint32 i = 0; i < ARRAY_SIZE(gHeliSfxRanges); i++) {
+ MaxDist = gHeliSfxRanges[i].m_fMaxDistance;
+ dist = m_sQueueSample.m_fDistance;
+ if (dist >= MaxDist)
+ return true;
+ baseDist = gHeliSfxRanges[i].m_fBaseDistance;
+ if (dist < baseDist)
+ emittingVol = (gHeliSfxRanges[i].m_bBaseVolume * ((MaxDist - dist) / (MaxDist - baseDist)));
+ else
+ emittingVol = gHeliSfxRanges[i].m_bBaseVolume;
+
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = i + 65;
+ m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nFrequency = 1200 * heli->m_nHeliId + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 6.0f;
+ m_sQueueSample.m_fSoundIntensity = gHeliSfxRanges[i].m_fMaxDistance;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ return true;
+}
+
+void
+cAudioManager::ProcessPlane(cVehicleParams *params)
+{
+ switch (params->m_nIndex) {
+ case AIRTRAIN:
+ ProcessJumbo(params);
+ break;
+ case DEADDODO:
+ ProcessCesna(params);
+ break;
+ default:
+ debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex());
+ break;
+ }
+}
+
+#pragma region JUMBO
+uint8 gJumboVolOffsetPercentage;
+
+void
+DoJumboVolOffset()
+{
+ if (!(AudioManager.GetFrameCounter() % (AudioManager.GetRandomNumber(0) % 6 + 3)))
+ gJumboVolOffsetPercentage = AudioManager.GetRandomNumber(1) % 60;
+}
+
+void
+cAudioManager::ProcessJumbo(cVehicleParams *params)
+{
+ CPlane *plane;
+ float position;
+
+ if (params->m_fDistance < SQR(440)) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ plane = (CPlane *)params->m_pVehicle;
+ DoJumboVolOffset();
+ position = PlanePathPosition[plane->m_nPlaneId];
+ if (position <= TakeOffPoint) {
+ if (plane->m_fSpeed <= 0.10334f) {
+ ProcessJumboTaxi();
+ return;
+ }
+
+ ProcessJumboAccel(plane);
+ } else if (300.0f + TakeOffPoint >= position) {
+ ProcessJumboTakeOff(plane);
+ } else if (LandingPoint - 350.0f >= position) {
+ ProcessJumboFlying();
+ } else {
+ if (position > LandingPoint) {
+ if (plane->m_fSpeed > 0.10334f) {
+ ProcessJumboDecel(plane);
+ return;
+ }
+ ProcessJumboTaxi();
+ return;
+ }
+ ProcessJumboLanding(plane);
+ }
+ }
+}
+
+void
+cAudioManager::ProcessJumboTaxi()
+{
+ if (SetupJumboFlySound(20)) {
+ if (SetupJumboTaxiSound(75))
+ SetupJumboWhineSound(18, 29500);
+ }
+}
+
+void
+cAudioManager::ProcessJumboAccel(CPlane *plane)
+{
+ int32 engineFreq;
+ int32 vol;
+ float whineSoundFreq;
+ float modificator;
+
+ if (SetupJumboFlySound(20)) {
+ modificator = (plane->m_fSpeed - 0.10334f) * 1.676f;
+ if (modificator > 1.0f)
+ modificator = 1.0f;
+ if (SetupJumboRumbleSound(MAX_VOLUME * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) {
+ if (modificator < 0.2f) {
+ whineSoundFreq = modificator * 5.f * 14600.0f + 29500;
+ vol = modificator * 5.f * MAX_VOLUME;
+ engineFreq = modificator * 5.f * 6050.f + 16000;
+ } else {
+ whineSoundFreq = 44100;
+ engineFreq = 22050;
+ vol = MAX_VOLUME;
+ }
+ SetupJumboEngineSound(vol, engineFreq);
+ SetupJumboWhineSound(18, whineSoundFreq);
+ }
+ }
+}
+
+void
+cAudioManager::ProcessJumboTakeOff(CPlane *plane)
+{
+ const float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f;
+
+ if (SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(MAX_VOLUME * (1.f - modificator))) {
+ if (SetupJumboEngineSound(MAX_VOLUME, 22050))
+ SetupJumboWhineSound(18.f * (1.f - modificator), 44100);
+ }
+}
+
+void
+cAudioManager::ProcessJumboFlying()
+{
+ if (SetupJumboFlySound(MAX_VOLUME))
+ SetupJumboEngineSound(63, 22050);
+}
+
+void
+cAudioManager::ProcessJumboLanding(CPlane *plane)
+{
+ const float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f;
+ if (SetupJumboFlySound(107.f * modificator + 20)) {
+ if (SetupJumboTaxiSound(75.f * (1.f - modificator))) {
+ SetupJumboEngineSound(MAX_VOLUME, 22050);
+ SetupJumboWhineSound(18.f * (1.f - modificator), 14600.f * modificator + 29500);
+ }
+ }
+}
+
+void
+cAudioManager::ProcessJumboDecel(CPlane *plane)
+{
+ if (SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) {
+ const float modificator = Min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f);
+ SetupJumboEngineSound(MAX_VOLUME * modificator, 6050.f * modificator + 16000);
+ SetupJumboWhineSound(18, 29500);
+ }
+}
+
+bool
+cAudioManager::SetupJumboTaxiSound(uint8 vol)
+{
+ const float SOUND_INTENSITY = 180.0f;
+ if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
+ return false;
+
+ uint8 emittingVol = (vol / 2) + ((vol / 2) * m_sQueueSample.m_fDistance / SOUND_INTENSITY);
+
+ if (m_sQueueSample.m_fDistance / SOUND_INTENSITY < 0.7f)
+ emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 1;
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nFrequency = GetJumboTaxiFreq();
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 4;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ return true;
+}
+
+bool
+cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
+{
+ const float SOUND_INTENSITY = 170.0f;
+
+ if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
+ return false;
+
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 2;
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nFrequency = freq;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 4;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ return true;
+}
+
+bool
+cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq)
+{
+ const float SOUND_INTENSITY = 180.0f;
+ if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
+ return false;
+
+ uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100;
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 3;
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nFrequency = freq;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 4;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ return true;
+}
+
+bool
+cAudioManager::SetupJumboFlySound(uint8 emittingVol)
+{
+ const float SOUND_INTENSITY = 440.0f;
+ if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
+ return false;
+
+ int32 vol = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_nVolume = vol;
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY;
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY);
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_nReleasingVolumeDivider = 5;
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ AddSampleToRequestedQueue();
+ }
+ return true;
+}
+
+bool
+cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
+{
+ const float SOUND_INTENSITY = 240.0f;
+ if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
+ return false;
+
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 5;
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 12;
+ m_sQueueSample.m_nOffset = 0;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ m_sQueueSample.m_nCounter = 6;
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
+ m_sQueueSample.m_nFrequency += 200;
+ m_sQueueSample.m_nOffset = MAX_VOLUME;
+ AddSampleToRequestedQueue();
+ }
+ return true;
+}
+
+int32
+cAudioManager::GetJumboTaxiFreq() const
+{
+ return (60.833f * m_sQueueSample.m_fDistance) + 22050;
+}
+
+#pragma endregion Some jumbo crap
+
+#pragma endregion All the vehicle audio code
+
+#pragma region PED AUDIO
+void
+cAudioManager::ProcessPed(CPhysical *ped)
+{
+ cPedParams params;
+
+ params.m_pPed = nil;
+ params.m_bDistanceCalculated = false;
+ params.m_fDistance = 0.0f;
+
+ m_sQueueSample.m_vecPos = ped->GetPosition();
+
+ // params.m_bDistanceCalculated = false;
+ params.m_pPed = (CPed *)ped;
+ params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (ped->GetModelIndex() == MI_FATMALE02)
+ ProcessPedHeadphones(&params);
+ ProcessPedOneShots(&params);
+}
+
+void
+cAudioManager::ProcessPedHeadphones(cPedParams *params)
+{
+ CPed *ped;
+ CAutomobile *veh;
+ uint8 emittingVol;
+
+ if (params->m_fDistance < SQR(7)) {
+ ped = params->m_pPed;
+ if (!ped->bIsAimingGun || ped->m_bodyPartBleeding != PED_HEAD) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ if (ped->bInVehicle && ped->m_nPedState == PED_DRIVING) {
+ emittingVol = 10;
+ veh = (CAutomobile *)ped->m_pMyVehicle;
+ if (veh && veh->IsCar()) {
+ for (int32 i = DOOR_FRONT_LEFT; i < ARRAY_SIZE(veh->Doors); i++) {
+ if (!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) {
+ emittingVol = 42;
+ break;
+ }
+ }
+ }
+ } else {
+ emittingVol = 42;
+ }
+
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 64;
+ m_sQueueSample.m_nSampleIndex = SFX_HEADPHONES;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_HEADPHONES);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = 7.0f;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 5;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ return;
+ }
+ }
+}
+
+void
+cAudioManager::ProcessPedOneShots(cPedParams *params)
+{
+ uint8 emittingVol;
+ int32 sampleIndex;
+
+ CPed *ped = params->m_pPed;
+
+ bool stereo;
+ int16 sound;
+ bool noReflection;
+ CWeapon *weapon;
+ float maxDist = 0.f; // uninitialized variable
+
+ static uint8 iSound = 21;
+
+ weapon = params->m_pPed->GetWeapon();
+ for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
+ noReflection = false;
+ stereo = false;
+ m_sQueueSample.m_bRequireReflection = false;
+ sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
+ 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 = SAMPLEBANK_MAIN;
+ 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;
+ }
+ 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 = SAMPLEBANK_MAIN;
+ 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;
+ m_sQueueSample.m_nFrequency = 18000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_KICK_34:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
+ m_sQueueSample.m_nFrequency = 16500;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_HEADBUTT_35:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
+ m_sQueueSample.m_nFrequency = 20000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_36:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2;
+ m_sQueueSample.m_nFrequency = 18000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_37:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2;
+ m_sQueueSample.m_nFrequency = 16500;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_CLOSE_PUNCH_38:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2;
+ m_sQueueSample.m_nFrequency = 20000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_39:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4;
+ m_sQueueSample.m_nFrequency = 18000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_OR_KICK_BELOW_40:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4;
+ m_sQueueSample.m_nFrequency = 16500;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_41:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4;
+ m_sQueueSample.m_nFrequency = 20000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_FROM_BEHIND_42:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5;
+ m_sQueueSample.m_nFrequency = 18000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_KNEE_OR_KICK_43:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5;
+ m_sQueueSample.m_nFrequency = 16500;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_KICK_44:
+ m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5;
+ m_sQueueSample.m_nFrequency = 20000;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound;
+ stereo = true;
+ ++iSound;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 26 + 100;
+ 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_WEAPON_BAT_ATTACK:
+ m_sQueueSample.m_nSampleIndex = SFX_BAT_HIT_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 22000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ emittingVol = m_anRandomTable[2] % 20 + 100;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ if (m_bDynamicAcousticModelingStatus)
+ m_sQueueSample.m_bRequireReflection = true;
+ else
+ noReflection = true;
+ break;
+ case SOUND_WEAPON_SHOT_FIRED:
+ weapon = ped->GetWeapon();
+ switch (weapon->m_eWeaponType) {
+ case WEAPONTYPE_COLT45:
+ m_sQueueSample.m_nSampleIndex = SFX_COLT45_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COLT45_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ maxDist = SQR(50);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ emittingVol = m_anRandomTable[1] % 10 + 90;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ if (m_bDynamicAcousticModelingStatus)
+ m_sQueueSample.m_bRequireReflection = true;
+ else
+ noReflection = true;
+ break;
+ case WEAPONTYPE_UZI:
+ m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 80.0f;
+ maxDist = SQR(80);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[3] % 15 + 70;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ break;
+ case WEAPONTYPE_SHOTGUN:
+ m_sQueueSample.m_nSampleIndex = SFX_SHOTGUN_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOTGUN_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ maxDist = SQR(60);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ emittingVol = m_anRandomTable[2] % 10 + 100;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ if (m_bDynamicAcousticModelingStatus)
+ m_sQueueSample.m_bRequireReflection = true;
+ else
+ noReflection = true;
+ break;
+ case WEAPONTYPE_AK47:
+ m_sQueueSample.m_nSampleIndex = SFX_AK47_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 80.0f;
+ maxDist = SQR(80);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[1] % 15 + 70;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ break;
+ case WEAPONTYPE_M16:
+ m_sQueueSample.m_nSampleIndex = SFX_M16_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 80.0f;
+ maxDist = SQR(80);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[4] % 15 + 70;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ break;
+ case WEAPONTYPE_SNIPERRIFLE:
+ m_sQueueSample.m_nSampleIndex = SFX_SNIPER_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SNIPER_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ maxDist = SQR(60);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ emittingVol = m_anRandomTable[4] % 10 + 110;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ if (m_bDynamicAcousticModelingStatus)
+ m_sQueueSample.m_bRequireReflection = true;
+ else
+ noReflection = true;
+ break;
+ case WEAPONTYPE_ROCKETLAUNCHER:
+ m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 90.0f;
+ maxDist = SQR(90);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ emittingVol = m_anRandomTable[0] % 20 + 80;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ if (m_bDynamicAcousticModelingStatus)
+ m_sQueueSample.m_bRequireReflection = true;
+ else
+ noReflection = true;
+ break;
+ case WEAPONTYPE_FLAMETHROWER:
+ m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = 9;
+ emittingVol = 90;
+ m_sQueueSample.m_nFrequency = (10 * m_sQueueSample.m_nEntityIndex & 2047) + SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_LEFT);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ maxDist = SQR(60);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nEmittingVolume = 90;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 6;
+ if (m_bDynamicAcousticModelingStatus)
+ m_sQueueSample.m_bRequireReflection = true;
+ else
+ noReflection = true;
+ break;
+ default:
+ continue;
+ }
+
+ break;
+ case SOUND_WEAPON_RELOAD:
+ weapon = &ped->m_weapons[ped->m_currentWeapon];
+ switch (weapon->m_eWeaponType) {
+ case WEAPONTYPE_COLT45:
+ m_sQueueSample.m_nSampleIndex = SFX_PISTOL_RELOAD;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PISTOL_RELOAD) + RandomDisplacement(300);
+ break;
+ case WEAPONTYPE_UZI:
+ m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD;
+ m_sQueueSample.m_nFrequency = 39243;
+ break;
+ case WEAPONTYPE_SHOTGUN:
+ m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
+ m_sQueueSample.m_nFrequency = 30290;
+ break;
+ case WEAPONTYPE_AK47:
+ m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_RELOAD);
+ break;
+ case WEAPONTYPE_M16:
+ m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_RELOAD);
+ break;
+ case WEAPONTYPE_SNIPERRIFLE:
+ m_sQueueSample.m_nSampleIndex = SFX_RIFLE_RELOAD;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RIFLE_RELOAD);
+ break;
+ case WEAPONTYPE_ROCKETLAUNCHER:
+ m_sQueueSample.m_nSampleIndex = SFX_ROCKET_RELOAD;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_RELOAD);
+ break;
+ default:
+ continue;
+ }
+ emittingVol = 75;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency += RandomDisplacement(300);
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_nEmittingVolume = 75;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ case SOUND_WEAPON_AK47_BULLET_ECHO:
+ case SOUND_WEAPON_UZI_BULLET_ECHO:
+ case SOUND_WEAPON_M16_BULLET_ECHO:
+ m_sQueueSample.m_nSampleIndex = SFX_UZI_END_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_END_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 80.0f;
+ maxDist = SQR(80);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ emittingVol = m_anRandomTable[4] % 10 + 40;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ if (m_bDynamicAcousticModelingStatus)
+ m_sQueueSample.m_bRequireReflection = true;
+ else
+ noReflection = true;
+ break;
+ case SOUND_WEAPON_FLAMETHROWER_FIRE:
+ m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_START_LEFT;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_START_LEFT);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ maxDist = SQR(60);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ emittingVol = 70;
+ m_sQueueSample.m_nEmittingVolume = 70;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ break;
+ case SOUND_WEAPON_HIT_PED:
+ m_sQueueSample.m_nSampleIndex = SFX_BULLET_PED;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BULLET_PED);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
+ m_sQueueSample.m_nReleasingVolumeModificator = 7;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = SQR(30);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[0] % 20 + 90;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ break;
+ case SOUND_SPLASH:
+ m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = true;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(1400) + 20000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 40.0f;
+ maxDist = SQR(40);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ emittingVol = m_anRandomTable[2] % 30 + 70;
+ 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;
+ default:
+ SetupPedComments(params, sound);
+ continue;
+ }
+
+ if (stereo && iSound > 60)
+ iSound = 21;
+ if (params->m_fDistance < maxDist) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ if (noReflection) {
+ if (m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_fSoundIntensity) {
+ m_sQueueSample.m_bIs2D = true;
+ m_sQueueSample.m_nOffset = 0;
+ } else {
+ noReflection = false;
+ }
+ }
+ m_sQueueSample.m_bReverbFlag = true;
+ AddSampleToRequestedQueue();
+ if (noReflection) {
+ m_sQueueSample.m_nOffset = 127;
+ ++m_sQueueSample.m_nSampleIndex;
+ if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] != SOUND_WEAPON_SHOT_FIRED ||
+ weapon->m_eWeaponType != WEAPONTYPE_FLAMETHROWER) {
+ m_sQueueSample.m_nCounter = iSound++;
+ if (iSound > 60)
+ iSound = 21;
+ } else {
+ ++m_sQueueSample.m_nCounter;
+ }
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+}
+
+void
+cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
+{
+ CPed *ped = params->m_pPed;
+ uint8 emittingVol;
+ float soundIntensity;
+ tPedComment pedComment;
+
+ if (ped != nil) {
+ switch (sound) {
+ case SOUND_AMMUNATION_WELCOME_1:
+ pedComment.m_nSampleIndex = SFX_AMMU_D;
+ break;
+ case SOUND_AMMUNATION_WELCOME_2:
+ pedComment.m_nSampleIndex = SFX_AMMU_E;
+ break;
+ case SOUND_AMMUNATION_WELCOME_3:
+ pedComment.m_nSampleIndex = SFX_AMMU_F;
+ break;
+ default:
+ pedComment.m_nSampleIndex = GetPedCommentSfx(ped, sound);
+ if (pedComment.m_nSampleIndex == NO_SAMPLE)
+ return;
+ break;
+ }
+
+ soundIntensity = 50.0f;
+ } else {
+ switch (sound) {
+ case SOUND_PED_HELI_PLAYER_FOUND:
+ soundIntensity = 400.0f;
+ pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_POLICE_HELI_1, SFX_POLICE_HELI_29);
+ break;
+ case SOUND_PED_BODYCAST_HIT:
+ if (CTimer::GetTimeInMilliseconds() <= gNextCryTime)
+ return;
+ soundIntensity = 50.0f;
+ gNextCryTime = CTimer::GetTimeInMilliseconds() + 500;
+ pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_PLASTER_BLOKE_1, SFX_PLASTER_BLOKE_4);
+ break;
+ case SOUND_INJURED_PED_MALE_OUCH:
+ case SOUND_INJURED_PED_MALE_PRISON:
+ soundIntensity = 50.0f;
+ pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_MALE_GRUNT_1, SFX_GENERIC_MALE_GRUNT_15);
+ break;
+ case SOUND_INJURED_PED_FEMALE:
+ soundIntensity = 50.0f;
+ pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_FEMALE_GRUNT_1, SFX_GENERIC_FEMALE_GRUNT_11);
+ break;
+ default:
+ return;
+ }
+ }
+
+ if (params->m_fDistance < SQR(soundIntensity)) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ if (sound != SOUND_PAGER) {
+ switch (sound) {
+ case SOUND_AMMUNATION_WELCOME_1:
+ case SOUND_AMMUNATION_WELCOME_2:
+ case SOUND_AMMUNATION_WELCOME_3:
+ emittingVol = MAX_VOLUME;
+ break;
+ default:
+ if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, true, false, false, false, false, false))
+ emittingVol = MAX_VOLUME;
+ else
+ emittingVol = 31;
+ break;
+ }
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
+ pedComment.m_nProcess = 10;
+ if (m_sQueueSample.m_nVolume != 0) {
+ pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
+ pedComment.m_vecPos = m_sQueueSample.m_vecPos;
+ pedComment.m_fDistance = m_sQueueSample.m_fDistance;
+ pedComment.m_bVolume = m_sQueueSample.m_nVolume;
+ m_sPedComments.Add(&pedComment);
+ }
+ }
+ }
+}
+
+int32
+cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
+{
+ if (ped->IsPlayer())
+ return GetPlayerTalkSfx(sound);
+
+ switch (ped->GetModelIndex()) {
+ case MI_COP:
+ return GetCopTalkSfx(sound);
+ case MI_SWAT:
+ return GetSwatTalkSfx(sound);
+ case MI_FBI:
+ return GetFBITalkSfx(sound);
+ case MI_ARMY:
+ return GetArmyTalkSfx(sound);
+ case MI_MEDIC:
+ return GetMedicTalkSfx(sound);
+ case MI_FIREMAN:
+ return GetFiremanTalkSfx(sound);
+ case MI_MALE01:
+ return GetNormalMaleTalkSfx(sound);
+ case MI_TAXI_D:
+ return GetTaxiDriverTalkSfx(sound);
+ case MI_PIMP:
+ return GetPimpTalkSfx(sound);
+ case MI_GANG01:
+ case MI_GANG02:
+ return GetMafiaTalkSfx(sound);
+ case MI_GANG03:
+ case MI_GANG04:
+ return GetTriadTalkSfx(sound);
+ case MI_GANG05:
+ case MI_GANG06:
+ return GetDiabloTalkSfx(sound);
+ case MI_GANG07:
+ case MI_GANG08:
+ return GetYakuzaTalkSfx(sound);
+ case MI_GANG09:
+ case MI_GANG10:
+ return GetYardieTalkSfx(sound);
+ case MI_GANG11:
+ case MI_GANG12:
+ return GetColumbianTalkSfx(sound);
+ case MI_GANG13:
+ case MI_GANG14:
+ return GetHoodTalkSfx(sound);
+ case MI_CRIMINAL01:
+ return GetBlackCriminalTalkSfx(sound);
+ case MI_CRIMINAL02:
+ return GetWhiteCriminalTalkSfx(sound);
+ case MI_SPECIAL01:
+ case MI_SPECIAL02:
+ case MI_SPECIAL03:
+ case MI_SPECIAL04:
+ return GetSpecialCharacterTalkSfx(ped->GetModelIndex(), sound);
+ case MI_MALE02:
+ return GetMaleNo2TalkSfx(sound);
+ case MI_MALE03:
+ case MI_P_MAN1:
+ case MI_P_MAN2:
+ return GetBlackProjectMaleTalkSfx(sound, ped->GetModelIndex());
+ case MI_FATMALE01:
+ return GetWhiteFatMaleTalkSfx(sound);
+ case MI_FATMALE02:
+ return GetBlackFatMaleTalkSfx(sound);
+ case MI_FEMALE01:
+ return GetBlackCasualFemaleTalkSfx(sound);
+ case MI_FEMALE02:
+ case MI_CAS_WOM:
+ return GetWhiteCasualFemaleTalkSfx(sound);
+ case MI_FEMALE03:
+ return GetFemaleNo3TalkSfx(sound);
+ case MI_FATFEMALE01:
+ return GetBlackFatFemaleTalkSfx(sound);
+ case MI_FATFEMALE02:
+ return GetWhiteFatFemaleTalkSfx(sound);
+ case MI_PROSTITUTE:
+ return GetBlackFemaleProstituteTalkSfx(sound);
+ case MI_PROSTITUTE2:
+ return GetWhiteFemaleProstituteTalkSfx(sound);
+ case MI_P_WOM1:
+ return GetBlackProjectFemaleOldTalkSfx(sound);
+ case MI_P_WOM2:
+ return GetBlackProjectFemaleYoungTalkSfx(sound);
+ case MI_CT_MAN1:
+ return GetChinatownMaleOldTalkSfx(sound);
+ case MI_CT_MAN2:
+ return GetChinatownMaleYoungTalkSfx(sound);
+ case MI_CT_WOM1:
+ return GetChinatownFemaleOldTalkSfx(sound);
+ case MI_CT_WOM2:
+ return GetChinatownFemaleYoungTalkSfx(sound);
+ case MI_LI_MAN1:
+ case MI_LI_MAN2:
+ return GetLittleItalyMaleTalkSfx(sound);
+ case MI_LI_WOM1:
+ return GetLittleItalyFemaleOldTalkSfx(sound);
+ case MI_LI_WOM2:
+ return GetLittleItalyFemaleYoungTalkSfx(sound);
+ case MI_DOCKER1:
+ return GetWhiteDockerMaleTalkSfx(sound);
+ case MI_DOCKER2:
+ return GetBlackDockerMaleTalkSfx(sound);
+ case MI_SCUM_MAN:
+ return GetScumMaleTalkSfx(sound);
+ case MI_SCUM_WOM:
+ return GetScumFemaleTalkSfx(sound);
+ case MI_WORKER1:
+ return GetWhiteWorkerMaleTalkSfx(sound);
+ case MI_WORKER2:
+ return GetBlackWorkerMaleTalkSfx(sound);
+ case MI_B_MAN1:
+ case MI_B_MAN3:
+ return GetBusinessMaleYoungTalkSfx(sound, ped->GetModelIndex());
+ case MI_B_MAN2:
+ return GetBusinessMaleOldTalkSfx(sound);
+ case MI_B_WOM1:
+ case MI_B_WOM2:
+ return GetWhiteBusinessFemaleTalkSfx(sound, ped->GetModelIndex());
+ case MI_B_WOM3:
+ return GetBlackBusinessFemaleTalkSfx(sound);
+ case MI_MOD_MAN:
+ return GetSupermodelMaleTalkSfx(sound);
+ case MI_MOD_WOM:
+ return GetSupermodelFemaleTalkSfx(sound);
+ case MI_ST_MAN:
+ return GetStewardMaleTalkSfx(sound);
+ case MI_ST_WOM:
+ return GetStewardFemaleTalkSfx(sound);
+ case MI_FAN_MAN1:
+ case MI_FAN_MAN2:
+ return GetFanMaleTalkSfx(sound, ped->GetModelIndex());
+ case MI_FAN_WOM:
+ return GetFanFemaleTalkSfx(sound);
+ case MI_HOS_MAN:
+ return GetHospitalMaleTalkSfx(sound);
+ case MI_HOS_WOM:
+ return GetHospitalFemaleTalkSfx(sound);
+ case MI_CONST1:
+ return GetWhiteConstructionWorkerTalkSfx(sound);
+ case MI_CONST2:
+ return GetBlackConstructionWorkerTalkSfx(sound);
+ case MI_SHOPPER1:
+ case MI_SHOPPER2:
+ case MI_SHOPPER3:
+ return GetShopperFemaleTalkSfx(sound, ped->GetModelIndex());
+ case MI_STUD_MAN:
+ return GetStudentMaleTalkSfx(sound);
+ case MI_STUD_WOM:
+ return GetStudentFemaleTalkSfx(sound);
+ case MI_CAS_MAN:
+ return GetCasualMaleOldTalkSfx(sound);
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+}
+
+void
+cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const
+{
+ *phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % maxOffset;
+
+ // check if the same sfx like last time, if yes, then try use next one,
+ // if exceeded range, then choose first available sample
+ if (*phrase == *prevPhrase && ++*phrase >= sample + maxOffset)
+ *phrase = sample;
+ *prevPhrase = *phrase;
+}
+
+#pragma region PED_COMMENTS
+
+uint32
+cAudioManager::GetPlayerTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_DAMAGE:
+ GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_HIGH_DAMAGE_GRUNT_1, 11);
+ break;
+ case SOUND_PED_HIT:
+ GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_LOW_DAMAGE_GRUNT_1, 10);
+ break;
+ case SOUND_PED_LAND:
+ GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_HIT_GROUND_GRUNT_1, 6);
+ break;
+ default:
+ sfx = NO_SAMPLE;
+ break;
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetCopTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ PedState pedState;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_ARREST_COP:
+ GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_ARREST_1, 6);
+ break;
+ case SOUND_PED_PURSUIT_COP:
+ pedState = FindPlayerPed()->m_nPedState;
+ if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
+ return NO_SAMPLE;
+ GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_CHASE_1, 7);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ return (SFX_COP_VOICE_2_ARREST_1 - SFX_COP_VOICE_1_ARREST_1) * (m_sQueueSample.m_nEntityIndex % 5) + sfx;
+}
+
+uint32
+cAudioManager::GetSwatTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ PedState pedState;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_ARREST_SWAT:
+ GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6);
+ break;
+ case SOUND_PED_PURSUIT_SWAT:
+ pedState = FindPlayerPed()->m_nPedState;
+ if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
+ return NO_SAMPLE;
+ GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ return (SFX_SWAT_VOICE_2_CHASE_1 - SFX_SWAT_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 4) + sfx;
+}
+
+uint32
+cAudioManager::GetFBITalkSfx(int16 sound)
+{
+ uint32 sfx;
+ PedState pedState;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_ARREST_FBI:
+ GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6);
+ break;
+ case SOUND_PED_PURSUIT_FBI:
+ pedState = FindPlayerPed()->m_nPedState;
+ if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
+ return NO_SAMPLE;
+ GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ return (SFX_FBI_VOICE_2_CHASE_1 - SFX_FBI_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx;
+}
+
+uint32
+cAudioManager::GetArmyTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ PedState pedState;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_PURSUIT_ARMY:
+ pedState = FindPlayerPed()->m_nPedState;
+ if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
+ return NO_SAMPLE;
+ GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15);
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ return (SFX_ARMY_VOICE_2_CHASE_1 - SFX_ARMY_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetMedicTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_GUN_PANIC_1, 5);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_CARJACKED_1, 5);
+ break;
+ case SOUND_PED_HEALING:
+ GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_AT_VICTIM_1, 12);
+ break;
+ case SOUND_PED_LEAVE_VEHICLE:
+ GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_GET_OUT_VAN_CHAT_1, 9);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_RUN_FROM_FIGHT_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return (SFX_MEDIC_VOICE_2_GUN_PANIC_1 - SFX_MEDIC_VOICE_1_GUN_PANIC_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetFiremanTalkSfx(int16 sound)
+{
+ return GetGenericMaleTalkSfx(sound);
+}
+
+uint32
+cAudioManager::GetNormalMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_GUN_PANIC_1, 7);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_CARJACKED_1, 7);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_DODGE_1, 9);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_RUN_FROM_FIGHT_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_DRIVER_ABUSE_1, 12);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_EYING_1, 8);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_SHOCKED_1, 10);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_CHAT_1, 25);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetTaxiDriverTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_CARJACKED_1, 7);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ return (SFX_ASIAN_TAXI_DRIVER_VOICE_2_DRIVER_ABUSE_1 - SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetPimpTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_PIMP_GUN_COOL_1, 7);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_PIMP_CARJACKED_1, 4);
+ break;
+ case SOUND_PED_DEFEND:
+ GetPhrase(&sfx, &lastSfx, SFX_PIMP_FIGHT_1, 9);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_PIMP_DODGE_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_PIMP_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_PIMP_SHOCKED_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_PIMP_CHAT_1, 17);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetMafiaTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKING:
+ GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CARJACKING_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return (SFX_MAFIA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx;
+}
+
+uint32
+cAudioManager::GetTriadTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_GUN_COOL_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKING:
+ GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CARJACKING_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CHAT_1, 8);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetDiabloTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_GUN_COOL_1, 4);
+ break;
+ case SOUND_PED_HANDS_COWER:
+ sound = SOUND_PED_FLEE_SPRINT;
+ return GetGenericMaleTalkSfx(sound);
+ break;
+ case SOUND_PED_CAR_JACKING:
+ GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CARJACKING_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_EYING_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return (SFX_DIABLO_MALE_VOICE_2_CHAT_1 - SFX_DIABLO_MALE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetYakuzaTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKING:
+ GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CARJACKING_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return (SFX_YAKUZA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetYardieTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ sfx = SFX_YARDIE_MALE_VOICE_1_GUN_COOL_1;
+ break;
+ case SOUND_PED_CAR_JACKING:
+ GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_CARJACKING_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ sfx = SFX_YARDIE_MALE_VOICE_1_CARJACKED_1;
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_FIGHT_1, 6);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_EYING_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_CHAT_1, 8);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return (SFX_YARDIE_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetColumbianTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKING:
+ GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CARJACKING_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_EYING_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return (SFX_COLUMBIAN_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetHoodTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_GUN_COOL_1, 5);
+ break;
+ case SOUND_PED_CAR_JACKING:
+ GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CARJACKING_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_FIGHT_1, 6);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_EYING_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CHAT_1, 6);
+ break;
+
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ break;
+ }
+ return (SFX_HOOD_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetBlackCriminalTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_GUN_COOL_1, 4);
+ break;
+ case SOUND_PED_CAR_JACKING:
+ sfx = SFX_BLACK_CRIMINAL_VOICE_1_CARJACKING_1;
+ break;
+ case SOUND_PED_MUGGING:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_MUGGING_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ break;
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteCriminalTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_GUN_COOL_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKING:
+ sfx = SFX_WHITE_CRIMINAL_VOICE_1_CARJACKING_1;
+ break;
+ case SOUND_PED_MUGGING:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_MUGGING_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_DRIVER_ABUSE_1, 4);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ break;
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetMaleNo2TalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_CARJACKED_1, 3);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_MUGGED_1, 4);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_EYING_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_FIGHT_1, 6);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CHAT_1, 6);
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ if (model == MI_P_MAN2)
+ sfx += (SFX_BLACK_PROJECT_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1);
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DODGE_1, 9);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 9);
+ break;
+ case SOUND_PED_WAIT_DOUBLEBACK:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_LOST_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CHAT_1, 9);
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackFatMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CARJACKED_1, 4);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_MUGGED_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DODGE_1, 7);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_WAIT_DOUBLEBACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_LOST_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CHAT_1, 8);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackCasualFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_GUN_PANIC_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_MUGGED_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_RUN_FROM_FIGHT_1, 2);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_CHAT_1, 8);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_GUN_PANIC_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ sfx = SFX_WHITE_CASUAL_FEMALE_VOICE_1_MUGGED_1;
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_DODGE_1, 3);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 2);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 8);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_SHOCKED_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CHAT_1, 4);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetFemaleNo3TalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_GUN_PANIC_1, 5);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_CARJACKED_1, 3);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_MUGGED_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_RUN_FROM_FIGHT_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackFatFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_SHOCKED_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteFatFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 8);
+ break;
+ case SOUND_PED_WAIT_DOUBLEBACK:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_LOST_1, 2);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CHAT_1, 8);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackFemaleProstituteTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_GUN_COOL_1, 4);
+ break;
+ case SOUND_PED_ROBBED:
+ sfx = SFX_BLACK_PROSTITUTE_VOICE_1_MUGGED_1;
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_DODGE_1, 3);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_DRIVER_ABUSE_1, 4);
+ break;
+ case SOUND_PED_SOLICIT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_SOLICIT_1, 8);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1, 4);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return (SFX_BLACK_PROSTITUTE_VOICE_2_CHAT_1 - SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetWhiteFemaleProstituteTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_DODGE_1, 3);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_DRIVER_ABUSE_1, 4);
+ break;
+ case SOUND_PED_SOLICIT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_SOLICIT_1, 8);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1, 4);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return (SFX_WHITE_PROSTITUTE_VOICE_2_CHAT_1 - SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetBlackProjectFemaleOldTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CARJACKED_1, 6);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_DODGE_1, 10);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_RUN_FROM_FIGHT_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_SHOCKED_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CHAT_1, 10);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackProjectFemaleYoungTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ sfx = SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CARJACKED_1;
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_SHOCKED_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetChinatownMaleOldTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetChinatownMaleYoungTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 2);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_FIGHT_1, 6);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetChinatownFemaleOldTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ sfx = SFX_CHINATOWN_OLD_FEMALE_VOICE_1_SHOCKED_1;
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetChinatownFemaleYoungTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetLittleItalyMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return (SFX_LITTLE_ITALY_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_LITTLE_ITALY_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetLittleItalyFemaleOldTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetLittleItalyFemaleYoungTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_DODGE_1, 7);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteDockerMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_GUN_PANIC_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_FIGHT_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_DRIVER_ABUSE_1, 4);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackDockerMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetScumMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_GUN_PANIC_1, 5);
+ break;
+ case SOUND_PED_ROBBED:
+ sfx = SFX_SCUM_MALE_VOICE_1_MUGGED_1;
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_FIGHT_1, 10);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_WAIT_DOUBLEBACK:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_LOST_1, 3);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_EYING_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_CHAT_1, 9);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetScumFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_DODGE_1, 8);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_CHAT_1, 13);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteWorkerMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_FIGHT_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_EYING_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackWorkerMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_FIGHT_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_DODGE_1, 3);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_DRIVER_ABUSE_1, 4);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_CHAT_1, 4);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBusinessMaleYoungTalkSfx(int16 sound, int32 model)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_RUN_FROM_FIGHT_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ if (model == MI_B_MAN3)
+ sfx += (SFX_BUSINESS_MALE_YOUNG_VOICE_2_DRIVER_ABUSE_1 - SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1);
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBusinessMaleOldTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MRUN_FROM_FIGHT_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+
+ if (model == MI_B_WOM2)
+ sfx += (SFX_WHITE_BUSINESS_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1);
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 5);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CARAJACKED_1, 4);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetSupermodelMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetSupermodelFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_MUGGED_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_SHOCKED_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_CHAT_1, 8);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetStewardMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_DODGE_1, 3);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_CHAT_1, 4);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetStewardFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return (SFX_STEWARD_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_FIGHT_1, 3);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_SHOCKED_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ if (model == MI_FAN_MAN2)
+ sfx += (SFX_FOOTBALL_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1);
+ return sfx;
+}
+
+uint32
+cAudioManager::GetFanFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_ROBBED:
+ sfx = SFX_FOOTBALL_FEMALE_VOICE_1_MUGGED_1;
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_SHOCKED_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return (SFX_FOOTBALL_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
+}
+
+uint32
+cAudioManager::GetHospitalMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetHospitalFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_CHAT_1, 6);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetWhiteConstructionWorkerTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ sfx = SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CARJACKED_1;
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_DRIVER_ABUSE_1, 4);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_EYING_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetBlackConstructionWorkerTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_GUN_PANIC_1, 3);
+ break;
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_FIGHT_1, 5);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_DODGE_1, 5);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
+ break;
+ case SOUND_PED_CHAT_SEXY:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_EYING_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CHAT_1, 4);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_CAR_JACKED:
+ GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_CARJACKED_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_DODGE_1, 6);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1, 7);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_SHOCKED_1, 4);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_CHAT_1, 7);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+
+ if (model == MI_SHOPPER2) {
+ sfx += (SFX_SHOPPER_VOICE_2_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1);
+ } else if (model == MI_SHOPPER3) {
+ sfx += (SFX_SHOPPER_VOICE_3_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetStudentMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_GUN_PANIC_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_DRIVER_ABUSE_1, 4);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_SHOCKED_1, 3);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_CHAT_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetStudentFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_COWER:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_GUN_PANIC_1, 4);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_DODGE_1, 4);
+ break;
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 4);
+ break;
+ case SOUND_PED_CHAT_EVENT:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_SHOCKED_1, 2);
+ break;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_CHAT_1, 4);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetCasualMaleOldTalkSfx(int16 sound)
+{
+ return GetGenericMaleTalkSfx(sound);
+}
+
+uint32
+cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
+{
+ char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName();
+ if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) {
+ return GetEightTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "frankie")) {
+ return GetFrankieTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "misty")) {
+ return GetMistyTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "ojg") || !CGeneral::faststricmp(modelName, "ojg_p")) {
+ return GetOJGTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "cat")) {
+ return GetCatatalinaTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "bomber")) {
+ return GetBomberTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "s_guard")) {
+ return GetSecurityGuardTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "chunky")) {
+ return GetChunkyTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "asuka")) {
+ return GetGenericFemaleTalkSfx(sound);
+ }
+ if (!CGeneral::faststricmp(modelName, "maria")) {
+ return GetGenericFemaleTalkSfx(sound);
+ }
+
+ return GetGenericMaleTalkSfx(sound);
+}
+uint32
+cAudioManager::GetEightTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_8BALL_GUN_COOL_1, 2);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_8BALL_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_8BALL_FIGHT_1, 6);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_8BALL_DODGE_1, 7);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetFrankieTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_GUN_COOL_1, 4);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_FIGHT_1, 6);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_DODGE_1, 3);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetMistyTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_MISTY_GUN_COOL_1, 5);
+ break;
+ case SOUND_PED_ROBBED:
+ GetPhrase(&sfx, &lastSfx, SFX_MISTY_MUGGED_1, 2);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_MISTY_FIGHT_1, 4);
+ break;
+ case SOUND_PED_EVADE:
+ GetPhrase(&sfx, &lastSfx, SFX_MISTY_DODGE_1, 5);
+ break;
+ case SOUND_PED_TAXI_CALL:
+ GetPhrase(&sfx, &lastSfx, SFX_MISTY_HERE_1, 4);
+ break;
+ default:
+ return GetGenericFemaleTalkSfx(sound);
+ break;
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetOJGTalkSfx(int16 sound)
+{
+ return GetGenericMaleTalkSfx(sound);
+}
+
+uint32
+cAudioManager::GetCatatalinaTalkSfx(int16 sound)
+{
+ return GetGenericFemaleTalkSfx(sound);
+}
+
+uint32
+cAudioManager::GetBomberTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound)
+ {
+ case SOUND_PED_BOMBER:
+ GetPhrase(&sfx, &lastSfx, SFX_BOMBERMAN_1, 7);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetSecurityGuardTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_HANDS_UP:
+ GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_GUN_COOL_1, 2);
+ break;
+ case SOUND_PED_HANDS_COWER:
+ sfx = SFX_SECURITY_GUARD_VOICE_1_GUN_PANIC_1;
+ break;
+ case SOUND_PED_CAR_JACKED:
+ case SOUND_PED_CAR_COLLISION:
+ GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 6);
+ break;
+ case SOUND_PED_ATTACK:
+ GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_FIGHT_1, 2);
+ break;
+ case SOUND_PED_FLEE_RUN:
+#ifdef FIX_BUGS
+ sfx = SFX_SECURITY_GUARD_VOICE_1_RUN_FROM_FIGHT_1;
+#else
+ GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 12);
+#endif
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetChunkyTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound)
+ {
+ case SOUND_PED_DEATH:
+ return SFX_CHUNKY_DEATH;
+ case SOUND_PED_FLEE_RUN:
+ GetPhrase(&sfx, &lastSfx, SFX_CHUNKY_RUN_1, 5);
+ break;
+ default:
+ return GetGenericMaleTalkSfx(sound);
+ }
+
+ return sfx;
+}
+
+uint32
+cAudioManager::GetGenericMaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_DEATH:
+ GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_DEATH_1, 8);
+ break;
+ case SOUND_PED_BULLET_HIT:
+ case SOUND_PED_DEFEND:
+ GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_GRUNT_1, 15);
+ break;
+ case SOUND_PED_BURNING:
+ GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_FIRE_1, 8);
+ break;
+ case SOUND_PED_FLEE_SPRINT:
+ GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_PANIC_1, 6);
+ break;
+ default:
+ return NO_SAMPLE;
+ }
+ return sfx;
+}
+
+uint32
+cAudioManager::GetGenericFemaleTalkSfx(int16 sound)
+{
+ uint32 sfx;
+ static uint32 lastSfx = NO_SAMPLE;
+
+ switch (sound) {
+ case SOUND_PED_DEATH:
+ GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_DEATH_1, 10);
+ break;
+ case SOUND_PED_BULLET_HIT:
+ case SOUND_PED_DEFEND:
+ GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_GRUNT_1, 11);
+ break;
+ case SOUND_PED_BURNING:
+ GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_FIRE_1, 9);
+ break;
+ case SOUND_PED_FLEE_SPRINT:
+ GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_PANIC_1, 8);
+ break;
+ default:
+ return NO_SAMPLE;
+ }
+ return sfx;
+}
+
+void
+cPedComments::Add(tPedComment *com)
+{
+ uint8 index;
+
+ if (m_nCommentsInBank[m_nActiveBank] >= NUM_PED_COMMENTS_SLOTS) {
+ index = m_nIndexMap[m_nActiveBank][NUM_PED_COMMENTS_SLOTS - 1];
+ if (m_asPedComments[m_nActiveBank][index].m_bVolume > com->m_bVolume)
+ return;
+ } else {
+ index = m_nCommentsInBank[m_nActiveBank]++;
+ }
+
+ m_asPedComments[m_nActiveBank][index] = *com;
+
+ uint32 i = 0;
+ if (index != 0) {
+ for (i = 0; i < index; i++) {
+ if (m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][i]].m_bVolume < m_asPedComments[m_nActiveBank][index].m_bVolume) {
+ break;
+ }
+ }
+
+ if (i < index)
+ memmove(&m_nIndexMap[m_nActiveBank][i + 1], &m_nIndexMap[m_nActiveBank][i], NUM_PED_COMMENTS_SLOTS - 1 - i);
+ }
+
+ m_nIndexMap[m_nActiveBank][i] = index;
+}
+
+void
+cPedComments::Process()
+{
+ int sampleIndex;
+ uint8 actualUsedBank;
+ tPedComment *comment;
+
+ if (AudioManager.m_nUserPause != 0) return;
+
+ if (m_nCommentsInBank[m_nActiveBank]) {
+ sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;
+ if (!SampleManager.IsPedCommentLoaded(sampleIndex))
+ SampleManager.LoadPedComment(sampleIndex);
+
+ AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex;
+ AudioManager.m_sQueueSample.m_nCounter = 0;
+ AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
+ AudioManager.m_sQueueSample.m_nBankIndex = SAMPLEBANK_PED;
+ AudioManager.m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_bVolume;
+ AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance;
+ AudioManager.m_sQueueSample.m_nLoopCount = 1;
+ AudioManager.m_sQueueSample.m_nLoopStart = 0;
+ AudioManager.m_sQueueSample.m_nLoopEnd = -1;
+ AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+ AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f;
+ switch (sampleIndex) {
+ case SFX_POLICE_HELI_1:
+ case SFX_POLICE_HELI_2:
+ case SFX_POLICE_HELI_3:
+ AudioManager.m_sQueueSample.m_fSoundIntensity = 400.0f;
+ break;
+ default:
+ AudioManager.m_sQueueSample.m_fSoundIntensity = 50.0f;
+ break;
+ }
+ AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true;
+ AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos;
+
+ if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) {
+ AudioManager.m_sQueueSample.m_bReverbFlag = false;
+ AudioManager.m_sQueueSample.m_bRequireReflection = false;
+ } else {
+ AudioManager.m_sQueueSample.m_bReverbFlag = true;
+ AudioManager.m_sQueueSample.m_bRequireReflection = true;
+ }
+
+ AudioManager.m_sQueueSample.m_bIs2D = false;
+ AudioManager.m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + AudioManager.RandomDisplacement(750);
+ if (CTimer::GetIsSlowMotionActive())
+ AudioManager.m_sQueueSample.m_nFrequency /= 2;
+ m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1;
+ AudioManager.AddSampleToRequestedQueue();
+ }
+
+ // Switch bank
+ if (m_nActiveBank) {
+ actualUsedBank = SAMPLEBANK_PED;
+ m_nActiveBank = SAMPLEBANK_MAIN;
+ } else {
+ actualUsedBank = SAMPLEBANK_MAIN;
+ m_nActiveBank = SAMPLEBANK_PED;
+ }
+ comment = m_asPedComments[actualUsedBank];
+ for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) {
+ if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) {
+ --m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess;
+ Add(&comment[m_nIndexMap[actualUsedBank][i]]);
+ }
+ }
+
+ for (uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) {
+ m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS;
+ }
+ m_nCommentsInBank[actualUsedBank] = 0;
+}
+
+#pragma endregion
+
+#pragma endregion All the ped audio code
+
+void
+cAudioManager::ProcessExplosions(int32 explosion)
+{
+ uint8 type;
+ CVector *pos;
+ float distSquared;
+
+ for (uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) {
+ if (CExplosion::GetExplosionActiveCounter(i) == 1) {
+ CExplosion::ResetExplosionActiveCounter(i);
+ type = CExplosion::GetExplosionType(i);
+ switch (type) {
+ case EXPLOSION_GRENADE:
+ case EXPLOSION_ROCKET:
+ case EXPLOSION_BARREL:
+ case EXPLOSION_TANK_GRENADE:
+ m_sQueueSample.m_fSoundIntensity = 400.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ break;
+ case EXPLOSION_MOLOTOV:
+ m_sQueueSample.m_fSoundIntensity = 200.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ break;
+ case EXPLOSION_MINE:
+ case EXPLOSION_HELI_BOMB:
+ m_sQueueSample.m_fSoundIntensity = 300.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ break;
+ default:
+ m_sQueueSample.m_fSoundIntensity = 400.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000;
+ if (type == EXPLOSION_HELI)
+ m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS;
+ break;
+ }
+ pos = CExplosion::GetExplosionPosition(i);
+ m_sQueueSample.m_vecPos = *pos;
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = i;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = true;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessFires(int32)
+{
+ CEntity *entity;
+ uint8 emittingVol;
+ float distSquared;
+
+ for (uint8 i = 0; i < NUM_FIRES; i++) {
+ if (gFireManager.m_aFires[i].m_bIsOngoing && gFireManager.m_aFires[i].m_bAudioSet) {
+ entity = gFireManager.m_aFires[i].m_pEntity;
+ if (entity) {
+ switch (entity->GetType()) {
+ case ENTITY_TYPE_BUILDING:
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
+ emittingVol = 100;
+ m_sQueueSample.m_nFrequency = 8 * SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE) / 10;
+ m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
+ m_sQueueSample.m_nReleasingVolumeModificator = 6;
+ break;
+ case ENTITY_TYPE_PED:
+ m_sQueueSample.m_fSoundIntensity = 25.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE);
+ emittingVol = 60;
+ m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
+ m_sQueueSample.m_nReleasingVolumeModificator = 10;
+ break;
+ default:
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
+ m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
+ emittingVol = 80;
+ m_sQueueSample.m_nReleasingVolumeModificator = 8;
+ }
+ } else {
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
+ m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
+ emittingVol = 80;
+ m_sQueueSample.m_nReleasingVolumeModificator = 8;
+ }
+ m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos;
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = i;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nReleasingVolumeDivider = 10;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessWaterCannon(int32)
+{
+ const float SOUND_INTENSITY = 900.0f;
+
+ for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
+ if (CWaterCannons::aCannons[i].m_nId) {
+ m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
+ float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SOUND_INTENSITY) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = 15591;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_nCounter = i;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nReleasingVolumeDivider = 8;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nEmittingVolume = 50;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+}
+
+#pragma region SCRIPT_OBJECTS
+const int SCRIPT_OBJECT_INTENSITY_S = 30;
+const int SCRIPT_OBJECT_INTENSITY_L = 80;
+
+void
+cAudioManager::ProcessScriptObject(int32 id)
+{
+ cAudioScriptObject *entity = (cAudioScriptObject *)m_asAudioEntities[id].m_pEntity;
+ if (entity != nil) {
+ m_sQueueSample.m_vecPos = entity->Posn;
+ if (m_asAudioEntities[id].m_AudioEvents == 1)
+ ProcessOneShotScriptObject(m_asAudioEntities[id].m_awAudioEvent[0]);
+ else
+ ProcessLoopingScriptObject(entity->AudioId);
+ }
+}
+
+void
+cAudioManager::ProcessOneShotScriptObject(uint8 sound)
+{
+ CPlayerPed *playerPed;
+ uint8 emittingVolume;
+ float distSquared;
+
+ cPedParams male;
+ cPedParams female;
+
+ static uint8 iSound = 0;
+
+ switch (sound) {
+ case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S:
+ case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L:
+ male.m_pPed = nil;
+ male.m_bDistanceCalculated = false;
+ male.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ SetupPedComments(&male, SOUND_INJURED_PED_MALE_OUCH);
+ return;
+ case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S:
+ case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L:
+ female.m_pPed = nil;
+ female.m_bDistanceCalculated = false;
+ female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ SetupPedComments(&female, SOUND_INJURED_PED_FEMALE);
+ return;
+ case SCRIPT_SOUND_GATE_START_CLUNK:
+ case SCRIPT_SOUND_GATE_STOP_CLUNK:
+ m_sQueueSample.m_fSoundIntensity = 40.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_COL_GATE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ if (sound == SCRIPT_SOUND_GATE_START_CLUNK)
+ m_sQueueSample.m_nFrequency = 10600;
+ else
+ m_sQueueSample.m_nFrequency = 9000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVolume = RandomDisplacement(10) + 50;
+ break;
+ case SCRIPT_SOUND_BULLET_HIT_GROUND_1:
+ case SCRIPT_SOUND_BULLET_HIT_GROUND_2:
+ case SCRIPT_SOUND_BULLET_HIT_GROUND_3:
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ m_sQueueSample.m_nSampleIndex = m_anRandomTable[iSound % 5] % 3 + SFX_BULLET_WALL_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ m_sQueueSample.m_nReleasingVolumeModificator = 9;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ emittingVolume = m_anRandomTable[2] % 20 + 90;
+ break;
+ case SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1:
+ case SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2:
+ if (!SampleManager.IsSampleBankLoaded(SAMPLEBANK_TRAIN))
+ return;
+ m_sQueueSample.m_fSoundIntensity = 80.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_TRAIN;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_STATION_ANNOUNCE);
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_bIs2D = false;
+ break;
+ case SCRIPT_SOUND_PAYPHONE_RINGING:
+ m_sQueueSample.m_fSoundIntensity = 80.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_PHONE_RING;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ emittingVolume = 80;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PHONE_RING);
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bRequireReflection = false;
+ break;
+ case SCRIPT_SOUND_GLASS_BREAK_L:
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ emittingVolume = 70;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ break;
+ case SCRIPT_SOUND_GLASS_BREAK_S:
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ emittingVolume = 60;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ break;
+ case SCRIPT_SOUND_GLASS_CRACK:
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ emittingVolume = 70;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ case SCRIPT_SOUND_GLASS_LIGHT_BREAK:
+ m_sQueueSample.m_fSoundIntensity = 55.0f;
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[4] & 3) + SFX_GLASS_SHARD_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 19000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 9;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ emittingVolume = RandomDisplacement(11) + 25;
+ break;
+ case SCRIPT_SOUND_BOX_DESTROYED_1:
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_WOODEN_BOX_SMASH;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVolume = m_anRandomTable[2] % 20 + 80;
+ break;
+ case SCRIPT_SOUND_BOX_DESTROYED_2:
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_CARDBOARD_BOX_SMASH;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVolume = m_anRandomTable[2] % 20 + 80;
+ break;
+ case SCRIPT_SOUND_METAL_COLLISION:
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 5 + SFX_COL_CAR_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVolume = m_anRandomTable[2] % 30 + 70;
+ break;
+ case SCRIPT_SOUND_TIRE_COLLISION:
+ m_sQueueSample.m_fSoundIntensity = 60.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVolume = m_anRandomTable[2] % 30 + 60;
+ break;
+ case SCRIPT_SOUND_GUNSHELL_DROP:
+ playerPed = FindPlayerPed();
+ if (playerPed) {
+ switch (playerPed->m_nSurfaceTouched) {
+ case SURFACE_GRASS:
+ case SURFACE_GRAVEL:
+ case SURFACE_MUD_DRY:
+ case SURFACE_TRANSPARENT_CLOTH:
+ case SURFACE_PED:
+ case SURFACE_SAND:
+ case SURFACE_RUBBER:
+ case SURFACE_HEDGE:
+ m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 18;
+ m_sQueueSample.m_fSoundIntensity = 20.0f;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ emittingVolume = m_anRandomTable[2] % 20 + 30;
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ AddSampleToRequestedQueue();
+ }
+ }
+ return;
+ case SURFACE_WATER:
+ return;
+ default:
+ break;
+ }
+ }
+ m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_1;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 15;
+ m_sQueueSample.m_fSoundIntensity = 20.0f;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ emittingVolume = m_anRandomTable[2] % 20 + 30;
+ break;
+ case SCRIPT_SOUND_GUNSHELL_DROP_SOFT:
+ m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 18;
+ m_sQueueSample.m_fSoundIntensity = 20.0f;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_bIs2D = false;
+ emittingVolume = m_anRandomTable[2] % 20 + 30;
+ break;
+ default:
+ return;
+ }
+
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+void
+cAudioManager::ProcessLoopingScriptObject(uint8 sound)
+{
+ uint8 emittingVolume;
+ float distSquared;
+
+ switch (sound) {
+ case SCRIPT_SOUND_PARTY_1_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_1;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_1_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_1;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_2_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_2;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_2;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_2_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_2;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_2;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_3_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_3;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_3;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_3_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_3;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_3;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_4_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_4;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_4;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_4_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_4;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_4;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_5_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_5;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_5;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_5_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_5;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_5;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_6_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_6;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_6;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_6_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_6;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_6;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_7_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_7;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_7;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_7_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_7;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_7;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_8_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_8;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_8;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_8_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_8;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_8;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_9_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_9;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_9;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_9_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_9;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_9;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_10_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_10;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_10;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_10_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_10;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_10;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_11_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_11;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_11;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_11_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_11;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_11;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_12_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_12;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_12;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_12_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_12;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_12;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_13_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_RAGGA;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_13_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_RAGGA;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_STRIP_CLUB_1;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_STRIP_CLUB_1;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_STRIP_CLUB_2;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_STRIP_CLUB_2;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_WORK_SHOP_LOOP_S:
+ case SCRIPT_SOUND_WORK_SHOP_LOOP_L:
+ ProcessWorkShopScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_SAWMILL_LOOP_S:
+ case SCRIPT_SOUND_SAWMILL_LOOP_L:
+ ProcessSawMillScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_38:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY);
+ m_sQueueSample.m_nReleasingVolumeModificator = 6;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_39:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY);
+ m_sQueueSample.m_nReleasingVolumeModificator = 6;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_LAUNDERETTE_LOOP_S:
+ case SCRIPT_SOUND_LAUNDERETTE_LOOP_L:
+ ProcessLaunderetteScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_CHINATOWN_RESTAURANT_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_CHINATOWN_RESTAURANT_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_CIPRIANI_RESAURANT_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_ITALY;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_CIPRIANI_RESAURANT_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_ITALY;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_46_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_47_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_MARCO_BISTRO_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_MARCO_BISTRO_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2;
+ emittingVolume = 110;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_AIRPORT_LOOP_S:
+ case SCRIPT_SOUND_AIRPORT_LOOP_L:
+ ProcessAirportScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_SHOP_LOOP_S:
+ case SCRIPT_SOUND_SHOP_LOOP_L:
+ ProcessShopScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_CINEMA_LOOP_S:
+ case SCRIPT_SOUND_CINEMA_LOOP_L:
+ ProcessCinemaScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_DOCKS_LOOP_S:
+ case SCRIPT_SOUND_DOCKS_LOOP_L:
+ ProcessDocksScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_HOME_LOOP_S:
+ case SCRIPT_SOUND_HOME_LOOP_L:
+ ProcessHomeScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_FRANKIE_PIANO:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PIANO_BAR;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PIANO_BAR_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PARTY_1_LOOP:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_CLUB_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_1;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PORN_CINEMA_1_S:
+ case SCRIPT_SOUND_PORN_CINEMA_1_L:
+ case SCRIPT_SOUND_PORN_CINEMA_2_S:
+ case SCRIPT_SOUND_PORN_CINEMA_2_L:
+ case SCRIPT_SOUND_PORN_CINEMA_3_S:
+ case SCRIPT_SOUND_PORN_CINEMA_3_L:
+ case SCRIPT_SOUND_MISTY_SEX_S:
+ case SCRIPT_SOUND_MISTY_SEX_L:
+ ProcessPornCinema(sound);
+ return;
+ case SCRIPT_SOUND_BANK_ALARM_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_BANK_ALARM;
+ emittingVolume = 90;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_BANK_ALARM_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_BANK_ALARM;
+ emittingVolume = 90;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_POLICE_BALL_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_POLICE_BALL;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_POLICE_BALL_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_POLICE_BALL;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1);
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S:
+ case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L:
+ ProcessPoliceCellBeatingScriptObject(sound);
+ return;
+ case SCRIPT_SOUND_RAVE_1_LOOP_S:
+ case SCRIPT_SOUND_RAVE_2_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_COMMERCIAL;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_RAVE_1_LOOP_L:
+ case SCRIPT_SOUND_RAVE_2_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_COMMERCIAL;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_RAVE_3_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_SUBURBAN;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_RAVE_3_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_SUBURBAN;
+ emittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ case SCRIPT_SOUND_PRETEND_FIRE_LOOP:
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ emittingVolume = 80;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
+ m_sQueueSample.m_nReleasingVolumeModificator = 8;
+ m_sQueueSample.m_nReleasingVolumeDivider = 10;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ break;
+ default:
+ return;
+ }
+
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+void
+cAudioManager::ProcessPornCinema(uint8 sound)
+{
+
+ eSfxSample sample;
+ uint32 time;
+ int32 rand;
+ float distSquared;
+
+ switch (sound) {
+ case SCRIPT_SOUND_PORN_CINEMA_1_S:
+ case SCRIPT_SOUND_MISTY_SEX_S:
+ m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_1;
+ sample = SFX_PORN_1_GROAN_1;
+ m_sQueueSample.m_fSoundIntensity = 20.0f;
+ break;
+ case SCRIPT_SOUND_PORN_CINEMA_1_L:
+ case SCRIPT_SOUND_MISTY_SEX_L:
+ m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_1;
+ sample = SFX_PORN_1_GROAN_1;
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ break;
+ case SCRIPT_SOUND_PORN_CINEMA_2_S:
+ m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_2;
+ sample = SFX_PORN_2_GROAN_1;
+ m_sQueueSample.m_fSoundIntensity = 20.0f;
+ break;
+ case SCRIPT_SOUND_PORN_CINEMA_2_L:
+ m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_2;
+ sample = SFX_PORN_2_GROAN_1;
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ break;
+ case SCRIPT_SOUND_PORN_CINEMA_3_S:
+ m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_3;
+ m_sQueueSample.m_fSoundIntensity = 20.0f;
+ sample = SFX_PORN_3_GROAN_1;
+ break;
+ case SCRIPT_SOUND_PORN_CINEMA_3_L:
+ m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_3;
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ sample = SFX_PORN_3_GROAN_1;
+ break;
+ default:
+ return;
+ }
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) {
+ m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+
+ time = CTimer::GetTimeInMilliseconds();
+ if (time > gPornNextTime) {
+ m_sQueueSample.m_nVolume = ComputeVolume(90, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ rand = m_anRandomTable[1] & 1;
+ m_sQueueSample.m_nSampleIndex = rand + sample;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nCounter = rand + 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 6;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ gPornNextTime = time + 2000 + m_anRandomTable[3] % 6000;
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
+{
+ float distSquared;
+
+ switch (sound) {
+ case SCRIPT_SOUND_WORK_SHOP_LOOP_S:
+ case SCRIPT_SOUND_WORK_SHOP_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = 20.0f;
+ break;
+ default:
+ return;
+ }
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_WORKSHOP;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1);
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = 30;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+void
+cAudioManager::ProcessSawMillScriptObject(uint8 sound)
+{
+
+ uint32 time;
+ float distSquared;
+
+ switch (sound) {
+ case SCRIPT_SOUND_SAWMILL_LOOP_S:
+ case SCRIPT_SOUND_SAWMILL_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ break;
+ default:
+ return;
+ }
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_SAWMILL;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP);
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = 30;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ time = CTimer::GetTimeInMilliseconds();
+ if (time > gSawMillNextTime) {
+ m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_CUT_WOOD;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_SAWMILL;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nCounter = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ gSawMillNextTime = time + 2000 + m_anRandomTable[3] % 4000;
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
+{
+ switch (sound) {
+ case SCRIPT_SOUND_LAUNDERETTE_LOOP_S:
+ case SCRIPT_SOUND_LAUNDERETTE_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ break;
+ default:
+ return;
+ }
+ float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_LAUNDERETTE;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP);
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = 45;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_LAUNDERETTE;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP);
+ m_sQueueSample.m_nCounter = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = 110;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+void
+cAudioManager::ProcessShopScriptObject(uint8 sound)
+{
+ uint32 time;
+ int32 rand;
+ float distSquared;
+
+ switch (sound) {
+ case SCRIPT_SOUND_SHOP_LOOP_S:
+ case SCRIPT_SOUND_SHOP_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ break;
+ default:
+ return;
+ }
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_SHOP;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP);
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = 30;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ time = CTimer::GetTimeInMilliseconds();
+ if (time > gShopNextTime) {
+ m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ rand = m_anRandomTable[1] & 1;
+ m_sQueueSample.m_nSampleIndex = rand + SFX_SHOP_TILL_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_SHOP;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nCounter = rand + 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = 70;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ gShopNextTime = time + 3000 + m_anRandomTable[3] % 7000;
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessAirportScriptObject(uint8 sound)
+{
+ static uint8 iSound = 0;
+
+ uint32 time = CTimer::GetTimeInMilliseconds();
+ if (time > gAirportNextTime) {
+ switch (sound) {
+ case SCRIPT_SOUND_AIRPORT_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ break;
+ case SCRIPT_SOUND_AIRPORT_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ break;
+ default:
+ return;
+ }
+ float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_AIRPORT;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = 110;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ gAirportNextTime = time + 10000 + m_anRandomTable[3] % 20000;
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessCinemaScriptObject(uint8 sound)
+{
+ uint8 rand;
+
+ static uint8 iSound = 0;
+
+ uint32 time = CTimer::GetTimeInMilliseconds();
+ if (time > gCinemaNextTime) {
+ switch (sound) {
+ case SCRIPT_SOUND_CINEMA_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ break;
+ case SCRIPT_SOUND_CINEMA_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ break;
+ default:
+ return;
+ }
+ float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ rand = m_anRandomTable[0] % 90 + 30;
+ m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = iSound % 3 + SFX_CINEMA_BASS_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CINEMA;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 4);
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = rand;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ gCinemaNextTime = time + 1000 + m_anRandomTable[3] % 4000;
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessDocksScriptObject(uint8 sound)
+{
+ uint32 time;
+ uint8 rand;
+ float distSquared;
+
+ static uint8 iSound = 0;
+
+ time = CTimer::GetTimeInMilliseconds();
+ if (time > gDocksNextTime) {
+ switch (sound) {
+ case SCRIPT_SOUND_DOCKS_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ break;
+ case SCRIPT_SOUND_DOCKS_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ break;
+ default:
+ return;
+ }
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ rand = m_anRandomTable[0] % 60 + 40;
+ m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = SFX_DOCKS_FOGHORN;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_DOCKS;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nEmittingVolume = rand;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ gDocksNextTime = time + 10000 + m_anRandomTable[3] % 40000;
+ }
+ }
+ }
+}
+void
+cAudioManager::ProcessHomeScriptObject(uint8 sound)
+{
+ uint32 time;
+ uint8 rand;
+ float dist;
+
+ static uint8 iSound = 0;
+
+ time = CTimer::GetTimeInMilliseconds();
+ if (time > gHomeNextTime) {
+ switch (sound) {
+ case SCRIPT_SOUND_HOME_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ break;
+ case SCRIPT_SOUND_HOME_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ break;
+ default:
+ return;
+ }
+ dist = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (dist < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(dist);
+ rand = m_anRandomTable[0] % 30 + 40;
+ m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + SFX_HOME_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_HOME;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_nEmittingVolume = rand;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = true;
+ AddSampleToRequestedQueue();
+ gHomeNextTime = time + 1000 + m_anRandomTable[3] % 4000;
+ }
+ }
+ }
+}
+void
+cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound)
+{
+ uint32 time = CTimer::GetTimeInMilliseconds();
+ int32 sampleIndex;
+ uint8 emittingVol;
+ float distSquared;
+ cPedParams params;
+
+ static uint8 iSound = 0;
+
+ if (time > gCellNextTime) {
+ switch (sound) {
+ case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S;
+ break;
+ case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L:
+ m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L;
+ break;
+ default:
+ return;
+ }
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ if (m_FrameCounter & 1)
+ sampleIndex = (m_anRandomTable[1] & 3) + SFX_FIGHT_1;
+ else
+ sampleIndex = (m_anRandomTable[3] & 1) + SFX_BAT_HIT_LEFT;
+ m_sQueueSample.m_nSampleIndex = sampleIndex;
+ emittingVol = m_anRandomTable[0] % 50 + 55;
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ params.m_bDistanceCalculated = true;
+ params.m_fDistance = distSquared;
+ params.m_pPed = nil;
+ SetupPedComments(&params, SOUND_INJURED_PED_MALE_PRISON);
+ }
+ gCellNextTime = time + 500 + m_anRandomTable[3] % 1500;
+ }
+ }
+}
+#pragma endregion All the code for script object audio on the map
+
+void
+cAudioManager::ProcessWeather(int32 id)
+{
+ uint8 vol;
+ static uint8 iSound = 0;
+
+ if (m_asAudioEntities[id].m_AudioEvents && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) {
+ if (m_asAudioEntities[id].m_afVolume[0] >= 10.f) {
+ m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000;
+ vol = (m_asAudioEntities[id].m_afVolume[0] - 10.f) + 40;
+ } else {
+ m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000;
+ vol = (m_asAudioEntities[id].m_afVolume[0]) + 35;
+ }
+ m_sQueueSample.m_nVolume = vol;
+ if (TheCamera.SoundDistUp < 20.f)
+ m_sQueueSample.m_nVolume /= 2;
+ if (iSound == 4)
+ iSound = 0;
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nOffset = (m_anRandomTable[2] & 15) + 55;
+ m_sQueueSample.m_bIs2D = true;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_bReverbFlag = false;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
+ m_sQueueSample.m_nSampleIndex = SFX_RAIN;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAIN);
+ m_sQueueSample.m_nVolume = (int32)(25.f * CWeather::Rain);
+ m_sQueueSample.m_nCounter = 4;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_nOffset = 63;
+ m_sQueueSample.m_bIs2D = true;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 30;
+ m_sQueueSample.m_bReverbFlag = false;
+ m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+}
+
+void
+cAudioManager::ProcessFrontEnd()
+{
+ bool stereo;
+ bool processedPickup;
+ bool processedMission;
+ bool frontendBank;
+ int16 sample;
+
+ static uint8 iSound = 0;
+ static uint32 cPickupNextFrame = 0;
+ static uint32 cPartMisComNextFrame = 0;
+
+ for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
+ processedPickup = false;
+ stereo = false;
+ processedMission = false;
+ frontendBank = false;
+ switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]) {
+ case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM:
+ m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_RIFLE;
+ break;
+ case SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM:
+ m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_ROCKET_LAUNCHER;
+ break;
+ case SOUND_GARAGE_NO_MONEY:
+ case SOUND_GARAGE_BAD_VEHICLE:
+ case SOUND_GARAGE_BOMB_ALREADY_SET:
+ m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT;
+ stereo = true;
+ break;
+ case SOUND_GARAGE_OPENING:
+ case SOUND_GARAGE_BOMB1_SET:
+ case SOUND_GARAGE_BOMB2_SET:
+ case SOUND_GARAGE_BOMB3_SET:
+ case SOUND_41:
+ case SOUND_GARAGE_VEHICLE_DECLINED:
+ case SOUND_GARAGE_VEHICLE_ACCEPTED:
+ case SOUND_PICKUP_HEALTH:
+ case SOUND_4B:
+ case SOUND_PICKUP_ADRENALINE:
+ case SOUND_PICKUP_ARMOUR:
+ case SOUND_EVIDENCE_PICKUP:
+ case SOUND_UNLOAD_GOLD:
+ m_sQueueSample.m_nSampleIndex = SFX_PICKUP_2_LEFT;
+ processedPickup = true;
+ stereo = true;
+ break;
+ case SOUND_PICKUP_WEAPON_BOUGHT:
+ case SOUND_PICKUP_WEAPON:
+ m_sQueueSample.m_nSampleIndex = SFX_PICKUP_1_LEFT;
+ processedPickup = true;
+ stereo = true;
+ break;
+ case SOUND_PICKUP_ERROR:
+ m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT;
+ processedPickup = true;
+ stereo = true;
+ break;
+ case SOUND_PICKUP_BONUS:
+ case SOUND_PICKUP_MONEY:
+ case SOUND_PICKUP_HIDDEN_PACKAGE:
+ case SOUND_PICKUP_PACMAN_PILL:
+ case SOUND_PICKUP_PACMAN_PACKAGE:
+ case SOUND_PICKUP_FLOAT_PACKAGE:
+ m_sQueueSample.m_nSampleIndex = SFX_PICKUP_3_LEFT;
+ processedPickup = true;
+ stereo = true;
+ break;
+ case SOUND_PAGER:
+ // TODO: ps2 code
+ m_sQueueSample.m_nSampleIndex = SFX_PAGER;
+ break;
+ case SOUND_RACE_START_3:
+ case SOUND_RACE_START_2:
+ case SOUND_RACE_START_1:
+ case SOUND_CLOCK_TICK:
+ m_sQueueSample.m_nSampleIndex = SFX_TIMER_BEEP;
+ break;
+ case SOUND_RACE_START_GO:
+ m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE;
+ break;
+ case SOUND_PART_MISSION_COMPLETE:
+ m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE;
+ processedMission = true;
+ break;
+ case SOUND_FRONTEND_MENU_STARTING:
+ m_sQueueSample.m_nSampleIndex = SFX_START_BUTTON_LEFT;
+ stereo = true;
+ break;
+ case SOUND_FRONTEND_MENU_NEW_PAGE:
+ m_sQueueSample.m_nSampleIndex = SFX_PAGE_CHANGE_AND_BACK_LEFT;
+ stereo = true;
+ frontendBank = true;
+ break;
+ case SOUND_FRONTEND_MENU_NAVIGATION:
+ m_sQueueSample.m_nSampleIndex = SFX_HIGHLIGHT_LEFT;
+ stereo = true;
+ frontendBank = true;
+ break;
+ case SOUND_FRONTEND_MENU_SETTING_CHANGE:
+ m_sQueueSample.m_nSampleIndex = SFX_SELECT_LEFT;
+ stereo = true;
+ frontendBank = true;
+ break;
+ case SOUND_FRONTEND_MENU_BACK:
+ m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT;
+ stereo = true;
+ frontendBank = true;
+ break;
+ case SOUND_9A:
+ m_sQueueSample.m_nSampleIndex = SFX_STEREO_LEFT;
+ stereo = true;
+ frontendBank = true;
+ break;
+ case SOUND_9B:
+ m_sQueueSample.m_nSampleIndex = SFX_MONO;
+ frontendBank = true;
+ break;
+ case SOUND_FRONTEND_AUDIO_TEST:
+ m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 3 + SFX_NOISE_BURST_1;
+ frontendBank = true;
+ break;
+ case SOUND_FRONTEND_FAIL:
+ m_sQueueSample.m_nSampleIndex = SFX_ERROR_LEFT;
+ frontendBank = true;
+ stereo = true;
+ break;
+ case SOUND_FRONTEND_NO_RADIO:
+ case SOUND_FRONTEND_RADIO_CHANGE:
+ m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK;
+ break;
+ case SOUND_HUD:
+ m_sQueueSample.m_nSampleIndex = SFX_INFO;
+ break;
+ default:
+ continue;
+ }
+
+ if (processedPickup) {
+ if (m_FrameCounter <= cPickupNextFrame)
+ continue;
+ cPickupNextFrame = m_FrameCounter + 5;
+ } else if (processedMission) {
+ if (m_FrameCounter <= cPartMisComNextFrame)
+ continue;
+ cPartMisComNextFrame = m_FrameCounter + 5;
+ }
+
+ sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
+ if (sample == SFX_RAIN) {
+ m_sQueueSample.m_nFrequency = 28509;
+ } else if (sample == SFX_PICKUP_1_LEFT) {
+ if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] == 1.0f)
+ m_sQueueSample.m_nFrequency = 32000;
+ else
+ m_sQueueSample.m_nFrequency = 48000;
+ } else {
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ }
+ m_sQueueSample.m_nVolume = 110;
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nBankIndex = frontendBank ? SAMPLEBANK_FRONTEND : SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nReleasingVolumeModificator = 0;
+ m_sQueueSample.m_bIs2D = true;
+ m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ if (stereo)
+ m_sQueueSample.m_nOffset = m_anRandomTable[0] & 31;
+ else
+ m_sQueueSample.m_nOffset = 63;
+ m_sQueueSample.m_bReverbFlag = false;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ if (stereo) {
+ ++m_sQueueSample.m_nSampleIndex;
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_nOffset = MAX_VOLUME - m_sQueueSample.m_nOffset;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+void
+cAudioManager::ProcessCrane()
+{
+ CCrane *crane = (CCrane *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity;
+ float distSquared;
+ bool distCalculated = false;
+ static const int intensity = 80;
+
+ if (crane) {
+ if (crane->m_nCraneStatus == CCrane::ACTIVATED) {
+ if (crane->m_nCraneState != CCrane::IDLE) {
+ m_sQueueSample.m_vecPos = crane->m_pCraneEntity->GetPosition();
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(intensity)) {
+ CalculateDistance(distCalculated, distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_nFrequency = 6000;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = 100;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_fSoundIntensity = intensity;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) {
+ m_sQueueSample.m_nCounter = 1;
+ m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_2;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COL_CAR_2);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = true;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessProjectiles()
+{
+ const int rocketLauncherIntensity = 90;
+ const int molotovIntensity = 30;
+ const int molotovVolume = 50;
+ uint8 emittingVol;
+
+ for (int32 i = 0; i < NUM_PROJECTILES; i++) {
+ if (CProjectileInfo::GetProjectileInfo(i)->m_bInUse) {
+ switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) {
+ case WEAPONTYPE_ROCKETLAUNCHER:
+ emittingVol = MAX_VOLUME;
+ m_sQueueSample.m_fSoundIntensity = rocketLauncherIntensity;
+ m_sQueueSample.m_nSampleIndex = SFX_ROCKET_FLY;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_FLY);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ break;
+ case WEAPONTYPE_MOLOTOV:
+ emittingVol = molotovVolume;
+ m_sQueueSample.m_fSoundIntensity = molotovIntensity;
+ m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nFrequency = 32 * SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE) / 25;
+ m_sQueueSample.m_nReleasingVolumeModificator = 7;
+ break;
+ default:
+ return;
+ }
+ m_sQueueSample.m_fSpeedMultiplier = 4.0f;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition();
+ float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
+ m_sQueueSample.m_fDistance = Sqrt(distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = i;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = emittingVol;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessGarages()
+{
+ const float SOUND_INTENSITY = 80.0f;
+
+ CEntity *entity;
+ eGarageState state;
+ uint32 sampleIndex;
+ uint8 j;
+ float distSquared;
+ bool distCalculated;
+
+ static uint8 iSound = 32;
+
+ for (uint32 i = 0; i < CGarages::NumGarages; ++i) {
+ if (CGarages::aGarages[i].m_eGarageType == GARAGE_NONE)
+ continue;
+ entity = CGarages::aGarages[i].m_pDoor1;
+ if (entity == nil)
+ continue;
+ m_sQueueSample.m_vecPos = entity->GetPosition();
+ distCalculated = false;
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(SOUND_INTENSITY)) {
+ state = CGarages::aGarages[i].m_eGarageState;
+ // while is here just to exit prematurely and avoid goto
+ while (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) {
+ CalculateDistance(distCalculated, distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(90, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) {
+ if (CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) {
+ if (m_FrameCounter & 1) {
+ if (m_anRandomTable[1] & 1)
+ sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_CAR_1;
+ else
+ sampleIndex = m_anRandomTable[2] % 6 + SFX_COL_CAR_PANEL_1;
+ m_sQueueSample.m_nSampleIndex = sampleIndex;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2;
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nCounter = iSound++;
+ if (iSound < 32)
+ iSound = 32;
+ } else break; // premature exit to go straight to the for loop
+ } else {
+ m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
+ m_sQueueSample.m_nFrequency = 6543;
+
+ m_sQueueSample.m_nCounter = i;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ }
+ } else {
+ m_sQueueSample.m_nSampleIndex = SFX_GARAGE_DOOR_LOOP;
+ m_sQueueSample.m_nFrequency = 13961;
+
+ m_sQueueSample.m_nCounter = i;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ }
+
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_nEmittingVolume = 90;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ break;
+ }
+ }
+ for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) {
+ switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) {
+ case SOUND_GARAGE_DOOR_CLOSED:
+ case SOUND_GARAGE_DOOR_OPENED:
+ if (distSquared < SQR(SOUND_INTENSITY)) {
+ CalculateDistance(distCalculated, distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) {
+ m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2;
+ m_sQueueSample.m_nFrequency = 6735;
+ } else if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j] == SOUND_GARAGE_DOOR_OPENED) {
+ m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2;
+ m_sQueueSample.m_nFrequency = 22000;
+ } else {
+ m_sQueueSample.m_nSampleIndex = SFX_COL_GARAGE_DOOR_1;
+ m_sQueueSample.m_nFrequency = 18000;
+ }
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_nReleasingVolumeModificator = 4;
+ m_sQueueSample.m_nEmittingVolume = 60;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_nCounter = iSound++;
+ if (iSound < 32)
+ iSound = 32;
+ m_sQueueSample.m_bRequireReflection = true;
+ AddSampleToRequestedQueue();
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void
+cAudioManager::ProcessFireHydrant()
+{
+ float distSquared;
+ bool distCalculated = false;
+ static const int intensity = 35;
+
+ m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition();
+ distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (distSquared < SQR(intensity)) {
+ CalculateDistance(distCalculated, distSquared);
+ m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 4;
+ m_sQueueSample.m_nFrequency = 15591;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = 40;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = intensity;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = true;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+#pragma region BRIDGE
+const int bridgeIntensity = 400;
+
+void
+cAudioManager::ProcessBridge()
+{
+ float dist;
+ bool distCalculated = false;
+
+ if (CBridge::pLiftRoad) {
+ m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition();
+ dist = GetDistanceSquared(m_sQueueSample.m_vecPos);
+ if (dist < SQR(450.0f)) {
+ CalculateDistance(distCalculated, dist);
+ switch (CBridge::State) {
+ case STATE_BRIDGE_LOCKED:
+ case STATE_LIFT_PART_IS_UP:
+ case STATE_LIFT_PART_ABOUT_TO_MOVE_UP:
+ ProcessBridgeWarning();
+ break;
+ case STATE_LIFT_PART_MOVING_DOWN:
+ case STATE_LIFT_PART_MOVING_UP:
+ ProcessBridgeWarning();
+ ProcessBridgeMotor();
+ break;
+ default:
+ break;
+ }
+ ProcessBridgeOneShots();
+ }
+ }
+}
+
+void
+cAudioManager::ProcessBridgeWarning()
+{
+ if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) {
+ m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 0;
+ m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING);
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = 100;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = 450.0f;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 8;
+ m_sQueueSample.m_bReverbFlag = false;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+void
+cAudioManager::ProcessBridgeMotor()
+{
+ if (m_sQueueSample.m_fDistance < bridgeIntensity) {
+ m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 1;
+ m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nFrequency = 5500;
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_bReverbFlag = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+
+void
+cAudioManager::ProcessBridgeOneShots()
+{
+ if (CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP)
+ m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1;
+ else if (CBridge::State == STATE_LIFT_PART_IS_DOWN && CBridge::OldState == STATE_LIFT_PART_MOVING_DOWN)
+ m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1;
+ else if (CBridge::State == STATE_LIFT_PART_MOVING_UP && CBridge::OldState == STATE_LIFT_PART_ABOUT_TO_MOVE_UP)
+ m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1;
+ else if (CBridge::State == STATE_LIFT_PART_MOVING_DOWN && CBridge::OldState == STATE_LIFT_PART_IS_UP)
+ m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1;
+ else return;
+
+ if (m_sQueueSample.m_fDistance < bridgeIntensity) {
+ m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume != 0) {
+ m_sQueueSample.m_nCounter = 2;
+ m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
+ m_sQueueSample.m_nLoopStart = 0;
+ m_sQueueSample.m_nLoopEnd = -1;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_bReverbFlag = false;
+ m_sQueueSample.m_bRequireReflection = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+}
+#pragma endregion
+
+#pragma region MISSION_AUDIO
+bool g_bMissionAudioLoadFailed;
+
+struct MissionAudioData {
+ const char *m_pName;
+ int32 m_nId;
+};
+
+const MissionAudioData MissionAudioNameSfxAssoc[] = {
+ {"lib_a1", STREAMED_SOUND_MISSION_LIB_A1}, {"lib_a2", STREAMED_SOUND_MISSION_LIB_A2}, {"lib_a", STREAMED_SOUND_MISSION_LIB_A},
+ {"lib_b", STREAMED_SOUND_MISSION_LIB_B}, {"lib_c", STREAMED_SOUND_MISSION_LIB_C}, {"lib_d", STREAMED_SOUND_MISSION_LIB_D},
+ {"l2_a", STREAMED_SOUND_MISSION_L2_A}, {"j4t_1", STREAMED_SOUND_MISSION_J4T_1}, {"j4t_2", STREAMED_SOUND_MISSION_J4T_2},
+ {"j4t_3", STREAMED_SOUND_MISSION_J4T_3}, {"j4t_4", STREAMED_SOUND_MISSION_J4T_4}, {"j4_a", STREAMED_SOUND_MISSION_J4_A},
+ {"j4_b", STREAMED_SOUND_MISSION_J4_B}, {"j4_c", STREAMED_SOUND_MISSION_J4_C}, {"j4_d", STREAMED_SOUND_MISSION_J4_D},
+ {"j4_e", STREAMED_SOUND_MISSION_J4_E}, {"j4_f", STREAMED_SOUND_MISSION_J4_F}, {"j6_1", STREAMED_SOUND_MISSION_J6_1},
+ {"j6_a", STREAMED_SOUND_MISSION_J6_A}, {"j6_b", STREAMED_SOUND_MISSION_J6_B}, {"j6_c", STREAMED_SOUND_MISSION_J6_C},
+ {"j6_d", STREAMED_SOUND_MISSION_J6_D}, {"t4_a", STREAMED_SOUND_MISSION_T4_A}, {"s1_a", STREAMED_SOUND_MISSION_S1_A},
+ {"s1_a1", STREAMED_SOUND_MISSION_S1_A1}, {"s1_b", STREAMED_SOUND_MISSION_S1_B}, {"s1_c", STREAMED_SOUND_MISSION_S1_C},
+ {"s1_c1", STREAMED_SOUND_MISSION_S1_C1}, {"s1_d", STREAMED_SOUND_MISSION_S1_D}, {"s1_e", STREAMED_SOUND_MISSION_S1_E},
+ {"s1_f", STREAMED_SOUND_MISSION_S1_F}, {"s1_g", STREAMED_SOUND_MISSION_S1_G}, {"s1_h", STREAMED_SOUND_MISSION_S1_H},
+ {"s1_i", STREAMED_SOUND_MISSION_S1_I}, {"s1_j", STREAMED_SOUND_MISSION_S1_J}, {"s1_k", STREAMED_SOUND_MISSION_S1_K},
+ {"s1_l", STREAMED_SOUND_MISSION_S1_L}, {"s3_a", STREAMED_SOUND_MISSION_S3_A}, {"s3_b", STREAMED_SOUND_MISSION_S3_B},
+ {"el3_a", STREAMED_SOUND_MISSION_EL3_A}, {"mf1_a", STREAMED_SOUND_MISSION_MF1_A}, {"mf2_a", STREAMED_SOUND_MISSION_MF2_A},
+ {"mf3_a", STREAMED_SOUND_MISSION_MF3_A}, {"mf3_b", STREAMED_SOUND_MISSION_MF3_B}, {"mf3_b1", STREAMED_SOUND_MISSION_MF3_B1},
+ {"mf3_c", STREAMED_SOUND_MISSION_MF3_C}, {"mf4_a", STREAMED_SOUND_MISSION_MF4_A}, {"mf4_b", STREAMED_SOUND_MISSION_MF4_B},
+ {"mf4_c", STREAMED_SOUND_MISSION_MF4_C}, {"a1_a", STREAMED_SOUND_MISSION_A1_A}, {"a3_a", STREAMED_SOUND_MISSION_A3_A},
+ {"a5_a", STREAMED_SOUND_MISSION_A5_A}, {"a4_a", STREAMED_SOUND_MISSION_A4_A}, {"a4_b", STREAMED_SOUND_MISSION_A4_B},
+ {"a4_c", STREAMED_SOUND_MISSION_A4_C}, {"a4_d", STREAMED_SOUND_MISSION_A4_D}, {"k1_a", STREAMED_SOUND_MISSION_K1_A},
+ {"k3_a", STREAMED_SOUND_MISSION_K3_A}, {"r1_a", STREAMED_SOUND_MISSION_R1_A}, {"r2_a", STREAMED_SOUND_MISSION_R2_A},
+ {"r2_b", STREAMED_SOUND_MISSION_R2_B}, {"r2_c", STREAMED_SOUND_MISSION_R2_C}, {"r2_d", STREAMED_SOUND_MISSION_R2_D},
+ {"r2_e", STREAMED_SOUND_MISSION_R2_E}, {"r2_f", STREAMED_SOUND_MISSION_R2_F}, {"r2_g", STREAMED_SOUND_MISSION_R2_G},
+ {"r2_h", STREAMED_SOUND_MISSION_R2_H}, {"r5_a", STREAMED_SOUND_MISSION_R5_A}, {"r6_a", STREAMED_SOUND_MISSION_R6_A},
+ {"r6_a1", STREAMED_SOUND_MISSION_R6_A1}, {"r6_b", STREAMED_SOUND_MISSION_R6_B}, {"lo2_a", STREAMED_SOUND_MISSION_LO2_A},
+ {"lo6_a", STREAMED_SOUND_MISSION_LO6_A}, {"yd2_a", STREAMED_SOUND_MISSION_YD2_A}, {"yd2_b", STREAMED_SOUND_MISSION_YD2_B},
+ {"yd2_c", STREAMED_SOUND_MISSION_YD2_C}, {"yd2_c1", STREAMED_SOUND_MISSION_YD2_C1}, {"yd2_d", STREAMED_SOUND_MISSION_YD2_D},
+ {"yd2_e", STREAMED_SOUND_MISSION_YD2_E}, {"yd2_f", STREAMED_SOUND_MISSION_YD2_F}, {"yd2_g", STREAMED_SOUND_MISSION_YD2_G},
+ {"yd2_h", STREAMED_SOUND_MISSION_YD2_H}, {"yd2_ass", STREAMED_SOUND_MISSION_YD2_ASS}, {"yd2_ok", STREAMED_SOUND_MISSION_YD2_OK},
+ {"h5_a", STREAMED_SOUND_MISSION_H5_A}, {"h5_b", STREAMED_SOUND_MISSION_H5_B}, {"h5_c", STREAMED_SOUND_MISSION_H5_C},
+ {"ammu_a", STREAMED_SOUND_MISSION_AMMU_A}, {"ammu_b", STREAMED_SOUND_MISSION_AMMU_B}, {"ammu_c", STREAMED_SOUND_MISSION_AMMU_C},
+ {"door_1", STREAMED_SOUND_MISSION_DOOR_1}, {"door_2", STREAMED_SOUND_MISSION_DOOR_2}, {"door_3", STREAMED_SOUND_MISSION_DOOR_3},
+ {"door_4", STREAMED_SOUND_MISSION_DOOR_4}, {"door_5", STREAMED_SOUND_MISSION_DOOR_5}, {"door_6", STREAMED_SOUND_MISSION_DOOR_6},
+ {"t3_a", STREAMED_SOUND_MISSION_T3_A}, {"t3_b", STREAMED_SOUND_MISSION_T3_B}, {"t3_c", STREAMED_SOUND_MISSION_T3_C},
+ {"k1_b", STREAMED_SOUND_MISSION_K1_B}, {"c_1", STREAMED_SOUND_MISSION_CAT1}, {nil, 0}};
+
+int32
+FindMissionAudioSfx(const char *name)
+{
+ for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; ++i) {
+ if (!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name))
+ return MissionAudioNameSfxAssoc[i].m_nId;
+ }
+ debug("Can't find mission audio %s", name);
+ return NO_SAMPLE;
+}
+
+bool
+cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const
+{
+ switch (soundMission) {
+ case STREAMED_SOUND_MISSION_J6_D:
+ case STREAMED_SOUND_MISSION_T4_A:
+ case STREAMED_SOUND_MISSION_S1_H:
+ case STREAMED_SOUND_MISSION_S3_B:
+ case STREAMED_SOUND_MISSION_EL3_A:
+ case STREAMED_SOUND_MISSION_A3_A:
+ case STREAMED_SOUND_MISSION_A5_A:
+ case STREAMED_SOUND_MISSION_K1_A:
+ case STREAMED_SOUND_MISSION_R1_A:
+ case STREAMED_SOUND_MISSION_R5_A:
+ case STREAMED_SOUND_MISSION_LO2_A:
+ case STREAMED_SOUND_MISSION_LO6_A:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void
+cAudioManager::PreloadMissionAudio(Const char *name)
+{
+ if (m_bIsInitialised) {
+ int32 missionAudioSfx = FindMissionAudioSfx(name);
+ if (missionAudioSfx != NO_SAMPLE) {
+ m_sMissionAudio.m_nSampleIndex = missionAudioSfx;
+ m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
+ m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
+ m_sMissionAudio.field_22 = 0;
+ m_sMissionAudio.m_nMissionAudioCounter = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000;
+ m_sMissionAudio.m_nMissionAudioCounter *= 4;
+ m_sMissionAudio.m_bIsPlayed = false;
+ m_sMissionAudio.m_bPredefinedProperties = 1;
+ g_bMissionAudioLoadFailed = false;
+ }
+ }
+}
+
+uint8
+cAudioManager::GetMissionAudioLoadingStatus() const
+{
+ if (m_bIsInitialised)
+ return m_sMissionAudio.m_nLoadingStatus;
+
+ return LOADING_STATUS_LOADED;
+}
+
+void
+cAudioManager::SetMissionAudioLocation(float x, float y, float z)
+{
+ if (m_bIsInitialised) {
+ m_sMissionAudio.m_bPredefinedProperties = false;
+ m_sMissionAudio.m_vecPos = CVector(x, y, z);
+ }
+}
+
+void
+cAudioManager::PlayLoadedMissionAudio()
+{
+ if (m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && m_sMissionAudio.m_nLoadingStatus == LOADING_STATUS_LOADED &&
+ m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_STOPPED)
+ m_sMissionAudio.m_bIsPlayed = true;
+}
+
+bool
+cAudioManager::IsMissionAudioSampleFinished()
+{
+ if (m_bIsInitialised)
+ return m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_FINISHED;
+
+ static int32 cPretendFrame = 1;
+
+ return (cPretendFrame++ & 63) == 0;
+}
+
+void
+cAudioManager::ClearMissionAudio()
+{
+ if (m_bIsInitialised) {
+ m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
+ m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
+ m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
+ m_sMissionAudio.field_22 = 0;
+ m_sMissionAudio.m_bIsPlayed = false;
+ m_sMissionAudio.m_bPredefinedProperties = true;
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
+ }
+}
+
+void
+cAudioManager::ProcessMissionAudio()
+{
+ float dist;
+ uint8 emittingVol;
+ uint8 pan;
+ float distSquared;
+ CVector vec;
+
+ static uint8 nCheckPlayingDelay = 0;
+ static uint8 nFramesUntilFailedLoad = 0;
+ static uint8 nFramesForPretendPlaying = 0;
+
+ if (!m_bIsInitialised) return;
+ if (m_sMissionAudio.m_nSampleIndex == NO_SAMPLE) return;
+
+ switch (m_sMissionAudio.m_nLoadingStatus) {
+ case LOADING_STATUS_NOT_LOADED:
+ SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1);
+ m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED;
+ nFramesUntilFailedLoad = 0;
+ break;
+ case LOADING_STATUS_LOADED:
+ if (!m_sMissionAudio.m_bIsPlayed)
+ return;
+ if (g_bMissionAudioLoadFailed) {
+ if (m_bTimerJustReset) {
+ ClearMissionAudio();
+ SampleManager.StopStreamedFile(1);
+ nFramesForPretendPlaying = 0;
+ nCheckPlayingDelay = 0;
+ nFramesUntilFailedLoad = 0;
+ } else if (!m_nUserPause) {
+ if (++nFramesForPretendPlaying < 120) {
+ m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING;
+ } else {
+ m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
+ m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
+ }
+ }
+ break;
+ }
+ switch (m_sMissionAudio.m_nPlayStatus) {
+ case PLAY_STATUS_STOPPED:
+ if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) {
+ SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex);
+ } else {
+ if (m_nUserPause)
+ SampleManager.PauseStream(1, 1);
+ if (m_sMissionAudio.m_bPredefinedProperties) {
+ SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1);
+ } else {
+ distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos);
+ if (distSquared >= SQR(50.0f)) {
+ emittingVol = 0;
+ pan = 63;
+ } else {
+ dist = Sqrt(distSquared);
+ emittingVol = ComputeVolume(80, 50.0f, dist);
+ TranslateEntity(&m_sMissionAudio.m_vecPos, &vec);
+ pan = ComputePan(50.f, &vec);
+ }
+ SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, 1);
+ }
+ SampleManager.StartPreloadedStreamedFile(1);
+ }
+ m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING;
+ nCheckPlayingDelay = 30;
+ break;
+ case PLAY_STATUS_PLAYING:
+ if (m_bTimerJustReset) {
+ ClearMissionAudio();
+ SampleManager.StopStreamedFile(1);
+ break;
+ }
+ if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) {
+ if (!m_nUserPause) {
+ if (nCheckPlayingDelay) {
+ --nCheckPlayingDelay;
+ } else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || m_sMissionAudio.m_nMissionAudioCounter-- == 0) {
+ m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
+ m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
+ SampleManager.StopStreamedFile(1);
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
+ }
+ }
+ } else if (m_sMissionAudio.field_22) {
+ if (SampleManager.IsStreamPlaying(1) || m_nUserPause || m_nPreviousUserPause) {
+ if (m_nUserPause)
+ SampleManager.PauseStream(1, 1);
+ else
+ SampleManager.PauseStream(0, 1);
+ } else {
+ m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
+ m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
+ SampleManager.StopStreamedFile(1);
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
+ }
+ } else {
+ if (m_nUserPause)
+ break;
+ if (nCheckPlayingDelay--) {
+ if (!SampleManager.IsStreamPlaying(1))
+ break;
+ nCheckPlayingDelay = 0;
+ }
+ m_sMissionAudio.field_22 = 1;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case LOADING_STATUS_FAILED:
+ if (++nFramesUntilFailedLoad >= 90) {
+ nFramesForPretendPlaying = 0;
+ g_bMissionAudioLoadFailed = true;
+ nFramesUntilFailedLoad = 0;
+ m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED;
+ }
+ break;
+ default:
+ break;
+ }
+}
+#pragma endregion All the mission audio stuff \ No newline at end of file
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 20f4ea18..757254e6 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -3,300 +3,19 @@
#include "AudioManager.h"
#include "audio_enums.h"
-#include "Automobile.h"
-#include "Boat.h"
-#include "Bridge.h"
-#include "Camera.h"
-#include "Cranes.h"
-#include "DMAudio.h"
-#include "Entity.h"
-#include "Explosion.h"
-#include "Fire.h"
-#include "Garages.h"
-#include "General.h"
-#include "HandlingMgr.h"
-#include "Heli.h"
-#include "ModelIndices.h"
+#include "AudioScriptObject.h"
#include "MusicManager.h"
-#include "Pad.h"
-#include "Ped.h"
-#include "Physical.h"
-#include "Placeable.h"
-#include "Plane.h"
-#include "PlayerPed.h"
-#include "Pools.h"
-#include "Projectile.h"
-#include "ProjectileInfo.h"
-#include "Replay.h"
-#include "Stats.h"
-#include "SurfaceTable.h"
-#include "Train.h"
-#include "Transmission.h"
-#include "Vehicle.h"
-#include "WaterCannon.h"
-#include "Weather.h"
-#include "ZoneCull.h"
+#include "Timer.h"
+#include "DMAudio.h"
#include "sampman.h"
+#include "Camera.h"
+#include "World.h"
cAudioManager AudioManager;
-uint32 gPornNextTime;
-uint32 gSawMillNextTime;
-uint32 gShopNextTime;
-uint32 gAirportNextTime;
-uint32 gCinemaNextTime;
-uint32 gDocksNextTime;
-uint32 gHomeNextTime;
-uint32 gCellNextTime;
-uint32 gNextCryTime;
-uint8 gJumboVolOffsetPercentage;
-bool bPlayerJustEnteredCar;
-bool g_bMissionAudioLoadFailed;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1;
const int allChannels = channels + 2;
-const int maxVolume = 127;
-
-const int scriptObjectIntensityS = 30;
-const int scriptObjectIntensityL = 80;
-const int bridgeIntensity = 400;
-const int rocketLauncherIntensity = 90;
-const int molotovIntensity = 30;
-const int molotovVolume = 50;
-
-const int rainOnVehicleIntensity = 22;
-const int reverseGearIntensity = 30;
-const int engineDamageIntensity = 40;
-
-const bool hornPatternsArray[8][44] = {
- {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false,
- false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false},
- {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false},
- {false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false,
- false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false},
- {false, false, true, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true,
- true, true, true, true, true, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false},
- {false, false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
- {false, false, true, true, true, false, false, false, true, true, true, false, false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
- {false, false, true, true, true, true, false, false, false, false, true, true, true, false, false, true, true, true, false, false, true, true,
- true, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false},
- {false, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true,
- false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false},
-};
-
-const int totalAudioEntitiesSlots = 200;
-
-const uint8 panTable[64]{0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53,
- 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63};
-
-// TODO: where is this used? Is this the right file?
-enum eVehicleModel {
- LANDSTAL,
- IDAHO,
- STINGER,
- LINERUN,
- PEREN,
- SENTINEL,
- PATRIOT,
- FIRETRUK,
- TRASH,
- STRETCH,
- MANANA,
- INFERNUS,
- BLISTA,
- PONY,
- MULE,
- CHEETAH,
- AMBULAN,
- FBICAR,
- MOONBEAM,
- ESPERANT,
- TAXI,
- KURUMA,
- BOBCAT,
- MRWHOOP,
- BFINJECT,
- CORPSE,
- POLICE,
- ENFORCER,
- SECURICA,
- BANSHEE,
- PREDATOR,
- BUS,
- RHINO,
- BARRACKS,
- TRAIN,
- CHOPPER,
- DODO,
- COACH,
- CABBIE,
- STALLION,
- RUMPO,
- RCBANDIT,
- BELLYUP,
- MRWONGS,
- MAFIA,
- YARDIE,
- YAKUZA,
- DIABLOS,
- COLUMB,
- HOODS,
- AIRTRAIN,
- DEADDODO,
- SPEEDER,
- REEFER,
- PANLANT,
- FLATBED,
- YANKEE,
- ESCAPE,
- BORGNINE,
- TOYZ,
- GHOST,
- CAR151,
- CAR152,
- CAR153,
- CAR154,
- CAR155,
- CAR156,
- CAR157,
- CAR158,
- CAR159,
-};
-
-enum PLAY_STATUS : uint8 { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING = 1, PLAY_STATUS_FINISHED = 2 };
-
-enum LOADING_STATUS : uint8 { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED = 1 };
-
-cPedComments::cPedComments()
-{
- for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
- for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) {
- m_asPedComments[j][i].m_nProcess = -1;
- m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS;
- }
-
- for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++)
- m_nCommentsInBank[i] = 0;
- m_nActiveBank = 0;
-}
-
-void
-cPedComments::Add(tPedComment *com)
-{
- uint8 index;
-
- if (m_nCommentsInBank[m_nActiveBank] >= NUM_PED_COMMENTS_SLOTS) {
- index = m_nIndexMap[m_nActiveBank][NUM_PED_COMMENTS_SLOTS - 1];
- if (m_asPedComments[m_nActiveBank][index].m_bVolume > com->m_bVolume)
- return;
- } else {
- index = m_nCommentsInBank[m_nActiveBank]++;
- }
-
- m_asPedComments[m_nActiveBank][index].m_nSampleIndex = com->m_nSampleIndex;
- m_asPedComments[m_nActiveBank][index].m_nEntityIndex = com->m_nEntityIndex;
- m_asPedComments[m_nActiveBank][index].m_vecPos = com->m_vecPos;
- m_asPedComments[m_nActiveBank][index].m_fDistance = com->m_fDistance;
- m_asPedComments[m_nActiveBank][index].m_bVolume = com->m_bVolume;
-
- uint32 i = 0;
- if (index != 0) {
- for (i = 0; i < index; i++) {
- if (m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][i]].m_bVolume < m_asPedComments[m_nActiveBank][index].m_bVolume) {
- break;
- }
- }
-
- if (i < index)
- memmove(&m_nIndexMap[m_nActiveBank][i + 1], &m_nIndexMap[m_nActiveBank][i], NUM_PED_COMMENTS_SLOTS - 1 - i);
- }
-
- m_nIndexMap[m_nActiveBank][i] = index;
-}
-
-void
-cPedComments::Process()
-{
- int sampleIndex;
- uint8 actualUsedBank;
- tPedComment *comment;
-
- static const int defaultIntensity = 50;
- static const int policeHeliIntensity = 400;
-
- if (!AudioManager.m_nUserPause) {
- if (m_nCommentsInBank[m_nActiveBank]) {
- sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;
- if (!SampleManager.IsPedCommentLoaded(sampleIndex))
- SampleManager.LoadPedComment(sampleIndex);
-
- AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex;
- AudioManager.m_sQueueSample.m_nCounter = 0;
- AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
- AudioManager.m_sQueueSample.m_nBankIndex = SAMPLEBANK_PED;
- AudioManager.m_sQueueSample.m_nReleasingVolumeModificator = 3;
- AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_bVolume;
- AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance;
- AudioManager.m_sQueueSample.m_nLoopCount = 1;
- AudioManager.m_sQueueSample.m_nLoopStart = 0;
- AudioManager.m_sQueueSample.m_nLoopEnd = -1;
- AudioManager.m_sQueueSample.m_nEmittingVolume = maxVolume;
- AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f;
- switch (sampleIndex) {
- case SFX_POLICE_HELI_1:
- case SFX_POLICE_HELI_2:
- case SFX_POLICE_HELI_3:
- AudioManager.m_sQueueSample.m_fSoundIntensity = policeHeliIntensity;
- break;
- default:
- AudioManager.m_sQueueSample.m_fSoundIntensity = defaultIntensity;
- break;
- }
- AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true;
- AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos;
-
- if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) {
- AudioManager.m_sQueueSample.m_bReverbFlag = false;
- AudioManager.m_sQueueSample.m_bRequireReflection = false;
- } else {
- AudioManager.m_sQueueSample.m_bReverbFlag = true;
- AudioManager.m_sQueueSample.m_bRequireReflection = true;
- }
-
- AudioManager.m_sQueueSample.m_bIs2D = false;
- AudioManager.m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + AudioManager.RandomDisplacement(750);
- if (CTimer::GetIsSlowMotionActive())
- AudioManager.m_sQueueSample.m_nFrequency /= 2;
- m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1;
- AudioManager.AddSampleToRequestedQueue();
- }
-
- // Switch bank
- if (m_nActiveBank) {
- actualUsedBank = SAMPLEBANK_PED;
- m_nActiveBank = SAMPLEBANK_MAIN;
- } else {
- actualUsedBank = SAMPLEBANK_MAIN;
- m_nActiveBank = SAMPLEBANK_PED;
- }
- comment = m_asPedComments[actualUsedBank];
- for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) {
- if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) {
- --m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess;
- Add(&comment[m_nIndexMap[actualUsedBank][i]]);
- }
- }
-
- for (uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) {
- m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS;
- }
- m_nCommentsInBank[actualUsedBank] = 0;
- }
-}
cAudioManager::cAudioManager()
{
@@ -312,7 +31,7 @@ cAudioManager::cAudioManager()
ClearActiveSamples();
GenerateIntegerRandomNumberTable();
field_4 = 0;
- m_bDynamicAcousticModelingStatus = 1;
+ m_bDynamicAcousticModelingStatus = true;
for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
m_asAudioEntities[i].m_bIsUsed = false;
@@ -320,8 +39,8 @@ cAudioManager::cAudioManager()
}
m_nAudioEntitiesTotal = 0;
m_FrameCounter = 0;
- m_bFifthFrameFlag = 0;
- m_bTimerJustReset = 0;
+ m_bFifthFrameFlag = false;
+ m_bTimerJustReset = false;
m_nTimer = 0;
}
@@ -332,291 +51,73 @@ cAudioManager::~cAudioManager()
}
void
-cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
-{
- uint32 i = 0;
- if (sample != 0) {
- for (; i < sample; i++) {
- if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nCalculatedVolume >
- m_asSamples[m_nActiveSampleQueue][sample].m_nCalculatedVolume)
- break;
- }
- if (i < sample) {
- memmove(&m_abSampleQueueIndexTable[m_nActiveSampleQueue][i + 1], &m_abSampleQueueIndexTable[m_nActiveSampleQueue][i], m_nActiveSamples - i - 1);
- }
- }
- m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
-}
-
-void
-cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, uint8 counter, bool notLooping)
-{
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = counter;
- m_sQueueSample.m_nSampleIndex = sample;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nFrequency = freq;
- if (notLooping) {
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nReleasingVolumeDivider = 8;
- } else {
- m_sQueueSample.m_nLoopCount = 1;
- }
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 6.0f;
- m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
-}
-
-void
-cAudioManager::AddReflectionsToRequestedQueue()
+cAudioManager::Initialise()
{
- float reflectionDistance;
- int32 noise;
- uint8 emittingVolume = (m_sQueueSample.m_nVolume / 2) + (m_sQueueSample.m_nVolume / 8);
-
- for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
- reflectionDistance = m_afReflectionsDistances[i];
- if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_fSoundIntensity) {
- m_sQueueSample.m_nLoopsRemaining = (reflectionDistance * 500.f / 1029.f);
- if (m_sQueueSample.m_nLoopsRemaining > 5) {
- m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
- m_sQueueSample.m_nCounter += (i + 1) * 256;
- if (m_sQueueSample.m_nLoopCount) {
- noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- if (noise <= 0)
- m_sQueueSample.m_nFrequency += noise;
- else
- m_sQueueSample.m_nFrequency -= noise;
- }
- m_sQueueSample.m_nReleasingVolumeModificator += 20;
- m_sQueueSample.m_vecPos = m_avecReflectionsPos[i];
- AddSampleToRequestedQueue();
- }
+ if (!m_bIsInitialised) {
+ PreInitialiseGameSpecificSetup();
+ m_bIsInitialised = SampleManager.Initialise();
+ if (m_bIsInitialised) {
+ m_nActiveSamples = SampleManager.GetMaximumSupportedChannels();
+ if (m_nActiveSamples <= 1) {
+ Terminate();
+ } else {
+ --m_nActiveSamples;
+ PostInitialiseGameSpecificSetup();
+ InitialisePoliceRadioZones();
+ InitialisePoliceRadio();
+ MusicManager.Initialise();
}
}
}
}
void
-cAudioManager::AddReleasingSounds()
+cAudioManager::Terminate()
{
- bool toProcess[44]; // why not 27?
-
- int8 queue = m_nActiveSampleQueue == 0;
-
- for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) {
- tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];
- if (sample.m_bLoopEnded)
- continue;
+ if (m_bIsInitialised) {
+ MusicManager.Terminate();
- toProcess[i] = false;
- for (int32 j = 0; j < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; j++) {
- if (sample.m_nEntityIndex == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nEntityIndex &&
- sample.m_nCounter == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nCounter) {
- toProcess[i] = true;
- break;
- }
- }
- if (!toProcess[i]) {
- if (sample.m_nCounter <= 255 || !sample.m_nLoopsRemaining) {
- if (!sample.m_nReleasingVolumeDivider)
- continue;
- if (!sample.m_nLoopCount) {
- if (sample.m_nVolumeChange == -1) {
- sample.m_nVolumeChange = sample.m_nVolume / sample.m_nReleasingVolumeDivider;
- if (sample.m_nVolumeChange <= 0)
- sample.m_nVolumeChange = 1;
- }
- if (sample.m_nVolume <= sample.m_nVolumeChange) {
- sample.m_nReleasingVolumeDivider = 0;
- continue;
- }
- sample.m_nVolume -= sample.m_nVolumeChange;
- }
- --sample.m_nReleasingVolumeDivider;
- if (m_bFifthFrameFlag) {
- if (sample.m_nReleasingVolumeModificator < 20)
- ++sample.m_nReleasingVolumeModificator;
- }
- sample.m_bReleasingSoundFlag = 0;
- }
- memcpy(&m_sQueueSample, &sample, sizeof(tSound));
- AddSampleToRequestedQueue();
+ for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
+ m_asAudioEntities[i].m_bIsUsed = false;
+ m_anAudioEntityIndices[i] = ARRAY_SIZE(m_anAudioEntityIndices);
}
- }
-}
-void
-cAudioManager::AddSampleToRequestedQueue()
-{
- int32 calculatedVolume;
- uint8 sampleIndex;
- bool bReflections;
+ m_nAudioEntitiesTotal = 0;
+ m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
+ PreTerminateGameSpecificShutdown();
- if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
- calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (maxVolume - m_sQueueSample.m_nVolume);
- sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
- if (sampleIndex >= m_nActiveSamples) {
- sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1];
- if (m_asSamples[m_nActiveSampleQueue][sampleIndex].m_nCalculatedVolume <= calculatedVolume)
- return;
- } else {
- ++m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
- }
- m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
- m_sQueueSample.m_bLoopEnded = false;
- if (m_sQueueSample.m_bIs2D) {
- m_sQueueSample.m_bRequireReflection = false;
- m_sQueueSample.m_nLoopsRemaining = 0;
- }
- if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) {
- bReflections = m_sQueueSample.m_bRequireReflection;
- } else {
- bReflections = false;
- m_sQueueSample.m_nLoopsRemaining = 0;
+ for (uint32 i = 0; i < MAX_SAMPLEBANKS; i++) {
+ if (SampleManager.IsSampleBankLoaded(i))
+ SampleManager.UnloadSampleBank(i);
}
- m_sQueueSample.m_bRequireReflection = false;
-
- if (!m_bDynamicAcousticModelingStatus)
- m_sQueueSample.m_bReverbFlag = false;
- m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
+ SampleManager.Terminate();
- AddDetailsToRequestedOrderList(sampleIndex);
- if (bReflections)
- AddReflectionsToRequestedQueue();
+ m_bIsInitialised = false;
+ PostTerminateGameSpecificShutdown();
}
}
void
-cAudioManager::CalculateDistance(bool &distCalculated, float dist)
-{
- if (!distCalculated) {
- m_sQueueSample.m_fDistance = Sqrt(dist);
- distCalculated = true;
- }
-}
-
-bool
-cAudioManager::CheckForAnAudioFileOnCD() const
-{
- return SampleManager.CheckForAnAudioFileOnCD();
-}
-
-void
-cAudioManager::ClearActiveSamples()
+cAudioManager::Service()
{
- for (int32 i = 0; i < m_nActiveSamples; i++) {
- m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
- m_asActiveSamples[i].m_nCounter = 0;
- m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
- m_asActiveSamples[i].m_nBankIndex = SAMPLEBANK_INVALID;
- m_asActiveSamples[i].m_bIs2D = false;
- m_asActiveSamples[i].m_nReleasingVolumeModificator = 5;
- m_asActiveSamples[i].m_nFrequency = 0;
- m_asActiveSamples[i].m_nVolume = 0;
- m_asActiveSamples[i].m_nEmittingVolume = 0;
- m_asActiveSamples[i].m_fDistance = 0.0f;
- m_asActiveSamples[i].m_bIsProcessed = false;
- m_asActiveSamples[i].m_bLoopEnded = false;
- m_asActiveSamples[i].m_nLoopCount = 1;
- m_asActiveSamples[i].m_nLoopStart = 0;
- m_asActiveSamples[i].m_nLoopEnd = -1;
- m_asActiveSamples[i].m_fSpeedMultiplier = 0.0f;
- m_asActiveSamples[i].m_fSoundIntensity = 200.0f;
- m_asActiveSamples[i].m_nOffset = 63;
- m_asActiveSamples[i].m_bReleasingSoundFlag = false;
- 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_bReverbFlag = false;
- m_asActiveSamples[i].m_nLoopsRemaining = 0;
- m_asActiveSamples[i].m_bRequireReflection = false;
+ GenerateIntegerRandomNumberTable();
+ if (m_bTimerJustReset) {
+ ResetAudioLogicTimers(m_nTimer);
+ MusicManager.ResetTimers(m_nTimer);
+ m_bTimerJustReset = false;
}
-}
-
-void
-cAudioManager::ClearMissionAudio()
-{
if (m_bIsInitialised) {
- m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
- m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
- m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
- m_sMissionAudio.field_22 = 0;
- m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.m_bPredefinedProperties = 1;
- m_sMissionAudio.m_nMissionAudioCounter = 0;
- }
-}
-
-void
-cAudioManager::ClearRequestedQueue()
-{
- for (int32 i = 0; i < m_nActiveSamples; i++) {
- m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = m_nActiveSamples;
- }
- m_SampleRequestQueuesStatus[m_nActiveSampleQueue] = 0;
-}
-
-int32
-cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const
-{
- uint32 newFreq = oldFreq;
- if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) {
- float dist = position2 - position1;
- if (dist != 0.0f) {
- float speedOfSource = (dist / m_nTimeSpent) * speedMultiplier;
- if (m_fSpeedOfSound > Abs(speedOfSource)) {
- if (speedOfSource < 0.0f) {
- speedOfSource = Max(speedOfSource, -1.5f);
- } else {
- speedOfSource = Min(speedOfSource, 1.5f);
- }
- newFreq = (oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound);
- }
- }
+ m_nPreviousUserPause = m_nUserPause;
+ m_nUserPause = CTimer::GetIsUserPaused();
+ UpdateReflections();
+ ServiceSoundEffects();
+ MusicManager.Service();
}
- return newFreq;
}
int32
-cAudioManager::ComputePan(float dist, CVector *vec)
-{
- int32 index = Min(63, Abs(vec->x / (dist / 64.f)));
-
- if (vec->x > 0.f)
- return Max(20, 63 - panTable[index]);
- return Min(107, panTable[index] + 63);
-}
-
-uint8
-cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const
-{
- float newSoundIntensity;
- if (soundIntensity <= 0.0f)
- return 0;
- newSoundIntensity = soundIntensity / 5.0f;
- if (newSoundIntensity <= distance)
- emittingVolume = sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) / (soundIntensity - newSoundIntensity)) * emittingVolume;
- return emittingVolume;
-}
-
-int32
-cAudioManager::CreateEntity(int32 type, void *entity)
+cAudioManager::CreateEntity(eAudioType type, void *entity)
{
if (!m_bIsInitialised)
return AEHANDLE_ERROR_NOAUDIOSYS;
@@ -628,12 +129,12 @@ cAudioManager::CreateEntity(int32 type, void *entity)
if (!m_asAudioEntities[i].m_bIsUsed) {
m_asAudioEntities[i].m_bIsUsed = true;
m_asAudioEntities[i].m_nStatus = 0;
- m_asAudioEntities[i].m_nType = (eAudioType)type;
+ m_asAudioEntities[i].m_nType = type;
m_asAudioEntities[i].m_pEntity = entity;
- m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_TOTAL_PED_SOUNDS;
- m_asAudioEntities[i].m_awAudioEvent[1] = SOUND_TOTAL_PED_SOUNDS;
- m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_TOTAL_PED_SOUNDS;
- m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_TOTAL_PED_SOUNDS;
+ m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND;
+ m_asAudioEntities[i].m_awAudioEvent[1] = SOUND_NO_SOUND;
+ m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_NO_SOUND;
+ m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_NO_SOUND;
m_asAudioEntities[i].m_AudioEvents = 0;
m_anAudioEntityIndices[m_nAudioEntitiesTotal++] = i;
return i;
@@ -643,49 +144,15 @@ cAudioManager::CreateEntity(int32 type, void *entity)
}
void
-cAudioManager::DestroyAllGameCreatedEntities()
-{
- cAudioScriptObject *entity;
-
- if (m_bIsInitialised) {
- for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) {
- if (m_asAudioEntities[i].m_bIsUsed) {
- switch (m_asAudioEntities[i].m_nType) {
- case AUDIOTYPE_PHYSICAL:
- case AUDIOTYPE_EXPLOSION:
- case AUDIOTYPE_WEATHER:
- case AUDIOTYPE_CRANE:
- case AUDIOTYPE_GARAGE:
- case AUDIOTYPE_FIREHYDRANT:
- DestroyEntity(i);
- break;
- case AUDIOTYPE_SCRIPTOBJECT:
- entity = (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity;
- if (entity) {
- delete entity;
- m_asAudioEntities[i].m_pEntity = nil;
- }
- DestroyEntity(i);
- break;
- default:
- break;
- }
- }
- }
- m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
- }
-}
-
-void
cAudioManager::DestroyEntity(int32 id)
{
- if (m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed) {
+ if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) {
m_asAudioEntities[id].m_bIsUsed = false;
for (int32 i = 0; i < m_nAudioEntitiesTotal; ++i) {
if (id == m_anAudioEntityIndices[i]) {
- if (i < totalAudioEntitiesSlots - 1)
+ if (i < NUM_AUDIOENTITIES - 1)
memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1], NUM_AUDIOENTITY_EVENTS * (m_nAudioEntitiesTotal - (i + 1)));
- m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = totalAudioEntitiesSlots;
+ m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = NUM_AUDIOENTITIES;
return;
}
}
@@ -693,2243 +160,245 @@ cAudioManager::DestroyEntity(int32 id)
}
void
-cAudioManager::DoJumboVolOffset() const
-{
- if (!(m_FrameCounter % (m_anRandomTable[0] % 6 + 3)))
- gJumboVolOffsetPercentage = m_anRandomTable[1] % 60;
-}
-
-uint32
-cAudioManager::GetPlayerTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_DAMAGE:
- GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_HIGH_DAMAGE_GRUNT_1, 11);
- break;
- case SOUND_PED_HIT:
- GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_LOW_DAMAGE_GRUNT_1, 10);
- break;
- case SOUND_PED_LAND:
- GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_HIT_GROUND_GRUNT_1, 6);
- break;
- default:
- sfx = NO_SAMPLE;
- break;
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetCopTalkSfx(int16 sound)
-{
- uint32 sfx;
- PedState pedState;
- static uint32 lastSfx = NO_SAMPLE;
-
- if (sound == SOUND_PED_ARREST_COP) {
- GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_ARREST_1, 6);
- } else {
- if (sound != SOUND_PED_PURSUIT_COP) {
- return GetGenericMaleTalkSfx(sound);
- }
-
- pedState = FindPlayerPed()->m_nPedState;
- if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
- return NO_SAMPLE;
- GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_CHASE_1, 7);
- }
-
- return (SFX_COP_VOICE_2_ARREST_1 - SFX_COP_VOICE_1_ARREST_1) * (m_sQueueSample.m_nEntityIndex % 5) + sfx;
-}
-
-uint32
-cAudioManager::GetSwatTalkSfx(int16 sound)
+cAudioManager::SetEntityStatus(int32 id, uint8 status)
{
- uint32 sfx;
- PedState pedState;
- static uint32 lastSfx = NO_SAMPLE;
-
- if (sound == SOUND_PED_ARREST_SWAT) {
- GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6);
- } else {
- if (sound != SOUND_PED_PURSUIT_SWAT) {
- return GetGenericMaleTalkSfx(sound);
- }
-
- pedState = FindPlayerPed()->m_nPedState;
- if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
- return NO_SAMPLE;
- GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6);
- }
-
- return (SFX_SWAT_VOICE_2_CHASE_1 - SFX_SWAT_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 4) + sfx;
+ if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed)
+ m_asAudioEntities[id].m_nStatus = status;
}
-uint32
-cAudioManager::GetFBITalkSfx(int16 sound)
+void
+cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
{
- uint32 sfx;
- PedState pedState;
- static uint32 lastSfx = NO_SAMPLE;
+ static const uint8 OneShotPriority[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 4, 4, 3, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9,
+ 2, 2, 0, 0, 0, 0, 3, 3, 5, 1, 1, 1, 1, 3, 4, 7, 6, 6, 6, 6, 1, 3, 4, 3, 4, 2, 1, 3, 5, 4, 6, 6, 1, 3,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- if (sound == SOUND_PED_ARREST_FBI) {
- GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6);
- } else {
- if (sound != SOUND_PED_PURSUIT_FBI) {
- return GetGenericMaleTalkSfx(sound);
+ if (m_bIsInitialised) {
+ if (index >= 0 && index < NUM_AUDIOENTITIES) {
+ tAudioEntity &entity = m_asAudioEntities[index];
+ if (entity.m_bIsUsed) {
+ if (sound < SOUND_TOTAL_SOUNDS) {
+ if (entity.m_nType == AUDIOTYPE_SCRIPTOBJECT) {
+ if (m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal < ARRAY_SIZE(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices)) {
+ entity.m_awAudioEvent[0] = sound;
+ entity.m_AudioEvents = 1;
+ m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal++] = index;
+ }
+ } else {
+ int32 i = 0;
+ while (true) {
+ if (i >= entity.m_AudioEvents) {
+ if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) {
+ entity.m_awAudioEvent[i] = sound;
+ entity.m_afVolume[i] = vol;
+ ++entity.m_AudioEvents;
+ }
+ return;
+ }
+ if (OneShotPriority[entity.m_awAudioEvent[i]] > OneShotPriority[sound])
+ break;
+ ++i;
+ }
+ if (i < NUM_AUDIOENTITY_EVENTS - 1) {
+ memmove(&entity.m_awAudioEvent[i + 1], &entity.m_awAudioEvent[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS / 2);
+ memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS);
+ }
+ entity.m_awAudioEvent[i] = sound;
+ entity.m_afVolume[i] = vol;
+ if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent))
+ ++entity.m_AudioEvents;
+ }
+ }
+ }
}
-
- pedState = FindPlayerPed()->m_nPedState;
- if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
- return NO_SAMPLE;
- GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6);
- }
-
- return (SFX_FBI_VOICE_2_CHASE_1 - SFX_FBI_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx;
-}
-
-uint32
-cAudioManager::GetArmyTalkSfx(int16 sound)
-{
- uint32 sfx;
- PedState pedState;
- static uint32 lastSfx = NO_SAMPLE;
-
- if (sound != SOUND_PED_PURSUIT_ARMY) {
- return GetGenericMaleTalkSfx(sound);
- }
-
- pedState = FindPlayerPed()->m_nPedState;
- if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE)
- return NO_SAMPLE;
- GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15);
-
- return (SFX_ARMY_VOICE_2_CHASE_1 - SFX_ARMY_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetMedicTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_GUN_PANIC_1, 5);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_CARJACKED_1, 5);
- break;
- case SOUND_PED_HEALING:
- GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_AT_VICTIM_1, 12);
- break;
- case SOUND_PED_LEAVE_VEHICLE:
- GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_GET_OUT_VAN_CHAT_1, 9);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_RUN_FROM_FIGHT_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return (SFX_MEDIC_VOICE_2_GUN_PANIC_1 - SFX_MEDIC_VOICE_1_GUN_PANIC_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetFiremanTalkSfx(int16 sound)
-{
- return GetGenericMaleTalkSfx(sound);
-}
-
-uint32
-cAudioManager::GetNormalMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_GUN_PANIC_1, 7);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_CARJACKED_1, 7);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_DODGE_1, 9);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_RUN_FROM_FIGHT_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_DRIVER_ABUSE_1, 12);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_EYING_1, 8);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_SHOCKED_1, 10);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_CHAT_1, 25);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetTaxiDriverTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- if (sound == SOUND_PED_CAR_JACKED) {
- GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_CARJACKED_1, 7);
- } else {
- if (sound != SOUND_PED_CAR_COLLISION)
- return GetGenericMaleTalkSfx(sound);
- GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1, 6);
- }
- return (SFX_ASIAN_TAXI_DRIVER_VOICE_2_DRIVER_ABUSE_1 - SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetPimpTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_PIMP_GUN_COOL_1, 7);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_PIMP_CARJACKED_1, 4);
- break;
- case SOUND_PED_DEFEND:
- GetPhrase(&sfx, &lastSfx, SFX_PIMP_FIGHT_1, 9);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_PIMP_DODGE_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_PIMP_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_PIMP_SHOCKED_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_PIMP_CHAT_1, 17);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetMafiaTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKING:
- GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CARJACKING_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return (SFX_MAFIA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx;
-}
-
-uint32
-cAudioManager::GetTriadTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_GUN_COOL_1, 3);
- break;
- case SOUND_PED_CAR_JACKING:
- GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CARJACKING_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CHAT_1, 8);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetDiabloTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_GUN_COOL_1, 4);
- break;
- case SOUND_PED_HANDS_COWER:
- sound = SOUND_PED_FLEE_SPRINT;
- return GetGenericMaleTalkSfx(sound);
- break;
- case SOUND_PED_CAR_JACKING:
- GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CARJACKING_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_EYING_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return (SFX_DIABLO_MALE_VOICE_2_CHAT_1 - SFX_DIABLO_MALE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetYakuzaTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKING:
- GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CARJACKING_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return (SFX_YAKUZA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetYardieTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- sfx = SFX_YARDIE_MALE_VOICE_1_GUN_COOL_1;
- break;
- case SOUND_PED_CAR_JACKING:
- GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_CARJACKING_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- sfx = SFX_YARDIE_MALE_VOICE_1_CARJACKED_1;
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_FIGHT_1, 6);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_EYING_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_CHAT_1, 8);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return (SFX_YARDIE_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetColumbianTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKING:
- GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CARJACKING_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_EYING_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return (SFX_COLUMBIAN_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetHoodTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_GUN_COOL_1, 5);
- break;
- case SOUND_PED_CAR_JACKING:
- GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CARJACKING_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_FIGHT_1, 6);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_EYING_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CHAT_1, 6);
- break;
-
- default:
- return GetGenericMaleTalkSfx(sound);
- break;
- }
- return (SFX_HOOD_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetBlackCriminalTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_GUN_COOL_1, 4);
- break;
- case SOUND_PED_CAR_JACKING:
- sfx = SFX_BLACK_CRIMINAL_VOICE_1_CARJACKING_1;
- break;
- case SOUND_PED_MUGGING:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_MUGGING_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- break;
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteCriminalTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_GUN_COOL_1, 3);
- break;
- case SOUND_PED_CAR_JACKING:
- sfx = SFX_WHITE_CRIMINAL_VOICE_1_CARJACKING_1;
- break;
- case SOUND_PED_MUGGING:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_MUGGING_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_DRIVER_ABUSE_1, 4);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- break;
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetMaleNo2TalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_CARJACKED_1, 3);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_MUGGED_1, 4);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_EYING_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_FIGHT_1, 6);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CHAT_1, 6);
- default:
- return GetGenericMaleTalkSfx(sound);
- }
-
- if (model == MI_P_MAN2)
- sfx += (SFX_BLACK_PROJECT_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1);
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DODGE_1, 9);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 9);
- break;
- case SOUND_PED_WAIT_DOUBLEBACK:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_LOST_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CHAT_1, 9);
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackFatMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CARJACKED_1, 4);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_MUGGED_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DODGE_1, 7);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_WAIT_DOUBLEBACK:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_LOST_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CHAT_1, 8);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackCasualFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_GUN_PANIC_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_MUGGED_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_RUN_FROM_FIGHT_1, 2);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_CHAT_1, 8);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_GUN_PANIC_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- sfx = SFX_WHITE_CASUAL_FEMALE_VOICE_1_MUGGED_1;
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_DODGE_1, 3);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 2);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 8);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_SHOCKED_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CHAT_1, 4);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetFemaleNo3TalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_GUN_PANIC_1, 5);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_CARJACKED_1, 3);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_MUGGED_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_RUN_FROM_FIGHT_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackFatFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_SHOCKED_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteFatFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 8);
- break;
- case SOUND_PED_WAIT_DOUBLEBACK:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_LOST_1, 2);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CHAT_1, 8);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackFemaleProstituteTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_GUN_COOL_1, 4);
- break;
- case SOUND_PED_ROBBED:
- sfx = SFX_BLACK_PROSTITUTE_VOICE_1_MUGGED_1;
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_DODGE_1, 3);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_DRIVER_ABUSE_1, 4);
- break;
- case SOUND_PED_SOLICIT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_SOLICIT_1, 8);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1, 4);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return (SFX_BLACK_PROSTITUTE_VOICE_2_CHAT_1 - SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetWhiteFemaleProstituteTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_DODGE_1, 3);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_DRIVER_ABUSE_1, 4);
- break;
- case SOUND_PED_SOLICIT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_SOLICIT_1, 8);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1, 4);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return (SFX_WHITE_PROSTITUTE_VOICE_2_CHAT_1 - SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetBlackProjectFemaleOldTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CARJACKED_1, 6);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_DODGE_1, 10);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_RUN_FROM_FIGHT_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_SHOCKED_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CHAT_1, 10);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackProjectFemaleYoungTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_CAR_JACKED:
- sfx = SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CARJACKED_1;
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_SHOCKED_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetChinatownMaleOldTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetChinatownMaleYoungTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 2);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_FIGHT_1, 6);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetChinatownFemaleOldTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT_EVENT:
- sfx = SFX_CHINATOWN_OLD_FEMALE_VOICE_1_SHOCKED_1;
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetChinatownFemaleYoungTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetLittleItalyMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return (SFX_LITTLE_ITALY_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_LITTLE_ITALY_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetLittleItalyFemaleOldTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetLittleItalyFemaleYoungTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_DODGE_1, 7);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteDockerMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_GUN_PANIC_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_FIGHT_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_DRIVER_ABUSE_1, 4);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackDockerMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetScumMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_GUN_PANIC_1, 5);
- break;
- case SOUND_PED_ROBBED:
- sfx = SFX_SCUM_MALE_VOICE_1_MUGGED_1;
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_FIGHT_1, 10);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_WAIT_DOUBLEBACK:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_LOST_1, 3);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_EYING_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_CHAT_1, 9);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetScumFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_DODGE_1, 8);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_CHAT_1, 13);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteWorkerMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_FIGHT_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_EYING_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackWorkerMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_FIGHT_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_DODGE_1, 3);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_DRIVER_ABUSE_1, 4);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_CHAT_1, 4);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetBusinessMaleYoungTalkSfx(int16 sound, int32 model)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_RUN_FROM_FIGHT_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
-
- if (model == MI_B_MAN3)
- sfx += (SFX_BUSINESS_MALE_YOUNG_VOICE_2_DRIVER_ABUSE_1 - SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1);
- return sfx;
-}
-
-uint32
-cAudioManager::GetBusinessMaleOldTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MRUN_FROM_FIGHT_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
-
- if (model == MI_B_WOM2)
- sfx += (SFX_WHITE_BUSINESS_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1);
- return sfx;
-}
-
-uint32
-cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 5);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CARAJACKED_1, 4);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_FLEE_RUN:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetSupermodelMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetSupermodelFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_MUGGED_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_SHOCKED_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_CHAT_1, 8);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetStewardMaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_DODGE_1, 3);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_CHAT_1, 4);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
-}
-
-uint32
-cAudioManager::GetStewardFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return (SFX_STEWARD_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
-}
-
-uint32
-cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_FIGHT_1, 3);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_SHOCKED_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
-
- if (model == MI_FAN_MAN2)
- sfx += (SFX_FOOTBALL_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1);
- return sfx;
-}
-
-uint32
-cAudioManager::GetFanFemaleTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_ROBBED:
- sfx = SFX_FOOTBALL_FEMALE_VOICE_1_MUGGED_1;
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_SHOCKED_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
}
- return (SFX_FOOTBALL_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx;
}
-uint32
-cAudioManager::GetHospitalMaleTalkSfx(int16 sound)
+void
+cAudioManager::SetEffectsMasterVolume(uint8 volume) const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
+ SampleManager.SetEffectsMasterVolume(volume);
}
-uint32
-cAudioManager::GetHospitalFemaleTalkSfx(int16 sound)
+void
+cAudioManager::SetMusicMasterVolume(uint8 volume) const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_CHAT_1, 6);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
- return sfx;
+ SampleManager.SetMusicMasterVolume(volume);
}
-uint32
-cAudioManager::GetWhiteConstructionWorkerTalkSfx(int16 sound)
+void
+cAudioManager::SetEffectsFadeVol(uint8 volume) const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- sfx = SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CARJACKED_1;
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_DRIVER_ABUSE_1, 4);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_EYING_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
+ SampleManager.SetEffectsFadeVolume(volume);
}
-uint32
-cAudioManager::GetBlackConstructionWorkerTalkSfx(int16 sound)
+void
+cAudioManager::SetMonoMode(uint8 mono)
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_GUN_PANIC_1, 3);
- break;
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_FIGHT_1, 5);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_DODGE_1, 5);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_DRIVER_ABUSE_1, 5);
- break;
- case SOUND_PED_CHAT_SEXY:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_EYING_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CHAT_1, 4);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
+ SampleManager.SetMonoMode(mono);
}
-uint32
-cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model)
+void
+cAudioManager::SetMusicFadeVol(uint8 volume) const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_CAR_JACKED:
- GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_CARJACKED_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_DODGE_1, 6);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1, 7);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_SHOCKED_1, 4);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_CHAT_1, 7);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- }
-
- if (model == MI_SHOPPER2) {
- sfx += (SFX_SHOPPER_VOICE_2_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1);
- } else if (model == MI_SHOPPER3) {
- sfx += (SFX_SHOPPER_VOICE_3_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1);
- }
- return sfx;
+ SampleManager.SetMusicFadeVolume(volume);
}
-uint32
-cAudioManager::GetStudentMaleTalkSfx(int16 sound)
+void
+cAudioManager::ResetTimers(uint32 time)
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_GUN_PANIC_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_DRIVER_ABUSE_1, 4);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_SHOCKED_1, 3);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_CHAT_1, 5);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
+ if (m_bIsInitialised) {
+ m_bTimerJustReset = true;
+ m_nTimer = time;
+ ClearRequestedQueue();
+ if (m_nActiveSampleQueue) {
+ m_nActiveSampleQueue = 0;
+ ClearRequestedQueue();
+ m_nActiveSampleQueue = 1;
+ } else {
+ m_nActiveSampleQueue = 1;
+ ClearRequestedQueue();
+ m_nActiveSampleQueue = 0;
+ }
+ ClearActiveSamples();
+ ClearMissionAudio();
+ SampleManager.StopChannel(policeChannel);
+ SampleManager.SetEffectsFadeVolume(0);
+ SampleManager.SetMusicFadeVolume(0);
+ MusicManager.ResetMusicAfterReload();
+#ifdef AUDIO_OAL
+ SampleManager.Service();
+#endif
}
- return sfx;
}
-uint32
-cAudioManager::GetStudentFemaleTalkSfx(int16 sound)
+void
+cAudioManager::DestroyAllGameCreatedEntities()
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
+ cAudioScriptObject *entity;
- switch (sound) {
- case SOUND_PED_HANDS_COWER:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_GUN_PANIC_1, 4);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_DODGE_1, 4);
- break;
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 4);
- break;
- case SOUND_PED_CHAT_EVENT:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_SHOCKED_1, 2);
- break;
- case SOUND_PED_CHAT:
- GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_CHAT_1, 4);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
+ if (m_bIsInitialised) {
+ for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) {
+ if (m_asAudioEntities[i].m_bIsUsed) {
+ switch (m_asAudioEntities[i].m_nType) {
+ case AUDIOTYPE_PHYSICAL:
+ case AUDIOTYPE_EXPLOSION:
+ case AUDIOTYPE_WEATHER:
+ case AUDIOTYPE_CRANE:
+ case AUDIOTYPE_GARAGE:
+ case AUDIOTYPE_FIREHYDRANT:
+ DestroyEntity(i);
+ break;
+ case AUDIOTYPE_SCRIPTOBJECT:
+ entity = (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity;
+ if (entity) {
+ delete entity;
+ m_asAudioEntities[i].m_pEntity = nil;
+ }
+ DestroyEntity(i);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
}
- return sfx;
}
-uint32
-cAudioManager::GetCasualMaleOldTalkSfx(int16 sound)
+uint8
+cAudioManager::GetNum3DProvidersAvailable() const
{
- return GetGenericMaleTalkSfx(sound);
+ if (m_bIsInitialised)
+ return SampleManager.GetNum3DProvidersAvailable();
+ return 0;
}
-uint32
-cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
-{
- char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName();
- if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) {
- return GetEightTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "frankie")) {
- return GetFrankieTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "misty")) {
- return GetMistyTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "ojg") || !CGeneral::faststricmp(modelName, "ojg_p")) {
- return GetOJGTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "cat")) {
- return GetCatatalinaTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "bomber")) {
- return GetBomberTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "s_guard")) {
- return GetSecurityGuardTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "chunky")) {
- return GetChunkyTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "asuka")) {
- return GetGenericFemaleTalkSfx(sound);
- }
- if (!CGeneral::faststricmp(modelName, "maria")) {
- return GetGenericFemaleTalkSfx(sound);
- }
-
- return GetGenericMaleTalkSfx(sound);
-}
-uint32
-cAudioManager::GetEightTalkSfx(int16 sound)
+char *
+cAudioManager::Get3DProviderName(uint8 id) const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_8BALL_GUN_COOL_1, 2);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_8BALL_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_8BALL_FIGHT_1, 6);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_8BALL_DODGE_1, 7);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
+ if (!m_bIsInitialised)
+ return nil;
+ if (id >= SampleManager.GetNum3DProvidersAvailable())
+ return nil;
+ return SampleManager.Get3DProviderName(id);
}
-uint32
-cAudioManager::GetFrankieTalkSfx(int16 sound)
+int8
+cAudioManager::GetCurrent3DProviderIndex() const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
+ if (m_bIsInitialised)
+ return SampleManager.GetCurrent3DProviderIndex();
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_GUN_COOL_1, 4);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_FIGHT_1, 6);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_DODGE_1, 3);
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
+ return -1;
}
-uint32
-cAudioManager::GetMistyTalkSfx(int16 sound)
+int8
+cAudioManager::SetCurrent3DProvider(uint8 which)
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_MISTY_GUN_COOL_1, 5);
- break;
- case SOUND_PED_ROBBED:
- GetPhrase(&sfx, &lastSfx, SFX_MISTY_MUGGED_1, 2);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_MISTY_FIGHT_1, 4);
- break;
- case SOUND_PED_EVADE:
- GetPhrase(&sfx, &lastSfx, SFX_MISTY_DODGE_1, 5);
- break;
- case SOUND_PED_TAXI_CALL:
- GetPhrase(&sfx, &lastSfx, SFX_MISTY_HERE_1, 4);
- break;
- default:
- return GetGenericFemaleTalkSfx(sound);
- break;
+ if (!m_bIsInitialised)
+ return -1;
+ for (uint8 i = 0; i < m_nActiveSamples + 1; ++i)
+ SampleManager.StopChannel(i);
+ ClearRequestedQueue();
+ if (m_nActiveSampleQueue == 0)
+ m_nActiveSampleQueue = 1;
+ else
+ m_nActiveSampleQueue = 0;
+ ClearRequestedQueue();
+ ClearActiveSamples();
+ int8 current = SampleManager.SetCurrent3DProvider(which);
+ if (current > 0) {
+ m_nActiveSamples = SampleManager.GetMaximumSupportedChannels();
+ if (m_nActiveSamples > 1)
+ --m_nActiveSamples;
}
- return sfx;
-}
-
-uint32
-cAudioManager::GetOJGTalkSfx(int16 sound)
-{
- return GetGenericMaleTalkSfx(sound);
-}
-
-uint32
-cAudioManager::GetCatatalinaTalkSfx(int16 sound)
-{
- return GetGenericFemaleTalkSfx(sound);
-}
-
-uint32
-cAudioManager::GetBomberTalkSfx(int16 sound)
-{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- if (sound != SOUND_PED_BOMBER)
- return GetGenericMaleTalkSfx(sound);
-
- GetPhrase(&sfx, &lastSfx, SFX_BOMBERMAN_1, 7);
- return sfx;
+ return current;
}
-uint32
-cAudioManager::GetSecurityGuardTalkSfx(int16 sound)
+void
+cAudioManager::SetSpeakerConfig(int32 conf) const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_HANDS_UP:
- GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_GUN_COOL_1, 2);
- break;
- case SOUND_PED_HANDS_COWER:
- sfx = SFX_SECURITY_GUARD_VOICE_1_GUN_PANIC_1;
- break;
- case SOUND_PED_CAR_JACKED:
- case SOUND_PED_CAR_COLLISION:
- GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 6);
- break;
- case SOUND_PED_ATTACK:
- GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_FIGHT_1, 2);
- break;
- case SOUND_PED_FLEE_RUN:
-#ifdef FIX_BUGS
- sfx = SFX_SECURITY_GUARD_VOICE_1_RUN_FROM_FIGHT_1;
-#else
- GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 12);
-#endif
- break;
- default:
- return GetGenericMaleTalkSfx(sound);
- }
- return sfx;
+ SampleManager.SetSpeakerConfig(conf);
}
-uint32
-cAudioManager::GetChunkyTalkSfx(int16 sound)
+bool
+cAudioManager::IsMP3RadioChannelAvailable() const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- if (sound == SOUND_PED_DEATH)
- return SFX_CHUNKY_DEATH;
-
- if (sound != SOUND_PED_FLEE_RUN)
- return GetGenericMaleTalkSfx(sound);
+ if (m_bIsInitialised)
+ return SampleManager.IsMP3RadioChannelAvailable();
- GetPhrase(&sfx, &lastSfx, SFX_CHUNKY_RUN_1, 5);
- return sfx;
+ return false;
}
-uint32
-cAudioManager::GetGenericMaleTalkSfx(int16 sound)
+void
+cAudioManager::ReleaseDigitalHandle() const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_DEATH:
- GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_DEATH_1, 8);
- break;
- case SOUND_PED_BULLET_HIT:
- case SOUND_PED_DEFEND:
- GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_GRUNT_1, 15);
- break;
- case SOUND_PED_BURNING:
- GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_FIRE_1, 8);
- break;
- case SOUND_PED_FLEE_SPRINT:
- GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_PANIC_1, 6);
- break;
- default:
- return NO_SAMPLE;
+ if (m_bIsInitialised) {
+ SampleManager.ReleaseDigitalHandle();
}
- return sfx;
}
-uint32
-cAudioManager::GetGenericFemaleTalkSfx(int16 sound)
+void
+cAudioManager::ReacquireDigitalHandle() const
{
- uint32 sfx;
- static uint32 lastSfx = NO_SAMPLE;
-
- switch (sound) {
- case SOUND_PED_DEATH:
- GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_DEATH_1, 10);
- break;
- case SOUND_PED_BULLET_HIT:
- case SOUND_PED_DEFEND:
- GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_GRUNT_1, 11);
- break;
- case SOUND_PED_BURNING:
- GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_FIRE_1, 9);
- break;
- case SOUND_PED_FLEE_SPRINT:
- GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_PANIC_1, 8);
- break;
- default:
- return NO_SAMPLE;
+ if (m_bIsInitialised) {
+ SampleManager.ReacquireDigitalHandle();
}
- return sfx;
}
void
-cAudioManager::GenerateIntegerRandomNumberTable()
+cAudioManager::SetDynamicAcousticModelingStatus(uint8 status)
{
- for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) {
- m_anRandomTable[i] = rand();
- }
+ m_bDynamicAcousticModelingStatus = status!=0;
}
-char *
-cAudioManager::Get3DProviderName(uint8 id) const
+bool
+cAudioManager::CheckForAnAudioFileOnCD() const
{
- if (!m_bIsInitialised)
- return nil;
- if (id >= SampleManager.GetNum3DProvidersAvailable())
- return nil;
- return SampleManager.Get3DProviderName(id);
+ return SampleManager.CheckForAnAudioFileOnCD();
}
uint8
@@ -2941,293 +410,130 @@ cAudioManager::GetCDAudioDriveLetter() const
return 0;
}
-int8
-cAudioManager::GetCurrent3DProviderIndex() const
+bool
+cAudioManager::IsAudioInitialised() const
{
- if (m_bIsInitialised)
- return SampleManager.GetCurrent3DProviderIndex();
-
- return -1;
+ return m_bIsInitialised;
}
-float
-cAudioManager::GetDistanceSquared(const CVector &v) const
+void
+cAudioManager::ServiceSoundEffects()
{
- const CVector &c = TheCamera.GetPosition();
- return sq(v.x - c.x) + sq(v.y - c.y) + sq((v.z - c.z) * 0.2f);
-}
+ m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
+ if (m_nUserPause && !m_nPreviousUserPause) {
+ for (int32 i = 0; i < allChannels; i++)
+ SampleManager.StopChannel(i);
-int32
-cAudioManager::GetJumboTaxiFreq() const
-{
- return (60.833f * m_sQueueSample.m_fDistance) + 22050;
+ ClearRequestedQueue();
+ if (m_nActiveSampleQueue) {
+ m_nActiveSampleQueue = 0;
+ ClearRequestedQueue();
+ m_nActiveSampleQueue = 1;
+ } else {
+ m_nActiveSampleQueue = 1;
+ ClearRequestedQueue();
+ m_nActiveSampleQueue = 0;
+ }
+ ClearActiveSamples();
+ }
+ m_nActiveSampleQueue = m_nActiveSampleQueue != 1;
+ ProcessReverb();
+ ProcessSpecial();
+ ClearRequestedQueue();
+ InterrogateAudioEntities();
+ m_sPedComments.Process();
+ ServicePoliceRadio();
+ ServiceCollisions();
+ AddReleasingSounds();
+ ProcessMissionAudio();
+#ifdef GTA_PC
+ AdjustSamplesVolume();
+#endif
+ ProcessActiveQueues();
+#ifdef AUDIO_OAL
+ SampleManager.Service();
+#endif
+ for (int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) {
+ cAudioScriptObject *object = (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity;
+ delete object;
+ m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil;
+ DestroyEntity(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]);
+ }
+ m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
}
-bool
-cAudioManager::GetMissionAudioLoadingStatus() const
+uint8
+cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const
{
- if (m_bIsInitialised)
- return m_sMissionAudio.m_nLoadingStatus;
-
- return true;
+ float newSoundIntensity;
+ if (soundIntensity <= 0.0f)
+ return 0;
+ newSoundIntensity = soundIntensity / 5.0f;
+ if (newSoundIntensity <= distance)
+ emittingVolume = sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) / (soundIntensity - newSoundIntensity)) * emittingVolume;
+ return emittingVolume;
}
-uint8
-cAudioManager::GetNum3DProvidersAvailable() const
+void
+cAudioManager::TranslateEntity(Const CVector *in, CVector *out) const
{
- if (m_bIsInitialised)
- return SampleManager.GetNum3DProvidersAvailable();
- return 0;
+ *out = MultiplyInverse(TheCamera.GetMatrix(), *in);
}
int32
-cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
+cAudioManager::ComputePan(float dist, CVector *vec)
{
- if (ped->IsPlayer())
- return GetPlayerTalkSfx(sound);
-
- switch (ped->GetModelIndex()) {
- case MI_COP:
- return GetCopTalkSfx(sound);
- case MI_SWAT:
- return GetSwatTalkSfx(sound);
- case MI_FBI:
- return GetFBITalkSfx(sound);
- case MI_ARMY:
- return GetArmyTalkSfx(sound);
- case MI_MEDIC:
- return GetMedicTalkSfx(sound);
- case MI_FIREMAN:
- return GetFiremanTalkSfx(sound);
- case MI_MALE01:
- return GetNormalMaleTalkSfx(sound);
- case MI_TAXI_D:
- return GetTaxiDriverTalkSfx(sound);
- case MI_PIMP:
- return GetPimpTalkSfx(sound);
- case MI_GANG01:
- case MI_GANG02:
- return GetMafiaTalkSfx(sound);
- case MI_GANG03:
- case MI_GANG04:
- return GetTriadTalkSfx(sound);
- case MI_GANG05:
- case MI_GANG06:
- return GetDiabloTalkSfx(sound);
- case MI_GANG07:
- case MI_GANG08:
- return GetYakuzaTalkSfx(sound);
- case MI_GANG09:
- case MI_GANG10:
- return GetYardieTalkSfx(sound);
- case MI_GANG11:
- case MI_GANG12:
- return GetColumbianTalkSfx(sound);
- case MI_GANG13:
- case MI_GANG14:
- return GetHoodTalkSfx(sound);
- case MI_CRIMINAL01:
- return GetBlackCriminalTalkSfx(sound);
- case MI_CRIMINAL02:
- return GetWhiteCriminalTalkSfx(sound);
- case MI_SPECIAL01:
- case MI_SPECIAL02:
- case MI_SPECIAL03:
- case MI_SPECIAL04:
- return GetSpecialCharacterTalkSfx(ped->GetModelIndex(), sound);
- case MI_MALE02:
- return GetMaleNo2TalkSfx(sound);
- case MI_MALE03:
- case MI_P_MAN1:
- case MI_P_MAN2:
- return GetBlackProjectMaleTalkSfx(sound, ped->GetModelIndex());
- case MI_FATMALE01:
- return GetWhiteFatMaleTalkSfx(sound);
- case MI_FATMALE02:
- return GetBlackFatMaleTalkSfx(sound);
- case MI_FEMALE01:
- return GetBlackCasualFemaleTalkSfx(sound);
- case MI_FEMALE02:
- case MI_CAS_WOM:
- return GetWhiteCasualFemaleTalkSfx(sound);
- case MI_FEMALE03:
- return GetFemaleNo3TalkSfx(sound);
- case MI_FATFEMALE01:
- return GetBlackFatFemaleTalkSfx(sound);
- case MI_FATFEMALE02:
- return GetWhiteFatFemaleTalkSfx(sound);
- case MI_PROSTITUTE:
- return GetBlackFemaleProstituteTalkSfx(sound);
- case MI_PROSTITUTE2:
- return GetWhiteFemaleProstituteTalkSfx(sound);
- case MI_P_WOM1:
- return GetBlackProjectFemaleOldTalkSfx(sound);
- case MI_P_WOM2:
- return GetBlackProjectFemaleYoungTalkSfx(sound);
- case MI_CT_MAN1:
- return GetChinatownMaleOldTalkSfx(sound);
- case MI_CT_MAN2:
- return GetChinatownMaleYoungTalkSfx(sound);
- case MI_CT_WOM1:
- return GetChinatownFemaleOldTalkSfx(sound);
- case MI_CT_WOM2:
- return GetChinatownFemaleYoungTalkSfx(sound);
- case MI_LI_MAN1:
- case MI_LI_MAN2:
- return GetLittleItalyMaleTalkSfx(sound);
- case MI_LI_WOM1:
- return GetLittleItalyFemaleOldTalkSfx(sound);
- case MI_LI_WOM2:
- return GetLittleItalyFemaleYoungTalkSfx(sound);
- case MI_DOCKER1:
- return GetWhiteDockerMaleTalkSfx(sound);
- case MI_DOCKER2:
- return GetBlackDockerMaleTalkSfx(sound);
- case MI_SCUM_MAN:
- return GetScumMaleTalkSfx(sound);
- case MI_SCUM_WOM:
- return GetScumFemaleTalkSfx(sound);
- case MI_WORKER1:
- return GetWhiteWorkerMaleTalkSfx(sound);
- case MI_WORKER2:
- return GetBlackWorkerMaleTalkSfx(sound);
- case MI_B_MAN1:
- case MI_B_MAN3:
- return GetBusinessMaleYoungTalkSfx(sound, ped->GetModelIndex());
- case MI_B_MAN2:
- return GetBusinessMaleOldTalkSfx(sound);
- case MI_B_WOM1:
- case MI_B_WOM2:
- return GetWhiteBusinessFemaleTalkSfx(sound, ped->GetModelIndex());
- case MI_B_WOM3:
- return GetBlackBusinessFemaleTalkSfx(sound);
- case MI_MOD_MAN:
- return GetSupermodelMaleTalkSfx(sound);
- case MI_MOD_WOM:
- return GetSupermodelFemaleTalkSfx(sound);
- case MI_ST_MAN:
- return GetStewardMaleTalkSfx(sound);
- case MI_ST_WOM:
- return GetStewardFemaleTalkSfx(sound);
- case MI_FAN_MAN1:
- case MI_FAN_MAN2:
- return GetFanMaleTalkSfx(sound, ped->GetModelIndex());
- case MI_FAN_WOM:
- return GetFanFemaleTalkSfx(sound);
- case MI_HOS_MAN:
- return GetHospitalMaleTalkSfx(sound);
- case MI_HOS_WOM:
- return GetHospitalFemaleTalkSfx(sound);
- case MI_CONST1:
- return GetWhiteConstructionWorkerTalkSfx(sound);
- case MI_CONST2:
- return GetBlackConstructionWorkerTalkSfx(sound);
- case MI_SHOPPER1:
- case MI_SHOPPER2:
- case MI_SHOPPER3:
- return GetShopperFemaleTalkSfx(sound, ped->GetModelIndex());
- case MI_STUD_MAN:
- return GetStudentMaleTalkSfx(sound);
- case MI_STUD_WOM:
- return GetStudentFemaleTalkSfx(sound);
- case MI_CAS_MAN:
- return GetCasualMaleOldTalkSfx(sound);
- default:
- return GetGenericMaleTalkSfx(sound);
- }
-}
+ const uint8 PanTable[64] = {0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53,
+ 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63};
-void
-cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const
-{
- *phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % maxOffset;
+ int32 index = Min(63, Abs(vec->x / (dist / 64.f)));
- // check if the same sfx like last time, if yes, then try use next one,
- // if exceeded range, then choose first available sample
- if (*phrase == *prevPhrase && ++*phrase >= sample + maxOffset)
- *phrase = sample;
- *prevPhrase = *phrase;
+ if (vec->x > 0.f)
+ return Max(20, 63 - PanTable[index]);
+ return Min(107, PanTable[index] + 63);
}
-float
-cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange)
+int32
+cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const
{
- tWheelState wheelState;
- float relativeVelChange;
- float gasPedalAudio = automobile->m_fGasPedalAudio;
- float modificator;
- float velChange;
- float relativeVel;
-
- wheelState = automobile->m_aWheelState[wheel];
- if (wheelState == WHEEL_STATE_SPINNING && gasPedalAudio > 0.4f) {
- relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f;
-
- } else if (wheelState == WHEEL_STATE_SKIDDING) {
- relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
- } else if (wheelState == WHEEL_STATE_FIXED) {
- modificator = 0.4f;
- relativeVelChange = gasPedalAudio;
- if (relativeVelChange > 0.4f) {
- relativeVelChange = relativeVelChange - 0.4f;
- modificator = 5.f / 3.f;
- }
- velChange = Abs(velocityChange);
- if (relativeVelChange > 0.4f)
- relativeVelChange = relativeVelChange * modificator;
- if (velChange > 0.04f) {
- relativeVel = Min(1.0f, velChange / transmission->fMaxVelocity);
- } else {
- relativeVel = 0.0f;
+ uint32 newFreq = oldFreq;
+ if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) {
+ float dist = position2 - position1;
+ if (dist != 0.0f) {
+ float speedOfSource = (dist / m_nTimeSpent) * speedMultiplier;
+ if (m_fSpeedOfSound > Abs(speedOfSource)) {
+ if (speedOfSource < 0.0f) {
+ speedOfSource = Max(speedOfSource, -1.5f);
+ } else {
+ speedOfSource = Min(speedOfSource, 1.5f);
+ }
+ newFreq = (oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound);
+ }
}
- if (relativeVel >= relativeVelChange)
- relativeVelChange = relativeVel;
- } else {
- relativeVelChange = 0.0f;
}
-
- return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
+ return newFreq;
}
-float
-cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange)
+int32
+cAudioManager::RandomDisplacement(uint32 seed) const
{
- float relativeVelChange;
+ int32 value;
- if (automobile->m_aWheelState[wheel] == 2) {
- relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
- } else {
- relativeVelChange = 0.0f;
- }
+ static bool bPos = true;
+ static uint32 Adjustment = 0;
- return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
-}
+ if (!seed)
+ return 0;
-bool
-cAudioManager::HasAirBrakes(int32 model) const
-{
- return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH;
-}
+ value = m_anRandomTable[(Adjustment + seed) % 5] % seed;
+ Adjustment += value;
-void
-cAudioManager::Initialise()
-{
- if (!m_bIsInitialised) {
- PreInitialiseGameSpecificSetup();
- m_bIsInitialised = SampleManager.Initialise();
- if (m_bIsInitialised) {
- m_nActiveSamples = SampleManager.GetMaximumSupportedChannels();
- if (m_nActiveSamples <= 1) {
- Terminate();
- } else {
- --m_nActiveSamples;
- PostInitialiseGameSpecificSetup();
- InitialisePoliceRadioZones();
- InitialisePoliceRadio();
- MusicManager.Initialise();
- }
- }
+ if (value % 2) {
+ bPos = !bPos;
}
+ if (!bPos)
+ value = -value;
+ return value;
}
void
@@ -3239,107 +545,91 @@ cAudioManager::InterrogateAudioEntities()
}
}
-bool
-cAudioManager::IsAudioInitialised() const
-{
- return m_bIsInitialised;
-}
-
-bool
-cAudioManager::IsMissionAudioSampleFinished()
+void
+cAudioManager::AddSampleToRequestedQueue()
{
- if (m_bIsInitialised)
- return m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_FINISHED;
-
- static int32 cPretendFrame = 1;
+ int32 calculatedVolume;
+ uint8 sampleIndex;
+ bool bReflections;
- return (cPretendFrame++ & 63) == 0;
-}
+ if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
+ calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume);
+ sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
+ if (sampleIndex >= m_nActiveSamples) {
+ sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1];
+ if (m_asSamples[m_nActiveSampleQueue][sampleIndex].m_nCalculatedVolume <= calculatedVolume)
+ return;
+ } else {
+ ++m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
+ }
+ m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
+ m_sQueueSample.m_bLoopEnded = false;
+ if (m_sQueueSample.m_bIs2D) {
+ m_sQueueSample.m_bRequireReflection = false;
+ m_sQueueSample.m_nLoopsRemaining = 0;
+ }
+ if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) {
+ bReflections = m_sQueueSample.m_bRequireReflection;
+ } else {
+ bReflections = false;
+ m_sQueueSample.m_nLoopsRemaining = 0;
+ }
+ m_sQueueSample.m_bRequireReflection = false;
-bool
-cAudioManager::IsMP3RadioChannelAvailable() const
-{
- if (m_bIsInitialised)
- return SampleManager.IsMP3RadioChannelAvailable();
+ if (!m_bDynamicAcousticModelingStatus)
+ m_sQueueSample.m_bReverbFlag = false;
- return false;
-}
+ m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
-bool
-cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const
-{
- switch (soundMission) {
- case STREAMED_SOUND_MISSION_J6_D:
- case STREAMED_SOUND_MISSION_T4_A:
- case STREAMED_SOUND_MISSION_S1_H:
- case STREAMED_SOUND_MISSION_S3_B:
- case STREAMED_SOUND_MISSION_EL3_A:
- case STREAMED_SOUND_MISSION_A3_A:
- case STREAMED_SOUND_MISSION_A5_A:
- case STREAMED_SOUND_MISSION_K1_A:
- case STREAMED_SOUND_MISSION_R1_A:
- case STREAMED_SOUND_MISSION_R5_A:
- case STREAMED_SOUND_MISSION_LO2_A:
- case STREAMED_SOUND_MISSION_LO6_A:
- return true;
- default:
- return false;
+ AddDetailsToRequestedOrderList(sampleIndex);
+ if (bReflections)
+ AddReflectionsToRequestedQueue();
}
}
-
void
-cAudioManager::PlayLoadedMissionAudio()
+cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{
- if (m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && m_sMissionAudio.m_nLoadingStatus == LOADING_STATUS_LOADED &&
- !m_sMissionAudio.m_nPlayStatus) {
- m_sMissionAudio.m_bIsPlayed = true;
+ uint32 i = 0;
+ if (sample != 0) {
+ for (; i < sample; i++) {
+ if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nCalculatedVolume >
+ m_asSamples[m_nActiveSampleQueue][sample].m_nCalculatedVolume)
+ break;
+ }
+ if (i < sample) {
+ memmove(&m_abSampleQueueIndexTable[m_nActiveSampleQueue][i + 1], &m_abSampleQueueIndexTable[m_nActiveSampleQueue][i], m_nActiveSamples - i - 1);
+ }
}
+ m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
}
void
-cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
+cAudioManager::AddReflectionsToRequestedQueue()
{
- static const uint8 OneShotPriority[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 4, 4, 3, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9,
- 2, 2, 0, 0, 0, 0, 3, 3, 5, 1, 1, 1, 1, 3, 4, 7, 6, 6, 6, 6, 1, 3, 4, 3, 4, 2, 1, 3, 5, 4, 6, 6, 1, 3,
- 1, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ float reflectionDistance;
+ int32 noise;
+ uint8 emittingVolume = (m_sQueueSample.m_nVolume / 2) + (m_sQueueSample.m_nVolume / 8);
- if (m_bIsInitialised) {
- if (index >= 0 && index < totalAudioEntitiesSlots) {
- tAudioEntity &entity = m_asAudioEntities[index];
- if (entity.m_bIsUsed) {
- if (sound < SOUND_TOTAL_SOUNDS) {
- if (entity.m_nType == AUDIOTYPE_SCRIPTOBJECT) {
- if (m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal < ARRAY_SIZE(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices)) {
- entity.m_awAudioEvent[0] = sound;
- entity.m_AudioEvents = 1;
- m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal++] = index;
- }
- } else {
- int32 i = 0;
- while (true) {
- if (i >= entity.m_AudioEvents) {
- if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) {
- entity.m_awAudioEvent[i] = sound;
- entity.m_afVolume[i] = vol;
- ++entity.m_AudioEvents;
- }
- return;
- }
- if (OneShotPriority[entity.m_awAudioEvent[i]] > OneShotPriority[sound])
- break;
- ++i;
- }
- if (i < NUM_AUDIOENTITY_EVENTS - 1) {
- memmove(&entity.m_awAudioEvent[i + 1], &entity.m_awAudioEvent[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS / 2);
- memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS);
- }
- entity.m_awAudioEvent[i] = sound;
- entity.m_afVolume[i] = vol;
- if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent))
- ++entity.m_AudioEvents;
+ for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
+ reflectionDistance = m_afReflectionsDistances[i];
+ if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_fSoundIntensity) {
+ m_sQueueSample.m_nLoopsRemaining = (reflectionDistance * 500.f / 1029.f);
+ if (m_sQueueSample.m_nLoopsRemaining > 5) {
+ m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
+ m_sQueueSample.m_nEmittingVolume = emittingVolume;
+ m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
+ m_sQueueSample.m_nCounter += (i + 1) * 256;
+ if (m_sQueueSample.m_nLoopCount) {
+ noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ if (noise <= 0)
+ m_sQueueSample.m_nFrequency += noise;
+ else
+ m_sQueueSample.m_nFrequency -= noise;
}
+ m_sQueueSample.m_nReleasingVolumeModificator += 20;
+ m_sQueueSample.m_vecPos = m_avecReflectionsPos[i];
+ AddSampleToRequestedQueue();
}
}
}
@@ -3347,173 +637,96 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
}
void
-cAudioManager::PlayerJustGotInCar() const
-{
- if (m_bIsInitialised) {
- bPlayerJustEnteredCar = true;
- }
-}
-
-void
-cAudioManager::PlayerJustLeftCar(void) const
-{
- // UNUSED: This is a perfectly empty function.
-}
-
-void
-cAudioManager::PostInitialiseGameSpecificSetup()
+cAudioManager::UpdateReflections()
{
- m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager);
- if (m_nFireAudioEntity >= 0)
- SetEntityStatus(m_nFireAudioEntity, 1);
-
- m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1);
- if (m_nCollisionEntity >= 0)
- SetEntityStatus(m_nCollisionEntity, 1);
-
- m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1);
- if (m_nFrontEndEntity >= 0)
- SetEntityStatus(m_nFrontEndEntity, 1);
-
- m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1);
- if (m_nProjectileEntity >= 0)
- SetEntityStatus(m_nProjectileEntity, 1);
-
- m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1);
- if (m_nWaterCannonEntity >= 0)
- SetEntityStatus(m_nWaterCannonEntity, 1);
-
- m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1);
- if (m_nPoliceChannelEntity >= 0)
- SetEntityStatus(m_nPoliceChannelEntity, 1);
-
- m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void *)1);
- if (m_nBridgeEntity >= 0)
- SetEntityStatus(m_nBridgeEntity, 1);
-
- m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
- m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
- m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
- m_sMissionAudio.field_22 = 0;
- m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.m_bPredefinedProperties = 1;
- m_sMissionAudio.m_nMissionAudioCounter = 0;
- ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds());
-}
+ const CVector &camPos = TheCamera.GetPosition();
+ CColPoint colpoint;
+ CEntity *ent;
-void
-cAudioManager::PostTerminateGameSpecificShutdown()
-{
- ;
+ if (m_FrameCounter % 8 == 0) {
+ m_avecReflectionsPos[0] = camPos;
+ m_avecReflectionsPos[0].y += 50.f;
+ if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true))
+ m_afReflectionsDistances[0] = Distance(camPos, colpoint.point);
+ else
+ m_afReflectionsDistances[0] = 50.0f;
+ } else if ((m_FrameCounter + 1) % 8 == 0) {
+ m_avecReflectionsPos[1] = camPos;
+ m_avecReflectionsPos[1].y -= 50.0f;
+ if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true))
+ m_afReflectionsDistances[1] = Distance(camPos, colpoint.point);
+ else
+ m_afReflectionsDistances[1] = 50.0f;
+ } else if ((m_FrameCounter + 2) % 8 == 0) {
+ m_avecReflectionsPos[2] = camPos;
+ m_avecReflectionsPos[2].x -= 50.0f;
+ if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true))
+ m_afReflectionsDistances[2] = Distance(camPos, colpoint.point);
+ else
+ m_afReflectionsDistances[2] = 50.0f;
+ } else if ((m_FrameCounter + 3) % 8 == 0) {
+ m_avecReflectionsPos[3] = camPos;
+ m_avecReflectionsPos[3].x += 50.0f;
+ if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true))
+ m_afReflectionsDistances[3] = Distance(camPos, colpoint.point);
+ else
+ m_afReflectionsDistances[3] = 50.0f;
+ } else if ((m_FrameCounter + 4) % 8 == 0) {
+ m_avecReflectionsPos[4] = camPos;
+ m_avecReflectionsPos[4].z += 50.0f;
+ if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, nil))
+ m_afReflectionsDistances[4] = colpoint.point.z - camPos.z;
+ else
+ m_afReflectionsDistances[4] = 50.0f;
+ }
}
void
-cAudioManager::PreInitialiseGameSpecificSetup() const
+cAudioManager::AddReleasingSounds()
{
- BankStartOffset[SAMPLEBANK_MAIN] = SFX_CAR_HORN_JEEP;
- BankStartOffset[SAMPLEBANK_PED] = SFX_COP_VOICE_1_ARREST_1;
-}
-
-struct MissionAudioData {
- const char *m_pName;
- int32 m_nId;
-};
+ bool toProcess[44]; // why not 27?
-const MissionAudioData MissionAudioNameSfxAssoc[] = {
- {"lib_a1", STREAMED_SOUND_MISSION_LIB_A1}, {"lib_a2", STREAMED_SOUND_MISSION_LIB_A2}, {"lib_a", STREAMED_SOUND_MISSION_LIB_A},
- {"lib_b", STREAMED_SOUND_MISSION_LIB_B}, {"lib_c", STREAMED_SOUND_MISSION_LIB_C}, {"lib_d", STREAMED_SOUND_MISSION_LIB_D},
- {"l2_a", STREAMED_SOUND_MISSION_L2_A}, {"j4t_1", STREAMED_SOUND_MISSION_J4T_1}, {"j4t_2", STREAMED_SOUND_MISSION_J4T_2},
- {"j4t_3", STREAMED_SOUND_MISSION_J4T_3}, {"j4t_4", STREAMED_SOUND_MISSION_J4T_4}, {"j4_a", STREAMED_SOUND_MISSION_J4_A},
- {"j4_b", STREAMED_SOUND_MISSION_J4_B}, {"j4_c", STREAMED_SOUND_MISSION_J4_C}, {"j4_d", STREAMED_SOUND_MISSION_J4_D},
- {"j4_e", STREAMED_SOUND_MISSION_J4_E}, {"j4_f", STREAMED_SOUND_MISSION_J4_F}, {"j6_1", STREAMED_SOUND_MISSION_J6_1},
- {"j6_a", STREAMED_SOUND_MISSION_J6_A}, {"j6_b", STREAMED_SOUND_MISSION_J6_B}, {"j6_c", STREAMED_SOUND_MISSION_J6_C},
- {"j6_d", STREAMED_SOUND_MISSION_J6_D}, {"t4_a", STREAMED_SOUND_MISSION_T4_A}, {"s1_a", STREAMED_SOUND_MISSION_S1_A},
- {"s1_a1", STREAMED_SOUND_MISSION_S1_A1}, {"s1_b", STREAMED_SOUND_MISSION_S1_B}, {"s1_c", STREAMED_SOUND_MISSION_S1_C},
- {"s1_c1", STREAMED_SOUND_MISSION_S1_C1}, {"s1_d", STREAMED_SOUND_MISSION_S1_D}, {"s1_e", STREAMED_SOUND_MISSION_S1_E},
- {"s1_f", STREAMED_SOUND_MISSION_S1_F}, {"s1_g", STREAMED_SOUND_MISSION_S1_G}, {"s1_h", STREAMED_SOUND_MISSION_S1_H},
- {"s1_i", STREAMED_SOUND_MISSION_S1_I}, {"s1_j", STREAMED_SOUND_MISSION_S1_J}, {"s1_k", STREAMED_SOUND_MISSION_S1_K},
- {"s1_l", STREAMED_SOUND_MISSION_S1_L}, {"s3_a", STREAMED_SOUND_MISSION_S3_A}, {"s3_b", STREAMED_SOUND_MISSION_S3_B},
- {"el3_a", STREAMED_SOUND_MISSION_EL3_A}, {"mf1_a", STREAMED_SOUND_MISSION_MF1_A}, {"mf2_a", STREAMED_SOUND_MISSION_MF2_A},
- {"mf3_a", STREAMED_SOUND_MISSION_MF3_A}, {"mf3_b", STREAMED_SOUND_MISSION_MF3_B}, {"mf3_b1", STREAMED_SOUND_MISSION_MF3_B1},
- {"mf3_c", STREAMED_SOUND_MISSION_MF3_C}, {"mf4_a", STREAMED_SOUND_MISSION_MF4_A}, {"mf4_b", STREAMED_SOUND_MISSION_MF4_B},
- {"mf4_c", STREAMED_SOUND_MISSION_MF4_C}, {"a1_a", STREAMED_SOUND_MISSION_A1_A}, {"a3_a", STREAMED_SOUND_MISSION_A3_A},
- {"a5_a", STREAMED_SOUND_MISSION_A5_A}, {"a4_a", STREAMED_SOUND_MISSION_A4_A}, {"a4_b", STREAMED_SOUND_MISSION_A4_B},
- {"a4_c", STREAMED_SOUND_MISSION_A4_C}, {"a4_d", STREAMED_SOUND_MISSION_A4_D}, {"k1_a", STREAMED_SOUND_MISSION_K1_A},
- {"k3_a", STREAMED_SOUND_MISSION_K3_A}, {"r1_a", STREAMED_SOUND_MISSION_R1_A}, {"r2_a", STREAMED_SOUND_MISSION_R2_A},
- {"r2_b", STREAMED_SOUND_MISSION_R2_B}, {"r2_c", STREAMED_SOUND_MISSION_R2_C}, {"r2_d", STREAMED_SOUND_MISSION_R2_D},
- {"r2_e", STREAMED_SOUND_MISSION_R2_E}, {"r2_f", STREAMED_SOUND_MISSION_R2_F}, {"r2_g", STREAMED_SOUND_MISSION_R2_G},
- {"r2_h", STREAMED_SOUND_MISSION_R2_H}, {"r5_a", STREAMED_SOUND_MISSION_R5_A}, {"r6_a", STREAMED_SOUND_MISSION_R6_A},
- {"r6_a1", STREAMED_SOUND_MISSION_R6_A1}, {"r6_b", STREAMED_SOUND_MISSION_R6_B}, {"lo2_a", STREAMED_SOUND_MISSION_LO2_A},
- {"lo6_a", STREAMED_SOUND_MISSION_LO6_A}, {"yd2_a", STREAMED_SOUND_MISSION_YD2_A}, {"yd2_b", STREAMED_SOUND_MISSION_YD2_B},
- {"yd2_c", STREAMED_SOUND_MISSION_YD2_C}, {"yd2_c1", STREAMED_SOUND_MISSION_YD2_C1}, {"yd2_d", STREAMED_SOUND_MISSION_YD2_D},
- {"yd2_e", STREAMED_SOUND_MISSION_YD2_E}, {"yd2_f", STREAMED_SOUND_MISSION_YD2_F}, {"yd2_g", STREAMED_SOUND_MISSION_YD2_G},
- {"yd2_h", STREAMED_SOUND_MISSION_YD2_H}, {"yd2_ass", STREAMED_SOUND_MISSION_YD2_ASS}, {"yd2_ok", STREAMED_SOUND_MISSION_YD2_OK},
- {"h5_a", STREAMED_SOUND_MISSION_H5_A}, {"h5_b", STREAMED_SOUND_MISSION_H5_B}, {"h5_c", STREAMED_SOUND_MISSION_H5_C},
- {"ammu_a", STREAMED_SOUND_MISSION_AMMU_A}, {"ammu_b", STREAMED_SOUND_MISSION_AMMU_B}, {"ammu_c", STREAMED_SOUND_MISSION_AMMU_C},
- {"door_1", STREAMED_SOUND_MISSION_DOOR_1}, {"door_2", STREAMED_SOUND_MISSION_DOOR_2}, {"door_3", STREAMED_SOUND_MISSION_DOOR_3},
- {"door_4", STREAMED_SOUND_MISSION_DOOR_4}, {"door_5", STREAMED_SOUND_MISSION_DOOR_5}, {"door_6", STREAMED_SOUND_MISSION_DOOR_6},
- {"t3_a", STREAMED_SOUND_MISSION_T3_A}, {"t3_b", STREAMED_SOUND_MISSION_T3_B}, {"t3_c", STREAMED_SOUND_MISSION_T3_C},
- {"k1_b", STREAMED_SOUND_MISSION_K1_B}, {"c_1", STREAMED_SOUND_MISSION_CAT1}};
+ int8 queue = m_nActiveSampleQueue == 0;
-int32
-FindMissionAudioSfx(const char *name)
-{
- for (uint32 i = 0; i < ARRAY_SIZE(MissionAudioNameSfxAssoc); ++i) {
- if (!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name))
- return MissionAudioNameSfxAssoc[i].m_nId;
- }
- debug("Can't find mission audio %s", name);
- return NO_SAMPLE;
-}
+ for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) {
+ tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];
+ if (sample.m_bLoopEnded)
+ continue;
-void
-cAudioManager::PreloadMissionAudio(const char *name)
-{
- if (m_bIsInitialised) {
- int32 missionAudioSfx = FindMissionAudioSfx(name);
- if (missionAudioSfx != NO_SAMPLE) {
- m_sMissionAudio.m_nSampleIndex = missionAudioSfx;
- m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
- m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
- m_sMissionAudio.field_22 = 0;
- m_sMissionAudio.m_nMissionAudioCounter = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000;
- m_sMissionAudio.m_nMissionAudioCounter *= 4;
- m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.m_bPredefinedProperties = 1;
- g_bMissionAudioLoadFailed = false;
+ toProcess[i] = false;
+ for (int32 j = 0; j < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; j++) {
+ if (sample.m_nEntityIndex == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nEntityIndex &&
+ sample.m_nCounter == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nCounter) {
+ toProcess[i] = true;
+ break;
+ }
+ }
+ if (!toProcess[i]) {
+ if (sample.m_nCounter <= 255 || !sample.m_nLoopsRemaining) {
+ if (!sample.m_nReleasingVolumeDivider)
+ continue;
+ if (!sample.m_nLoopCount) {
+ if (sample.m_nVolumeChange == -1) {
+ sample.m_nVolumeChange = sample.m_nVolume / sample.m_nReleasingVolumeDivider;
+ if (sample.m_nVolumeChange <= 0)
+ sample.m_nVolumeChange = 1;
+ }
+ if (sample.m_nVolume <= sample.m_nVolumeChange) {
+ sample.m_nReleasingVolumeDivider = 0;
+ continue;
+ }
+ sample.m_nVolume -= sample.m_nVolumeChange;
+ }
+ --sample.m_nReleasingVolumeDivider;
+ if (m_bFifthFrameFlag) {
+ if (sample.m_nReleasingVolumeModificator < 20)
+ ++sample.m_nReleasingVolumeModificator;
+ }
+ sample.m_bReleasingSoundFlag = 0;
+ }
+ memcpy(&m_sQueueSample, &sample, sizeof(tSound));
+ AddSampleToRequestedQueue();
}
- }
-}
-void
-cAudioManager::PreTerminateGameSpecificShutdown()
-{
- if (m_nBridgeEntity >= 0) {
- DestroyEntity(m_nBridgeEntity);
- m_nBridgeEntity = AEHANDLE_NONE;
- }
- if (m_nPoliceChannelEntity >= 0) {
- DestroyEntity(m_nPoliceChannelEntity);
- m_nPoliceChannelEntity = AEHANDLE_NONE;
- }
- if (m_nWaterCannonEntity >= 0) {
- DestroyEntity(m_nWaterCannonEntity);
- m_nWaterCannonEntity = AEHANDLE_NONE;
- }
- if (m_nFireAudioEntity >= 0) {
- DestroyEntity(m_nFireAudioEntity);
- m_nFireAudioEntity = AEHANDLE_NONE;
- }
- if (m_nCollisionEntity >= 0) {
- DestroyEntity(m_nCollisionEntity);
- m_nCollisionEntity = AEHANDLE_NONE;
- }
- if (m_nFrontEndEntity >= 0) {
- DestroyEntity(m_nFrontEndEntity);
- m_nFrontEndEntity = AEHANDLE_NONE;
- }
- if (m_nProjectileEntity >= 0) {
- DestroyEntity(m_nProjectileEntity);
- m_nProjectileEntity = AEHANDLE_NONE;
}
}
@@ -3688,6094 +901,57 @@ cAudioManager::ProcessActiveQueues()
}
}
-bool
-cAudioManager::ProcessAirBrakes(cVehicleParams *params)
-{
- CAutomobile *automobile;
- uint8 rand;
-
- if (params->m_fDistance > 900.0f)
- return false;
- automobile = (CAutomobile *)params->m_pVehicle;
- if (!automobile->bEngineOn)
- return true;
-
- if ((automobile->m_fVelocityChangeForAudio < 0.025f || params->m_fVelocityChange >= 0.025f) &&
- (automobile->m_fVelocityChangeForAudio > -0.025f || params->m_fVelocityChange <= 0.025f))
- return true;
-
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- rand = m_anRandomTable[0] % 10 + 70;
- m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 13;
- m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 10;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = rand;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
-
- return true;
-}
-
-void
-cAudioManager::ProcessAirportScriptObject(uint8 sound)
-{
- static uint8 counter = 0;
-
- uint32 time = CTimer::GetTimeInMilliseconds();
- if (time > gAirportNextTime) {
- switch (sound) {
- case SCRIPT_SOUND_AIRPORT_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS;
- break;
- case SCRIPT_SOUND_AIRPORT_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL;
- break;
- default:
- return;
- }
- float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nCounter = counter++;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = 110;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- gAirportNextTime = time + 10000 + m_anRandomTable[3] % 20000;
- }
- }
- }
-}
-
-bool
-cAudioManager::ProcessBoatEngine(cVehicleParams *params)
-{
- CBoat *boat;
- float padRelativeAccerate;
- float gasPedal;
- int32 padAccelerate;
- uint8 emittingVol;
- float oneShotVol;
-
- static uint16 LastAccel = 0;
- static uint8 LastVol = 0;
-
- static const int intensity = 50;
-
- if (params->m_fDistance < SQR(intensity)) {
- boat = (CBoat *)params->m_pVehicle;
- if (params->m_nIndex == REEFER) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 39;
- m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
- m_sQueueSample.m_nFrequency = 10386;
- m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 80;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 7;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- if (FindPlayerVehicle() == params->m_pVehicle) {
- if (Pads[0].GetAccelerate() <= Pads[0].GetBrake())
- padAccelerate = Pads[0].GetBrake();
- else
- padAccelerate = Pads[0].GetAccelerate();
- padRelativeAccerate = padAccelerate / 255;
- emittingVol = (100.f * padRelativeAccerate) + 15;
- m_sQueueSample.m_nFrequency = (3000.f * padRelativeAccerate) + 6000;
- if (!boat->m_bIsAnchored)
- m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
- } else {
- gasPedal = Abs(boat->m_fGasPedal);
- if (gasPedal > 0.0f) {
- m_sQueueSample.m_nFrequency = 6000;
- emittingVol = 15;
- } else {
- emittingVol = (100.f * gasPedal) + 15;
- m_sQueueSample.m_nFrequency = (3000.f * gasPedal) + 6000;
- if (!boat->m_bIsAnchored)
- m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
- }
- }
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
- if (!m_sQueueSample.m_nVolume)
- return true;
- m_sQueueSample.m_nCounter = 40;
- m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
- m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 7;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- } else {
- if (FindPlayerVehicle() == params->m_pVehicle) {
- if (Pads[0].GetAccelerate() <= Pads[0].GetBrake())
- padAccelerate = Pads[0].GetBrake();
- else
- padAccelerate = Pads[0].GetAccelerate();
- if (padAccelerate <= 20) {
- emittingVol = 45 - 45 * padAccelerate / 40;
- m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025;
- m_sQueueSample.m_nCounter = 39;
- m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE;
- if (LastAccel > 20) {
- oneShotVol = LastVol;
- PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_17, oneShotVol);
- }
- } else {
- emittingVol = 105 * padAccelerate / 255 + 15;
- m_sQueueSample.m_nFrequency = 4000 * padAccelerate / 255 + 8000;
- if (!boat->m_bIsAnchored)
- m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
- m_sQueueSample.m_nCounter = 40;
- m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
- }
- LastVol = emittingVol;
- LastAccel = padAccelerate;
- } else {
- gasPedal = Abs(boat->m_fGasPedal);
- if (gasPedal > 0.0f) {
- m_sQueueSample.m_nFrequency = 11025;
- emittingVol = 45;
- m_sQueueSample.m_nCounter = 39;
- m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE;
- } else {
- emittingVol = (105.f * gasPedal) + 15;
- m_sQueueSample.m_nFrequency = (4000.f * gasPedal) + 8000;
- if (!boat->m_bIsAnchored)
- m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
- m_sQueueSample.m_nCounter = 40;
- m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
- }
- }
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
- if (!m_sQueueSample.m_nVolume)
- return true;
- m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 7;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- }
- AddSampleToRequestedQueue();
- return true;
- }
- return false;
-}
-
-bool
-cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
-{
- float velocityChange;
- int32 vol;
- float multiplier;
-
- if (params->m_fDistance > 2500.f)
- return false;
-
- velocityChange = Abs(params->m_fVelocityChange);
- if (velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y)
- return true;
-
- velocityChange = Min(0.75f, velocityChange);
- multiplier = (velocityChange - 0.0005f) * 1.3342f;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- vol = (30.f * multiplier);
- m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 38;
- m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = vol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
-
- return true;
-}
-
-void
-cAudioManager::ProcessBridge()
-{
- float dist;
- bool distCalculated = false;
-
- if (CBridge::pLiftRoad) {
- m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition();
- dist = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (dist < 202500.0f) {
- CalculateDistance(distCalculated, dist);
- switch (CBridge::State) {
- case STATE_BRIDGE_LOCKED:
- case STATE_LIFT_PART_IS_UP:
- case STATE_LIFT_PART_ABOUT_TO_MOVE_UP:
- ProcessBridgeWarning();
- break;
- case STATE_LIFT_PART_MOVING_DOWN:
- case STATE_LIFT_PART_MOVING_UP:
- ProcessBridgeWarning();
- ProcessBridgeMotor();
- break;
- default:
- break;
- }
- ProcessBridgeOneShots();
- }
- }
-}
-
-void
-cAudioManager::ProcessBridgeMotor()
-{
- if (m_sQueueSample.m_fDistance < bridgeIntensity) {
- m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 1;
- m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = 5500;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = maxVolume;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = false;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-void
-cAudioManager::ProcessBridgeOneShots()
-{
- if (CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP) {
- m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1;
- } else {
- if (CBridge::State == STATE_LIFT_PART_IS_DOWN && CBridge::OldState == STATE_LIFT_PART_MOVING_DOWN) {
- m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1;
- } else {
- if (CBridge::State == STATE_LIFT_PART_MOVING_UP && CBridge::OldState == STATE_LIFT_PART_ABOUT_TO_MOVE_UP) {
- m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1;
- } else {
- if (CBridge::State == STATE_LIFT_PART_MOVING_DOWN && CBridge::OldState == STATE_LIFT_PART_IS_UP) {
- m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1;
- } else
- return;
- }
- }
- }
- if (m_sQueueSample.m_fDistance < bridgeIntensity) {
- m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 2;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = maxVolume;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bReverbFlag = false;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-void
-cAudioManager::ProcessBridgeWarning()
-{
- if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) {
- m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 100;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = 450.0f;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 8;
- m_sQueueSample.m_bReverbFlag = false;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-bool
-cAudioManager::ProcessCarBombTick(cVehicleParams *params)
-{
- CAutomobile *automobile;
-
- if (params->m_fDistance >= SQR(40.f))
- return false;
- automobile = (CAutomobile *)params->m_pVehicle;
- if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 35;
- m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 60;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = 40.0f;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- return true;
-}
-
-void
-cAudioManager::ProcessCesna(cVehicleParams *params)
-{
- static uint8 nAccel = 0;
-
- //((CAutomobile *)params->m_pVehicle)->Damage.GetEngineStatus();
-
- if (FindPlayerVehicle() == params->m_pVehicle) {
- if (params->m_nIndex == DODO) {
- if (Pads[0].GetAccelerate() <= 0) {
- if (nAccel)
- --nAccel;
- } else if (nAccel < 60) {
- ++nAccel;
- }
- AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, 0, 52, 1);
- AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, 0, 2, 1);
- }
- } else if (params->m_nIndex == DODO) {
- AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, 0, 52, 1);
- } else if (params->m_fDistance < 40000.f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 52;
- m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nFrequency = 12500;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nReleasingVolumeDivider = 8;
- m_sQueueSample.m_nEmittingVolume = 80;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 8.0f;
- m_sQueueSample.m_fSoundIntensity = 200.0f;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- if (params->m_fDistance < 8100.f) {
- m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 2;
- m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nFrequency = 25000;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nReleasingVolumeDivider = 4;
- m_sQueueSample.m_nEmittingVolume = 80;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 8.0f;
- m_sQueueSample.m_fSoundIntensity = 90.0f;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessCinemaScriptObject(uint8 sound)
-{
- uint8 rand;
-
- static uint8 counter = 0;
-
- uint32 time = CTimer::GetTimeInMilliseconds();
- if (time > gCinemaNextTime) {
- switch (sound) {
- case SCRIPT_SOUND_CINEMA_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS;
- break;
- case SCRIPT_SOUND_CINEMA_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL;
- break;
- default:
- return;
- }
- float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- rand = m_anRandomTable[0] % 90 + 30;
- m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = counter % 3 + SFX_CINEMA_BASS_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 4);
- m_sQueueSample.m_nCounter = counter++;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = rand;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- gCinemaNextTime = time + 1000 + m_anRandomTable[3] % 4000;
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessCrane()
-{
- CCrane *crane = (CCrane *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity;
- float distSquared;
- bool distCalculated = false;
- static const int intensity = 80;
-
- if (crane) {
- if (crane->m_nCraneStatus == CCrane::ACTIVATED) {
- if (crane->m_nCraneState != CCrane::IDLE) {
- m_sQueueSample.m_vecPos = crane->m_pCraneEntity->GetPosition();
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(intensity)) {
- CalculateDistance(distCalculated, distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nFrequency = 6000;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 100;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) {
- m_sQueueSample.m_nCounter = 1;
- m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_2;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COL_CAR_2);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = true;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessDocksScriptObject(uint8 sound)
-{
- uint32 time;
- uint8 rand;
- float distSquared;
-
- static uint32 counter = 0;
-
- time = CTimer::GetTimeInMilliseconds();
- if (time > gDocksNextTime) {
- switch (sound) {
- case SCRIPT_SOUND_DOCKS_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS;
- break;
- case SCRIPT_SOUND_DOCKS_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL;
- break;
- default:
- return;
- }
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- rand = m_anRandomTable[0] % 60 + 40;
- m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = SFX_DOCKS_FOGHORN;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
- m_sQueueSample.m_nCounter = counter++;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = rand;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- gDocksNextTime = time + 10000 + m_anRandomTable[3] % 40000;
- }
- }
- }
-}
-
-bool
-cAudioManager::ProcessEngineDamage(cVehicleParams *params)
-{
- CAutomobile *veh;
- uint8 engineStatus;
- uint8 emittingVolume;
-
- if (params->m_fDistance >= SQR(engineDamageIntensity))
- return false;
- veh = (CAutomobile *)params->m_pVehicle;
- if (veh->bEngineOn) {
- engineStatus = veh->Damage.GetEngineStatus();
- if (engineStatus > 250 || engineStatus < 100)
- return true;
- if (engineStatus < 225) {
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
- emittingVolume = 6;
- m_sQueueSample.m_nReleasingVolumeModificator = 7;
- m_sQueueSample.m_nFrequency = 40000;
- } else {
- emittingVolume = 60;
- m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
- m_sQueueSample.m_nReleasingVolumeModificator = 7;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
- }
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 28;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = engineDamageIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- return true;
-}
-
-void
-cAudioManager::ProcessEntity(int32 id)
-{
- if (m_asAudioEntities[id].m_nStatus) {
- m_sQueueSample.m_nEntityIndex = id;
- switch (m_asAudioEntities[id].m_nType) {
- case AUDIOTYPE_PHYSICAL:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessPhysical(id);
- }
- break;
- case AUDIOTYPE_EXPLOSION:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessExplosions(id);
- }
- break;
- case AUDIOTYPE_FIRE:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessFires(id);
- }
- break;
- case AUDIOTYPE_WEATHER:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessWeather(id);
- }
- break;
- case AUDIOTYPE_CRANE:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessCrane();
- }
- break;
- case AUDIOTYPE_SCRIPTOBJECT:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessScriptObject(id);
- }
- break;
- case AUDIOTYPE_BRIDGE:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessBridge();
- }
- break;
- case AUDIOTYPE_FRONTEND:
- m_sQueueSample.m_bReverbFlag = false;
- ProcessFrontEnd();
- break;
- case AUDIOTYPE_PROJECTILE:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessProjectiles();
- }
- break;
- case AUDIOTYPE_GARAGE:
- if (!m_nUserPause)
- ProcessGarages();
- break;
- case AUDIOTYPE_FIREHYDRANT:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessFireHydrant();
- }
- break;
- case AUDIOTYPE_WATERCANNON:
- if (!m_nUserPause) {
- m_sQueueSample.m_bReverbFlag = true;
- ProcessWaterCannon(id);
- }
- break;
- default:
- return;
- }
- }
-}
-
-void
-cAudioManager::ProcessExplosions(int32 explosion)
-{
- uint8 type;
- CVector *pos;
- float distSquared;
-
- for (uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) {
- if (CExplosion::GetExplosionActiveCounter(i) == 1) {
- CExplosion::ResetExplosionActiveCounter(i);
- type = CExplosion::GetExplosionType(i);
- switch (type) {
- case EXPLOSION_GRENADE:
- case EXPLOSION_ROCKET:
- case EXPLOSION_BARREL:
- case EXPLOSION_TANK_GRENADE:
- m_sQueueSample.m_fSoundIntensity = 400.0f;
- m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2;
- m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- break;
- case EXPLOSION_MOLOTOV:
- m_sQueueSample.m_fSoundIntensity = 200.0f;
- m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3;
- m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- break;
- case EXPLOSION_MINE:
- case EXPLOSION_HELI_BOMB:
- m_sQueueSample.m_fSoundIntensity = 300.0f;
- m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT;
- m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- break;
- default:
- m_sQueueSample.m_fSoundIntensity = 400.0f;
- m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1;
- m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000;
- if (type == EXPLOSION_HELI)
- m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- break;
- }
- pos = CExplosion::GetExplosionPosition(i);
- m_sQueueSample.m_vecPos = *pos;
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = i;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_nEmittingVolume = maxVolume;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = true;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessFireHydrant()
-{
- float distSquared;
- bool distCalculated = false;
- static const int intensity = 35;
-
- m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition();
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(intensity)) {
- CalculateDistance(distCalculated, distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 4;
- m_sQueueSample.m_nFrequency = 15591;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 40;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-void cAudioManager::ProcessFires(int32)
-{
- CEntity *entity;
- uint8 emittingVol;
- float distSquared;
-
- for (uint8 i = 0; i < NUM_FIRES; i++) {
- if (gFireManager.m_aFires[i].m_bIsOngoing && gFireManager.m_aFires[i].m_bAudioSet) {
- entity = gFireManager.m_aFires[i].m_pEntity;
- if (entity) {
- switch (entity->GetType()) {
- case ENTITY_TYPE_BUILDING:
- m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
- emittingVol = 100;
- m_sQueueSample.m_nFrequency = 8 * SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE) / 10;
- m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
- m_sQueueSample.m_nReleasingVolumeModificator = 6;
- break;
- case ENTITY_TYPE_PED:
- m_sQueueSample.m_fSoundIntensity = 25.0f;
- m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE);
- emittingVol = 60;
- m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
- m_sQueueSample.m_nReleasingVolumeModificator = 10;
- break;
- default:
- m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
- m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
- emittingVol = 80;
- m_sQueueSample.m_nReleasingVolumeModificator = 8;
- }
- } else {
- m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
- m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64);
- emittingVol = 80;
- m_sQueueSample.m_nReleasingVolumeModificator = 8;
- }
- m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos;
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = i;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nReleasingVolumeDivider = 10;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessFrontEnd()
-{
- bool stereo;
- bool processedPickup;
- bool processedMission;
- int16 sample;
-
- static uint8 counter = 0;
- static uint32 cPickupNextFrame = 0;
- static uint32 cPartMisComNextFrame = 0;
-
- for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
- processedPickup = false;
- stereo = false;
- processedMission = false;
- switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]) {
- case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM:
- m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_RIFLE;
- break;
- case SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM:
- m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_ROCKET_LAUNCHER;
- break;
- case SOUND_GARAGE_NO_MONEY:
- case SOUND_GARAGE_BAD_VEHICLE:
- case SOUND_GARAGE_BOMB_ALREADY_SET:
- m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT;
- stereo = true;
- break;
- case SOUND_GARAGE_OPENING:
- case SOUND_GARAGE_BOMB1_SET:
- case SOUND_GARAGE_BOMB2_SET:
- case SOUND_GARAGE_BOMB3_SET:
- case SOUND_41:
- case SOUND_GARAGE_VEHICLE_DECLINED:
- case SOUND_GARAGE_VEHICLE_ACCEPTED:
- case SOUND_PICKUP_HEALTH:
- case SOUND_4B:
- case SOUND_PICKUP_ADRENALINE:
- case SOUND_PICKUP_ARMOUR:
- case SOUND_EVIDENCE_PICKUP:
- case SOUND_UNLOAD_GOLD:
- m_sQueueSample.m_nSampleIndex = SFX_PICKUP_2_LEFT;
- processedPickup = true;
- stereo = true;
- break;
- case SOUND_PICKUP_WEAPON_BOUGHT:
- case SOUND_PICKUP_WEAPON:
- m_sQueueSample.m_nSampleIndex = SFX_PICKUP_1_LEFT;
- processedPickup = true;
- stereo = true;
- break;
- case SOUND_4A:
- m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT;
- processedPickup = true;
- stereo = true;
- break;
- case SOUND_PICKUP_BONUS:
- case SOUND_PICKUP_MONEY:
- case SOUND_PICKUP_HIDDEN_PACKAGE:
- case SOUND_PICKUP_PACMAN_PILL:
- case SOUND_PICKUP_PACMAN_PACKAGE:
- case SOUND_PICKUP_FLOAT_PACKAGE:
- m_sQueueSample.m_nSampleIndex = SFX_PICKUP_3_LEFT;
- processedPickup = true;
- stereo = true;
- break;
- case SOUND_PAGER:
- m_sQueueSample.m_nSampleIndex = SFX_PAGER;
- break;
- case SOUND_RACE_START_3:
- case SOUND_RACE_START_2:
- case SOUND_RACE_START_1:
- case SOUND_CLOCK_TICK:
- m_sQueueSample.m_nSampleIndex = SFX_TIMER_BEEP;
- break;
- case SOUND_RACE_START_GO:
- m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE;
- break;
- case SOUND_PART_MISSION_COMPLETE:
- m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE;
- processedMission = true;
- break;
- case SOUND_FRONTEND_MENU_STARTING:
- m_sQueueSample.m_nSampleIndex = SFX_START_BUTTON_LEFT;
- stereo = true;
- break;
- case SOUND_FRONTEND_MENU_COMPLETED:
- m_sQueueSample.m_nSampleIndex = SFX_PAGE_CHANGE_AND_BACK_LEFT;
- stereo = true;
- break;
- case SOUND_FRONTEND_MENU_DENIED:
- m_sQueueSample.m_nSampleIndex = SFX_HIGHLIGHT_LEFT;
- stereo = true;
- break;
- case SOUND_FRONTEND_MENU_SUCCESS:
- m_sQueueSample.m_nSampleIndex = SFX_SELECT_LEFT;
- stereo = true;
- break;
- case SOUND_FRONTEND_EXIT:
- m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT;
- stereo = true;
- break;
- case SOUND_FRONTEND_STEREO:
- m_sQueueSample.m_nSampleIndex = SFX_STEREO_LEFT;
- stereo = true;
- break;
- case SOUND_FRONTEND_MONO:
- m_sQueueSample.m_nSampleIndex = SFX_MONO;
- break;
- case SOUND_FRONTEND_AUDIO_TEST:
- m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 3 + SFX_NOISE_BURST_1;
- break;
- case SOUND_FRONTEND_FAIL:
- m_sQueueSample.m_nSampleIndex = SFX_ERROR_LEFT;
- stereo = true;
- break;
- case SOUND_FRONTEND_NO_RADIO:
- case SOUND_FRONTEND_RADIO_CHANGE:
- m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK;
- break;
- case SOUND_A0:
- m_sQueueSample.m_nSampleIndex = SFX_INFO;
- break;
- default:
- continue;
- }
-
- if (processedPickup) {
- if (m_FrameCounter <= cPickupNextFrame)
- continue;
- cPickupNextFrame = m_FrameCounter + 5;
- } else if (processedMission) {
- if (m_FrameCounter <= cPartMisComNextFrame)
- continue;
- cPartMisComNextFrame = m_FrameCounter + 5;
- }
-
- sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
- if (sample == SFX_RAIN) {
- m_sQueueSample.m_nFrequency = 28509;
- } else if (sample == SFX_PICKUP_1_LEFT) {
- if (1.f == m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i])
- m_sQueueSample.m_nFrequency = 32000;
- else
- m_sQueueSample.m_nFrequency = 48000;
- } else {
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- }
- m_sQueueSample.m_nVolume = 110;
- m_sQueueSample.m_nCounter = counter++;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_bIs2D = true;
- m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- if (stereo)
- m_sQueueSample.m_nOffset = m_anRandomTable[0] & 31;
- else
- m_sQueueSample.m_nOffset = 63;
- m_sQueueSample.m_bReverbFlag = false;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- if (stereo) {
- ++m_sQueueSample.m_nSampleIndex;
- m_sQueueSample.m_nCounter = counter++;
- m_sQueueSample.m_nOffset = maxVolume - m_sQueueSample.m_nOffset;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-void
-cAudioManager::ProcessGarages()
-{
- CEntity *entity;
- eGarageState state;
- uint32 sampleIndex;
- uint8 j;
- float distSquared;
- bool distCalculated;
-
- static uint8 iSound = 32;
-
-#define LOOP_HELPER \
- for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) { \
- switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) { \
- case SOUND_GARAGE_DOOR_CLOSED: \
- case SOUND_GARAGE_DOOR_OPENED: \
- if (distSquared < 6400.f) { \
- CalculateDistance(distCalculated, distSquared); \
- m_sQueueSample.m_nVolume = ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \
- if (m_sQueueSample.m_nVolume) { \
- if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { \
- m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \
- m_sQueueSample.m_nFrequency = 6735; \
- } else if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j] == 69) { \
- m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \
- m_sQueueSample.m_nFrequency = 22000; \
- } else { \
- m_sQueueSample.m_nSampleIndex = SFX_COL_GARAGE_DOOR_1; \
- m_sQueueSample.m_nFrequency = 18000; \
- } \
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; \
- m_sQueueSample.m_nReleasingVolumeModificator = 4; \
- m_sQueueSample.m_nEmittingVolume = 60; \
- m_sQueueSample.m_fSpeedMultiplier = 0.0f; \
- m_sQueueSample.m_fSoundIntensity = 80.0f; \
- /*m_sQueueSample.m_nReleasingVolumeModificator = 4;*/ \
- m_sQueueSample.m_bReverbFlag = true; \
- /*m_sQueueSample.m_bReverbFlag = true;*/ \
- m_sQueueSample.m_bIs2D = false; \
- m_sQueueSample.m_bReleasingSoundFlag = true; \
- m_sQueueSample.m_nLoopCount = 1; \
- m_sQueueSample.m_nLoopStart = 0; \
- m_sQueueSample.m_nLoopEnd = -1; \
- m_sQueueSample.m_nCounter = iSound++; \
- if (iSound < 32) \
- iSound = 32; \
- m_sQueueSample.m_bRequireReflection = true; \
- AddSampleToRequestedQueue(); \
- } \
- } \
- break; \
- default: \
- continue; \
- } \
- }
-
- for (uint32 i = 0; i < CGarages::NumGarages; ++i) {
- if (CGarages::aGarages[i].m_eGarageType == GARAGE_NONE)
- continue;
- entity = CGarages::aGarages[i].m_pDoor1;
- if (!entity)
- continue;
- m_sQueueSample.m_vecPos = entity->GetPosition();
- distCalculated = false;
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < 6400.f) {
- state = CGarages::aGarages[i].m_eGarageState;
- if (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) {
- CalculateDistance(distCalculated, distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(90, 80.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) {
- if (CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) {
- if (!(m_FrameCounter & 1)) {
- LOOP_HELPER
- continue;
- }
- if (m_anRandomTable[1] & 1) {
- sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_CAR_1;
- } else {
- sampleIndex = m_anRandomTable[2] % 6 + SFX_COL_CAR_PANEL_1;
- }
- m_sQueueSample.m_nSampleIndex = sampleIndex;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2;
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nCounter = iSound++;
- if (iSound < 32)
- iSound = 32;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nEmittingVolume = 90;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- LOOP_HELPER
- continue;
- }
- m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
- m_sQueueSample.m_nFrequency = 6543;
- } else {
- m_sQueueSample.m_nSampleIndex = SFX_GARAGE_DOOR_LOOP;
- m_sQueueSample.m_nFrequency = 13961;
- }
- m_sQueueSample.m_nCounter = i;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nEmittingVolume = 90;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- LOOP_HELPER
- }
- }
-#undef LOOP_HELPER
-}
-
-struct tHelicopterSampleData {
- float m_fMaxDistance;
- float m_fBaseDistance;
- uint8 m_bBaseVolume;
-};
-
-bool
-cAudioManager::ProcessHelicopter(cVehicleParams *params)
-{
- CHeli *heli;
- float MaxDist;
- float dist;
- float baseDist;
- int32 emittingVol;
- static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, maxVolume}, {60.f, 30.f, maxVolume}};
-
- if (gHeliSfxRanges[0].m_fMaxDistance * gHeliSfxRanges[0].m_fMaxDistance <= params->m_fDistance)
- return false;
-
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- heli = (CHeli *)params->m_pVehicle;
- for (uint32 i = 0; i < ARRAY_SIZE(gHeliSfxRanges); i++) {
- MaxDist = gHeliSfxRanges[i].m_fMaxDistance;
- dist = m_sQueueSample.m_fDistance;
- if (dist >= MaxDist)
- return true;
- baseDist = gHeliSfxRanges[i].m_fBaseDistance;
- if (dist < baseDist)
- emittingVol = (gHeliSfxRanges[i].m_bBaseVolume * ((MaxDist - dist) / (MaxDist - baseDist)));
- else
- emittingVol = gHeliSfxRanges[i].m_bBaseVolume;
-
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = i + 65;
- m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nFrequency = 1200 * heli->m_nHeliId + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 6.0f;
- m_sQueueSample.m_fSoundIntensity = gHeliSfxRanges[i].m_fMaxDistance;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- return true;
-}
-
-void
-cAudioManager::ProcessHomeScriptObject(uint8 sound)
-{
- uint32 time;
- uint8 rand;
- float dist;
-
- static uint8 counter = 0;
-
- time = CTimer::GetTimeInMilliseconds();
- if (time > gHomeNextTime) {
- switch (sound) {
- case SCRIPT_SOUND_HOME_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS;
- break;
- case SCRIPT_SOUND_HOME_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL;
- break;
- default:
- return;
- }
- dist = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (dist < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(dist);
- rand = m_anRandomTable[0] % 30 + 40;
- m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + SFX_HOME_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nCounter = counter++;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_nEmittingVolume = rand;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = true;
- AddSampleToRequestedQueue();
- gHomeNextTime = time + 1000 + m_anRandomTable[3] % 4000;
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessJumbo(cVehicleParams *params)
-{
- CPlane *plane;
- float position;
-
- if (params->m_fDistance < 193600.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- plane = (CPlane *)params->m_pVehicle;
- DoJumboVolOffset();
- position = PlanePathPosition[plane->m_nPlaneId];
- if (position <= TakeOffPoint) {
- if (plane->m_fSpeed <= 0.10334f) {
- ProcessJumboTaxi();
- return;
- }
-
- ProcessJumboAccel(plane);
- } else if (300.0f + TakeOffPoint >= position) {
- ProcessJumboTakeOff(plane);
- } else if (LandingPoint - 350.0f >= position) {
- ProcessJumboFlying();
- } else {
- if (position > LandingPoint) {
- if (plane->m_fSpeed > 0.10334f) {
- ProcessJumboDecel(plane);
- return;
- }
- ProcessJumboTaxi();
- return;
- }
- ProcessJumboLanding(plane);
- }
- }
-}
-
-void
-cAudioManager::ProcessJumboAccel(CPlane *plane)
-{
- int32 engineFreq;
- int32 vol;
- float whineSoundFreq;
- float modificator;
-
- if (SetupJumboFlySound(20)) {
- modificator = (plane->m_fSpeed - 0.10334f) * 1.676f;
- if (modificator > 1.0f)
- modificator = 1.0f;
- if (SetupJumboRumbleSound(maxVolume * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) {
- if (modificator < 0.2f) {
- whineSoundFreq = modificator * 5.f * 14600.0f + 29500;
- vol = modificator * 5.f * maxVolume;
- engineFreq = modificator * 5.f * 6050.f + 16000;
- } else {
- whineSoundFreq = 44100;
- engineFreq = 22050;
- vol = maxVolume;
- }
- SetupJumboEngineSound(vol, engineFreq);
- SetupJumboWhineSound(18, whineSoundFreq);
- }
- }
-}
-
-void
-cAudioManager::ProcessJumboDecel(CPlane *plane)
-{
- if (SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) {
- const float modificator = Min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f);
- SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000);
- SetupJumboWhineSound(18, 29500);
- }
-}
-
-void
-cAudioManager::ProcessJumboFlying()
-{
- if (SetupJumboFlySound(maxVolume))
- SetupJumboEngineSound(63, 22050);
-}
-
-void
-cAudioManager::ProcessJumboLanding(CPlane *plane)
-{
- const float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f;
- if (SetupJumboFlySound(107.f * modificator + 20)) {
- if (SetupJumboTaxiSound(75.f * (1.f - modificator))) {
- SetupJumboEngineSound(maxVolume, 22050);
- SetupJumboWhineSound(18.f * (1.f - modificator), 14600.f * modificator + 29500);
- }
- }
-}
-
-void
-cAudioManager::ProcessJumboTakeOff(CPlane *plane)
-{
- const float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f;
-
- if (SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(maxVolume * (1.f - modificator))) {
- if (SetupJumboEngineSound(maxVolume, 22050))
- SetupJumboWhineSound(18.f * (1.f - modificator), 44100);
- }
-}
-
-void
-cAudioManager::ProcessJumboTaxi()
-{
- if (SetupJumboFlySound(20)) {
- if (SetupJumboTaxiSound(75))
- SetupJumboWhineSound(18, 29500);
- }
-}
-
-void
-cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
-{
- switch (sound) {
- case SCRIPT_SOUND_LAUNDERETTE_LOOP_S:
- case SCRIPT_SOUND_LAUNDERETTE_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- break;
- default:
- return;
- }
- float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP);
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = 45;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP);
- m_sQueueSample.m_nCounter = 1;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = 110;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-void
-cAudioManager::ProcessLoopingScriptObject(uint8 sound)
-{
- uint8 emittingVolume;
- float distSquared;
-
- switch (sound) {
- case SCRIPT_SOUND_PARTY_1_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_1_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_2_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_2;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_2_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_2;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_3_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_3;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_3_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_3;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_4_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_4;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_4_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_4;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_5_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_5;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_5_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_5;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_6_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_6;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_6_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_6;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_7_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_7;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_7_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_7;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_8_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_8;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_8_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_8;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_9_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_9;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_9_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_9;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_10_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_10;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_10_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_10;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_11_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_11;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_11_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_11;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_12_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_12;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_12_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_12;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_13_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_13_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_WORK_SHOP_LOOP_S:
- case SCRIPT_SOUND_WORK_SHOP_LOOP_L:
- ProcessWorkShopScriptObject(sound);
- return;
- case SCRIPT_SOUND_SAWMILL_LOOP_S:
- case SCRIPT_SOUND_SAWMILL_LOOP_L:
- ProcessSawMillScriptObject(sound);
- return;
- case SCRIPT_SOUND_38:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY);
- m_sQueueSample.m_nReleasingVolumeModificator = 6;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_39:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY);
- m_sQueueSample.m_nReleasingVolumeModificator = 6;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_LAUNDERETTE_LOOP_S:
- case SCRIPT_SOUND_LAUNDERETTE_LOOP_L:
- ProcessLaunderetteScriptObject(sound);
- return;
- case SCRIPT_SOUND_CHINATOWN_RESTAURANT_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_CHINATOWN_RESTAURANT_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_CIPRIANI_RESAURANT_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_CIPRIANI_RESAURANT_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_46_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_47_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_MARCO_BISTRO_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_MARCO_BISTRO_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_AIRPORT_LOOP_S:
- case SCRIPT_SOUND_AIRPORT_LOOP_L:
- ProcessAirportScriptObject(sound);
- return;
- case SCRIPT_SOUND_SHOP_LOOP_S:
- case SCRIPT_SOUND_SHOP_LOOP_L:
- ProcessShopScriptObject(sound);
- return;
- case SCRIPT_SOUND_CINEMA_LOOP_S:
- case SCRIPT_SOUND_CINEMA_LOOP_L:
- ProcessCinemaScriptObject(sound);
- return;
- case SCRIPT_SOUND_DOCKS_LOOP_S:
- case SCRIPT_SOUND_DOCKS_LOOP_L:
- ProcessDocksScriptObject(sound);
- return;
- case SCRIPT_SOUND_HOME_LOOP_S:
- case SCRIPT_SOUND_HOME_LOOP_L:
- ProcessHomeScriptObject(sound);
- return;
- case SCRIPT_SOUND_FRANKIE_PIANO:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PIANO_BAR_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PARTY_1_LOOP:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CLUB_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PORN_CINEMA_1_S:
- case SCRIPT_SOUND_PORN_CINEMA_1_L:
- case SCRIPT_SOUND_PORN_CINEMA_2_S:
- case SCRIPT_SOUND_PORN_CINEMA_2_L:
- case SCRIPT_SOUND_PORN_CINEMA_3_S:
- case SCRIPT_SOUND_PORN_CINEMA_3_L:
- case SCRIPT_SOUND_MISTY_SEX_S:
- case SCRIPT_SOUND_MISTY_SEX_L:
- ProcessPornCinema(sound);
- return;
- case SCRIPT_SOUND_BANK_ALARM_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 90;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_BANK_ALARM_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 90;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_POLICE_BALL_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_POLICE_BALL_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1);
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S:
- case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L:
- ProcessPoliceCellBeatingScriptObject(sound);
- return;
- case SCRIPT_SOUND_RAVE_1_LOOP_S:
- case SCRIPT_SOUND_RAVE_2_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_RAVE_1_LOOP_L:
- case SCRIPT_SOUND_RAVE_2_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_RAVE_3_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_RAVE_3_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- case SCRIPT_SOUND_PRETEND_FIRE_LOOP:
- m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 80;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
- m_sQueueSample.m_nReleasingVolumeModificator = 8;
- m_sQueueSample.m_nReleasingVolumeDivider = 10;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- break;
- default:
- return;
- }
-
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-void
-cAudioManager::ProcessMissionAudio()
-{
- float dist;
- uint8 emittingVol;
- uint8 pan;
- float distSquared;
- CVector vec;
-
- static uint8 nCheckPlayingDelay = 0;
- static uint8 nFramesUntilFailedLoad = 0;
- static uint8 nFramesForPretendPlaying = 0;
-
- if (m_bIsInitialised) {
- if (m_sMissionAudio.m_nSampleIndex != NO_SAMPLE) {
- switch (m_sMissionAudio.m_nLoadingStatus) {
- case LOADING_STATUS_NOT_LOADED:
- SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1);
- m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED;
- nFramesUntilFailedLoad = 0;
- return;
- case LOADING_STATUS_LOADED:
- if (!m_sMissionAudio.m_bIsPlayed)
- return;
- if (g_bMissionAudioLoadFailed) {
- if (m_bTimerJustReset) {
- ClearMissionAudio();
- SampleManager.StopStreamedFile(1);
- nFramesForPretendPlaying = 0;
- nCheckPlayingDelay = 0;
- nFramesUntilFailedLoad = 0;
- } else if (!m_nUserPause) {
- if (++nFramesForPretendPlaying < 120) {
- m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING;
- } else {
- m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
- m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
- }
- }
- } else {
- if (m_sMissionAudio.m_nPlayStatus) {
- if (m_sMissionAudio.m_nPlayStatus != PLAY_STATUS_PLAYING)
- return;
- if (m_bTimerJustReset) {
- ClearMissionAudio();
- SampleManager.StopStreamedFile(1);
- return;
- }
- if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) {
- if (!m_nUserPause) {
- if (nCheckPlayingDelay) {
- --nCheckPlayingDelay;
- } else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED ||
- m_sMissionAudio.m_nMissionAudioCounter-- == 0) {
- m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
- m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
- SampleManager.StopStreamedFile(1);
- m_sMissionAudio.m_nMissionAudioCounter = 0;
- }
- }
- } else if (m_sMissionAudio.field_22) {
- if (SampleManager.IsStreamPlaying(1) || m_nUserPause || m_nPreviousUserPause) {
- if (m_nUserPause)
- SampleManager.PauseStream(1, 1);
- else
- SampleManager.PauseStream(0, 1);
- } else {
- m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
- m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
- SampleManager.StopStreamedFile(1);
- m_sMissionAudio.m_nMissionAudioCounter = 0;
- }
- } else {
- if (m_nUserPause)
- return;
- if (nCheckPlayingDelay--) {
- if (!SampleManager.IsStreamPlaying(1))
- return;
- nCheckPlayingDelay = 0;
- }
- m_sMissionAudio.field_22 = 1;
- }
- } else {
- if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) {
- SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex);
- } else {
- if (m_nUserPause)
- SampleManager.PauseStream(1, 1);
- if (m_sMissionAudio.m_bPredefinedProperties) {
- SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1);
- } else {
- distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos);
- if (distSquared >= 2500.f) {
- emittingVol = 0;
- pan = 63;
- } else {
- dist = Sqrt(distSquared);
- emittingVol = ComputeVolume(80, 50.0f, dist);
- TranslateEntity(&m_sMissionAudio.m_vecPos, &vec);
- pan = ComputePan(50.f, &vec);
- }
- SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, 1);
- }
- SampleManager.StartPreloadedStreamedFile(1);
- }
- m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING;
- nCheckPlayingDelay = 30;
- }
- }
- break;
- case 2:
- if (++nFramesUntilFailedLoad >= 90) {
- nFramesForPretendPlaying = 0;
- g_bMissionAudioLoadFailed = true;
- nFramesUntilFailedLoad = 0;
- m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED;
- }
- return;
- default:
- return;
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
-{
- CAutomobile *automobile;
- float allowedVelocity;
- int32 emittingVol;
- float velocityChange;
-
- if (params->m_fDistance < 900.f) {
- automobile = (CAutomobile *)params->m_pVehicle;
- if (automobile->bEngineOn) {
- if (automobile->m_nWheelsOnGround) {
- velocityChange = Abs(params->m_fVelocityChange);
- } else {
- if (automobile->m_nDriveWheelsOnGround)
- automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f;
- velocityChange = automobile->m_fGasPedalAudio * params->m_pTransmission->fMaxVelocity;
- }
- if (velocityChange > 0.001f) {
- allowedVelocity = 0.5f * params->m_pTransmission->fMaxVelocity;
- if (velocityChange < allowedVelocity)
- emittingVol = (90.f * velocityChange / allowedVelocity);
- else
- emittingVol = 90;
- if (emittingVol) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 2;
- m_sQueueSample.m_nSampleIndex = SFX_REMOTE_CONTROLLED_CAR;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = (11025.f * velocityChange / params->m_pTransmission->fMaxVelocity + 11025.f);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 3.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessOneShotScriptObject(uint8 sound)
-{
- CPlayerPed *playerPed;
- uint8 emittingVolume;
- float distSquared;
-
- cPedParams male;
- cPedParams female;
-
- static uint8 iSound = 0;
-
- switch (sound) {
- case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S:
- case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L:
- male.m_pPed = nil;
- male.m_bDistanceCalculated = false;
- male.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
- SetupPedComments(&male, SOUND_INJURED_PED_MALE_OUCH);
- return;
- case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S:
- case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L:
- female.m_pPed = nil;
- female.m_bDistanceCalculated = false;
- female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
- SetupPedComments(&female, SOUND_INJURED_PED_FEMALE);
- return;
- case SCRIPT_SOUND_GATE_START_CLUNK:
- case SCRIPT_SOUND_GATE_STOP_CLUNK:
- m_sQueueSample.m_fSoundIntensity = 40.0f;
- m_sQueueSample.m_nSampleIndex = SFX_COL_GATE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- if (sound == SCRIPT_SOUND_GATE_START_CLUNK)
- m_sQueueSample.m_nFrequency = 10600;
- else
- m_sQueueSample.m_nFrequency = 9000;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bRequireReflection = true;
- emittingVolume = RandomDisplacement(10) + 50;
- break;
- case SCRIPT_SOUND_BULLET_HIT_GROUND_1:
- case SCRIPT_SOUND_BULLET_HIT_GROUND_2:
- case SCRIPT_SOUND_BULLET_HIT_GROUND_3:
- m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_nSampleIndex = m_anRandomTable[iSound % 5] % 3 + SFX_BULLET_WALL_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 9;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- emittingVolume = m_anRandomTable[2] % 20 + 90;
- break;
- case SCRIPT_SOUND_110:
- case SCRIPT_SOUND_111:
- if (SampleManager.IsSampleBankLoaded(0) != 1)
- return;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_STATION_ANNOUNCE);
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_bIs2D = false;
- break;
- case SCRIPT_SOUND_PAYPHONE_RINGING:
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- m_sQueueSample.m_nSampleIndex = SFX_PHONE_RING;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 80;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PHONE_RING);
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bRequireReflection = false;
- break;
- case SCRIPT_SOUND_GLASS_BREAK_L:
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 70;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- break;
- case SCRIPT_SOUND_GLASS_BREAK_S:
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 60;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- break;
- case SCRIPT_SOUND_GLASS_CRACK:
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- emittingVolume = 70;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bRequireReflection = true;
- break;
- case SCRIPT_SOUND_GLASS_LIGHT_BREAK:
- m_sQueueSample.m_fSoundIntensity = 55.0f;
- m_sQueueSample.m_nSampleIndex = (m_anRandomTable[4] & 3) + SFX_GLASS_SHARD_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 19000;
- m_sQueueSample.m_nReleasingVolumeModificator = 9;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- emittingVolume = RandomDisplacement(11) + 25;
- break;
- case SCRIPT_SOUND_BOX_DESTROYED_1:
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- m_sQueueSample.m_nSampleIndex = SFX_WOODEN_BOX_SMASH;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bRequireReflection = true;
- emittingVolume = m_anRandomTable[2] % 20 + 80;
- break;
- case SCRIPT_SOUND_BOX_DESTROYED_2:
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- m_sQueueSample.m_nSampleIndex = SFX_CARDBOARD_BOX_SMASH;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bRequireReflection = true;
- emittingVolume = m_anRandomTable[2] % 20 + 80;
- break;
- case SCRIPT_SOUND_METAL_COLLISION:
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 5 + SFX_COL_CAR_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bRequireReflection = true;
- emittingVolume = m_anRandomTable[2] % 30 + 70;
- break;
- case SCRIPT_SOUND_TIRE_COLLISION:
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bRequireReflection = true;
- emittingVolume = m_anRandomTable[2] % 30 + 60;
- break;
- case SCRIPT_SOUND_GUNSHELL_DROP:
- playerPed = FindPlayerPed();
- if (playerPed) {
- switch (playerPed->m_nSurfaceTouched) {
- case SURFACE_GRASS:
- case SURFACE_DIRT:
- case SURFACE_DIRTTRACK:
- case SURFACE_SCAFFOLD:
- case SURFACE_FLESH:
- case SURFACE_SAND:
- case SURFACE_TIRE:
- case SURFACE_HEDGE:
- m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2;
- m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000;
- m_sQueueSample.m_nReleasingVolumeModificator = 18;
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- emittingVolume = m_anRandomTable[2] % 20 + 30;
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = iSound++;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- AddSampleToRequestedQueue();
- }
- }
- return;
- case SURFACE_PUDDLE:
- return;
- default:
- break;
- }
- }
- m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_1;
- m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000;
- m_sQueueSample.m_nReleasingVolumeModificator = 15;
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- emittingVolume = m_anRandomTable[2] % 20 + 30;
- break;
- case SCRIPT_SOUND_GUNSHELL_DROP_SOFT:
- m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2;
- m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000;
- m_sQueueSample.m_nReleasingVolumeModificator = 18;
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_bIs2D = false;
- emittingVolume = m_anRandomTable[2] % 20 + 30;
- break;
- default:
- return;
- }
-
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = iSound++;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nEmittingVolume = emittingVolume;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-void
-cAudioManager::ProcessPed(CPhysical *ped)
-{
- cPedParams params;
-
- params.m_pPed = nil;
- params.m_bDistanceCalculated = false;
- params.m_fDistance = 0.0f;
-
- m_sQueueSample.m_vecPos = ped->GetPosition();
-
- // params.m_bDistanceCalculated = false;
- params.m_pPed = (CPed *)ped;
- params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (ped->GetModelIndex() == MI_FATMALE02)
- ProcessPedHeadphones(&params);
- ProcessPedOneShots(&params);
-}
-
-void
-cAudioManager::ProcessPedHeadphones(cPedParams *params)
-{
- CPed *ped;
- CAutomobile *veh;
- uint8 emittingVol;
-
- if (params->m_fDistance < 49.f) {
- ped = params->m_pPed;
- if (!ped->bIsAimingGun || ped->m_bodyPartBleeding != PED_HEAD) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- if (ped->bInVehicle && ped->m_nPedState == PED_DRIVING) {
- emittingVol = 10;
- veh = (CAutomobile *)ped->m_pMyVehicle;
- if (veh && veh->IsCar()) {
- for (int32 i = 2; i < ARRAY_SIZE(veh->Doors); i++) {
- if (!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) {
- emittingVol = 42;
- break;
- }
- }
- }
- } else {
- emittingVol = 42;
- }
-
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 64;
- m_sQueueSample.m_nSampleIndex = SFX_HEADPHONES;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_HEADPHONES);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = 7.0f;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 5;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- return;
- }
- }
-}
-
-void
-cAudioManager::ProcessPedOneShots(cPedParams *params)
-{
- uint8 emittingVol;
- int32 sampleIndex;
-
- CPed *ped = params->m_pPed;
-
- bool stereo;
- int16 sound;
- bool noReflection;
- CWeapon *weapon;
- float maxDist = 0.f; // uninitialized variable
-
- static uint8 iSound = 21;
-
- weapon = params->m_pPed->GetWeapon();
- for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
- noReflection = false;
- stereo = false;
- m_sQueueSample.m_bRequireReflection = false;
- sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
- 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_DIRT:
- case SURFACE_DIRTTRACK:
- sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
- break;
- case SURFACE_METAL6:
- case SURFACE_METAL_DOOR:
- case SURFACE_BILLBOARD:
- case SURFACE_STEEL:
- case SURFACE_METAL_POLE:
- case SURFACE_STREET_LIGHT:
- case SURFACE_METAL14:
- case SURFACE_METAL15:
- case SURFACE_METAL_FENCE:
- case SURFACE_METAL27:
- case SURFACE_METAL28:
- 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_PUDDLE:
- sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
- break;
- case SURFACE_WOOD:
- case SURFACE_WOOD_BOX:
- case SURFACE_WOOD_PLANK:
- 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 = SAMPLEBANK_MAIN;
- 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;
- }
- 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_PUDDLE) {
- 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 = SAMPLEBANK_MAIN;
- 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;
- m_sQueueSample.m_nFrequency = 18000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_KICK_34:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
- m_sQueueSample.m_nFrequency = 16500;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_HEADBUTT_35:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
- m_sQueueSample.m_nFrequency = 20000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_36:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2;
- m_sQueueSample.m_nFrequency = 18000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_37:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2;
- m_sQueueSample.m_nFrequency = 16500;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_CLOSE_PUNCH_38:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2;
- m_sQueueSample.m_nFrequency = 20000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_39:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4;
- m_sQueueSample.m_nFrequency = 18000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_OR_KICK_BELOW_40:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4;
- m_sQueueSample.m_nFrequency = 16500;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_41:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4;
- m_sQueueSample.m_nFrequency = 20000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_FROM_BEHIND_42:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5;
- m_sQueueSample.m_nFrequency = 18000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_KNEE_OR_KICK_43:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5;
- m_sQueueSample.m_nFrequency = 16500;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_KICK_44:
- m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5;
- m_sQueueSample.m_nFrequency = 20000;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound;
- stereo = true;
- ++iSound;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 26 + 100;
- 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_WEAPON_BAT_ATTACK:
- m_sQueueSample.m_nSampleIndex = SFX_BAT_HIT_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 22000;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- emittingVol = m_anRandomTable[2] % 20 + 100;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- if (m_bDynamicAcousticModelingStatus)
- m_sQueueSample.m_bRequireReflection = true;
- else
- noReflection = true;
- break;
- case SOUND_WEAPON_SHOT_FIRED:
- weapon = &ped->m_weapons[ped->m_currentWeapon];
- switch (weapon->m_eWeaponType) {
- case WEAPONTYPE_COLT45:
- m_sQueueSample.m_nSampleIndex = SFX_COLT45_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COLT45_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 50.0f;
- maxDist = SQR(50);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- emittingVol = m_anRandomTable[1] % 10 + 90;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- if (m_bDynamicAcousticModelingStatus)
- m_sQueueSample.m_bRequireReflection = true;
- else
- noReflection = true;
- break;
- case WEAPONTYPE_UZI:
- m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- maxDist = SQR(80);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[3] % 15 + 70;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- break;
- case WEAPONTYPE_SHOTGUN:
- m_sQueueSample.m_nSampleIndex = SFX_SHOTGUN_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOTGUN_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- maxDist = 3600.f;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- emittingVol = m_anRandomTable[2] % 10 + 100;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- if (m_bDynamicAcousticModelingStatus)
- m_sQueueSample.m_bRequireReflection = true;
- else
- noReflection = true;
- break;
- case WEAPONTYPE_AK47:
- m_sQueueSample.m_nSampleIndex = SFX_AK47_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- maxDist = SQR(80);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[1] % 15 + 70;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- break;
- case WEAPONTYPE_M16:
- m_sQueueSample.m_nSampleIndex = SFX_M16_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- maxDist = SQR(80);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[4] % 15 + 70;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- break;
- case WEAPONTYPE_SNIPERRIFLE:
- m_sQueueSample.m_nSampleIndex = SFX_SNIPER_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SNIPER_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- maxDist = 3600.f;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- emittingVol = m_anRandomTable[4] % 10 + 110;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- if (m_bDynamicAcousticModelingStatus)
- m_sQueueSample.m_bRequireReflection = true;
- else
- noReflection = true;
- break;
- case WEAPONTYPE_ROCKETLAUNCHER:
- m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 90.0f;
- maxDist = 8100.f;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- emittingVol = m_anRandomTable[0] % 20 + 80;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- if (m_bDynamicAcousticModelingStatus)
- m_sQueueSample.m_bRequireReflection = true;
- else
- noReflection = true;
- break;
- case WEAPONTYPE_FLAMETHROWER:
- m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 9;
- emittingVol = 90;
- m_sQueueSample.m_nFrequency = (10 * m_sQueueSample.m_nEntityIndex & 2047) + SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_LEFT);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- maxDist = 3600.f;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nEmittingVolume = 90;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 6;
- if (m_bDynamicAcousticModelingStatus)
- m_sQueueSample.m_bRequireReflection = true;
- else
- noReflection = true;
- break;
- default:
- continue;
- }
-
- break;
- case SOUND_WEAPON_RELOAD:
- weapon = &ped->m_weapons[ped->m_currentWeapon];
- switch (weapon->m_eWeaponType) {
- case WEAPONTYPE_COLT45:
- m_sQueueSample.m_nSampleIndex = SFX_PISTOL_RELOAD;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PISTOL_RELOAD) + RandomDisplacement(300);
- break;
- case WEAPONTYPE_UZI:
- m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD;
- m_sQueueSample.m_nFrequency = 39243;
- break;
- case WEAPONTYPE_SHOTGUN:
- m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
- m_sQueueSample.m_nFrequency = 30290;
- break;
- case WEAPONTYPE_AK47:
- m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_RELOAD);
- break;
- case WEAPONTYPE_M16:
- m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_RELOAD);
- break;
- case WEAPONTYPE_SNIPERRIFLE:
- m_sQueueSample.m_nSampleIndex = SFX_RIFLE_RELOAD;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RIFLE_RELOAD);
- break;
- case WEAPONTYPE_ROCKETLAUNCHER:
- m_sQueueSample.m_nSampleIndex = SFX_ROCKET_RELOAD;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_RELOAD);
- break;
- default:
- continue;
- }
- emittingVol = 75;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency += RandomDisplacement(300);
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_nEmittingVolume = 75;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bRequireReflection = true;
- break;
- case SOUND_WEAPON_AK47_BULLET_ECHO:
- case SOUND_WEAPON_UZI_BULLET_ECHO:
- case SOUND_WEAPON_M16_BULLET_ECHO:
- m_sQueueSample.m_nSampleIndex = SFX_UZI_END_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_END_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- maxDist = SQR(80);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- emittingVol = m_anRandomTable[4] % 10 + 40;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- if (m_bDynamicAcousticModelingStatus)
- m_sQueueSample.m_bRequireReflection = true;
- else
- noReflection = true;
- break;
- case SOUND_WEAPON_FLAMETHROWER_FIRE:
- m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_START_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_START_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = 60.0f;
- maxDist = 3600.f;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- emittingVol = 70;
- m_sQueueSample.m_nEmittingVolume = 70;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- break;
- case SOUND_WEAPON_HIT_PED:
- m_sQueueSample.m_nSampleIndex = SFX_BULLET_PED;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BULLET_PED);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
- m_sQueueSample.m_nReleasingVolumeModificator = 7;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- maxDist = SQR(30);
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[0] % 20 + 90;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- break;
- case SOUND_SPLASH:
- m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iSound++;
- stereo = true;
- m_sQueueSample.m_nFrequency = RandomDisplacement(1400) + 20000;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 40.0f;
- maxDist = 1600.f;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nLoopStart = 0;
- emittingVol = m_anRandomTable[2] % 30 + 70;
- 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;
- default:
- SetupPedComments(params, sound);
- continue;
- }
-
- if (stereo && iSound > 60)
- iSound = 21;
- if (params->m_fDistance < maxDist) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- if (noReflection) {
- if (0.2f * m_sQueueSample.m_fSoundIntensity <= m_sQueueSample.m_fDistance) {
- noReflection = 0;
- } else {
- m_sQueueSample.m_bIs2D = true;
- m_sQueueSample.m_nOffset = 0;
- }
- }
- m_sQueueSample.m_bReverbFlag = true;
- AddSampleToRequestedQueue();
- if (noReflection) {
- m_sQueueSample.m_nOffset = 127;
- ++m_sQueueSample.m_nSampleIndex;
- if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] != SOUND_WEAPON_SHOT_FIRED ||
- weapon->m_eWeaponType != WEAPONTYPE_FLAMETHROWER) {
- m_sQueueSample.m_nCounter = iSound++;
- if (iSound > 60)
- iSound = 21;
- } else {
- ++m_sQueueSample.m_nCounter;
- }
- AddSampleToRequestedQueue();
- }
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessPhysical(int32 id)
-{
- CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity;
- if (entity) {
- switch (entity->GetType()) {
- case ENTITY_TYPE_VEHICLE:
- ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity);
- break;
- case ENTITY_TYPE_PED:
- ProcessPed((CPhysical *)m_asAudioEntities[id].m_pEntity);
- break;
- default:
- return;
- }
- }
-}
-
-void
-cAudioManager::ProcessPlane(cVehicleParams *params)
-{
- switch (params->m_nIndex) {
- case AIRTRAIN:
- ProcessJumbo(params);
- break;
- case DEADDODO:
- ProcessCesna(params);
- break;
- default:
- debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex());
- break;
- }
-}
-
-struct tVehicleSampleData {
- eSfxSample m_nAccelerationSampleIndex;
- uint8 m_bEngineSoundType;
- eSfxSample m_nHornSample;
- int32 m_nHornFrequency;
- uint8 m_nSirenOrAlarmSample;
- int32 m_nSirenOrAlarmFrequency;
- uint8 m_bDoorType;
-};
-
-const tVehicleSampleData aVehicleSettings[70] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, 1},
- {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 2},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_ALARM_1, 8941, 0},
- {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_ALARM_1, 11922, 1},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 7948, 2},
- {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, 2},
- {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_ALARM_1, 8941, 2},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_ALARM_1, 12220, 1},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_3, 3, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_ALARM_1, 9935, 1},
- {SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_ALARM_1, 12200, 1},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, 1},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, 2},
- {SFX_CAR_REV_3, 3, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 13600, 1},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, 2},
- {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, 1},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_ALARM_1, 8000, 1},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_2, 2, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_ALARM_1, 8543, 1},
- {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_ALARM_1, 9935, 1},
- {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, 1},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, 0},
- {SFX_CAR_REV_7, 7, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 10000, 0},
- {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, 1},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, 2},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 9935, 2},
- {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_ALARM_1, 10123, 1},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, 0},
- {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_ALARM_1, 10554, 3},
- {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 8000, 2},
- {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, 2},
- {SFX_CAR_REV_1, 0, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 3},
- {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CESNA_IDLE, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS, 16291, SFX_CAR_ALARM_1, 7500, 3},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_ALARM_1, 8935, 0},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 8935, 0},
- {SFX_CAR_REV_1, 0, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_ALARM_1, 17000, 0},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_ALARM_1, 9935, 1},
- {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_ALARM_1, 9935, 1},
- {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_ALARM_1, 9935, 1},
- {SFX_CAR_REV_7, 7, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_7, 7, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 2},
- {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9000, 0},
- {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, 2},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, 2},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, 1},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
- {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}};
-
-void
-cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile)
-{
- static int32 GearFreqAdj[] = {6000, 6000, 3400, 1200, 0, -1000};
-
- cTransmission *transmission;
- float velocityChange;
- float relativeVelocityChange;
- float accelerationMultipler;
- uint8 wheelInUseCounter;
- float time;
- int baseFreq;
- uint8 vol;
- int gearNr;
- int32 freq;
-
- int freqModifier;
- int soundOffset;
- uint8 engineSoundType;
- int32 accelerateState;
- bool channelUsed;
- char lostTraction;
- bool processedAccelSampleStopped;
- uint8 currentGear;
- float gasPedalAudio;
- CVector pos;
-
- static int16 LastAccel = 0;
- static int16 LastBrake = 0;
- static uint8 CurrentPretendGear = 1;
- static bool bLostTractionLastFrame = false;
- static bool bHandbrakeOnLastFrame = 0;
- static int32 nCruising = 0;
- static bool bAccelSampleStopped = true;
-
- lostTraction = 0;
- processedAccelSampleStopped = 0;
- if (bPlayerJustEnteredCar) {
- bAccelSampleStopped = true;
- bPlayerJustEnteredCar = false;
- nCruising = 0;
- LastAccel = 0;
- bLostTractionLastFrame = false;
- LastBrake = 0;
- bHandbrakeOnLastFrame = 0;
- CurrentPretendGear = 1;
- }
- if (CReplay::IsPlayingBack()) {
- accelerateState = 255.f * Max(0.0f, Min(1.0f, automobile->m_fGasPedal));
- } else {
- accelerateState = Pads->GetAccelerate();
- }
- channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples);
- transmission = params->m_pTransmission;
- velocityChange = params->m_fVelocityChange;
- relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
-
- accelerationMultipler = Min(Min(1.f, relativeVelocityChange), 0.f);
- gasPedalAudio = accelerationMultipler;
- currentGear = params->m_pVehicle->m_nCurrentGear;
-
- if (transmission->nDriveType == '4') {
- wheelInUseCounter = 0;
- for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
- if (automobile->m_aWheelState[i])
- ++wheelInUseCounter;
- }
- if (wheelInUseCounter > 2)
- lostTraction = 1;
- } else if (transmission->nDriveType == 'F') {
- if ((automobile->m_aWheelState[0] || automobile->m_aWheelState[2]) && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) {
- lostTraction = 1;
- }
- } else if (transmission->nDriveType == 'R' && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) {
- lostTraction = 1;
- }
- if (0.0f != velocityChange) {
- time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange;
- if (time <= 0.0f) {
- freqModifier = Max(-0.2f, time) * -15000.f;
- } else {
- freqModifier = -(Min(0.2f, time) * 15000.f);
- }
- if (params->m_fVelocityChange < -0.001f)
- freqModifier = -freqModifier;
- } else {
- freqModifier = 0;
- }
- engineSoundType = aVehicleSettings[params->m_nIndex].m_bEngineSoundType;
- soundOffset = 3 * (engineSoundType - 1);
- if (accelerateState <= 0) {
- if (params->m_fVelocityChange < -0.001f) {
- if (channelUsed) {
- SampleManager.StopChannel(m_nActiveSamples);
- bAccelSampleStopped = true;
- }
- if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) {
- gasPedalAudio = automobile->m_fGasPedalAudio;
- } else {
- gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity);
- }
- gasPedalAudio = Max(0.0f, gasPedalAudio);
- automobile->m_fGasPedalAudio = gasPedalAudio;
- } else if (LastAccel > 0) {
- if (channelUsed) {
- SampleManager.StopChannel(m_nActiveSamples);
- bAccelSampleStopped = true;
- }
- nCruising = 0;
- if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction ||
- params->m_fVelocityChange >= 0.01f && automobile->m_fGasPedalAudio > 0.2f) {
- automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f;
- gasPedalAudio = automobile->m_fGasPedalAudio;
- }
- if (gasPedalAudio > 0.05f) {
- freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000;
- if (engineSoundType == 6)
- freq /= 2;
- AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63, 0);
- }
- }
- freq = (10000.f * gasPedalAudio) + 22050;
- if (engineSoundType == 6)
- freq /= 2;
- AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType + SFX_CAR_REV_10), 0, 52, 1);
-
- CurrentPretendGear = Max(1, currentGear);
- LastAccel = accelerateState;
-
- bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
- bLostTractionLastFrame = lostTraction;
- return;
- }
- if (!nCruising) {
- if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction ||
- currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs
- if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) {
- if (!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround ||
- (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround) {
- automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f;
- }
- freqModifier = 0;
- baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000;
- vol = (25.0f * automobile->m_fGasPedalAudio) + 60;
- } else {
- baseFreq = (8000.f * accelerationMultipler) + 16000;
- vol = (25.0f * accelerationMultipler) + 60;
- automobile->m_fGasPedalAudio = accelerationMultipler;
- }
- freq = freqModifier + baseFreq;
- if (engineSoundType == 6)
- freq /= 2;
- if (channelUsed) {
- SampleManager.StopChannel(m_nActiveSamples);
- bAccelSampleStopped = true;
- }
- AddPlayerCarSample(vol, freq, (engineSoundType + SFX_PHONE_RING), 0, 2, 1);
- LastAccel = accelerateState;
-
- bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
- bLostTractionLastFrame = lostTraction;
- return;
- }
- TranslateEntity(&m_sQueueSample.m_vecPos, &pos);
- if (bAccelSampleStopped) {
- if (CurrentPretendGear != 1 || currentGear != 2) {
- gearNr = currentGear - 1;
- if (gearNr < 1)
- gearNr = 1;
- CurrentPretendGear = gearNr;
- }
- processedAccelSampleStopped = 1;
- bAccelSampleStopped = false;
- }
- if (channelUsed) {
- SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85);
- SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z);
- SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f);
- if (engineSoundType == 6)
- freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) / 2;
- else
- freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
- SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
- if (!channelUsed) {
- SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0);
- SampleManager.StartChannel(m_nActiveSamples);
- }
- LastAccel = accelerateState;
-
- bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
- bLostTractionLastFrame = lostTraction;
- return;
- }
- if (processedAccelSampleStopped) {
- if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + 345, 0))
- return;
- SampleManager.SetChannelLoopCount(m_nActiveSamples, 1);
- SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1);
- SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85);
- SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z);
- SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f);
- freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
- if (engineSoundType == 6)
- freq /= 2;
- SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
- if (!channelUsed) {
- SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0);
- SampleManager.StartChannel(m_nActiveSamples);
- }
- LastAccel = accelerateState;
-
- bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
- bLostTractionLastFrame = lostTraction;
- return;
- }
- if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) {
- ++CurrentPretendGear;
- if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + 345, 0))
- return;
- SampleManager.SetChannelLoopCount(m_nActiveSamples, 1);
- SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1);
- SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85);
- SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z);
- SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f);
- freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
- if (engineSoundType == 6)
- freq /= 2;
- SampleManager.SetChannelFrequency(m_nActiveSamples, freq);
- if (!channelUsed) {
- SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0);
- SampleManager.StartChannel(m_nActiveSamples);
- }
- LastAccel = accelerateState;
-
- bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
- bLostTractionLastFrame = lostTraction;
- return;
- }
- nCruising = 1;
- }
- bAccelSampleStopped = true;
- if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction ||
- currentGear < params->m_pTransmission->nNumberOfGears - 1) {
- nCruising = 0;
- } else {
- if (accelerateState >= 220 && 0.001f + params->m_fVelocityChange < automobile->m_fVelocityChangeForAudio) {
- if (nCruising < 800)
- ++nCruising;
- } else if (nCruising > 3) {
- --nCruising;
- }
- freq = 27 * nCruising + freqModifier + 22050;
- if (engineSoundType == 6)
- freq /= 2;
- AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, 1);
- }
- LastAccel = accelerateState;
-
- bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
- bLostTractionLastFrame = lostTraction;
-}
-
-void
-cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound)
-{
- uint32 time = CTimer::GetTimeInMilliseconds();
- int32 sampleIndex;
- uint8 emittingVol;
- float distSquared;
- cPedParams params;
-
- static uint8 counter = 0;
-
- if (time > gCellNextTime) {
- switch (sound) {
- case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS;
- break;
- case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL;
- break;
- default:
- return;
- }
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- if (m_FrameCounter & 1)
- sampleIndex = (m_anRandomTable[1] & 3) + SFX_FIGHT_1;
- else
- sampleIndex = (m_anRandomTable[3] & 1) + SFX_BAT_HIT_LEFT;
- m_sQueueSample.m_nSampleIndex = sampleIndex;
- emittingVol = m_anRandomTable[0] % 50 + 55;
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nCounter = counter++;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- params.m_bDistanceCalculated = true;
- params.m_fDistance = distSquared;
- params.m_pPed = nil;
- SetupPedComments(&params, SOUND_INJURED_PED_MALE_PRISON);
- }
- gCellNextTime = time + 500 + m_anRandomTable[3] % 1500;
- }
- }
-}
-
-void
-cAudioManager::ProcessPornCinema(uint8 sound)
-{
-
- eSfxSample sample;
- uint32 time;
- int32 rand;
- float distSquared;
-
- switch (sound) {
- case SCRIPT_SOUND_PORN_CINEMA_1_S:
- case SCRIPT_SOUND_MISTY_SEX_S:
- m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- sample = SFX_PORN_1_GROAN_1;
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- break;
- case SCRIPT_SOUND_PORN_CINEMA_1_L:
- case SCRIPT_SOUND_MISTY_SEX_L:
- m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- sample = SFX_PORN_1_GROAN_1;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- break;
- case SCRIPT_SOUND_PORN_CINEMA_2_S:
- m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- sample = SFX_PORN_2_GROAN_1;
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- break;
- case SCRIPT_SOUND_PORN_CINEMA_2_L:
- m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- sample = SFX_PORN_2_GROAN_1;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- break;
- case SCRIPT_SOUND_PORN_CINEMA_3_S:
- m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- sample = SFX_PORN_3_GROAN_1;
- break;
- case SCRIPT_SOUND_PORN_CINEMA_3_L:
- m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_fSoundIntensity = 80.0f;
- sample = SFX_PORN_3_GROAN_1;
- break;
- default:
- return;
- }
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) {
- m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = maxVolume;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
-
- time = CTimer::GetTimeInMilliseconds();
- if (time > gPornNextTime) {
- m_sQueueSample.m_nVolume = ComputeVolume(90, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- rand = m_anRandomTable[1] & 1;
- m_sQueueSample.m_nSampleIndex = rand + sample;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nCounter = rand + 1;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 6;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- gPornNextTime = time + 2000 + m_anRandomTable[3] % 6000;
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessProjectiles()
-{
- uint8 emittingVol;
-
- for (int32 i = 0; i < NUM_PROJECTILES; i++) {
- if (CProjectileInfo::GetProjectileInfo(i)->m_bInUse) {
- switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) {
- case WEAPONTYPE_ROCKETLAUNCHER:
- emittingVol = maxVolume;
- m_sQueueSample.m_fSoundIntensity = rocketLauncherIntensity;
- m_sQueueSample.m_nSampleIndex = SFX_ROCKET_FLY;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_FLY);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- break;
- case WEAPONTYPE_MOLOTOV:
- emittingVol = molotovVolume;
- m_sQueueSample.m_fSoundIntensity = molotovIntensity;
- m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = 32 * SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE) / 25;
- m_sQueueSample.m_nReleasingVolumeModificator = 7;
- break;
- default:
- return;
- }
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition();
- float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = i;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
-{
- if (params->m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
- CVehicle *veh = params->m_pVehicle;
- ++veh->m_bRainAudioCounter;
- if (veh->m_bRainAudioCounter >= 2) {
- veh->m_bRainAudioCounter = 0;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- float emittingVol = 30.f * CWeather::Rain;
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++;
- if (veh->m_bRainSamplesCounter > 4)
- veh->m_bRainSamplesCounter = 68;
- m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_CAR_RAIN_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 9;
- m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = (uint8)emittingVol;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = rainOnVehicleIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bReverbFlag = false;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessReverb() const
-{
- if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
- for (uint32 i = 0; i <
-#ifdef FIX_BUGS
- channels
-#else
- 28
-#endif
- ;
- i++) {
- if (m_asActiveSamples[i].m_bReverbFlag)
- SampleManager.SetChannelReverbFlag(i, 1);
- }
- }
-}
-
-bool
-cAudioManager::ProcessReverseGear(cVehicleParams *params)
-{
- CVehicle *veh;
- CAutomobile *automobile;
- int32 emittingVol;
- float modificator;
-
- if (params->m_fDistance >= SQR(reverseGearIntensity))
- return false;
- veh = params->m_pVehicle;
- if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || !veh->m_nCurrentGear)) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- automobile = (CAutomobile *)params->m_pVehicle;
- if (automobile->m_nWheelsOnGround) {
- modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity;
- } else {
- if (automobile->m_nDriveWheelsOnGround)
- automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f;
- modificator = automobile->m_fGasPedalAudio;
- }
- modificator = Abs(modificator);
- emittingVol = (24.f * modificator);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- if (params->m_pVehicle->m_fGasPedal >= 0.0f) {
- m_sQueueSample.m_nCounter = 62;
- m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2;
- } else {
- m_sQueueSample.m_nCounter = 61;
- m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR;
- }
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nFrequency = (6000.f * modificator) + 7000;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 3.0f;
- m_sQueueSample.m_fSoundIntensity = reverseGearIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 5;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- return true;
-}
-
-void
-cAudioManager::ProcessSawMillScriptObject(uint8 sound)
-{
- uint32 time;
- float distSquared;
-
- switch (sound) {
- case SCRIPT_SOUND_SAWMILL_LOOP_S:
- case SCRIPT_SOUND_SAWMILL_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS;
- break;
- default:
- return;
- }
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP);
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = 30;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- time = CTimer::GetTimeInMilliseconds();
- if (time > gSawMillNextTime) {
- m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_CUT_WOOD;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nCounter = 1;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- gSawMillNextTime = time + 2000 + m_anRandomTable[3] % 4000;
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessScriptObject(int32 id)
-{
- cAudioScriptObject *entity = (cAudioScriptObject *)m_asAudioEntities[id].m_pEntity;
- if (entity) {
- m_sQueueSample.m_vecPos = entity->Posn;
- if (m_asAudioEntities[id].m_AudioEvents == 1)
- ProcessOneShotScriptObject(m_asAudioEntities[id].m_awAudioEvent[0]);
- else
- ProcessLoopingScriptObject(entity->AudioId);
- }
-}
-
-void
-cAudioManager::ProcessShopScriptObject(uint8 sound)
-{
- uint32 time;
- int32 rand;
- float distSquared;
-
- switch (sound) {
- case SCRIPT_SOUND_SHOP_LOOP_S:
- case SCRIPT_SOUND_SHOP_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- break;
- default:
- return;
- }
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP);
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = 30;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- time = CTimer::GetTimeInMilliseconds();
- if (time > gShopNextTime) {
- m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- rand = m_anRandomTable[1] & 1;
- m_sQueueSample.m_nSampleIndex = rand + SFX_SHOP_TILL_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nCounter = rand + 1;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = 70;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- gShopNextTime = time + 3000 + m_anRandomTable[3] % 7000;
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessSpecial()
-{
- if (m_nUserPause) {
- if (!m_nPreviousUserPause) {
- MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND);
- SampleManager.SetEffectsFadeVolume(maxVolume);
- SampleManager.SetMusicFadeVolume(maxVolume);
- }
- } else {
- if (m_nPreviousUserPause) {
- MusicManager.StopFrontEndTrack();
- MusicManager.ChangeMusicMode(MUSICMODE_GAME);
- }
- CPlayerPed *playerPed = FindPlayerPed();
- if (playerPed) {
- const PedState &state = playerPed->m_nPedState;
- if (state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle)
- SampleManager.StopChannel(m_nActiveSamples);
- }
- }
-}
-
-bool
-cAudioManager::ProcessTrainNoise(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 300.0f;
-
- CTrain *train;
- uint8 emittingVol;
- float speedMultipler;
-
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
- return false;
-
- if (params->m_fVelocityChange > 0.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- train = (CTrain *)params->m_pVehicle;
- speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f);
- emittingVol = (75.f * speedMultipler);
- if (train->m_fWagonPosition == 0.0f) {
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
- m_sQueueSample.m_nCounter = 32;
- m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_FAR);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 3.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- const float SOUND_INTENSITY = 70.0f;
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
- m_sQueueSample.m_nCounter = 33;
- m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 6.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
- return true;
-}
-
-void
-cAudioManager::ProcessVehicle(CVehicle *veh)
-{
- tHandlingData *handling = veh->pHandling;
- float velChange;
- cVehicleParams params;
- m_sQueueSample.m_vecPos = veh->GetPosition();
-
- params.m_bDistanceCalculated = false;
- params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
- params.m_pVehicle = veh;
- params.m_pTransmission = nil;
- params.m_nIndex = 0;
- params.m_fVelocityChange = 0.0f;
-
- if (handling)
- params.m_pTransmission = &handling->Transmission;
-
- params.m_nIndex = veh->GetModelIndex() - MI_FIRST_VEHICLE;
- if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE)
- velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f;
- else
- velChange = DotProduct(params.m_pVehicle->m_vecMoveSpeed, params.m_pVehicle->GetForward());
- params.m_fVelocityChange = velChange;
- switch (params.m_pVehicle->m_vehType) {
- case VEHICLE_TYPE_CAR:
- UpdateGasPedalAudio((CAutomobile *)veh);
- if (params.m_nIndex == RCBANDIT) {
- ProcessModelCarEngine(&params);
- ProcessVehicleOneShots(&params);
- ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
- ProcessRainOnVehicle(&params);
- break;
- }
- if (params.m_nIndex == DODO) {
- if (!ProcessVehicleRoadNoise(&params)) {
- ProcessVehicleOneShots(&params);
- ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
- ProcessRainOnVehicle(&params);
- break;
- }
- if (CWeather::WetRoads > 0.f)
- ProcessWetRoadNoise(&params);
- ProcessVehicleSkidding(&params);
- } else {
- if (!ProcessVehicleRoadNoise(&params)) {
- ProcessVehicleOneShots(&params);
- ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
- ProcessRainOnVehicle(&params);
- break;
- }
- ProcessReverseGear(&params);
- if (CWeather::WetRoads > 0.f)
- ProcessWetRoadNoise(&params);
- ProcessVehicleSkidding(&params);
- ProcessVehicleHorn(&params);
- ProcessVehicleSirenOrAlarm(&params);
- if (UsesReverseWarning(params.m_nIndex))
- ProcessVehicleReverseWarning(&params);
- if (HasAirBrakes(params.m_nIndex))
- ProcessAirBrakes(&params);
- }
- ProcessCarBombTick(&params);
- ProcessVehicleEngine(&params);
- ProcessEngineDamage(&params);
- ProcessVehicleDoors(&params);
- ProcessVehicleOneShots(&params);
- ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
- ProcessRainOnVehicle(&params);
- break;
- case VEHICLE_TYPE_BOAT:
- ProcessBoatEngine(&params);
- ProcessBoatMovingOverWater(&params);
- ProcessVehicleOneShots(&params);
- ProcessRainOnVehicle(&params);
- break;
- case VEHICLE_TYPE_TRAIN:
- ProcessTrainNoise(&params);
- ProcessVehicleOneShots(&params);
- ProcessRainOnVehicle(&params);
- break;
- case VEHICLE_TYPE_HELI:
- ProcessHelicopter(&params);
- ProcessVehicleOneShots(&params);
- ProcessRainOnVehicle(&params);
- break;
- case VEHICLE_TYPE_PLANE:
- ProcessPlane(&params);
- ProcessVehicleOneShots(&params);
- ProcessRainOnVehicle(&params);
- break;
- default:
- ProcessRainOnVehicle(&params);
- break;
- }
-}
-
-bool
-cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 40.0f;
-
- CAutomobile *automobile;
- int8 doorState;
- int32 emittingVol;
- float velocity;
-
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
- return false;
-
- automobile = (CAutomobile *)params->m_pVehicle;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) {
- if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) {
- doorState = automobile->Doors[i].m_nDoorState;
- if (doorState == DOOR_STATUS_SMASHED || doorState == DOOR_STATUS_SWINGING) {
- velocity = Min(0.3f, Abs(automobile->Doors[i].m_fAngVel));
- if (velocity > 0.0035f) {
- emittingVol = (100.f * velocity * 10.f / 3.f);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = i + 6;
- m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000);
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 10;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_fSpeedMultiplier = 1.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = true;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
- }
- return true;
-}
-
void
-cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 50.0f;
-
- CVehicle *playerVeh;
- CVehicle *veh;
- CAutomobile *automobile;
- float relativeGearChange;
- float relativeChange;
- uint8 volume;
- int32 freq = 0; // uinitialized variable
- uint8 emittingVol;
- cTransmission *transmission;
- uint8 currentGear;
- float modificator;
- float traction = 0.f;
-
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
- playerVeh = FindPlayerVehicle();
- veh = params->m_pVehicle;
- if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) {
- SampleManager.StopChannel(m_nActiveSamples);
- return;
- }
- if (veh->bEngineOn) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- automobile = (CAutomobile *)params->m_pVehicle;
- if (params->m_nIndex == DODO) {
- ProcessCesna(params);
- return;
- }
- if (FindPlayerVehicle() == veh) {
- ProcessPlayersVehicleEngine(params, automobile);
- return;
- }
- transmission = params->m_pTransmission;
- if (transmission) {
- currentGear = params->m_pVehicle->m_nCurrentGear;
- if (automobile->m_nWheelsOnGround) {
- if (automobile->bIsHandbrakeOn) {
- if (params->m_fVelocityChange == 0.0f)
- traction = 0.9f;
- } else if (params->m_pVehicle->GetStatus() == STATUS_SIMPLE) {
- traction = 0.0f;
- } else {
- switch (transmission->nDriveType) {
- case '4':
- for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
- if (automobile->m_aWheelState[i] == WHEEL_STATE_SPINNING)
- traction += 0.05f;
- }
- break;
- case 'F':
- if (automobile->m_aWheelState[0] == WHEEL_STATE_SPINNING)
- traction += 0.1f;
- if (automobile->m_aWheelState[2] == WHEEL_STATE_SPINNING)
- traction += 0.1f;
- break;
- case 'R':
- if (automobile->m_aWheelState[1] == WHEEL_STATE_SPINNING)
- traction += 0.1f;
- if (automobile->m_aWheelState[3] == WHEEL_STATE_SPINNING)
- traction += 0.1f;
- break;
- }
- }
- if (transmission->fMaxVelocity <= 0.f) {
- relativeChange = 0.f;
- } else if (currentGear) {
- relativeGearChange =
- Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f);
- if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE &&
- params->m_fVelocityChange >= transmission->Gears[1].fShiftUpVelocity) {
- traction = 0.7f;
- }
- relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange;
- } else
- relativeChange =
- Min(1.0f, 1.0f - Abs((params->m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity));
- } else {
- if (automobile->m_nDriveWheelsOnGround)
- automobile->m_fGasPedalAudio *= 0.4f;
- relativeChange = automobile->m_fGasPedalAudio;
- }
- modificator = relativeChange;
- if (currentGear || !automobile->m_nWheelsOnGround)
- freq = 1200 * currentGear + 18000.f * modificator + 14000;
- else
- freq = 13000.f * modificator + 14000;
- if (modificator >= 0.75f) {
- emittingVol = 120;
- volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- } else {
- emittingVol = modificator * 4.0f / 3.0f * 40.f + 80.f;
- volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- }
- } else {
- modificator = 0.f;
- emittingVol = 80;
- volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- }
- m_sQueueSample.m_nVolume = volume;
- if (m_sQueueSample.m_nVolume) {
- if (automobile->GetStatus() == STATUS_SIMPLE) {
- if (modificator < 0.02f) {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1;
- freq = modificator * 10000 + 22050;
- m_sQueueSample.m_nCounter = 52;
- } else {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex;
- m_sQueueSample.m_nCounter = 2;
- }
- } else {
- if (automobile->m_fGasPedal < 0.05f) {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1;
- freq = modificator * 10000 + 22050;
- m_sQueueSample.m_nCounter = 52;
- } else {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex;
- m_sQueueSample.m_nCounter = 2;
- }
- }
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_nFrequency = freq + 100 * m_sQueueSample.m_nEntityIndex % 1000;
- if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6)
- m_sQueueSample.m_nFrequency /= 2;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 6.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 8;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 40.0f;
-
- CAutomobile *automobile;
-
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
- automobile = (CAutomobile *)params->m_pVehicle;
- if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) {
- if (automobile->m_nCarHornTimer) {
- if (params->m_pVehicle->GetStatus() != STATUS_PLAYER) {
- automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer);
- if (automobile->m_nCarHornTimer == 44)
- automobile->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7;
- if (!hornPatternsArray[automobile->m_nCarHornPattern][44 - automobile->m_nCarHornTimer])
- return;
- }
-
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 4;
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nHornSample;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nHornFrequency;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 80;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 5.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
-{
- int16 event;
- uint8 emittingVol;
- float relVol;
- float vol;
- bool noReflections;
- float maxDist;
- cPedParams pedParams;
-
- static uint8 WaveIndex = 41;
- static uint8 GunIndex = 53;
- static uint8 iWheelIndex = 82;
- static uint8 CrunchOffset = 0;
-
- for (int i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
- noReflections = 0;
- m_sQueueSample.m_bRequireReflection = false;
- event = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
- switch (event) {
- case SOUND_CAR_DOOR_CLOSE_BONNET:
- case SOUND_CAR_DOOR_CLOSE_BUMPER:
- case SOUND_CAR_DOOR_CLOSE_FRONT_LEFT:
- case SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT:
- case SOUND_CAR_DOOR_CLOSE_BACK_LEFT:
- case SOUND_CAR_DOOR_CLOSE_BACK_RIGHT:
- {
- const float SOUND_INTENSITY = 50.0f;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[2] % 5 + 122;
- switch (aVehicleSettings[params->m_nIndex].m_bDoorType) {
- case 0:
- m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_CLOSE;
- break;
- case 2:
- m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_CLOSE;
- break;
- case 3:
- m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
- break;
- default:
- m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE;
- break;
- }
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 22;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = true;
- break;
- }
- case SOUND_CAR_DOOR_OPEN_BONNET:
- case SOUND_CAR_DOOR_OPEN_BUMPER:
- case SOUND_CAR_DOOR_OPEN_FRONT_LEFT:
- case SOUND_CAR_DOOR_OPEN_FRONT_RIGHT:
- case SOUND_CAR_DOOR_OPEN_BACK_LEFT:
- case SOUND_CAR_DOOR_OPEN_BACK_RIGHT:
- {
- const float SOUND_INTENSITY = 50.0f;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[1] % 10 + 117;
- switch (aVehicleSettings[params->m_nIndex].m_bDoorType) {
- case 0:
- m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_OPEN;
- break;
- case 2:
- m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_OPEN;
- break;
- case 3:
- m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
- break;
- default:
- m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_OPEN;
- break;
- }
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 10;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = true;
- break;
- }
- case SOUND_CAR_WINDSHIELD_CRACK:
- {
- const float SOUND_INTENSITY = 30.0f;
- maxDist = SQR(SOUND_INTENSITY);
- m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 68;
- emittingVol = m_anRandomTable[1] % 30 + 60;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK);
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- } break;
- case SOUND_CAR_JUMP:
- {
- const float SOUND_INTENSITY = 35.0f;
- emittingVol = Max(80.f, 2 * (100.f * m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]));
- maxDist = SQR(SOUND_INTENSITY);
- m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = iWheelIndex++;
- if (iWheelIndex > 85)
- iWheelIndex = 82;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- if (params->m_nIndex == 41) {
- m_sQueueSample.m_nFrequency *= 2;
- emittingVol /= 2;
- }
- m_sQueueSample.m_nReleasingVolumeModificator = 6;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- break;
- }
- case SOUND_CAR_ENGINE_START:
- {
- const float SOUND_INTENSITY = 40.0f;
- emittingVol = 60;
- maxDist = SQR(SOUND_INTENSITY);
- m_sQueueSample.m_nSampleIndex = SFX_CAR_STARTER;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 33;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_STARTER);
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = true;
- break;
- }
- case SOUND_CAR_LIGHT_BREAK:
- {
- const float SOUND_INTENSITY = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_GLASS_SHARD_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 37;
- m_sQueueSample.m_nFrequency = 9 * SampleManager.GetSampleBaseFrequency(SFX_GLASS_SHARD_1) / 10;
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[4] % 10 + 30;
- break;
- }
- case SOUND_CAR_HYDRAULIC_1:
- case SOUND_CAR_HYDRAULIC_2:
- {
- const float SOUND_INTENSITY = 35.0f;
- if (event == MOONBEAM) // todo check
- m_sQueueSample.m_nFrequency = 15600;
- else
- m_sQueueSample.m_nFrequency = 13118;
- m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_FAST_MOVE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 51;
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[0] % 15 + 55;
- break;
- }
- case SOUND_CAR_HYDRAULIC_3:
- {
- const float SOUND_INTENSITY = 35.0f;
- m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_SLOW_MOVE_LOOP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 86;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SUSPENSION_SLOW_MOVE_LOOP);
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_nReleasingVolumeDivider = 7;
- noReflections = true;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[0] % 15 + 55;
- break;
- }
- case SOUND_CAR_JERK:
- {
- const float SOUND_INTENSITY = 35.0f;
- m_sQueueSample.m_nSampleIndex = SFX_SHAG_SUSPENSION;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 87;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHAG_SUSPENSION);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8);
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[1] % 15 + 55;
- break;
- }
- case SOUND_CAR_SPLASH:
- {
- const float SOUND_INTENSITY = 40.0f;
- vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
- if (vol <= 300.f)
- continue;
- if (vol > 1200.f)
- m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] = 1200.0f;
- relVol = (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] - 300.f) / 900.f;
- m_sQueueSample.m_nSampleIndex = (m_anRandomTable[0] & 1) + SFX_BOAT_SPLASH_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = WaveIndex++;
- if (WaveIndex > 46)
- WaveIndex = 41;
- m_sQueueSample.m_nFrequency = (7000.f * relVol) + 6000;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- emittingVol = (55.f * relVol);
- maxDist = SQR(SOUND_INTENSITY);
- break;
- }
- case SOUND_17:
- {
- const float SOUND_INTENSITY = 50.0f;
- m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_THUMB_OFF;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 47;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BOAT_THUMB_OFF) + RandomDisplacement(600);
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- emittingVol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
- maxDist = SQR(SOUND_INTENSITY);
- break;
- }
- case SOUND_18:
- case SOUND_19:
- {
- const float SOUND_INTENSITY = 35.0f;
- m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 59;
- m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 11025;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 5.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[1] % 20 + 70;
- break;
- }
- case SOUND_CAR_TANK_TURRET_ROTATE:
- {
- const float SOUND_INTENSITY = 40.0f;
- vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
- if (vol > 96.0f / 2500.0f)
- vol = 96.0f / 2500.0f;
- m_sQueueSample.m_nSampleIndex = SFX_TANK_TURRET;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 79;
- m_sQueueSample.m_nFrequency = (3000.f * vol * 2500.0f / 96.0f) + 9000;
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- emittingVol = (37.f * vol * 2500.0f / 96.0f) + 90;
- maxDist = SQR(SOUND_INTENSITY);
- noReflections = true;
- break;
- }
- case SOUND_CAR_BOMB_TICK:
- {
- const float SOUND_INTENSITY = 30.0f;
- m_sQueueSample.m_nSampleIndex = SFX_BOMB_BEEP;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 80;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BOMB_BEEP);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- m_sQueueSample.m_bRequireReflection = true;
- emittingVol = 60;
- break;
- }
- case SOUND_PLANE_ON_GROUND:
- {
- const float SOUND_INTENSITY = 180.0f;
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_LAND_WHEELS;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 81;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_LAND_WHEELS);
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[4] % 25 + 75;
- break;
- }
- case SOUND_WEAPON_SHOT_FIRED:
- {
- const float SOUND_INTENSITY = 120.0f;
- emittingVol = m_anRandomTable[2];
- maxDist = SQR(SOUND_INTENSITY);
- m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = GunIndex++;
- emittingVol = emittingVol % 15 + 65;
- if (GunIndex > 58)
- GunIndex = 53;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- break;
- }
- case SOUND_WEAPON_HIT_VEHICLE:
- {
- const float SOUND_INTENSITY = 40.0f;
- m_sQueueSample.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex % ARRAY_SIZE(m_anRandomTable)] % 6 + SFX_BULLET_CAR_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 34;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
- m_sQueueSample.m_nReleasingVolumeModificator = 7;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[3] % 20 + 90;
- break;
- }
- case SOUND_BOMB_TIMED_ACTIVATED:
- case SOUND_55:
- case SOUND_BOMB_ONIGNITION_ACTIVATED:
- case SOUND_BOMB_TICK:
- {
- const float SOUND_INTENSITY = 50.0f;
- m_sQueueSample.m_nSampleIndex = SFX_ARM_BOMB;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 36;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARM_BOMB);
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bRequireReflection = true;
- emittingVol = 50;
- maxDist = SQR(SOUND_INTENSITY);
- break;
- }
- case SOUND_PED_HELI_PLAYER_FOUND:
- pedParams.m_pPed = nil;
- pedParams.m_bDistanceCalculated = false;
- pedParams.m_fDistance = 0.0f;
- pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated;
- pedParams.m_fDistance = params->m_fDistance;
- SetupPedComments(&pedParams, SOUND_PED_HELI_PLAYER_FOUND);
- continue;
- case SOUND_PED_BODYCAST_HIT:
- pedParams.m_pPed = nil;
- pedParams.m_bDistanceCalculated = false;
- pedParams.m_fDistance = 0.0f;
- pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated;
- pedParams.m_fDistance = params->m_fDistance;
- SetupPedComments(&pedParams, SOUND_PED_BODYCAST_HIT);
- continue;
- case SOUND_WATER_FALL:
- {
- const float SOUND_INTENSITY = 40.0f;
- m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 15;
- m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 16000;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- m_sQueueSample.m_bRequireReflection = true;
- emittingVol = m_anRandomTable[4] % 20 + 90;
- break;
- }
- case SOUND_SPLATTER:
- {
- const float SOUND_INTENSITY = 40.0f;
- m_sQueueSample.m_nSampleIndex = CrunchOffset + SFX_PED_CRUNCH_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 48;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_CRUNCH_1) + RandomDisplacement(600);
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = 40.0f;
- ++CrunchOffset;
- maxDist = SQR(SOUND_INTENSITY);
- emittingVol = m_anRandomTable[4] % 20 + 55;
- CrunchOffset %= 2;
- m_sQueueSample.m_bRequireReflection = true;
- break;
- }
- case SOUND_CAR_PED_COLLISION:
- {
- const float SOUND_INTENSITY = 40.0f;
- vol = Min(20.0f, m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]);
- emittingVol = (vol / 20.0f * 127.f);
- if (!emittingVol)
- continue;
-
- m_sQueueSample.m_nSampleIndex = (m_anRandomTable[2] & 3) + SFX_FIGHT_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nCounter = 50;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_fSpeedMultiplier = 0.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- maxDist = SQR(SOUND_INTENSITY);
- break;
- }
- default:
- continue;
- }
- if (params->m_fDistance < maxDist) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
- if (noReflections) {
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- } else {
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- }
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bIs2D = false;
- AddSampleToRequestedQueue();
- }
- }
- }
-}
-
-bool
-cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 50.0f;
-
- CVehicle *veh = params->m_pVehicle;
-
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
- return false;
-
- if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 12;
- m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nFrequency = (100 * m_sQueueSample.m_nEntityIndex & 1023) + SampleManager.GetSampleBaseFrequency(SFX_REVERSE_WARNING);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 60;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 3.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- return true;
-}
-
-bool
-cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 95.0f;
-
- int32 emittingVol;
- uint32 freq;
- float modificator;
- int sampleFreq;
- float velocity;
-
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
- return false;
- if (params->m_pTransmission) {
- if (params->m_pVehicle->m_vecMoveSpeed.z) {
- velocity = Abs(params->m_fVelocityChange);
- if (velocity > 0.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- emittingVol = 30.f * Min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- if (params->m_pVehicle->m_nSurfaceTouched == SURFACE_PUDDLE) {
- m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
- freq = 6050 * emittingVol / 30 + 16000;
- } else {
- m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
- modificator = m_sQueueSample.m_fDistance / 190.f;
- sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
- freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4);
- }
- m_sQueueSample.m_nFrequency = freq;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 6.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 4;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
- return true;
-}
-
-void
-cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 110.0f;
-
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
- CVehicle *veh = params->m_pVehicle;
- if (veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0)
- return;
-
-#ifdef FIX_BUGS
- if (params->m_pVehicle->GetStatus() == STATUS_WRECKED)
- return;
-#endif
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 5;
- if (UsesSiren(params->m_nIndex)) {
- if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED)
- return;
- if (veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) {
- m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST;
- if (params->m_nIndex == FBICAR)
- m_sQueueSample.m_nFrequency = 16113;
- else
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST);
- m_sQueueSample.m_nCounter = 60;
- } else {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample;
- m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency;
- }
- } else {
- m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample;
- m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency;
- }
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = 80;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 7.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 5;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- return;
- }
- }
-}
-
-void
-cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 40.0f;
-
- CAutomobile *automobile;
- cTransmission *transmission;
- int32 emittingVol;
- float newSkidVal = 0.0f;
- float skidVal = 0.0f;
-
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
- return;
- automobile = (CAutomobile *)params->m_pVehicle;
- if (!automobile->m_nWheelsOnGround)
- return;
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
- if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING)
- continue;
- transmission = params->m_pTransmission;
- switch (transmission->nDriveType)
- {
- case '4':
- newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
- break;
- case 'F':
- if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT)
- newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
- else
- newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
- break;
- case 'R':
- if (i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT)
- newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
- else
- newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
- break;
- default:
- break;
- }
- skidVal = Max(skidVal, newSkidVal);
- }
-
- if (skidVal > 0.0f) {
- emittingVol = 50.f * skidVal;
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
- m_sQueueSample.m_nCounter = 3;
- switch (params->m_pVehicle->m_nSurfaceTouched) {
- case SURFACE_GRASS:
- case SURFACE_HEDGE:
- m_sQueueSample.m_nSampleIndex = SFX_RAIN;
- emittingVol /= 4;
- m_sQueueSample.m_nFrequency = 13000.f * skidVal + 35000.f;
- m_sQueueSample.m_nVolume /= 4;
- break;
- case SURFACE_DIRT:
- case SURFACE_DIRTTRACK:
- case SURFACE_SAND:
- case SURFACE_PUDDLE:
- m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
- m_sQueueSample.m_nFrequency = 6000.f * skidVal + 10000.f;
- break;
-
- default:
- m_sQueueSample.m_nSampleIndex = SFX_SKID;
- m_sQueueSample.m_nFrequency = 5000.f * skidVal + 11000.f;
- break;
- }
-
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 8;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 3.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-void cAudioManager::ProcessWaterCannon(int32)
-{
- const float SOUND_INTENSITY = 900.0f;
-
- for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
- if (CWaterCannons::aCannons[i].m_nId) {
- m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
- float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SOUND_INTENSITY) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = 15591;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_nCounter = i;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nReleasingVolumeDivider = 8;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nEmittingVolume = 50;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
-}
-
-void
-cAudioManager::ProcessWeather(int32 id)
-{
- uint8 vol;
- static uint8 counter = 0;
-
- if (m_asAudioEntities[id].m_AudioEvents && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) {
- if (m_asAudioEntities[id].m_afVolume[0] >= 10.f) {
- m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000;
- vol = (m_asAudioEntities[id].m_afVolume[0] - 10.f) + 40;
- } else {
- m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000;
- vol = (m_asAudioEntities[id].m_afVolume[0]) + 35;
- }
- m_sQueueSample.m_nVolume = vol;
- if (TheCamera.SoundDistUp < 20.f)
- m_sQueueSample.m_nVolume /= 2;
- if (counter == 4)
- counter = 0;
- m_sQueueSample.m_nCounter = counter++;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nOffset = (m_anRandomTable[2] & 15) + 55;
- m_sQueueSample.m_bIs2D = true;
- m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
- m_sQueueSample.m_nLoopStart = 0;
- m_sQueueSample.m_nLoopEnd = -1;
- m_sQueueSample.m_bReverbFlag = false;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
- m_sQueueSample.m_nSampleIndex = SFX_RAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAIN);
- m_sQueueSample.m_nVolume = (int32)(25.f * CWeather::Rain);
- m_sQueueSample.m_nCounter = 4;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nOffset = 63;
- m_sQueueSample.m_bIs2D = true;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 30;
- m_sQueueSample.m_bReverbFlag = false;
- m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
-}
-
-bool
-cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
-{
- const float SOUND_INTENSITY = 30.0f;
-
- float relativeVelocity;
- int32 emittingVol;
- float modificator;
- int freq;
- float velChange;
-
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
- return false;
- if (params->m_pTransmission) {
- if (params->m_pVehicle->m_vecMoveSpeed.z) {
- velChange = Abs(params->m_fVelocityChange);
- if (velChange > 0.f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- relativeVelocity = Min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity));
- emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nCounter = 1;
- m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
- modificator = m_sQueueSample.m_fDistance / 6.f;
- freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
- m_sQueueSample.m_nFrequency = freq + freq * modificator;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 6.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 4;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
- }
- }
- return true;
-}
-
-void
-cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
-{
- float distSquared;
-
- switch (sound) {
- case SCRIPT_SOUND_WORK_SHOP_LOOP_S:
- case SCRIPT_SOUND_WORK_SHOP_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- break;
- default:
- return;
- }
- distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
- m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume) {
- m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1);
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_fSpeedMultiplier = 2.0f;
- m_sQueueSample.m_nEmittingVolume = 30;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- }
-}
-
-int32
-cAudioManager::RandomDisplacement(uint32 seed) const
-{
- int32 value;
-
- static bool bIsEven = true;
- static uint32 base = 0;
-
- if (!seed)
- return 0;
-
- value = m_anRandomTable[(base + seed) % 5] % seed;
- base += value;
-
- if (value % 2) {
- bIsEven = !bIsEven;
- }
- if (!bIsEven)
- value = -value;
- return value;
-}
-
-void
-cAudioManager::ReacquireDigitalHandle() const
-{
- if (m_bIsInitialised) {
- SampleManager.ReacquireDigitalHandle();
- }
-}
-
-void
-cAudioManager::ReleaseDigitalHandle() const
-{
- if (m_bIsInitialised) {
- SampleManager.ReleaseDigitalHandle();
- }
-}
-
-void
-cAudioManager::ResetAudioLogicTimers(uint32 timer)
-{
- gPornNextTime = timer;
- gNextCryTime = timer;
- gSawMillNextTime = timer;
- gCellNextTime = timer;
- gShopNextTime = timer;
- gHomeNextTime = timer;
- gAirportNextTime = timer;
- gDocksNextTime = timer;
- gCinemaNextTime = timer;
- for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) {
- if (m_asAudioEntities[m_anAudioEntityIndices[i]].m_nType == AUDIOTYPE_PHYSICAL) {
- CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity;
- if (ped->IsPed()) {
- ped->m_lastSoundStart = timer;
- ped->m_soundStart = timer + m_anRandomTable[0] % 3000;
- }
- }
- }
- ClearMissionAudio();
- SampleManager.StopChannel(policeChannel);
-}
-
-void
-cAudioManager::ResetTimers(uint32 time)
-{
- if (m_bIsInitialised) {
- m_bTimerJustReset = true;
- m_nTimer = time;
- ClearRequestedQueue();
- if (m_nActiveSampleQueue) {
- m_nActiveSampleQueue = 0;
- ClearRequestedQueue();
- m_nActiveSampleQueue = 1;
- } else {
- m_nActiveSampleQueue = 1;
- ClearRequestedQueue();
- m_nActiveSampleQueue = 0;
- }
- ClearActiveSamples();
- ClearMissionAudio();
- SampleManager.StopChannel(policeChannel);
- SampleManager.SetEffectsFadeVolume(0);
- SampleManager.SetMusicFadeVolume(0);
- MusicManager.ResetMusicAfterReload();
-#ifdef AUDIO_OAL
- SampleManager.Service();
-#endif
- }
-}
-
-void
-cAudioManager::Service()
-{
- GenerateIntegerRandomNumberTable();
- if (m_bTimerJustReset) {
- ResetAudioLogicTimers(m_nTimer);
- MusicManager.ResetTimers(m_nTimer);
- m_bTimerJustReset = false;
- }
- if (m_bIsInitialised) {
- m_nPreviousUserPause = m_nUserPause;
- m_nUserPause = CTimer::GetIsUserPaused();
- UpdateReflections();
- ServiceSoundEffects();
- MusicManager.Service();
- }
-}
-
-void
-cAudioManager::ServiceSoundEffects()
-{
- m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
- if (m_nUserPause && !m_nPreviousUserPause) {
- for (int32 i = 0; i < allChannels; i++)
- SampleManager.StopChannel(i);
-
- ClearRequestedQueue();
- if (m_nActiveSampleQueue) {
- m_nActiveSampleQueue = 0;
- ClearRequestedQueue();
- m_nActiveSampleQueue = 1;
- } else {
- m_nActiveSampleQueue = 1;
- ClearRequestedQueue();
- m_nActiveSampleQueue = 0;
- }
- ClearActiveSamples();
- }
- m_nActiveSampleQueue = m_nActiveSampleQueue != 1;
- ProcessReverb();
- ProcessSpecial();
- ClearRequestedQueue();
- InterrogateAudioEntities();
- m_sPedComments.Process();
- ServicePoliceRadio();
- ServiceCollisions();
- AddReleasingSounds();
- ProcessMissionAudio();
- AdjustSamplesVolume();
- ProcessActiveQueues();
-#ifdef AUDIO_OAL
- SampleManager.Service();
-#endif
- for (int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) {
- cAudioScriptObject *object = (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity;
- delete object;
- m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil;
- DestroyEntity(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]);
- }
- m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
-}
-
-int8
-cAudioManager::SetCurrent3DProvider(uint8 which)
-{
- if (!m_bIsInitialised)
- return -1;
- for (uint8 i = 0; i < m_nActiveSamples + 1; ++i)
- SampleManager.StopChannel(i);
- ClearRequestedQueue();
- if (m_nActiveSampleQueue == 0)
- m_nActiveSampleQueue = 1;
- else
- m_nActiveSampleQueue = 0;
- ClearRequestedQueue();
- ClearActiveSamples();
- int8 current = SampleManager.SetCurrent3DProvider(which);
- if (current > 0) {
- m_nActiveSamples = SampleManager.GetMaximumSupportedChannels();
- if (m_nActiveSamples > 1)
- --m_nActiveSamples;
- }
- return current;
-}
-
-void
-cAudioManager::SetDynamicAcousticModelingStatus(uint8 status)
-{
- m_bDynamicAcousticModelingStatus = status!=0;
-}
-
-void
-cAudioManager::SetEffectsFadeVolume(uint8 volume) const
-{
- SampleManager.SetEffectsFadeVolume(volume);
-}
-
-void
-cAudioManager::SetEffectsMasterVolume(uint8 volume) const
-{
- SampleManager.SetEffectsMasterVolume(volume);
-}
-
-void
-cAudioManager::SetEntityStatus(int32 id, uint8 status)
-{
- if (m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed)
- m_asAudioEntities[id].m_nStatus = status;
-}
-
-void
-cAudioManager::SetMissionAudioLocation(float x, float y, float z)
-{
- if (m_bIsInitialised) {
- m_sMissionAudio.m_bPredefinedProperties = false;
- m_sMissionAudio.m_vecPos = CVector(x, y, z);
- }
-}
-
-void
-cAudioManager::SetMonoMode(uint8 mono)
-{
- SampleManager.SetMonoMode(mono);
-}
-
-void
-cAudioManager::SetMusicFadeVolume(uint8 volume) const
-{
- SampleManager.SetMusicFadeVolume(volume);
-}
-
-void
-cAudioManager::SetMusicMasterVolume(uint8 volume) const
-{
- SampleManager.SetMusicMasterVolume(volume);
-}
-
-void
-cAudioManager::SetSpeakerConfig(int32 conf) const
-{
- SampleManager.SetSpeakerConfig(conf);
-}
-
-bool
-cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq)
-{
- const float SOUND_INTENSITY = 180.0f;
- if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
- return false;
-
- uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100;
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- if (m_sQueueSample.m_nVolume != 0) {
- m_sQueueSample.m_nCounter = 3;
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = freq;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 4;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- return true;
-}
-
-bool
-cAudioManager::SetupJumboFlySound(uint8 emittingVol)
-{
- const float SOUND_INTENSITY = 440.0f;
- if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
- return false;
-
- int32 vol = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
- m_sQueueSample.m_nVolume = vol;
- if (m_sQueueSample.m_nVolume != 0) {
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY;
- m_sQueueSample.m_nCounter = 0;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY);
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_nReleasingVolumeDivider = 5;
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- AddSampleToRequestedQueue();
- }
- return true;
-}
-
-bool
-cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
-{
- const float SOUND_INTENSITY = 240.0f;
- if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
- return false;
-
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
-
- if (m_sQueueSample.m_nVolume != 0) {
- m_sQueueSample.m_nCounter = 5;
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = true;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE);
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 12;
- m_sQueueSample.m_nOffset = 0;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- m_sQueueSample.m_nCounter = 6;
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
- m_sQueueSample.m_nFrequency += 200;
- m_sQueueSample.m_nOffset = maxVolume;
- AddSampleToRequestedQueue();
- }
- return true;
-}
-
-bool
-cAudioManager::SetupJumboTaxiSound(uint8 vol)
-{
- const float SOUND_INTENSITY = 180.0f;
- if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
- return false;
-
- uint8 emittingVol = (vol / 2) + ((vol / 2) * m_sQueueSample.m_fDistance / SOUND_INTENSITY);
-
- if (m_sQueueSample.m_fDistance / SOUND_INTENSITY < 0.7f)
- emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
-
- if (m_sQueueSample.m_nVolume != 0) {
- m_sQueueSample.m_nCounter = 1;
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = GetJumboTaxiFreq();
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 4;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- return true;
-}
-
-bool
-cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
-{
- const float SOUND_INTENSITY = 170.0f;
-
- if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY)
- return false;
-
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
-
- if (m_sQueueSample.m_nVolume != 0) {
- m_sQueueSample.m_nCounter = 2;
- m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE;
- m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = freq;
- m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_nEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_fSpeedMultiplier = 4.0f;
- m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
- m_sQueueSample.m_bReleasingSoundFlag = false;
- m_sQueueSample.m_nReleasingVolumeDivider = 4;
- m_sQueueSample.m_bReverbFlag = true;
- m_sQueueSample.m_bRequireReflection = false;
- AddSampleToRequestedQueue();
- }
- return true;
-}
-
-void
-cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
-{
- CPed *ped = params->m_pPed;
- uint8 emittingVol;
- float soundIntensity;
- tPedComment pedComment;
-
- if (ped != nil) {
- switch (sound) {
- case SOUND_AMMUNATION_WELCOME_1:
- pedComment.m_nSampleIndex = SFX_AMMU_D;
- break;
- case SOUND_AMMUNATION_WELCOME_2:
- pedComment.m_nSampleIndex = SFX_AMMU_E;
- break;
- case SOUND_AMMUNATION_WELCOME_3:
- pedComment.m_nSampleIndex = SFX_AMMU_F;
- break;
- default:
- pedComment.m_nSampleIndex = GetPedCommentSfx(ped, sound);
- if (pedComment.m_nSampleIndex == NO_SAMPLE)
- return;
- break;
- }
-
- soundIntensity = 50.0f;
- } else {
- switch (sound) {
- case SOUND_PED_HELI_PLAYER_FOUND:
- soundIntensity = 400.0f;
- pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_POLICE_HELI_1, SFX_POLICE_HELI_29);
- break;
- case SOUND_PED_BODYCAST_HIT:
- if (CTimer::GetTimeInMilliseconds() <= gNextCryTime)
- return;
- soundIntensity = 50.0f;
- gNextCryTime = CTimer::GetTimeInMilliseconds() + 500;
- pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_PLASTER_BLOKE_1, SFX_PLASTER_BLOKE_4);
- break;
- case SOUND_INJURED_PED_MALE_OUCH:
- case SOUND_INJURED_PED_MALE_PRISON:
- soundIntensity = 50.0f;
- pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_MALE_GRUNT_1, SFX_GENERIC_MALE_GRUNT_15);
- break;
- case SOUND_INJURED_PED_FEMALE:
- soundIntensity = 50.0f;
- pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_FEMALE_GRUNT_1, SFX_GENERIC_FEMALE_GRUNT_11);
- break;
- default:
- return;
- }
- }
-
- if (params->m_fDistance < SQR(soundIntensity)) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- if (sound != SOUND_PAGER) {
- switch (sound) {
- case SOUND_AMMUNATION_WELCOME_1:
- case SOUND_AMMUNATION_WELCOME_2:
- case SOUND_AMMUNATION_WELCOME_3:
- emittingVol = maxVolume;
- break;
- default:
- if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, true, false, false, false, false, false))
- emittingVol = maxVolume;
- else
- emittingVol = 31;
- break;
- }
- m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
- pedComment.m_nProcess = 10;
- if (m_sQueueSample.m_nVolume != 0) {
- pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
- pedComment.m_vecPos = m_sQueueSample.m_vecPos;
- pedComment.m_fDistance = m_sQueueSample.m_fDistance;
- pedComment.m_bVolume = m_sQueueSample.m_nVolume;
- m_sPedComments.Add(&pedComment);
- }
- }
- }
-}
-
-void
-cAudioManager::Terminate()
+cAudioManager::ClearRequestedQueue()
{
- if (m_bIsInitialised) {
- MusicManager.Terminate();
-
- for (uint32 i = 0; i < totalAudioEntitiesSlots; i++) {
- m_asAudioEntities[i].m_bIsUsed = false;
- m_anAudioEntityIndices[i] = ARRAY_SIZE(m_anAudioEntityIndices);
- }
-
- m_nAudioEntitiesTotal = 0;
- m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
- PreTerminateGameSpecificShutdown();
-
- for (uint32 i = 0; i < MAX_SAMPLEBANKS; i++) {
- if (SampleManager.IsSampleBankLoaded(i))
- SampleManager.UnloadSampleBank(i);
- }
-
- SampleManager.Terminate();
-
- m_bIsInitialised = false;
- PostTerminateGameSpecificShutdown();
+ for (int32 i = 0; i < m_nActiveSamples; i++) {
+ m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = m_nActiveSamples;
}
+ m_SampleRequestQueuesStatus[m_nActiveSampleQueue] = 0;
}
void
-cAudioManager::TranslateEntity(Const CVector *in, CVector *out) const
-{
- *out = MultiplyInverse(TheCamera.GetMatrix(), *in);
-}
-
-void
-cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile)
+cAudioManager::ClearActiveSamples()
{
- float newGasPedalAudio;
-
- float gasPedal = Abs(automobile->m_fGasPedal);
- float gasPedalAudio = automobile->m_fGasPedalAudio;
-
- if (gasPedalAudio < gasPedal) {
- newGasPedalAudio = gasPedalAudio + 0.09f;
- if (gasPedal <= newGasPedalAudio)
- newGasPedalAudio = gasPedal;
- } else {
- newGasPedalAudio = gasPedalAudio - 0.07f;
- if (gasPedal >= newGasPedalAudio)
- newGasPedalAudio = gasPedal;
+ for (int32 i = 0; i < m_nActiveSamples; i++) {
+ m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
+ m_asActiveSamples[i].m_nCounter = 0;
+ m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
+ m_asActiveSamples[i].m_nBankIndex = SAMPLEBANK_INVALID;
+ m_asActiveSamples[i].m_bIs2D = false;
+ m_asActiveSamples[i].m_nReleasingVolumeModificator = 5;
+ m_asActiveSamples[i].m_nFrequency = 0;
+ m_asActiveSamples[i].m_nVolume = 0;
+ m_asActiveSamples[i].m_nEmittingVolume = 0;
+ m_asActiveSamples[i].m_fDistance = 0.0f;
+ m_asActiveSamples[i].m_bIsProcessed = false;
+ m_asActiveSamples[i].m_bLoopEnded = false;
+ m_asActiveSamples[i].m_nLoopCount = 1;
+ m_asActiveSamples[i].m_nLoopStart = 0;
+ m_asActiveSamples[i].m_nLoopEnd = -1;
+ m_asActiveSamples[i].m_fSpeedMultiplier = 0.0f;
+ m_asActiveSamples[i].m_fSoundIntensity = 200.0f;
+ m_asActiveSamples[i].m_nOffset = 63;
+ m_asActiveSamples[i].m_bReleasingSoundFlag = false;
+ 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_bReverbFlag = false;
+ m_asActiveSamples[i].m_nLoopsRemaining = 0;
+ m_asActiveSamples[i].m_bRequireReflection = false;
}
- automobile->m_fGasPedalAudio = newGasPedalAudio;
}
void
-cAudioManager::UpdateReflections()
-{
- const CVector &camPos = TheCamera.GetPosition();
- CColPoint colpoint;
- CEntity *ent;
-
- if (m_FrameCounter % 8 == 0) {
- m_avecReflectionsPos[0] = camPos;
- m_avecReflectionsPos[0].y += 50.f;
- if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true))
- m_afReflectionsDistances[0] = Distance(camPos, colpoint.point);
- else
- m_afReflectionsDistances[0] = 50.0f;
- } else if ((m_FrameCounter + 1) % 8 == 0) {
- m_avecReflectionsPos[1] = camPos;
- m_avecReflectionsPos[1].y -= 50.0f;
- if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true))
- m_afReflectionsDistances[1] = Distance(camPos, colpoint.point);
- else
- m_afReflectionsDistances[1] = 50.0f;
- } else if ((m_FrameCounter + 2) % 8 == 0) {
- m_avecReflectionsPos[2] = camPos;
- m_avecReflectionsPos[2].x -= 50.0f;
- if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true))
- m_afReflectionsDistances[2] = Distance(camPos, colpoint.point);
- else
- m_afReflectionsDistances[2] = 50.0f;
- } else if ((m_FrameCounter + 3) % 8 == 0) {
- m_avecReflectionsPos[3] = camPos;
- m_avecReflectionsPos[3].x += 50.0f;
- if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true))
- m_afReflectionsDistances[3] = Distance(camPos, colpoint.point);
- else
- m_afReflectionsDistances[3] = 50.0f;
- } else if ((m_FrameCounter + 4) % 8 == 0) {
- m_avecReflectionsPos[4] = camPos;
- m_avecReflectionsPos[4].z += 50.0f;
- if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, nil))
- m_afReflectionsDistances[4] = colpoint.point.z - camPos.z;
- else
- m_afReflectionsDistances[4] = 50.0f;
- }
-}
-
-bool
-cAudioManager::UsesReverseWarning(int32 model) const
-{
- return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH;
-}
-
-bool
-cAudioManager::UsesSiren(int32 model) const
-{
- switch (model) {
- case FIRETRUK:
- case AMBULAN:
- case FBICAR:
- case POLICE:
- case ENFORCER:
- case PREDATOR:
- return true;
- default:
- return false;
- }
-}
-
-bool
-cAudioManager::UsesSirenSwitching(int32 model) const
+cAudioManager::GenerateIntegerRandomNumberTable()
{
- switch (model) {
- case AMBULAN:
- case POLICE:
- case ENFORCER:
- case PREDATOR:
- return true;
- default:
- return false;
+ for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) {
+ m_anRandomTable[i] = myrand();
}
}
+#ifdef GTA_PC
void
cAudioManager::AdjustSamplesVolume()
{
@@ -9796,3 +972,4 @@ cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, floa
return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity;
return emittingVolume;
}
+#endif \ No newline at end of file
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 92bf55d8..0e9ef51a 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -75,7 +75,18 @@ public:
uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
uint8 m_nActiveBank;
- cPedComments();
+ cPedComments()
+ {
+ for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
+ for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) {
+ m_asPedComments[j][i].m_nProcess = -1;
+ m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS;
+ }
+
+ for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++)
+ m_nCommentsInBank[i] = 0;
+ m_nActiveBank = 0;
+ }
void Add(tPedComment *com);
void Process();
};
@@ -202,11 +213,11 @@ public:
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; }
- bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; }
+ bool IsMissionAudioSamplePlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; }
// "Should" be in alphabetic order, except "getXTalkSfx"
void AddDetailsToRequestedOrderList(uint8 sample);
- void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
+ void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank,
uint8 counter, bool notLooping);
void AddReflectionsToRequestedQueue();
void AddReleasingSounds();
@@ -222,11 +233,10 @@ public:
float speedMultiplier) const;
int32 ComputePan(float, CVector *);
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
- int32 CreateEntity(int32 type, void *entity);
+ int32 CreateEntity(eAudioType type, void *entity);
void DestroyAllGameCreatedEntities();
void DestroyEntity(int32 id);
- void DoJumboVolOffset() const;
void DoPoliceRadioCrackle();
// functions returning talk sfx,
@@ -318,7 +328,7 @@ public:
float GetCollisionRatio(float a, float b, float c, float d) const;
float GetDistanceSquared(const CVector &v) const;
int32 GetJumboTaxiFreq() const;
- bool GetMissionAudioLoadingStatus() const;
+ uint8 GetMissionAudioLoadingStatus() const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
uint8 GetNum3DProvidersAvailable() const;
int32 GetPedCommentSfx(CPed *ped, int32 sound);
@@ -348,7 +358,7 @@ public:
void PostInitialiseGameSpecificSetup();
void PostTerminateGameSpecificShutdown();
void PreInitialiseGameSpecificSetup() const;
- void PreloadMissionAudio(const char *name);
+ void PreloadMissionAudio(Const char *name);
void PreTerminateGameSpecificShutdown();
/// processX - main logic of adding new sounds
void ProcessActiveQueues();
@@ -410,7 +420,7 @@ public:
void ProcessVehicleOneShots(cVehicleParams *params);
bool ProcessVehicleReverseWarning(cVehicleParams *params);
bool ProcessVehicleRoadNoise(cVehicleParams *params);
- void ProcessVehicleSirenOrAlarm(cVehicleParams *params);
+ bool ProcessVehicleSirenOrAlarm(cVehicleParams *params);
void ProcessVehicleSkidding(cVehicleParams *params);
void ProcessWaterCannon(int32);
void ProcessWeather(int32 id);
@@ -464,11 +474,11 @@ public:
bool UsesSiren(int32 model) const;
bool UsesSirenSwitching(int32 model) const;
+#ifdef GTA_PC
// only used in pc
void AdjustSamplesVolume();
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
-
- void DebugShit();
+#endif
};
#ifdef AUDIO_MSS
diff --git a/src/audio/AudioSamples.h b/src/audio/AudioSamples.h
index 937fe633..e2721888 100644
--- a/src/audio/AudioSamples.h
+++ b/src/audio/AudioSamples.h
@@ -350,42 +350,52 @@ enum eSfxSample : uint32
SFX_RADIO_CLICK,
SFX_INFO,
+ // bank 1
SFX_CAR_ACCEL_1,
SFX_CAR_AFTER_ACCEL_1,
SFX_CAR_FINGER_OFF_ACCEL_1,
+ // bank 2
SFX_CAR_ACCEL_2,
SFX_CAR_AFTER_ACCEL_2,
SFX_CAR_FINGER_OFF_ACCEL_2,
+ // bank 3
SFX_CAR_ACCEL_3,
SFX_CAR_AFTER_ACCEL_3,
SFX_CAR_FINGER_OFF_ACCEL_3,
+ // bank 4
SFX_CAR_ACCEL_4,
SFX_CAR_AFTER_ACCEL_4,
SFX_CAR_FINGER_OFF_ACCEL_4,
+ // bank 5
SFX_CAR_ACCEL_5,
SFX_CAR_AFTER_ACCEL_5,
SFX_CAR_FINGER_OFF_ACCEL_5,
+ // bank 6
SFX_CAR_ACCEL_6,
SFX_CAR_AFTER_ACCEL_6,
SFX_CAR_FINGER_OFF_ACCEL_6,
+ // bank 7
SFX_CAR_ACCEL_7,
SFX_CAR_AFTER_ACCEL_7,
SFX_CAR_FINGER_OFF_ACCEL_7,
+ // bank 8
SFX_CAR_ACCEL_8,
SFX_CAR_AFTER_ACCEL_8,
SFX_CAR_FINGER_OFF_ACCEL_8,
+ // bank 9
SFX_CAR_ACCEL_9,
SFX_CAR_AFTER_ACCEL_9,
SFX_CAR_FINGER_OFF_ACCEL_9,
+ // bank 10
SFX_PAGE_CHANGE_AND_BACK_LEFT,
SFX_PAGE_CHANGE_AND_BACK_RIGHT,
SFX_HIGHLIGHT_LEFT,
@@ -402,64 +412,142 @@ enum eSfxSample : uint32
SFX_NOISE_BURST_3,
SFX_ERROR_LEFT,
SFX_ERROR_RIGHT,
+
+ // bank 11
SFX_TRAIN_STATION_AMBIENCE_LOOP,
SFX_TRAIN_STATION_ANNOUNCE,
+
+ // bank 12
SFX_CLUB_1,
+
+ // bank 13
SFX_CLUB_2,
+
+ // bank 14
SFX_CLUB_3,
+
+ // bank 15
SFX_CLUB_4,
+
+ // bank 16
SFX_CLUB_5,
+
+ // bank 17
SFX_CLUB_6,
+
+ // bank 18
SFX_CLUB_7,
+
+ // bank 19
SFX_CLUB_8,
+
+ // bank 20
SFX_CLUB_9,
+
+ // bank 21
SFX_CLUB_10,
+
+ // bank 22
SFX_CLUB_11,
+
+ // bank 23
SFX_CLUB_12,
+
+ // bank 24
SFX_CLUB_RAGGA,
+
+ // bank 25
SFX_STRIP_CLUB_1,
+
+ // bank 26
SFX_STRIP_CLUB_2,
+
+ // bank 27
SFX_WORKSHOP_1,
+
+ // bank 28
SFX_PIANO_BAR_1,
+
+ // bank 29
SFX_SAWMILL_LOOP,
SFX_SAWMILL_CUT_WOOD,
+
+ // bank 30
SFX_DOG_FOOD_FACTORY,
+
+ // bank 31
SFX_LAUNDERETTE_LOOP,
SFX_LAUNDERETTE_SONG_LOOP,
+
+ // bank 32
SFX_RESTAURANT_CHINATOWN,
+
+ // bank 33
SFX_RESTAURANT_ITALY,
+
+ // bank 34
SFX_RESTAURANT_GENERIC_1,
+
+ // bank 35
SFX_RESTAURANT_GENERIC_2,
+
+ // bank 36
SFX_AIRPORT_ANNOUNCEMENT_1,
SFX_AIRPORT_ANNOUNCEMENT_2,
SFX_AIRPORT_ANNOUNCEMENT_3,
SFX_AIRPORT_ANNOUNCEMENT_4,
+
+ // bank 37
SFX_SHOP_LOOP,
SFX_SHOP_TILL_1,
SFX_SHOP_TILL_2,
+
+ // bank 38
SFX_CINEMA_BASS_1,
SFX_CINEMA_BASS_2,
SFX_CINEMA_BASS_3,
+
+ // bank 39
SFX_DOCKS_FOGHORN,
+
+ // bank 40
SFX_HOME_1,
SFX_HOME_2,
SFX_HOME_3,
SFX_HOME_4,
SFX_HOME_5,
+
+ // bank 41
SFX_PORN_1_LOOP,
SFX_PORN_1_GROAN_1,
SFX_PORN_1_GROAN_2,
+
+ // bank 42
SFX_PORN_2_LOOP,
SFX_PORN_2_GROAN_1,
SFX_PORN_2_GROAN_2,
+
+ // bank 43
SFX_PORN_3_LOOP,
SFX_PORN_3_GROAN_1,
SFX_PORN_3_GROAN_2,
+
+ // bank 44
SFX_POLICE_BALL_1,
+
+ // bank 45
SFX_BANK_ALARM_1,
+
+ // bank 46
SFX_RAVE_INDUSTRIAL,
+
+ // bank 47
SFX_RAVE_COMMERCIAL,
+
+ // bank 48
SFX_RAVE_SUBURBAN,
+
+ // bank 49
SFX_RAVE_COMMERCIAL_2,
// unused banks 50-58
@@ -473,6 +561,7 @@ enum eSfxSample : uint32
SFX_CLUB_1_8,
SFX_CLUB_1_9,
+ // bank 59
SFX_EXPLOSION_1,
SFX_BRIDGE_OPEN_WARNING,
diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp
index 3d84006d..69d80fbc 100644
--- a/src/audio/AudioScriptObject.cpp
+++ b/src/audio/AudioScriptObject.cpp
@@ -7,7 +7,7 @@
void
cAudioScriptObject::Reset()
{
- AudioId = SCRSOUND_INVALID;
+ AudioId = SCRIPT_SOUND_INVALID;
Posn = CVector(0.0f, 0.0f, 0.0f);
AudioEntity = AEHANDLE_NONE;
}
diff --git a/src/audio/AudioScriptObject.h b/src/audio/AudioScriptObject.h
index ecc07fdf..ff36474d 100644
--- a/src/audio/AudioScriptObject.h
+++ b/src/audio/AudioScriptObject.h
@@ -1,135 +1,5 @@
#pragma once
-enum
-{
- SCRSOUND_TEST_1,
- _SCRSOUND_UNK_1,
- _SCRSOUND_UNK_2,
- _SCRSOUND_UNK_3,
- _SCRSOUND_CLUB_1_S,
- _SCRSOUND_CLUB_1_L,
- _SCRSOUND_CLUB_2_S,
- _SCRSOUND_CLUB_2_L,
- _SCRSOUND_CLUB_3_S,
- _SCRSOUND_CLUB_3_L,
- _SCRSOUND_CLUB_4_S,
- _SCRSOUND_CLUB_4_L,
- _SCRSOUND_CLUB_5_S,
- _SCRSOUND_CLUB_5_L,
- _SCRSOUND_CLUB_6_S,
- _SCRSOUND_CLUB_6_L,
- _SCRSOUND_CLUB_7_S,
- _SCRSOUND_CLUB_7_L,
- _SCRSOUND_CLUB_8_S,
- _SCRSOUND_CLUB_8_L,
- _SCRSOUND_CLUB_9_S,
- _SCRSOUND_CLUB_9_L,
- _SCRSOUND_CLUB_10_S,
- _SCRSOUND_CLUB_10_L,
- _SCRSOUND_CLUB_11_S,
- _SCRSOUND_CLUB_11_L,
- _SCRSOUND_CLUB_12_S,
- _SCRSOUND_CLUB_12_L,
- _SCRSOUND_CLUB_RAGGA_S,
- _SCRSOUND_CLUB_RAGGA_L,
- SCRSOUND_STRIP_CLUB_LOOP_1_S,
- _SCRSOUND_STRIP_CLUB_LOOP_1_L,
- SCRSOUND_STRIP_CLUB_LOOP_2_S,
- _SCRSOUND_STRIP_CLUB_LOOP_2_L,
- _SCRSOUND_SFX_WORKSHOP_1,
- _SCRSOUND_SFX_WORKSHOP_2,
- _SCRSOUND_SAWMILL_LOOP_S,
- SCRSOUND_SAWMILL_LOOP_L,
- _SCRSOUND_DOG_FOOD_FACTORY_S,
- _SCRSOUND_DOG_FOOD_FACTORY_L,
- _SCRSOUND_LAUNDERETTE_1,
- _SCRSOUND_LAUNDERETTE_2,
- _SCRSOUND_RESTAURANT_CHINATOWN_S,
- _SCRSOUND_RESTAURANT_CHINATOWN_L,
- _SCRSOUND_RESTAURANT_ITALY_S,
- _SCRSOUND_RESTAURANT_ITALY_L,
- _SCRSOUND_RESTAURANT_GENERIC_1_S,
- _SCRSOUND_RESTAURANT_GENERIC_1_L,
- _SCRSOUND_RESTAURANT_GENERIC_2_S,
- _SCRSOUND_RESTAURANT_GENERIC_2_L,
- _SCRSOUND_AIRPORT_ANNOUNCEMENT_S,
- _SCRSOUND_AIRPORT_ANNOUNCEMENT_L,
- _SCRSOUND_SHOP_LOOP_1,
- _SCRSOUND_SHOP_LOOP_2,
- _SCRSOUND_CINEMA_S,
- _SCRSOUND_CINEMA_L,
- _SCRSOUND_DOCKS_FOGHORN_S,
- _SCRSOUND_DOCKS_FOGHORN_L,
- _SCRSOUND_HOME_S,
- _SCRSOUND_HOME_L,
- _SCRSOUND_PIANO_BAR,
- _SCRSOUND_CLUB,
- SCRSOUND_PORN_CINEMA_1_S,
- _SCRSOUND_PORN_CINEMA_1_L,
- SCRSOUND_PORN_CINEMA_2_S,
- _SCRSOUND_PORN_CINEMA_2_L,
- SCRSOUND_PORN_CINEMA_3_S,
- _SCRSOUND_PORN_CINEMA_3_L,
- _SCRSOUND_BANK_ALARM_LOOP_S,
- SCRSOUND_BANK_ALARM_LOOP_L,
- _SCRSOUND_POLICE_BALL_LOOP_S,
- SCRSOUND_POLICE_BALL_LOOP_L,
- _SCRSOUND_RAVE_LOOP_INDUSTRIAL_S,
- SCRSOUND_RAVE_LOOP_INDUSTRIAL_L,
- _SCRSOUND_UNK_74,
- _SCRSOUND_UNK_75,
- _SCRSOUND_POLICE_CELL_BEATING_LOOP_S,
- SCRSOUND_POLICE_CELL_BEATING_LOOP_L,
- SCRSOUND_INJURED_PED_MALE_OUCH_S,
- SCRSOUND_INJURED_PED_MALE_OUCH_L,
- SCRSOUND_INJURED_PED_FEMALE_OUCH_S,
- SCRSOUND_INJURED_PED_FEMALE_OUCH_L,
- SCRSOUND_EVIDENCE_PICKUP,
- SCRSOUND_UNLOAD_GOLD,
- _SCRSOUND_RAVE_INDUSTRIAL_S,
- _SCRSOUND_RAVE_INDUSTRIAL_L,
- _SCRSOUND_RAVE_COMMERCIAL_S,
- _SCRSOUND_RAVE_COMMERCIAL_L,
- _SCRSOUND_RAVE_SUBURBAN_S,
- _SCRSOUND_RAVE_SUBURBAN_L,
- _SCRSOUND_GROAN_S,
- _SCRSOUND_GROAN_L,
- SCRSOUND_GATE_START_CLUNK,
- SCRSOUND_GATE_STOP_CLUNK,
- SCRSOUND_PART_MISSION_COMPLETE,
- SCRSOUND_CHUNKY_RUN_SHOUT,
- SCRSOUND_SECURITY_GUARD_RUN_AWAY_SHOUT,
- SCRSOUND_RACE_START_1,
- SCRSOUND_RACE_START_2,
- SCRSOUND_RACE_START_3,
- SCRSOUND_RACE_START_GO,
- SCRSOUND_SWAT_PED_SHOUT,
- SCRSOUND_PRETEND_FIRE_LOOP,
- SCRSOUND_AMMUNATION_CHAT_1,
- SCRSOUND_AMMUNATION_CHAT_2,
- SCRSOUND_AMMUNATION_CHAT_3,
- _SCRSOUND_BULLET_WALL_1,
- _SCRSOUND_BULLET_WALL_2,
- _SCRSOUND_BULLET_WALL_3,
- _SCRSOUND_UNK_109,
- _SCRSOUND_GLASSFX2_1,
- _SCRSOUND_GLASSFX2_2,
- _SCRSOUND_PHONE_RING,
- _SCRSOUND_UNK_113,
- _SCRSOUND_GLASS_SMASH_1,
- _SCRSOUND_GLASS_SMASH_2,
- _SCRSOUND_GLASS_CRACK,
- _SCRSOUND_GLASS_SHARD,
- _SCRSOUND_WOODEN_BOX_SMASH,
- _SCRSOUND_CARDBOARD_BOX_SMASH,
- _SCRSOUND_COL_CAR,
- _SCRSOUND_TYRE_BUMP,
- _SCRSOUND_BULLET_SHELL_HIT_GROUND_1,
- _SCRSOUND_BULLET_SHELL_HIT_GROUND_2,
- TOTAL_SCRSOUNDS,
- SCRSOUND_INVALID
-};
-
class cAudioScriptObject
{
public:
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index 4f87f5a1..dd55f76d 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -29,7 +29,7 @@ cDMAudio::Service(void)
}
int32
-cDMAudio::CreateEntity(int32 type, void *UID)
+cDMAudio::CreateEntity(eAudioType type, void *UID)
{
return AudioManager.CreateEntity(type, (CPhysical *)UID);
}
@@ -88,7 +88,7 @@ cDMAudio::SetEffectsFadeVol(uint8 volume)
uint8 vol = volume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
- AudioManager.SetEffectsFadeVolume(vol);
+ AudioManager.SetEffectsFadeVol(vol);
}
void
@@ -97,7 +97,7 @@ cDMAudio::SetMusicFadeVol(uint8 volume)
uint8 vol = volume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
- AudioManager.SetMusicFadeVolume(vol);
+ AudioManager.SetMusicFadeVol(vol);
}
uint8
@@ -296,7 +296,7 @@ cDMAudio::StopCutSceneMusic(void)
}
void
-cDMAudio::PreloadMissionAudio(char *missionAudio)
+cDMAudio::PreloadMissionAudio(Const char *missionAudio)
{
AudioManager.PreloadMissionAudio(missionAudio);
}
diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h
index 9585a1ff..bb95f303 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -20,7 +20,7 @@ public:
void Terminate(void);
void Service(void);
- int32 CreateEntity(int32 type, void *UID);
+ int32 CreateEntity(eAudioType type, void *UID);
void DestroyEntity(int32 audioEntity);
void SetEntityStatus(int32 audioEntity, uint8 status);
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
@@ -77,7 +77,7 @@ public:
void PlayPreloadedCutSceneMusic(void);
void StopCutSceneMusic(void);
- void PreloadMissionAudio(char *missionAudio);
+ void PreloadMissionAudio(Const char *missionAudio);
uint8 GetMissionAudioLoadingStatus(void);
void SetMissionAudioLocation(float x, float y, float z);
void PlayLoadedMissionAudio(void);
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index fd02691e..9f648d07 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -21,8 +21,6 @@ int32 gNumRetunePresses;
int32 gRetuneCounter;
bool bHasStarted;
-const int maxVolume = 127;
-
cMusicManager::cMusicManager()
{
m_bIsInitialised = false;
@@ -303,14 +301,14 @@ cMusicManager::GetRadioInCar(void)
CVehicle *veh = FindPlayerVehicle();
if (veh != nil){
if (UsesPoliceRadio(veh)) {
- if (m_nRadioInCar == NO_STREAMED_SOUND || CReplay::IsPlayingBack() && AudioManager.m_nUserPause)
+ if (m_nRadioInCar == NO_STREAMED_SOUND || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
return POLICE_RADIO;
return m_nRadioInCar;
} else return veh->m_nRadioStation;
}
}
- if (m_nRadioInCar == NO_STREAMED_SOUND || CReplay::IsPlayingBack() && AudioManager.m_nUserPause)
+ if (m_nRadioInCar == NO_STREAMED_SOUND || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
return RADIO_OFF;
return m_nRadioInCar;
}
@@ -375,7 +373,7 @@ cMusicManager::Service()
if (!m_bIsInitialised || m_bDisabled) return;
if (m_nMusicMode == MUSICMODE_CUTSCENE) {
- SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0);
+ SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0);
return;
}
@@ -528,7 +526,7 @@ cMusicManager::ServiceGameMode()
} else if (dist >= 100.0f) {
int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f);
int8 pan;
- if (AudioManager.IsMissionAudioPlaying())
+ if (AudioManager.IsMissionAudioSamplePlaying())
volume /= 4;
if (volume != 0) {
CVector trVec;
@@ -540,7 +538,7 @@ cMusicManager::ServiceGameMode()
if (gRetuneCounter)
volume /= 4;
SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0);
- } else if (AudioManager.IsMissionAudioPlaying()) {
+ } else if (AudioManager.IsMissionAudioSamplePlaying()) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
} else if (gRetuneCounter) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
@@ -548,7 +546,7 @@ cMusicManager::ServiceGameMode()
SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0);
}
}
- } else if (AudioManager.IsMissionAudioPlaying()) {
+ } else if (AudioManager.IsMissionAudioSamplePlaying()) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
nFramesSinceCutsceneEnded = 0;
} else {
@@ -676,7 +674,7 @@ cMusicManager::PreloadCutSceneMusic(uint8 track)
while (SampleManager.IsStreamPlaying(0))
SampleManager.StopStreamedFile(0);
SampleManager.PreloadStreamedFile(track, 0);
- SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0);
+ SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0);
m_nCurrentStreamedSound = track;
}
}
@@ -834,7 +832,7 @@ cMusicManager::ServiceAnnouncement()
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) {
- SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0);
+ SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0);
m_bAnnouncementInProgress = true;
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = m_nAnnouncement;
@@ -907,7 +905,7 @@ cMusicManager::ChangeRadioChannel()
return false;
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0))
return false;
- SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0);
+ SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0);
}
return true;
}
diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp
index ec02368e..af346479 100644
--- a/src/audio/PoliceRadio.cpp
+++ b/src/audio/PoliceRadio.cpp
@@ -14,7 +14,6 @@
#include "Zones.h"
#include "sampman.h"
-const int maxVolume = 127;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1;
@@ -225,7 +224,7 @@ cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel)
}
} else if (!SampleManager.GetChannelUsedFlag(policeChannel)) {
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
- SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 1);
+ SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 1);
SampleManager.StartPreloadedStreamedFile(1);
g_nMissionAudioPlayingStatus = 1;
bMissionAudioPhysicalPlayingStatus = 0;
diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h
index 8136ff66..3b996205 100644
--- a/src/audio/audio_enums.h
+++ b/src/audio/audio_enums.h
@@ -238,18 +238,18 @@ enum AudioEntityHandle {
enum eAudioType : int32
{
AUDIOTYPE_PHYSICAL = 0,
- AUDIOTYPE_EXPLOSION = 1,
- AUDIOTYPE_FIRE = 2,
- AUDIOTYPE_WEATHER = 3,
- AUDIOTYPE_CRANE = 4,
- AUDIOTYPE_SCRIPTOBJECT = 5,
- AUDIOTYPE_BRIDGE = 6,
- AUDIOTYPE_COLLISION = 7,
- AUDIOTYPE_FRONTEND = 8,
- AUDIOTYPE_PROJECTILE = 9,
- AUDIOTYPE_GARAGE = 10,
- AUDIOTYPE_FIREHYDRANT = 11,
- AUDIOTYPE_WATERCANNON = 12,
- AUDIOTYPE_POLICERADIO = 13,
- TOTAL_AUDIO_TYPES = 14,
+ AUDIOTYPE_EXPLOSION,
+ AUDIOTYPE_FIRE,
+ AUDIOTYPE_WEATHER,
+ AUDIOTYPE_CRANE,
+ AUDIOTYPE_SCRIPTOBJECT,
+ AUDIOTYPE_BRIDGE,
+ AUDIOTYPE_COLLISION,
+ AUDIOTYPE_FRONTEND,
+ AUDIOTYPE_PROJECTILE,
+ AUDIOTYPE_GARAGE,
+ AUDIOTYPE_FIREHYDRANT,
+ AUDIOTYPE_WATERCANNON,
+ AUDIOTYPE_POLICERADIO,
+ TOTAL_AUDIO_TYPES,
};
diff --git a/src/audio/oal/aldlist.cpp b/src/audio/oal/aldlist.cpp
index 458b7c80..3e86b1d7 100644
--- a/src/audio/oal/aldlist.cpp
+++ b/src/audio/oal/aldlist.cpp
@@ -35,15 +35,13 @@
*/
ALDeviceList::ALDeviceList()
{
- ALDEVICEINFO ALDeviceInfo;
char *devices;
int index;
const char *defaultDeviceName;
const char *actualDeviceName;
// DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support
- vDeviceInfo.empty();
- vDeviceInfo.reserve(10);
+ nNumOfDevices = 0;
defaultDeviceIndex = 0;
@@ -65,51 +63,49 @@ ALDeviceList::ALDeviceList()
// if new actual device name isn't already in the list, then add it...
actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
bool bNewName = true;
- for (int i = 0; i < GetNumDevices(); i++) {
+ for (unsigned int i = 0; i < GetNumDevices(); i++) {
if (strcmp(GetDeviceName(i), actualDeviceName) == 0) {
bNewName = false;
}
}
if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
- memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO));
+ ALDEVICEINFO ALDeviceInfo;
ALDeviceInfo.bSelected = true;
- ALDeviceInfo.strDeviceName.assign(actualDeviceName, strlen(actualDeviceName));
+ ALDeviceInfo.strDeviceName = actualDeviceName;
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion);
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion);
- ALDeviceInfo.pvstrExtensions = new std::vector<std::string>;
-
// Check for ALC Extensions
if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_CAPTURE");
+ ALDeviceInfo.Extensions |= ADEXT_EXT_CAPTURE;
if (alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_EFX");
+ ALDeviceInfo.Extensions |= ADEXT_EXT_EFX;
// Check for AL Extensions
if (alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_OFFSET");
+ ALDeviceInfo.Extensions |= ADEXT_EXT_OFFSET;
if (alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_LINEAR_DISTANCE");
+ ALDeviceInfo.Extensions |= ADEXT_EXT_LINEAR_DISTANCE;
if (alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_EXPONENT_DISTANCE");
+ ALDeviceInfo.Extensions |= ADEXT_EXT_EXPONENT_DISTANCE;
if (alIsExtensionPresent("EAX2.0") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("EAX2.0");
+ ALDeviceInfo.Extensions |= ADEXT_EAX2;
if (alIsExtensionPresent("EAX3.0") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("EAX3.0");
+ ALDeviceInfo.Extensions |= ADEXT_EAX3;
if (alIsExtensionPresent("EAX4.0") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("EAX4.0");
+ ALDeviceInfo.Extensions |= ADEXT_EAX4;
if (alIsExtensionPresent("EAX5.0") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("EAX5.0");
+ ALDeviceInfo.Extensions |= ADEXT_EAX5;
if (alIsExtensionPresent("EAX-RAM") == AL_TRUE)
- ALDeviceInfo.pvstrExtensions->push_back("EAX-RAM");
+ ALDeviceInfo.Extensions |= ADEXT_EAX_RAM;
// Get Source Count
ALDeviceInfo.uiSourceCount = GetMaxNumSources();
- vDeviceInfo.push_back(ALDeviceInfo);
+ aDeviceInfo[nNumOfDevices++] = ALDeviceInfo;
}
alcMakeContextCurrent(NULL);
alcDestroyContext(context);
@@ -129,31 +125,23 @@ ALDeviceList::ALDeviceList()
*/
ALDeviceList::~ALDeviceList()
{
- for (unsigned int i = 0; i < vDeviceInfo.size(); i++) {
- if (vDeviceInfo[i].pvstrExtensions) {
- vDeviceInfo[i].pvstrExtensions->empty();
- delete vDeviceInfo[i].pvstrExtensions;
- }
- }
-
- vDeviceInfo.empty();
}
/*
* Returns the number of devices in the complete device list
*/
-int ALDeviceList::GetNumDevices()
+unsigned int ALDeviceList::GetNumDevices()
{
- return (int)vDeviceInfo.size();
+ return nNumOfDevices;
}
/*
* Returns the device name at an index in the complete device list
*/
-char * ALDeviceList::GetDeviceName(int index)
+const char * ALDeviceList::GetDeviceName(unsigned int index)
{
if (index < GetNumDevices())
- return (char *)vDeviceInfo[index].strDeviceName.c_str();
+ return aDeviceInfo[index].strDeviceName;
else
return NULL;
}
@@ -161,13 +149,13 @@ char * ALDeviceList::GetDeviceName(int index)
/*
* Returns the major and minor version numbers for a device at a specified index in the complete list
*/
-void ALDeviceList::GetDeviceVersion(int index, int *major, int *minor)
+void ALDeviceList::GetDeviceVersion(unsigned int index, int *major, int *minor)
{
if (index < GetNumDevices()) {
if (major)
- *major = vDeviceInfo[index].iMajorVersion;
+ *major = aDeviceInfo[index].iMajorVersion;
if (minor)
- *minor = vDeviceInfo[index].iMinorVersion;
+ *minor = aDeviceInfo[index].iMinorVersion;
}
return;
}
@@ -175,10 +163,10 @@ void ALDeviceList::GetDeviceVersion(int index, int *major, int *minor)
/*
* Returns the maximum number of Sources that can be generate on the given device
*/
-unsigned int ALDeviceList::GetMaxNumSources(int index)
+unsigned int ALDeviceList::GetMaxNumSources(unsigned int index)
{
if (index < GetNumDevices())
- return vDeviceInfo[index].uiSourceCount;
+ return aDeviceInfo[index].uiSourceCount;
else
return 0;
}
@@ -186,20 +174,9 @@ unsigned int ALDeviceList::GetMaxNumSources(int index)
/*
* Checks if the extension is supported on the given device
*/
-bool ALDeviceList::IsExtensionSupported(int index, const char *szExtName)
+bool ALDeviceList::IsExtensionSupported(int index, unsigned short ext)
{
- bool bReturn = false;
-
- if (index < GetNumDevices()) {
- for (unsigned int i = 0; i < vDeviceInfo[index].pvstrExtensions->size(); i++) {
- if (!_stricmp(vDeviceInfo[index].pvstrExtensions->at(i).c_str(), szExtName)) {
- bReturn = true;
- break;
- }
- }
- }
-
- return bReturn;
+ return !!(aDeviceInfo[index].Extensions & ext);
}
/*
@@ -216,10 +193,10 @@ int ALDeviceList::GetDefaultDevice()
void ALDeviceList::FilterDevicesMinVer(int major, int minor)
{
int dMajor, dMinor;
- for (unsigned int i = 0; i < vDeviceInfo.size(); i++) {
+ for (unsigned int i = 0; i < nNumOfDevices; i++) {
GetDeviceVersion(i, &dMajor, &dMinor);
if ((dMajor < major) || ((dMajor == major) && (dMinor < minor))) {
- vDeviceInfo[i].bSelected = false;
+ aDeviceInfo[i].bSelected = false;
}
}
}
@@ -230,10 +207,10 @@ void ALDeviceList::FilterDevicesMinVer(int major, int minor)
void ALDeviceList::FilterDevicesMaxVer(int major, int minor)
{
int dMajor, dMinor;
- for (unsigned int i = 0; i < vDeviceInfo.size(); i++) {
+ for (unsigned int i = 0; i < nNumOfDevices; i++) {
GetDeviceVersion(i, &dMajor, &dMinor);
if ((dMajor > major) || ((dMajor == major) && (dMinor > minor))) {
- vDeviceInfo[i].bSelected = false;
+ aDeviceInfo[i].bSelected = false;
}
}
}
@@ -241,20 +218,12 @@ void ALDeviceList::FilterDevicesMaxVer(int major, int minor)
/*
* Deselects device which don't support the given extension name
*/
-void ALDeviceList::FilterDevicesExtension(char *szExtName)
+void
+ALDeviceList::FilterDevicesExtension(unsigned short ext)
{
- bool bFound;
-
- for (unsigned int i = 0; i < vDeviceInfo.size(); i++) {
- bFound = false;
- for (unsigned int j = 0; j < vDeviceInfo[i].pvstrExtensions->size(); j++) {
- if (!_stricmp(vDeviceInfo[i].pvstrExtensions->at(j).c_str(), szExtName)) {
- bFound = true;
- break;
- }
- }
- if (!bFound)
- vDeviceInfo[i].bSelected = false;
+ for (unsigned int i = 0; i < nNumOfDevices; i++) {
+ if (!IsExtensionSupported(i, ext))
+ aDeviceInfo[i].bSelected = false;
}
}
@@ -263,8 +232,8 @@ void ALDeviceList::FilterDevicesExtension(char *szExtName)
*/
void ALDeviceList::ResetFilters()
{
- for (int i = 0; i < GetNumDevices(); i++) {
- vDeviceInfo[i].bSelected = true;
+ for (unsigned int i = 0; i < GetNumDevices(); i++) {
+ aDeviceInfo[i].bSelected = true;
}
filterIndex = 0;
}
@@ -274,10 +243,10 @@ void ALDeviceList::ResetFilters()
*/
int ALDeviceList::GetFirstFilteredDevice()
{
- int i;
+ unsigned int i;
for (i = 0; i < GetNumDevices(); i++) {
- if (vDeviceInfo[i].bSelected == true) {
+ if (aDeviceInfo[i].bSelected == true) {
break;
}
}
@@ -290,10 +259,10 @@ int ALDeviceList::GetFirstFilteredDevice()
*/
int ALDeviceList::GetNextFilteredDevice()
{
- int i;
+ unsigned int i;
for (i = filterIndex; i < GetNumDevices(); i++) {
- if (vDeviceInfo[i].bSelected == true) {
+ if (aDeviceInfo[i].bSelected == true) {
break;
}
}
diff --git a/src/audio/oal/aldlist.h b/src/audio/oal/aldlist.h
index 694c9d01..417bd314 100644
--- a/src/audio/oal/aldlist.h
+++ b/src/audio/oal/aldlist.h
@@ -5,38 +5,58 @@
#ifdef AUDIO_OAL
#pragma warning(disable: 4786) //disable warning "identifier was truncated to '255' characters in the browser information"
-#include <vector>
-#include <string>
-typedef struct
+enum
{
- std::string strDeviceName;
+ ADEXT_EXT_CAPTURE = (1 << 0),
+ ADEXT_EXT_EFX = (1 << 1),
+ ADEXT_EXT_OFFSET = (1 << 2),
+ ADEXT_EXT_LINEAR_DISTANCE = (1 << 3),
+ ADEXT_EXT_EXPONENT_DISTANCE = (1 << 4),
+ ADEXT_EAX2 = (1 << 5),
+ ADEXT_EAX3 = (1 << 6),
+ ADEXT_EAX4 = (1 << 7),
+ ADEXT_EAX5 = (1 << 8),
+ ADEXT_EAX_RAM = (1 << 9),
+};
+
+struct ALDEVICEINFO {
+ const char *strDeviceName;
int iMajorVersion;
int iMinorVersion;
unsigned int uiSourceCount;
- std::vector<std::string> *pvstrExtensions;
+ unsigned short Extensions;
bool bSelected;
-} ALDEVICEINFO, *LPALDEVICEINFO;
+
+ ALDEVICEINFO() : iMajorVersion(0), iMinorVersion(0), uiSourceCount(0), bSelected(false)
+ {
+ strDeviceName = NULL;
+ Extensions = 0;
+ }
+};
+
+typedef ALDEVICEINFO *LPALDEVICEINFO;
class ALDeviceList
{
private:
- std::vector<ALDEVICEINFO> vDeviceInfo;
+ ALDEVICEINFO aDeviceInfo[64];
+ unsigned int nNumOfDevices;
int defaultDeviceIndex;
int filterIndex;
public:
ALDeviceList ();
~ALDeviceList ();
- int GetNumDevices();
- char *GetDeviceName(int index);
- void GetDeviceVersion(int index, int *major, int *minor);
- unsigned int GetMaxNumSources(int index);
- bool IsExtensionSupported(int index, const char *szExtName);
+ unsigned int GetNumDevices();
+ const char *GetDeviceName(unsigned int index);
+ void GetDeviceVersion(unsigned int index, int *major, int *minor);
+ unsigned int GetMaxNumSources(unsigned int index);
+ bool IsExtensionSupported(int index, unsigned short ext);
int GetDefaultDevice();
void FilterDevicesMinVer(int major, int minor);
void FilterDevicesMaxVer(int major, int minor);
- void FilterDevicesExtension(char *szExtName);
+ void FilterDevicesExtension(unsigned short ext);
void ResetFilters();
int GetFirstFilteredDevice();
int GetNextFilteredDevice();
diff --git a/src/audio/oal/channel.cpp b/src/audio/oal/channel.cpp
index 6fe1d856..731e3581 100644
--- a/src/audio/oal/channel.cpp
+++ b/src/audio/oal/channel.cpp
@@ -1,7 +1,7 @@
-#include "channel.h"
+#include "common.h"
#ifdef AUDIO_OAL
-#include "common.h"
+#include "channel.h"
#include "sampman.h"
#ifndef _WIN32
diff --git a/src/audio/oal/channel.h b/src/audio/oal/channel.h
index 4dd09ca1..0c86bdc6 100644
--- a/src/audio/oal/channel.h
+++ b/src/audio/oal/channel.h
@@ -1,5 +1,4 @@
#pragma once
-#include "common.h"
#ifdef AUDIO_OAL
#include "oal/oal_utils.h"
diff --git a/src/audio/oal/oal_utils.cpp b/src/audio/oal/oal_utils.cpp
index 4119672f..e16de572 100644
--- a/src/audio/oal/oal_utils.cpp
+++ b/src/audio/oal/oal_utils.cpp
@@ -1,3 +1,4 @@
+#include "common.h"
#include "oal_utils.h"
#ifdef AUDIO_OAL
diff --git a/src/audio/oal/oal_utils.h b/src/audio/oal/oal_utils.h
index af45a944..b89ccf36 100644
--- a/src/audio/oal/oal_utils.h
+++ b/src/audio/oal/oal_utils.h
@@ -1,5 +1,4 @@
#pragma once
-#include "common.h"
#ifdef AUDIO_OAL
#include "eax.h"
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index 5a9c7d7d..34518f54 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -1,11 +1,9 @@
-#include "stream.h"
+#include "common.h"
#ifdef AUDIO_OAL
-#include "common.h"
+#include "stream.h"
#include "sampman.h"
-#include <sndfile.h>
-#include <mpg123.h>
#ifdef _WIN32
typedef long ssize_t;
#pragma comment( lib, "libsndfile-1.lib" )
@@ -13,6 +11,8 @@ typedef long ssize_t;
#else
#include "crossplatform.h"
#endif
+#include <sndfile.h>
+#include <mpg123.h>
class CSndFile : public IDecoder
{
diff --git a/src/audio/oal/stream.h b/src/audio/oal/stream.h
index f1e5f458..456c080a 100644
--- a/src/audio/oal/stream.h
+++ b/src/audio/oal/stream.h
@@ -1,5 +1,4 @@
#pragma once
-#include "common.h"
#ifdef AUDIO_OAL
#include <AL/al.h>
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
index d3c82943..391e884b 100644
--- a/src/audio/sampman.h
+++ b/src/audio/sampman.h
@@ -3,7 +3,7 @@
#include "AudioSamples.h"
#define MAX_VOLUME 127
-#define MAX_FREQ 22050
+#define MAX_FREQ DIGITALRATE
struct tSample {
int32 nOffset;
@@ -13,9 +13,83 @@ struct tSample {
int32 nLoopEnd;
};
+#ifdef GTA_PS2
+#define PS2BANK(e) e
+#else
+#define PS2BANK(e) e = SAMPLEBANK_MAIN
+#endif // GTA_PS2
+
+
enum
{
SAMPLEBANK_MAIN,
+
+ CAR_SAMPLEBANKS_OFFSET,
+ SAMPLEBANK_CAR_PACARD = CAR_SAMPLEBANKS_OFFSET,
+ SAMPLEBANK_CAR_PATHFINDER,
+ SAMPLEBANK_CAR_PORSCHE,
+ SAMPLEBANK_CAR_SPIDER,
+ SAMPLEBANK_CAR_MERC,
+ SAMPLEBANK_CAR_MACKTRUCK,
+ SAMPLEBANK_CAR_HOTROD,
+ SAMPLEBANK_CAR_COBRA,
+ SAMPLEBANK_CAR_NONE,
+
+ PS2BANK(SAMPLEBANK_FRONTEND),
+
+ PS2BANK(SAMPLEBANK_TRAIN),
+
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_1),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_2),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_3),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_4),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_5),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_6),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_7),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_8),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_9),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_10),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_11),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_12),
+ PS2BANK(SAMPLEBANK_BUILDING_CLUB_RAGGA),
+ PS2BANK(SAMPLEBANK_BUILDING_STRIP_CLUB_1),
+ PS2BANK(SAMPLEBANK_BUILDING_STRIP_CLUB_2),
+ PS2BANK(SAMPLEBANK_BUILDING_WORKSHOP),
+ PS2BANK(SAMPLEBANK_BUILDING_PIANO_BAR),
+ PS2BANK(SAMPLEBANK_BUILDING_SAWMILL),
+ PS2BANK(SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY),
+ PS2BANK(SAMPLEBANK_BUILDING_LAUNDERETTE),
+ PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN),
+ PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_ITALY),
+ PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1),
+ PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2),
+ PS2BANK(SAMPLEBANK_BUILDING_AIRPORT),
+ PS2BANK(SAMPLEBANK_BUILDING_SHOP),
+ PS2BANK(SAMPLEBANK_BUILDING_CINEMA),
+ PS2BANK(SAMPLEBANK_BUILDING_DOCKS),
+ PS2BANK(SAMPLEBANK_BUILDING_HOME),
+ PS2BANK(SAMPLEBANK_BUILDING_PORN_1),
+ PS2BANK(SAMPLEBANK_BUILDING_PORN_2),
+ PS2BANK(SAMPLEBANK_BUILDING_PORN_3),
+ PS2BANK(SAMPLEBANK_BUILDING_POLICE_BALL),
+ PS2BANK(SAMPLEBANK_BUILDING_BANK_ALARM),
+ PS2BANK(SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL),
+ PS2BANK(SAMPLEBANK_BUILDING_RAVE_COMMERCIAL),
+ PS2BANK(SAMPLEBANK_BUILDING_RAVE_SUBURBAN),
+ PS2BANK(SAMPLEBANK_BUILDING_RAVE_COMMERCIAL_2),
+
+ PS2BANK(SAMPLEBANK_BUILDING_39),
+ PS2BANK(SAMPLEBANK_BUILDING_40),
+ PS2BANK(SAMPLEBANK_BUILDING_41),
+ PS2BANK(SAMPLEBANK_BUILDING_42),
+ PS2BANK(SAMPLEBANK_BUILDING_43),
+ PS2BANK(SAMPLEBANK_BUILDING_44),
+ PS2BANK(SAMPLEBANK_BUILDING_45),
+ PS2BANK(SAMPLEBANK_BUILDING_46),
+ PS2BANK(SAMPLEBANK_BUILDING_47),
+
+ PS2BANK(SAMPLEBANK_EXTRAS),
+
SAMPLEBANK_PED,
MAX_SAMPLEBANKS,
SAMPLEBANK_INVALID
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index a2a206a4..d625ac35 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1445,7 +1445,7 @@ cSampleManager::IsSampleBankLoaded(uint8 nBank)
bool
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
- uint8 slot;
+ int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ )
{
@@ -1464,11 +1464,15 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
int32
cSampleManager::_GetPedCommentSlot(uint32 nComment)
{
- uint8 slot;
+ int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ )
{
slot = nCurrentPedSlot - i - 1;
+#ifdef FIX_BUGS
+ if (slot < 0)
+ slot += ARRAY_SIZE(nPedSlotSfx);
+#endif
if ( nComment == nPedSlotSfx[slot] )
return slot;
}
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 30efd7f5..1952f370 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -174,10 +174,10 @@ add_providers()
}
if ( alGetEnumValue("AL_EFFECT_EAXREVERB") != 0
- || pDeviceList->IsExtensionSupported(i, "EAX2.0")
- || pDeviceList->IsExtensionSupported(i, "EAX3.0")
- || pDeviceList->IsExtensionSupported(i, "EAX4.0")
- || pDeviceList->IsExtensionSupported(i, "EAX5.0") )
+ || pDeviceList->IsExtensionSupported(i, ADEXT_EAX2)
+ || pDeviceList->IsExtensionSupported(i, ADEXT_EAX3)
+ || pDeviceList->IsExtensionSupported(i, ADEXT_EAX4)
+ || pDeviceList->IsExtensionSupported(i, ADEXT_EAX5) )
{
if ( n < MAXPROVIDERS )
{
@@ -775,7 +775,7 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
- uint8 slot;
+ int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ )
{
@@ -795,11 +795,15 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
int32
cSampleManager::_GetPedCommentSlot(uint32 nComment)
{
- uint8 slot;
+ int8 slot;
for (int32 i = 0; i < _TODOCONST(3); i++)
{
slot = nCurrentPedSlot - i - 1;
+#ifdef FIX_BUGS
+ if (slot < 0)
+ slot += ARRAY_SIZE(nPedSlotSfx);
+#endif
if (nComment == nPedSlotSfx[slot])
return slot;
}
diff --git a/src/audio/soundlist.h b/src/audio/soundlist.h
index 07e20848..856b691a 100644
--- a/src/audio/soundlist.h
+++ b/src/audio/soundlist.h
@@ -1,301 +1,303 @@
#pragma once
-enum eSound : int16
+enum eSound : uint16
{
SOUND_CAR_DOOR_CLOSE_BONNET = 0,
- SOUND_CAR_DOOR_CLOSE_BUMPER = 1,
- SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2,
- SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 3,
- SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 4,
- SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 5,
- SOUND_CAR_DOOR_OPEN_BONNET = 6,
- SOUND_CAR_DOOR_OPEN_BUMPER = 7,
- SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 8,
- SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 9,
- SOUND_CAR_DOOR_OPEN_BACK_LEFT = 10,
- SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 11,
- SOUND_CAR_WINDSHIELD_CRACK = 12,
- SOUND_CAR_JUMP = 13,
- SOUND_E = 14,
- SOUND_F = 15,
- SOUND_CAR_ENGINE_START = 16,
- SOUND_CAR_LIGHT_BREAK = 17,
- SOUND_CAR_HYDRAULIC_1 = 18,
- SOUND_CAR_HYDRAULIC_2 = 19,
- SOUND_CAR_HYDRAULIC_3 = 20,
- SOUND_CAR_JERK = 21,
- SOUND_CAR_SPLASH = 22,
- SOUND_17 = 23,
- SOUND_18 = 24,
- SOUND_19 = 25,
- SOUND_CAR_TANK_TURRET_ROTATE = 26,
- SOUND_CAR_BOMB_TICK = 27,
- SOUND_PLANE_ON_GROUND = 28,
- SOUND_STEP_START = 29,
- SOUND_STEP_END = 30,
- SOUND_FALL_LAND = 31,
- SOUND_FALL_COLLAPSE = 32,
- SOUND_FIGHT_PUNCH_33 = 33,
- SOUND_FIGHT_KICK_34 = 34,
- SOUND_FIGHT_HEADBUTT_35 = 35,
- SOUND_FIGHT_PUNCH_36 = 36,
- SOUND_FIGHT_PUNCH_37 = 37,
- SOUND_FIGHT_CLOSE_PUNCH_38 = 38,
- SOUND_FIGHT_PUNCH_39 = 39,
- SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40 = 40,
- SOUND_FIGHT_PUNCH_41 = 41,
- SOUND_FIGHT_PUNCH_FROM_BEHIND_42 = 42,
- SOUND_FIGHT_KNEE_OR_KICK_43 = 43,
- SOUND_FIGHT_KICK_44 = 44,
- SOUND_2D = 45,
- SOUND_WEAPON_BAT_ATTACK = 46,
- SOUND_WEAPON_SHOT_FIRED = 47,
- SOUND_WEAPON_RELOAD = 48,
- SOUND_WEAPON_AK47_BULLET_ECHO = 49,
- SOUND_WEAPON_UZI_BULLET_ECHO = 50,
- SOUND_WEAPON_M16_BULLET_ECHO = 51,
- SOUND_WEAPON_FLAMETHROWER_FIRE = 52,
- SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 53,
- SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 54,
- SOUND_WEAPON_HIT_PED = 55,
- SOUND_WEAPON_HIT_VEHICLE = 56,
- SOUND_GARAGE_NO_MONEY = 57,
- SOUND_GARAGE_BAD_VEHICLE = 58,
- SOUND_GARAGE_OPENING = 59,
- SOUND_GARAGE_BOMB_ALREADY_SET = 60,
- SOUND_GARAGE_BOMB1_SET = 61,
- SOUND_GARAGE_BOMB2_SET = 62,
- SOUND_GARAGE_BOMB3_SET = 63,
- SOUND_40 = 64,
- SOUND_41 = 65,
- SOUND_GARAGE_VEHICLE_DECLINED = 66,
- SOUND_GARAGE_VEHICLE_ACCEPTED = 67,
- SOUND_GARAGE_DOOR_CLOSED = 68,
- SOUND_GARAGE_DOOR_OPENED = 69,
- SOUND_CRANE_PICKUP = 70,
- SOUND_PICKUP_WEAPON_BOUGHT = 71,
- SOUND_PICKUP_WEAPON = 72,
- SOUND_PICKUP_HEALTH = 73,
- SOUND_4A = 74,
- SOUND_4B = 75,
- SOUND_PICKUP_ADRENALINE = 76,
- SOUND_PICKUP_ARMOUR = 77,
- SOUND_PICKUP_BONUS = 78,
- SOUND_PICKUP_MONEY = 79,
- SOUND_PICKUP_HIDDEN_PACKAGE = 80,
- SOUND_PICKUP_PACMAN_PILL = 81,
- SOUND_PICKUP_PACMAN_PACKAGE = 82,
- SOUND_PICKUP_FLOAT_PACKAGE = 83,
- SOUND_BOMB_TIMED_ACTIVATED = 84,
- SOUND_55 = 85,
- SOUND_BOMB_ONIGNITION_ACTIVATED = 86,
- SOUND_BOMB_TICK = 87,
- SOUND_RAMPAGE_START = 88,
- SOUND_RAMPAGE_ONGOING = 89,
- SOUND_RAMPAGE_PASSED = 90,
- SOUND_RAMPAGE_FAILED = 91,
- SOUND_RAMPAGE_KILL = 92,
- SOUND_RAMPAGE_CAR_BLOWN = 93,
- SOUND_EVIDENCE_PICKUP = 94,
- SOUND_UNLOAD_GOLD = 95,
- SOUND_PAGER = 96,
- SOUND_PED_DEATH = 97, // 103 in VC
- SOUND_PED_DAMAGE = 98, // 104 in VC
- SOUND_PED_HIT = 99, // 105 in VC
- SOUND_PED_LAND = 100, // hopefully 106 in VC
- SOUND_PED_BULLET_HIT = 101,
- SOUND_PED_BOMBER = 102,
- SOUND_PED_BURNING = 103, // 108 in VC
- SOUND_PED_ARREST_FBI = 104,
- SOUND_PED_ARREST_SWAT = 105,
- SOUND_PED_ARREST_COP = 106,
- SOUND_PED_HELI_PLAYER_FOUND = 107,
- SOUND_PED_HANDS_UP = 108,
- SOUND_PED_HANDS_COWER = 109,
- SOUND_PED_FLEE_SPRINT = 110, // 120 in VC
- SOUND_PED_CAR_JACKING = 111,
- SOUND_PED_MUGGING = 112,
- SOUND_PED_CAR_JACKED = 113,
- SOUND_PED_ROBBED = 114,
- SOUND_PED_TAXI_WAIT = 115, // 137 in VC
- SOUND_PED_ATTACK = 116,
- SOUND_PED_DEFEND = 117,
- SOUND_PED_PURSUIT_ARMY = 118,
- SOUND_PED_PURSUIT_FBI = 119,
- SOUND_PED_PURSUIT_SWAT = 120,
- SOUND_PED_PURSUIT_COP = 121,
- SOUND_PED_HEALING = 122,
- SOUND_PED_7B = 123,
- SOUND_PED_LEAVE_VEHICLE = 124,
- SOUND_PED_EVADE = 125, // 142 in VC
- SOUND_PED_FLEE_RUN = 126,
- SOUND_PED_CAR_COLLISION = 127, // 144-145-146 in VC
- SOUND_PED_SOLICIT = 128,
- SOUND_PED_EXTINGUISHING_FIRE = 129,
- SOUND_PED_WAIT_DOUBLEBACK = 130,
- SOUND_PED_CHAT_SEXY = 131,
- SOUND_PED_CHAT_EVENT = 132,
- SOUND_PED_CHAT = 133,
- SOUND_PED_BODYCAST_HIT = 134,
- SOUND_PED_TAXI_CALL = 135,
- SOUND_INJURED_PED_MALE_OUCH = 136,
- SOUND_INJURED_PED_FEMALE = 137,
- SOUND_INJURED_PED_MALE_PRISON = 138,
- SOUND_RACE_START_3 = 139,
- SOUND_RACE_START_2 = 140,
- SOUND_RACE_START_1 = 141,
- SOUND_RACE_START_GO = 142,
- SOUND_SPLASH = 143,
- SOUND_WATER_FALL = 144,
- SOUND_SPLATTER = 145,
- SOUND_CAR_PED_COLLISION = 146,
- SOUND_CLOCK_TICK = 147,
- SOUND_PART_MISSION_COMPLETE = 148,
- SOUND_FRONTEND_MENU_STARTING = 149,
- SOUND_FRONTEND_MENU_COMPLETED = 150,
- SOUND_FRONTEND_MENU_DENIED = 151,
- SOUND_FRONTEND_MENU_SUCCESS = 152,
- SOUND_FRONTEND_EXIT = 153,
- SOUND_FRONTEND_STEREO = 154,
- SOUND_FRONTEND_MONO = 155,
- SOUND_FRONTEND_AUDIO_TEST = 156,
- SOUND_FRONTEND_FAIL = 157,
- SOUND_FRONTEND_NO_RADIO = 158,
- SOUND_FRONTEND_RADIO_CHANGE = 159,
- SOUND_A0 = 160,
- SOUND_AMMUNATION_WELCOME_1 = 161,
- SOUND_AMMUNATION_WELCOME_2 = 162,
- SOUND_AMMUNATION_WELCOME_3 = 163,
- SOUND_LIGHTNING = 164,
- SOUND_A5 = 165,
- SOUND_TOTAL_SOUNDS = 166,
- SOUND_TOTAL_PED_SOUNDS = 167,
+ SOUND_CAR_DOOR_CLOSE_BUMPER,
+ SOUND_CAR_DOOR_CLOSE_FRONT_LEFT,
+ SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT,
+ SOUND_CAR_DOOR_CLOSE_BACK_LEFT,
+ SOUND_CAR_DOOR_CLOSE_BACK_RIGHT,
+ SOUND_CAR_DOOR_OPEN_BONNET,
+ SOUND_CAR_DOOR_OPEN_BUMPER,
+ SOUND_CAR_DOOR_OPEN_FRONT_LEFT,
+ SOUND_CAR_DOOR_OPEN_FRONT_RIGHT,
+ SOUND_CAR_DOOR_OPEN_BACK_LEFT,
+ SOUND_CAR_DOOR_OPEN_BACK_RIGHT,
+ SOUND_CAR_WINDSHIELD_CRACK,
+ SOUND_CAR_JUMP,
+ SOUND_E,
+ SOUND_F,
+ SOUND_CAR_ENGINE_START,
+ SOUND_CAR_LIGHT_BREAK,
+ SOUND_CAR_HYDRAULIC_1,
+ SOUND_CAR_HYDRAULIC_2,
+ SOUND_CAR_HYDRAULIC_3,
+ SOUND_CAR_JERK,
+ SOUND_CAR_SPLASH,
+ SOUND_BOAT_SLOWDOWN,
+ SOUND_TRAIN_DOOR_CLOSE,
+ SOUND_TRAIN_DOOR_OPEN,
+ SOUND_CAR_TANK_TURRET_ROTATE,
+ SOUND_CAR_BOMB_TICK,
+ SOUND_PLANE_ON_GROUND,
+ SOUND_STEP_START,
+ SOUND_STEP_END,
+ SOUND_FALL_LAND,
+ SOUND_FALL_COLLAPSE,
+ SOUND_FIGHT_PUNCH_33,
+ SOUND_FIGHT_KICK_34,
+ SOUND_FIGHT_HEADBUTT_35,
+ SOUND_FIGHT_PUNCH_36,
+ SOUND_FIGHT_PUNCH_37,
+ SOUND_FIGHT_CLOSE_PUNCH_38,
+ SOUND_FIGHT_PUNCH_39,
+ SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40,
+ SOUND_FIGHT_PUNCH_41,
+ SOUND_FIGHT_PUNCH_FROM_BEHIND_42,
+ SOUND_FIGHT_KNEE_OR_KICK_43,
+ SOUND_FIGHT_KICK_44,
+ SOUND_2D,
+ SOUND_WEAPON_BAT_ATTACK,
+ SOUND_WEAPON_SHOT_FIRED,
+ SOUND_WEAPON_RELOAD,
+ SOUND_WEAPON_AK47_BULLET_ECHO,
+ SOUND_WEAPON_UZI_BULLET_ECHO,
+ SOUND_WEAPON_M16_BULLET_ECHO,
+ SOUND_WEAPON_FLAMETHROWER_FIRE,
+ SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM,
+ SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM,
+ SOUND_WEAPON_HIT_PED,
+ SOUND_WEAPON_HIT_VEHICLE,
+ SOUND_GARAGE_NO_MONEY,
+ SOUND_GARAGE_BAD_VEHICLE,
+ SOUND_GARAGE_OPENING,
+ SOUND_GARAGE_BOMB_ALREADY_SET,
+ SOUND_GARAGE_BOMB1_SET,
+ SOUND_GARAGE_BOMB2_SET,
+ SOUND_GARAGE_BOMB3_SET,
+ SOUND_40,
+ SOUND_41,
+ SOUND_GARAGE_VEHICLE_DECLINED,
+ SOUND_GARAGE_VEHICLE_ACCEPTED,
+ SOUND_GARAGE_DOOR_CLOSED,
+ SOUND_GARAGE_DOOR_OPENED,
+ SOUND_CRANE_PICKUP,
+ SOUND_PICKUP_WEAPON_BOUGHT,
+ SOUND_PICKUP_WEAPON,
+ SOUND_PICKUP_HEALTH,
+ SOUND_PICKUP_ERROR,
+ SOUND_4B,
+ SOUND_PICKUP_ADRENALINE,
+ SOUND_PICKUP_ARMOUR,
+ SOUND_PICKUP_BONUS,
+ SOUND_PICKUP_MONEY,
+ SOUND_PICKUP_HIDDEN_PACKAGE,
+ SOUND_PICKUP_PACMAN_PILL,
+ SOUND_PICKUP_PACMAN_PACKAGE,
+ SOUND_PICKUP_FLOAT_PACKAGE,
+ SOUND_BOMB_TIMED_ACTIVATED,
+ SOUND_55,
+ SOUND_BOMB_ONIGNITION_ACTIVATED,
+ SOUND_BOMB_TICK,
+ SOUND_RAMPAGE_START,
+ SOUND_RAMPAGE_ONGOING,
+ SOUND_RAMPAGE_PASSED,
+ SOUND_RAMPAGE_FAILED,
+ SOUND_RAMPAGE_KILL,
+ SOUND_RAMPAGE_CAR_BLOWN,
+ SOUND_EVIDENCE_PICKUP,
+ SOUND_UNLOAD_GOLD,
+ SOUND_PAGER,
+ SOUND_PED_DEATH,
+ SOUND_PED_DAMAGE,
+ SOUND_PED_HIT,
+ SOUND_PED_LAND,
+ SOUND_PED_BULLET_HIT,
+ SOUND_PED_BOMBER,
+ SOUND_PED_BURNING,
+ SOUND_PED_ARREST_FBI,
+ SOUND_PED_ARREST_SWAT,
+ SOUND_PED_ARREST_COP,
+ SOUND_PED_HELI_PLAYER_FOUND,
+ SOUND_PED_HANDS_UP,
+ SOUND_PED_HANDS_COWER,
+ SOUND_PED_FLEE_SPRINT,
+ SOUND_PED_CAR_JACKING,
+ SOUND_PED_MUGGING,
+ SOUND_PED_CAR_JACKED,
+ SOUND_PED_ROBBED,
+ SOUND_PED_TAXI_WAIT,
+ SOUND_PED_ATTACK,
+ SOUND_PED_DEFEND,
+ SOUND_PED_PURSUIT_ARMY,
+ SOUND_PED_PURSUIT_FBI,
+ SOUND_PED_PURSUIT_SWAT,
+ SOUND_PED_PURSUIT_COP,
+ SOUND_PED_HEALING,
+ SOUND_PED_7B,
+ SOUND_PED_LEAVE_VEHICLE,
+ SOUND_PED_EVADE,
+ SOUND_PED_FLEE_RUN,
+ SOUND_PED_CAR_COLLISION,
+ SOUND_PED_SOLICIT,
+ SOUND_PED_EXTINGUISHING_FIRE,
+ SOUND_PED_WAIT_DOUBLEBACK,
+ SOUND_PED_CHAT_SEXY,
+ SOUND_PED_CHAT_EVENT,
+ SOUND_PED_CHAT,
+ SOUND_PED_BODYCAST_HIT,
+ SOUND_PED_TAXI_CALL,
+ SOUND_INJURED_PED_MALE_OUCH,
+ SOUND_INJURED_PED_FEMALE,
+ SOUND_INJURED_PED_MALE_PRISON,
+ SOUND_RACE_START_3,
+ SOUND_RACE_START_2,
+ SOUND_RACE_START_1,
+ SOUND_RACE_START_GO,
+ SOUND_SPLASH,
+ SOUND_WATER_FALL,
+ SOUND_SPLATTER,
+ SOUND_CAR_PED_COLLISION,
+ SOUND_CLOCK_TICK,
+ SOUND_PART_MISSION_COMPLETE,
+ SOUND_FRONTEND_MENU_STARTING,
+ SOUND_FRONTEND_MENU_NEW_PAGE,
+ SOUND_FRONTEND_MENU_NAVIGATION,
+ SOUND_FRONTEND_MENU_SETTING_CHANGE,
+ SOUND_FRONTEND_MENU_BACK,
+ SOUND_FRONTEND_STEREO,
+ SOUND_FRONTEND_MONO,
+ SOUND_FRONTEND_AUDIO_TEST,
+ SOUND_FRONTEND_FAIL,
+ SOUND_FRONTEND_NO_RADIO,
+ SOUND_FRONTEND_RADIO_CHANGE,
+ SOUND_HUD,
+ SOUND_AMMUNATION_WELCOME_1,
+ SOUND_AMMUNATION_WELCOME_2,
+ SOUND_AMMUNATION_WELCOME_3,
+ SOUND_LIGHTNING,
+ SOUND_A5,
+ SOUND_TOTAL_SOUNDS,
+ SOUND_NO_SOUND,
};
-enum eScriptSounds : int16 {
+enum eScriptSounds : uint16 {
SCRIPT_SOUND_0 = 0,
- SCRIPT_SOUND_1 = 1,
- SCRIPT_SOUND_2 = 2,
- SCRIPT_SOUND_3 = 3,
- SCRIPT_SOUND_PARTY_1_LOOP_S = 4,
- SCRIPT_SOUND_PARTY_1_LOOP_L = 5,
- SCRIPT_SOUND_PARTY_2_LOOP_S = 6,
- SCRIPT_SOUND_PARTY_2_LOOP_L = 7,
- SCRIPT_SOUND_PARTY_3_LOOP_S = 8,
- SCRIPT_SOUND_PARTY_3_LOOP_L = 9,
- SCRIPT_SOUND_PARTY_4_LOOP_S = 10,
- SCRIPT_SOUND_PARTY_4_LOOP_L = 11,
- SCRIPT_SOUND_PARTY_5_LOOP_S = 12,
- SCRIPT_SOUND_PARTY_5_LOOP_L = 13,
- SCRIPT_SOUND_PARTY_6_LOOP_S = 14,
- SCRIPT_SOUND_PARTY_6_LOOP_L = 15,
- SCRIPT_SOUND_PARTY_7_LOOP_S = 16,
- SCRIPT_SOUND_PARTY_7_LOOP_L = 17,
- SCRIPT_SOUND_PARTY_8_LOOP_S = 18,
- SCRIPT_SOUND_PARTY_8_LOOP_L = 19,
- SCRIPT_SOUND_PARTY_9_LOOP_S = 20,
- SCRIPT_SOUND_PARTY_9_LOOP_L = 21,
- SCRIPT_SOUND_PARTY_10_LOOP_S = 22,
- SCRIPT_SOUND_PARTY_10_LOOP_L = 23,
- SCRIPT_SOUND_PARTY_11_LOOP_S = 24,
- SCRIPT_SOUND_PARTY_11_LOOP_L = 25,
- SCRIPT_SOUND_PARTY_12_LOOP_S = 26,
- SCRIPT_SOUND_PARTY_12_LOOP_L = 27,
- SCRIPT_SOUND_PARTY_13_LOOP_S = 28,
- SCRIPT_SOUND_PARTY_13_LOOP_L = 29,
- SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S = 30,
- SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L = 31,
- SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S = 32,
- SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L = 33,
- SCRIPT_SOUND_WORK_SHOP_LOOP_S = 34,
- SCRIPT_SOUND_WORK_SHOP_LOOP_L = 35,
- SCRIPT_SOUND_SAWMILL_LOOP_S = 36,
- SCRIPT_SOUND_SAWMILL_LOOP_L = 37,
- SCRIPT_SOUND_38 = 38,
- SCRIPT_SOUND_39 = 39,
- SCRIPT_SOUND_LAUNDERETTE_LOOP_S = 40,
- SCRIPT_SOUND_LAUNDERETTE_LOOP_L = 41,
- SCRIPT_SOUND_CHINATOWN_RESTAURANT_S = 42,
- SCRIPT_SOUND_CHINATOWN_RESTAURANT_L = 43,
- SCRIPT_SOUND_CIPRIANI_RESAURANT_S = 44,
- SCRIPT_SOUND_CIPRIANI_RESAURANT_L = 45,
- SCRIPT_SOUND_46_S = 46,
- SCRIPT_SOUND_47_L = 47,
- SCRIPT_SOUND_MARCO_BISTRO_S = 48,
- SCRIPT_SOUND_MARCO_BISTRO_L = 49,
- SCRIPT_SOUND_AIRPORT_LOOP_S = 50,
- SCRIPT_SOUND_AIRPORT_LOOP_L = 51,
- SCRIPT_SOUND_SHOP_LOOP_S = 52,
- SCRIPT_SOUND_SHOP_LOOP_L = 53,
- SCRIPT_SOUND_CINEMA_LOOP_S = 54,
- SCRIPT_SOUND_CINEMA_LOOP_L = 55,
- SCRIPT_SOUND_DOCKS_LOOP_S = 56,
- SCRIPT_SOUND_DOCKS_LOOP_L = 57,
- SCRIPT_SOUND_HOME_LOOP_S = 58,
- SCRIPT_SOUND_HOME_LOOP_L = 59,
- SCRIPT_SOUND_FRANKIE_PIANO = 60,
- SCRIPT_SOUND_PARTY_1_LOOP = 61,
- SCRIPT_SOUND_PORN_CINEMA_1_S = 62,
- SCRIPT_SOUND_PORN_CINEMA_1_L = 63,
- SCRIPT_SOUND_PORN_CINEMA_2_S = 64,
- SCRIPT_SOUND_PORN_CINEMA_2_L = 65,
- SCRIPT_SOUND_PORN_CINEMA_3_S = 66,
- SCRIPT_SOUND_PORN_CINEMA_3_L = 67,
- SCRIPT_SOUND_BANK_ALARM_LOOP_S = 68,
- SCRIPT_SOUND_BANK_ALARM_LOOP_L = 69,
- SCRIPT_SOUND_POLICE_BALL_LOOP_S = 70,
- SCRIPT_SOUND_POLICE_BALL_LOOP_L = 71,
- SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S = 72,
- SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L = 73,
- SCRIPT_SOUND_74 = 74,
- SCRIPT_SOUND_75 = 75,
- SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S = 76,
- SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L = 77,
- SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S = 78,
- SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L = 79,
- SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S = 80,
- SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L = 81,
- SCRIPT_SOUND_EVIDENCE_PICKUP = 82,
- SCRIPT_SOUND_UNLOAD_GOLD = 83,
- SCRIPT_SOUND_RAVE_1_LOOP_S = 84,
- SCRIPT_SOUND_RAVE_1_LOOP_L = 85,
- SCRIPT_SOUND_RAVE_2_LOOP_S = 86,
- SCRIPT_SOUND_RAVE_2_LOOP_L = 87,
- SCRIPT_SOUND_RAVE_3_LOOP_S = 88,
- SCRIPT_SOUND_RAVE_3_LOOP_L = 89,
- SCRIPT_SOUND_MISTY_SEX_S = 90,
- SCRIPT_SOUND_MISTY_SEX_L = 91,
- SCRIPT_SOUND_GATE_START_CLUNK = 92,
- SCRIPT_SOUND_GATE_STOP_CLUNK = 93,
- SCRIPT_SOUND_PART_MISSION_COMPLETE = 94,
- SCRIPT_SOUND_CHUNKY_RUN_SHOUT = 95,
- SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT = 96,
- SCRIPT_SOUND_RACE_START_3 = 97,
- SCRIPT_SOUND_RACE_START_2 = 98,
- SCRIPT_SOUND_RACE_START_1 = 99,
- SCRIPT_SOUND_RACE_START_GO = 100,
- SCRIPT_SOUND_SWAT_PED_SHOUT = 101,
- SCRIPT_SOUND_PRETEND_FIRE_LOOP = 102,
- SCRIPT_SOUND_AMMUNATION_CHAT_1 = 103,
- SCRIPT_SOUND_AMMUNATION_CHAT_2 = 104,
- SCRIPT_SOUND_AMMUNATION_CHAT_3 = 105,
- SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106,
- SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107,
- SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108,
- SCRIPT_SOUND_BULLET_HIT_WATER = 109, //no sound
- SCRIPT_SOUND_110 = 110,
- SCRIPT_SOUND_111 = 111,
- SCRIPT_SOUND_PAYPHONE_RINGING = 112,
- SCRIPT_SOUND_113 = 113,
- SCRIPT_SOUND_GLASS_BREAK_L = 114,
- SCRIPT_SOUND_GLASS_BREAK_S = 115,
- SCRIPT_SOUND_GLASS_CRACK = 116,
- SCRIPT_SOUND_GLASS_LIGHT_BREAK = 117,
- SCRIPT_SOUND_BOX_DESTROYED_1 = 118,
- SCRIPT_SOUND_BOX_DESTROYED_2 = 119,
- SCRIPT_SOUND_METAL_COLLISION = 120,
- SCRIPT_SOUND_TIRE_COLLISION = 121,
- SCRIPT_SOUND_GUNSHELL_DROP = 122,
- SCRIPT_SOUND_GUNSHELL_DROP_SOFT = 123,
+ SCRIPT_SOUND_1,
+ SCRIPT_SOUND_2,
+ SCRIPT_SOUND_3,
+ SCRIPT_SOUND_PARTY_1_LOOP_S,
+ SCRIPT_SOUND_PARTY_1_LOOP_L,
+ SCRIPT_SOUND_PARTY_2_LOOP_S,
+ SCRIPT_SOUND_PARTY_2_LOOP_L,
+ SCRIPT_SOUND_PARTY_3_LOOP_S,
+ SCRIPT_SOUND_PARTY_3_LOOP_L,
+ SCRIPT_SOUND_PARTY_4_LOOP_S,
+ SCRIPT_SOUND_PARTY_4_LOOP_L,
+ SCRIPT_SOUND_PARTY_5_LOOP_S,
+ SCRIPT_SOUND_PARTY_5_LOOP_L,
+ SCRIPT_SOUND_PARTY_6_LOOP_S,
+ SCRIPT_SOUND_PARTY_6_LOOP_L,
+ SCRIPT_SOUND_PARTY_7_LOOP_S,
+ SCRIPT_SOUND_PARTY_7_LOOP_L,
+ SCRIPT_SOUND_PARTY_8_LOOP_S,
+ SCRIPT_SOUND_PARTY_8_LOOP_L,
+ SCRIPT_SOUND_PARTY_9_LOOP_S,
+ SCRIPT_SOUND_PARTY_9_LOOP_L,
+ SCRIPT_SOUND_PARTY_10_LOOP_S,
+ SCRIPT_SOUND_PARTY_10_LOOP_L,
+ SCRIPT_SOUND_PARTY_11_LOOP_S,
+ SCRIPT_SOUND_PARTY_11_LOOP_L,
+ SCRIPT_SOUND_PARTY_12_LOOP_S,
+ SCRIPT_SOUND_PARTY_12_LOOP_L,
+ SCRIPT_SOUND_PARTY_13_LOOP_S,
+ SCRIPT_SOUND_PARTY_13_LOOP_L,
+ SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S,
+ SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L,
+ SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S,
+ SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L,
+ SCRIPT_SOUND_WORK_SHOP_LOOP_S,
+ SCRIPT_SOUND_WORK_SHOP_LOOP_L,
+ SCRIPT_SOUND_SAWMILL_LOOP_S,
+ SCRIPT_SOUND_SAWMILL_LOOP_L,
+ SCRIPT_SOUND_38,
+ SCRIPT_SOUND_39,
+ SCRIPT_SOUND_LAUNDERETTE_LOOP_S,
+ SCRIPT_SOUND_LAUNDERETTE_LOOP_L,
+ SCRIPT_SOUND_CHINATOWN_RESTAURANT_S,
+ SCRIPT_SOUND_CHINATOWN_RESTAURANT_L,
+ SCRIPT_SOUND_CIPRIANI_RESAURANT_S,
+ SCRIPT_SOUND_CIPRIANI_RESAURANT_L,
+ SCRIPT_SOUND_46_S,
+ SCRIPT_SOUND_47_L,
+ SCRIPT_SOUND_MARCO_BISTRO_S,
+ SCRIPT_SOUND_MARCO_BISTRO_L,
+ SCRIPT_SOUND_AIRPORT_LOOP_S,
+ SCRIPT_SOUND_AIRPORT_LOOP_L,
+ SCRIPT_SOUND_SHOP_LOOP_S,
+ SCRIPT_SOUND_SHOP_LOOP_L,
+ SCRIPT_SOUND_CINEMA_LOOP_S,
+ SCRIPT_SOUND_CINEMA_LOOP_L,
+ SCRIPT_SOUND_DOCKS_LOOP_S,
+ SCRIPT_SOUND_DOCKS_LOOP_L,
+ SCRIPT_SOUND_HOME_LOOP_S,
+ SCRIPT_SOUND_HOME_LOOP_L,
+ SCRIPT_SOUND_FRANKIE_PIANO,
+ SCRIPT_SOUND_PARTY_1_LOOP,
+ SCRIPT_SOUND_PORN_CINEMA_1_S,
+ SCRIPT_SOUND_PORN_CINEMA_1_L,
+ SCRIPT_SOUND_PORN_CINEMA_2_S,
+ SCRIPT_SOUND_PORN_CINEMA_2_L,
+ SCRIPT_SOUND_PORN_CINEMA_3_S,
+ SCRIPT_SOUND_PORN_CINEMA_3_L,
+ SCRIPT_SOUND_BANK_ALARM_LOOP_S,
+ SCRIPT_SOUND_BANK_ALARM_LOOP_L,
+ SCRIPT_SOUND_POLICE_BALL_LOOP_S,
+ SCRIPT_SOUND_POLICE_BALL_LOOP_L,
+ SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S,
+ SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L,
+ SCRIPT_SOUND_74,
+ SCRIPT_SOUND_75,
+ SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S,
+ SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L,
+ SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S,
+ SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L,
+ SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S,
+ SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L,
+ SCRIPT_SOUND_EVIDENCE_PICKUP,
+ SCRIPT_SOUND_UNLOAD_GOLD,
+ SCRIPT_SOUND_RAVE_1_LOOP_S,
+ SCRIPT_SOUND_RAVE_1_LOOP_L,
+ SCRIPT_SOUND_RAVE_2_LOOP_S,
+ SCRIPT_SOUND_RAVE_2_LOOP_L,
+ SCRIPT_SOUND_RAVE_3_LOOP_S,
+ SCRIPT_SOUND_RAVE_3_LOOP_L,
+ SCRIPT_SOUND_MISTY_SEX_S,
+ SCRIPT_SOUND_MISTY_SEX_L,
+ SCRIPT_SOUND_GATE_START_CLUNK,
+ SCRIPT_SOUND_GATE_STOP_CLUNK,
+ SCRIPT_SOUND_PART_MISSION_COMPLETE,
+ SCRIPT_SOUND_CHUNKY_RUN_SHOUT,
+ SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT,
+ SCRIPT_SOUND_RACE_START_3,
+ SCRIPT_SOUND_RACE_START_2,
+ SCRIPT_SOUND_RACE_START_1,
+ SCRIPT_SOUND_RACE_START_GO,
+ SCRIPT_SOUND_SWAT_PED_SHOUT,
+ SCRIPT_SOUND_PRETEND_FIRE_LOOP,
+ SCRIPT_SOUND_AMMUNATION_CHAT_1,
+ SCRIPT_SOUND_AMMUNATION_CHAT_2,
+ SCRIPT_SOUND_AMMUNATION_CHAT_3,
+ SCRIPT_SOUND_BULLET_HIT_GROUND_1,
+ SCRIPT_SOUND_BULLET_HIT_GROUND_2,
+ SCRIPT_SOUND_BULLET_HIT_GROUND_3,
+ SCRIPT_SOUND_BULLET_HIT_WATER, // no sound
+ SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1,
+ SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2,
+ SCRIPT_SOUND_PAYPHONE_RINGING,
+ SCRIPT_SOUND_113,
+ SCRIPT_SOUND_GLASS_BREAK_L,
+ SCRIPT_SOUND_GLASS_BREAK_S,
+ SCRIPT_SOUND_GLASS_CRACK,
+ SCRIPT_SOUND_GLASS_LIGHT_BREAK,
+ SCRIPT_SOUND_BOX_DESTROYED_1,
+ SCRIPT_SOUND_BOX_DESTROYED_2,
+ SCRIPT_SOUND_METAL_COLLISION,
+ SCRIPT_SOUND_TIRE_COLLISION,
+ SCRIPT_SOUND_GUNSHELL_DROP,
+ SCRIPT_SOUND_GUNSHELL_DROP_SOFT,
+ SCRIPT_SOUND_TOTAL,
+ SCRIPT_SOUND_INVALID,
};
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index cd86ce4c..5db674cd 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -463,10 +463,6 @@ CCarCtrl::GenerateOneRandomCar()
directionNextLinkY = pNextLink->GetDirY() * pVehicle->AutoPilot.m_nNextDirection;
}
#else
- float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirX();
- float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirY();
- float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirX();
- float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirY();
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
@@ -988,13 +984,15 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
if (pVehicle->GetModelIndex() == MI_RCBANDIT){
if (dotVelocity * GAME_SPEED_TO_METERS_PER_SECOND / 2 > distanceUntilHit)
pPed->SetEvasiveStep(pVehicle, 0);
- }else if (dotVelocity > 0.3f){
- if (sideLength - 0.5f < sidewaysDistance)
+ }
+ else if (dotVelocity > 0.3f) {
+ if (sideLength + 0.1f < sidewaysDistance)
pPed->SetEvasiveStep(pVehicle, 0);
else
pPed->SetEvasiveDive(pVehicle, 0);
- }else{
- if (sideLength + 0.1f < sidewaysDistance)
+ }
+ else if (dotVelocity > 0.1f) {
+ if (sideLength - 0.5f < sidewaysDistance)
pPed->SetEvasiveStep(pVehicle, 0);
else
pPed->SetEvasiveDive(pVehicle, 0);
@@ -1023,7 +1021,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
CPlayerPed* pPlayerPed = (CPlayerPed*)pPed;
if (pPlayerPed->IsPlayer() && dotDirection < frontSafe &&
pPlayerPed->IsPedInControl() &&
- pPlayerPed->m_fMoveSpeed < 0.1f && pPlayerPed->bIsLooking &&
+ pPlayerPed->m_fMoveSpeed < 1.0f && !pPlayerPed->bIsLooking &&
CTimer::GetTimeInMilliseconds() > pPlayerPed->m_lookTimer) {
pPlayerPed->AnnoyPlayerPed(false);
pPlayerPed->SetLookFlag(pVehicle, true);
@@ -1647,12 +1645,18 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
if (pVehicle->AutoPilot.m_bStayInFastLane)
pVehicle->AutoPilot.m_nNextLane = 0;
CVector positionOnCurrentLinkIncludingLane(
- pCurLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH)
+#ifdef FIX_BUGS
+ * currentPathLinkForwardY
+#endif
+ ,pCurLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->GetX() + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->GetY() - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->GetX() + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH)
+#ifdef FIX_BUGS
+ * nextPathLinkForwardY
+#endif
+ ,pNextLink->GetY() - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
float directionCurrentLinkX = pCurLink->GetDirX() * pVehicle->AutoPilot.m_nCurrentDirection;
float directionCurrentLinkY = pCurLink->GetDirY() * pVehicle->AutoPilot.m_nCurrentDirection;
diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp
index 9c3c4982..04983e30 100644
--- a/src/control/GameLogic.cpp
+++ b/src/control/GameLogic.cpp
@@ -83,12 +83,20 @@ CGameLogic::Update()
}
break;
case WBSTATE_WASTED:
+#ifdef MISSION_REPLAY
+ if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) {
+#else
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
+#endif
TheCamera.SetFadeColour(200, 200, 200);
TheCamera.Fade(2.0f, FADE_OUT);
}
+#ifdef MISSION_REPLAY
+ if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) {
+#else
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
+#endif
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
if (pPlayerInfo.m_bGetOutOfHospitalFree) {
pPlayerInfo.m_bGetOutOfHospitalFree = false;
@@ -131,11 +139,19 @@ CGameLogic::Update()
}
break;
case WBSTATE_BUSTED:
+#ifdef MISSION_REPLAY
+ if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) {
+#else
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
+#endif
TheCamera.SetFadeColour(0, 0, 0);
TheCamera.Fade(2.0f, FADE_OUT);
}
+#ifdef MISSION_REPLAY
+ if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) {
+#else
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
+#endif
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
int takeMoney;
@@ -203,11 +219,19 @@ CGameLogic::Update()
}
break;
case WBSTATE_FAILED_CRITICAL_MISSION:
- if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800 && CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800) {
+#ifdef MISSION_REPLAY
+ if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) {
+#else
+ if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
+#endif
TheCamera.SetFadeColour(0, 0, 0);
TheCamera.Fade(2.0f, FADE_OUT);
}
+#ifdef MISSION_REPLAY
+ if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) {
+#else
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
+#endif
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
if (pPlayerInfo.m_pPed->bInVehicle) {
CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle;
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 5fc44974..e37df8d4 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -1853,7 +1853,14 @@ CVehicle* CStoredCar::RestoreCar()
CStreaming::RequestModel(m_nModelIndex, STREAMFLAGS_DEPENDENCY);
if (!CStreaming::HasModelLoaded(m_nModelIndex))
return nil;
- CVehicleModelInfo::SetComponentsToUse(m_nVariationA, m_nVariationB);
+#ifdef FIX_BUGS
+ CVehicleModelInfo* pModelInfo = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex);
+ assert(pModelInfo);
+ if (pModelInfo->m_numComps != 0)
+#endif
+ {
+ CVehicleModelInfo::SetComponentsToUse(m_nVariationA, m_nVariationB);
+ }
#ifdef FIX_BUGS
CVehicle* pVehicle;
if (CModelInfo::IsBoatModel(m_nModelIndex))
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index ee15b82f..46895678 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -404,11 +404,10 @@ CPathFind::PreparePathData(void)
maxX = 0.0f;
maxY = 0.0f;
for(j = 0; j < 12; j++){
- k = i*12 + j;
+ k = m_mapObjects[i]->GetModelIndex()*12 + j;
if(InfoForTileCars[k].type == NodeTypeExtern){
numExtern++;
- if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes)
- numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes;
+ numLanes = Max(numLanes, InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes);
maxX = Max(maxX, Abs(InfoForTileCars[k].x));
maxY = Max(maxY, Abs(InfoForTileCars[k].y));
}else if(InfoForTileCars[k].type == NodeTypeIntern)
@@ -417,7 +416,7 @@ CPathFind::PreparePathData(void)
if(numIntern == 1 && numExtern == 2){
if(numLanes < 4){
- if((i & 7) == 4){ // WHAT?
+ if((i & 7) == 4){ // 1/8 probability
m_objectFlags[i] |= UseInRoadBlock;
if(maxX > maxY)
m_objectFlags[i] |= ObjectEastWest;
diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp
index ee01b6c4..b89641f9 100644
--- a/src/control/Phones.cpp
+++ b/src/control/Phones.cpp
@@ -12,6 +12,7 @@
#include "AudioScriptObject.h"
#include "RpAnimBlend.h"
#include "AnimBlendAssociation.h"
+#include "soundlist.h"
#ifdef FIX_BUGS
#include "Replay.h"
#endif
@@ -65,7 +66,7 @@ CPhoneInfo::Update(void)
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
endAssoc->SetFinishCallback(PhonePutDownCB, player);
} else {
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
if (player->m_nPedState == PED_MAKE_CALL)
player->m_nPedState = PED_IDLE;
}
@@ -97,7 +98,7 @@ CPhoneInfo::Update(void)
if (scratchTheCabinet) {
m_aPhones[phoneId].m_pEntity->GetUp().z = (CGeneral::GetRandomNumber() % 1024) / 16000.0f + 1.0f;
if (!phoneRings)
- PlayOneShotScriptObject(_SCRSOUND_PHONE_RING, m_aPhones[phoneId].m_pEntity->GetPosition());
+ PlayOneShotScriptObject(SCRIPT_SOUND_PAYPHONE_RINGING, m_aPhones[phoneId].m_pEntity->GetPosition());
} else {
m_aPhones[phoneId].m_pEntity->GetUp().z = 1.0f;
}
@@ -115,7 +116,7 @@ CPhoneInfo::Update(void)
player->m_fRotationDest = angleToFace;
player->SetHeading(angleToFace);
player->m_nPedState = PED_MAKE_CALL;
- CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_40;
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
TheCamera.SetWideScreenOn();
playerInfo->MakePlayerSafe(true);
CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f);
@@ -136,7 +137,7 @@ CPhoneInfo::Update(void)
if (scratchTheCabinet) {
m_aPhones[phoneId].m_pEntity->GetUp().z = (CGeneral::GetRandomNumber() % 1024) / 16000.0f + 1.0f;
if (!phoneRings)
- PlayOneShotScriptObject(_SCRSOUND_PHONE_RING, m_aPhones[phoneId].m_pEntity->GetPosition());
+ PlayOneShotScriptObject(SCRIPT_SOUND_PAYPHONE_RINGING, m_aPhones[phoneId].m_pEntity->GetPosition());
} else {
m_aPhones[phoneId].m_pEntity->GetUp().z = 1.0f;
}
@@ -339,7 +340,7 @@ PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg)
{
assoc->flags |= ASSOC_DELETEFADEDOUT;
assoc->blendDelta = -1000.0f;
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
CPed *ped = (CPed*)arg;
if (assoc->blendAmount > 0.5f)
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index 572f8134..ee9ec17e 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -132,58 +132,58 @@ CRoadBlocks::GenerateRoadBlocks(void)
CColModel *pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel();
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
int16 radius = (int16)(fMapObjectRadius / fModelRadius);
- if (radius > 0 && radius < 6) {
- CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition();
- float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward());
- float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
- for (int16 i = 0; i < radius; i++) {
- uint8 nRoadblockType = fDotProduct < 0.0f;
- if (CGeneral::GetRandomNumber() & 1) {
- offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI);
+ if (radius >= 6)
+ continue;
+ CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition();
+ float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward());
+ float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
+ for (int16 i = 0; i < radius; i++) {
+ uint8 nRoadblockType = fDotProduct < 0.0f;
+ if (CGeneral::GetRandomNumber() & 1) {
+ offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI);
+ }
+ else {
+ nRoadblockType = !nRoadblockType;
+ offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI);
+ }
+ if (ThePaths.m_objectFlags[RoadBlockObjects[nRoadblockNode]] & ObjectEastWest)
+ offsetMatrix.GetPosition() = CVector(0.0f, i * fModelRadius - fOffset, 0.6f);
+ else
+ offsetMatrix.GetPosition() = CVector(i * fModelRadius - fOffset, 0.0f, 0.6f);
+ CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix;
+ float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
+ int16 colliding = 0;
+ CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
+ if (!colliding) {
+ CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE);
+ pVehicle->SetStatus(STATUS_ABANDONED);
+ // pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
+ vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
+ pVehicle->m_matrix = vehicleMatrix;
+ pVehicle->PlaceOnRoadProperly();
+ pVehicle->bIsStatic = false;
+ pVehicle->m_matrix.UpdateRW();
+ pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
+ CCarCtrl::JoinCarWithRoadSystem(pVehicle);
+ pVehicle->bIsLocked = false;
+ pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
+ pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
+ pVehicle->AutoPilot.m_nCurrentLane = 0;
+ pVehicle->AutoPilot.m_nNextLane = 0;
+ pVehicle->AutoPilot.m_fMaxTrafficSpeed = 0.0f;
+ pVehicle->AutoPilot.m_nCruiseSpeed = 0.0f;
+ pVehicle->bExtendedRange = true;
+ if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
+ pVehicle->m_bSirenOrAlarm = true;
+ if (pVehicle->GetUp().z > 0.94f) {
+ CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
+ CWorld::Add(pVehicle);
+ pVehicle->bCreateRoadBlockPeds = true;
+ pVehicle->m_nRoadblockType = nRoadblockType;
+ pVehicle->m_nRoadblockNode = nRoadblockNode;
}
else {
- nRoadblockType = !nRoadblockType;
- offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI);
- }
- if (ThePaths.m_objectFlags[RoadBlockObjects[nRoadblockNode]] & ObjectEastWest)
- offsetMatrix.GetPosition() = CVector(0.0f, -fOffset, 0.6f);
- else
- offsetMatrix.GetPosition() = CVector(-fOffset, 0.0f, 0.6f);
- CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix;
- float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
- int16 colliding = 0;
- CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
- if (!colliding) {
- CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE);
- pVehicle->SetStatus(STATUS_ABANDONED);
- // pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
- vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
- pVehicle->m_matrix = vehicleMatrix;
- pVehicle->PlaceOnRoadProperly();
- pVehicle->bIsStatic = false;
- pVehicle->m_matrix.UpdateRW();
- pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
- CCarCtrl::JoinCarWithRoadSystem(pVehicle);
- pVehicle->bIsLocked = false;
- pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
- pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
- pVehicle->AutoPilot.m_nCurrentLane = 0;
- pVehicle->AutoPilot.m_nNextLane = 0;
- pVehicle->AutoPilot.m_fMaxTrafficSpeed = 0.0f;
- pVehicle->AutoPilot.m_nCruiseSpeed = 0.0f;
- pVehicle->bExtendedRange = true;
- if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
- pVehicle->m_bSirenOrAlarm = true;
- if (pVehicle->GetForward().z > 0.94f) {
- CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
- CWorld::Add(pVehicle);
- pVehicle->bCreateRoadBlockPeds = true;
- pVehicle->m_nRoadblockType = nRoadblockType;
- pVehicle->m_nRoadblockNode = nRoadblockNode;
- }
- else {
- delete pVehicle;
- }
+ delete pVehicle;
}
}
}
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 357436c6..934571ef 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1,4 +1,3 @@
-#define WITHWINDOWS // for our script loading hack
#include "common.h"
#include "Script.h"
@@ -18,6 +17,7 @@
#include "Cranes.h"
#include "Credits.h"
#include "CutsceneMgr.h"
+#include "Debug.h"
#include "DMAudio.h"
#include "Darkel.h"
#include "EmergencyPed.h"
@@ -28,6 +28,9 @@
#include "Gangs.h"
#include "Garages.h"
#include "General.h"
+#ifdef MISSION_REPLAY
+#include "GenericGameStorage.h"
+#endif
#include "HandlingMgr.h"
#include "Heli.h"
#include "Hud.h"
@@ -67,6 +70,9 @@
#include "World.h"
#include "Zones.h"
#include "main.h"
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+#include <stdarg.h>
+#endif
#define PICKUP_PLACEMENT_OFFSET 0.5f
#define PED_FIND_Z_OFFSET 5.0f
@@ -128,6 +134,1245 @@ uint16 CTheScripts::CommandsExecuted;
uint16 CTheScripts::ScriptsUpdated;
int32 ScriptParams[32];
+#ifdef MISSION_REPLAY
+
+static const char* nonMissionScripts[] = {
+ "copcar",
+ "ambulan",
+ "taxi",
+ "firetru",
+ "rampage",
+ "t4x4_1",
+ "t4x4_2",
+ "t4x4_3",
+ "rc1",
+ "rc2",
+ "rc3",
+ "rc4",
+ "hj",
+ "usj",
+ "mayhem"
+};
+
+int AllowMissionReplay;
+uint32 NextMissionDelay;
+uint32 MissionStartTime;
+uint32 WaitForMissionActivate;
+uint32 WaitForSave;
+float oldTargetX;
+float oldTargetY;
+int missionRetryScriptIndex;
+bool doingMissionRetry;
+
+#endif
+
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+
+#define REGISTER_COMMAND(command, in, out, cond, ovrd, visual) { command, #command, in, out, cond, ovrd, visual }
+#define INPUT_ARGUMENTS(...) { __VA_ARGS__ ARGTYPE_NONE }
+#define OUTPUT_ARGUMENTS(...) { __VA_ARGS__ ARGTYPE_NONE }
+const tScriptCommandData commands[] = {
+ REGISTER_COMMAND(COMMAND_NOP, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_WAIT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GOTO, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SHAKE_CAM, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_ADD_VAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_VAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_VAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_VAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_SUB_VAL_FROM_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_VAL_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_VAL_FROM_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_VAL_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_MULT_INT_VAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_FLOAT_VAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_INT_LVAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_FLOAT_LVAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_DIV_INT_VAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_FLOAT_VAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_INT_LVAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_FLOAT_LVAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_THAN_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_THAN_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_THAN_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_THAN_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_THAN_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_THAN_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_THAN_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_THAN_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_THAN_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_THAN_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_THAN_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_THAN_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_NOT_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_NOT_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_NOT_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_INT_LVAR_NOT_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_INT_VAR_NOT_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="),
+ REGISTER_COMMAND(COMMAND_GOTO_IF_TRUE, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GOTO_IF_FALSE, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_TERMINATE_THIS_SCRIPT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_NEW_SCRIPT, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GOSUB, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RETURN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LINE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_INT_VAR_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_FLOAT_VAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_INT_LVAR_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_FLOAT_LVAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_INT_VAR_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_FLOAT_VAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_INT_LVAR_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_ADD_FLOAT_LVAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="),
+ REGISTER_COMMAND(COMMAND_SUB_INT_VAR_FROM_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_FLOAT_VAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_INT_LVAR_FROM_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_INT_VAR_FROM_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_FLOAT_VAR_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_INT_LVAR_FROM_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="),
+ REGISTER_COMMAND(COMMAND_MULT_INT_VAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_FLOAT_VAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_INT_LVAR_BY_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_INT_VAR_BY_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_INT_LVAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="),
+ REGISTER_COMMAND(COMMAND_DIV_INT_VAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_FLOAT_VAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_INT_LVAR_BY_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_INT_VAR_BY_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_INT_LVAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="),
+ REGISTER_COMMAND(COMMAND_ADD_TIMED_VAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_ADD_TIMED_VAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_SUB_TIMED_VAL_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_SUB_TIMED_VAL_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"),
+ REGISTER_COMMAND(COMMAND_SET_VAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_VAR_FLOAT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_LVAR_FLOAT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ REGISTER_COMMAND(COMMAND_SET_VAR_INT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
+ 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_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_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"),
+ REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
+ REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DELETE_CHAR, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHAR_WANDER_DIR, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHAR_WANDER_RANGE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHAR_FOLLOW_PATH, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHAR_SET_IDLE, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CHAR_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_STILL_ALIVE, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DELETE_CAR, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CAR_GOTO_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CAR_WANDER_RANDOMLY, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CAR_SET_IDLE, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAR_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_STILL_ALIVE, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_CRUISE_SPEED, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_DRIVING_STYLE, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_MISSION, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SPECIAL_0, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SPECIAL_1, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SPECIAL_2, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SPECIAL_3, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SPECIAL_4, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SPECIAL_5, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SPECIAL_6, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SPECIAL_7, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_PRINTS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_TIME_OF_DAY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TIME_OF_DAY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_MINUTES_TO_TIME_OF_DAY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_POINT_ON_SCREEN, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_DEBUG_ON, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DEBUG_OFF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RETURN_TRUE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RETURN_FALSE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_VAR_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_VAR_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LVAR_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LVAR_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LBRACKET, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RBRACKET, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REPEAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ENDREPEAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IFNOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ELSE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ENDIF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_WHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_WHILENOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ENDWHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ANDOR, INPUT_ARGUMENTS(ARGTYPE_ANDOR,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LAUNCH_MISSION, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MISSION_HAS_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_CAR_CHAR_IS_IN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_CAR_PLAYER_IS_IN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_BUTTON_PRESSED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_PAD_STATE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_ANY_MEANS_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_ANY_MEANS_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_DELETE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_SCORE_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GIVE_REMOTE_CONTROLLED_CAR_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ALTER_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ALTER_WANTED_LEVEL_NO_DROP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_WANTED_LEVEL_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_DEATHARREST_STATE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_DEATHARREST_BEEN_EXECUTED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_AMMO_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_AMMO_TO_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_AMMO_TO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STILL_ALIVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_DEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_DEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_DEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_THREAT_SEARCH, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_THREAT_REACTION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_NO_OBJ, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ORDER_DRIVER_OUT_OF_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ORDER_CHAR_TO_DRIVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_PATROL_POINT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_GANGZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_PRESSING_HORN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CHAR_SPOTTED_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_ORDER_CHAR_TO_BACKDOOR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_CHAR_TO_GANG, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_OBJECTIVE_PASSED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_DRIVE_AGGRESSION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_MAX_DRIVESPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_CHAR_INSIDE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_WARP_PLAYER_FROM_CAR_TO_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MAKE_CHAR_DO_NOTHING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_INVINCIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_INVINCIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_GRAPHIC_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_GRAPHIC_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_PLAYER_BEEN_ARRESTED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_STOP_CHAR_DRIVING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_KILL_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FAVOURITE_CAR_MODEL_FOR_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OCCUPATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHANGE_CAR_LOCK, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SHAKE_CAM_WITH_POINT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_REMAP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CAR_JUST_SUNK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_NO_COLLIDE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_DEAD_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_DEAD_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_TRAILER_ATTACHED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_ON_TRAILER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CAR_GOT_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_PARK, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_PARK_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_KILL_ALL_PASSENGERS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_BULLETPROOF, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_FLAMEPROOF, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_ROCKETPROOF, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CARBOMB_ACTIVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GIVE_CAR_ALARM, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PUT_CAR_ON_TRAILER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_CRUSHED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_GANG_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_CAR_GENERATOR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_CAR_GENERATOR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_PAGER_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_COUNTER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_ONSCREEN_COUNTER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ZONE_CAR_INFO, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_GANG_ZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_DENSITY, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PED_DENSITY, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_POINT_CAMERA_AT_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_POINT_CAMERA_AT_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_POINT_CAMERA_AT_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RESTORE_CAMERA, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SHAKE_PAD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ZONE_PED_INFO, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TIME_SCALE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_IN_AIR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FIXED_CAMERA_POSITION, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_POINT_CAMERA_AT_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CAR_OLD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CHAR_OLD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_OBJECT_OLD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_BLIP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHANGE_BLIP_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DIM_BLIP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_COORD_OLD, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHANGE_BLIP_SCALE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FADING_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DO_FADE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_FADING_STATUS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_HOSPITAL_RESTART, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_POLICE_RESTART, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_OVERRIDE_NEXT_RESTART, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DRAW_SHADOW, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_PLAYER_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CHAR_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAR_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_OBJECT_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_OBJECT_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_TOUCHING_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_TOUCHING_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_AMMO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_AMMO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_AMMO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_CAMERA_SPLINE, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MOVE_CAMERA_ALONG_SPLINE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAMERA_POSITION_ALONG_SPLINE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DECLARE_MISSION_FLAG, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DECLARE_MISSION_FLAG_FOR_CONTACT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DECLARE_BASE_BRIEF_ID_FOR_CONTACT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_HEALTH_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_HEALTH_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_HEALTH_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CONTACT_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_COORD, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHANGE_BLIP_DISPLAY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_ONE_OFF_SOUND, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_CONTINUOUS_SOUND, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_SOUND, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_STUCK_ON_ROOF, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_UPSIDEDOWN_CAR_CHECK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_UPSIDEDOWN_CAR_CHECK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_WAIT_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GUARD_SPOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GUARD_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_WAIT_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_STOPPED_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_STOPPED_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GIVE_WEAPON_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GIVE_WEAPON_TO_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GIVE_WEAPON_TO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_CONTROL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FORCE_WEATHER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FORCE_WEATHER_NOW, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RELEASE_WEATHER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CURRENT_PLAYER_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CURRENT_CHAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CURRENT_CAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_OBJECT_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_OBJECT_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_GAME_TIMER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_TURN_CHAR_TO_FACE_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_TURN_PLAYER_TO_FACE_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_STOPPED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_MARK_CHAR_AS_NO_LONGER_NEEDED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MARK_CAR_AS_NO_LONGER_NEEDED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MARK_OBJECT_AS_NO_LONGER_NEEDED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DONT_REMOVE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DONT_REMOVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DONT_REMOVE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_CHAR_AS_PASSENGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_KILL_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_KILL_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_KILL_CHAR_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_KILL_PLAYER_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_LEAVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_PASSENGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_DRIVER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_DESTROY_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_DESTROY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_AREA_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_AREA_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GUARD_ATTACK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_AS_LEADER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_AS_LEADER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LEAVE_GROUP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_ROUTE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_ROUTE_POINT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_ROADS_ON, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_ROADS_OFF, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_PASSENGERS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_MAXIMUM_NUMBER_OF_PASSENGERS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_DENSITY_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_HEAVY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_CHAR_THREAT_SEARCH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ACTIVATE_CRANE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DEACTIVATE_CRANE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_MAX_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SAVE_VAR_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SAVE_VAR_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_IN_AIR_PROPER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_UPSIDEDOWN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_PLAYER_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CANCEL_OVERRIDE_RESTART, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_POLICE_IGNORE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_PAGER_MESSAGE_WITH_NUMBER, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_KILL_FRENZY, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_READ_KILL_FRENZY_STATUS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SQRT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_FLOAT_IN_RANGE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_INT_IN_RANGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCK_CAR_DOORS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_EXPLODE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_EXPLOSION, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_UPRIGHT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_TURN_CHAR_TO_FACE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_TURN_CHAR_TO_FACE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_TURN_PLAYER_TO_FACE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_COORD_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_COORD_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_PICKUP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_PICKUP_BEEN_COLLECTED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_PICKUP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TAXI_LIGHTS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_BIG_Q, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER_BIG_Q, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GARAGE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GARAGE_WITH_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TARGET_CAR_FOR_MISSION_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_IN_MISSION_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FREE_BOMBS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_POWERPOINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ALL_TAXI_LIGHTS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_ARMED_WITH_ANY_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_APPLY_BRAKES_TO_PLAYERS_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_PLAYER_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CHAR_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAR_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_ARMED_WITH_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHANGE_CAR_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_PED_ROADS_ON, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_PED_ROADS_OFF, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHAR_LOOK_AT_CHAR_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHAR_LOOK_AT_PLAYER_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PLAYER_LOOK_AT_CHAR_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STOP_CHAR_LOOKING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STOP_PLAYER_LOOKING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_HELICOPTER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GANG_ATTITUDE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GANG_GANG_ATTITUDE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GANG_PLAYER_ATTITUDE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GANG_PED_MODELS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GANG_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GANG_WEAPONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_RUN_TO_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_RUN_TO_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_TOUCHING_OBJECT_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_TOUCHING_OBJECT_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_SPECIAL_CHARACTER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_SPECIAL_CHARACTER_LOADED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_FLASH_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FLASH_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FLASH_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_REMOTE_MODE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_ARM_CAR_WITH_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_PERSONALITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CUTSCENE_OFFSET, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ANIM_GROUP_FOR_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ANIM_GROUP_FOR_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REQUEST_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_MODEL_LOADED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_MARK_MODEL_AS_NO_LONGER_NEEDED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GRAB_PHONE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_REPEATED_PHONE_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PHONE_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_PHONE_DISPLAYED_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_TURN_PHONE_OFF, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DRAW_CORONA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DRAW_LIGHT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_WEATHER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RESTORE_WEATHER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_CLOCK, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RESTORE_CLOCK, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RESTART_CRITICAL_MISSION, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_PLAYING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_NO_OBJ, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GUARD_SPOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GUARD_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_WAIT_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_LEAVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FOLLOW_CAR_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_DESTROY_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_DESTROY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_AREA_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GUARD_ATTACK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_RUN_TO_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_RUN_TO_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_PEDS_IN_AREA_TO_COLL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_COLL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_COLL_IN_CARS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_IN_CAR_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_COLL_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_COLL_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_COLL_STOPPED_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_PEDS_IN_COLL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_HEED_THREATS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_HEED_THREATS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CONTROLLER_MODE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAN_RESPRAY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_TAXI, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_UNLOAD_SPECIAL_CHARACTER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RESET_NUM_OF_MODELS_KILLED_BY_PLAYER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_NUM_OF_MODELS_KILLED_BY_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ACTIVATE_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_TAXI_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_OBJECT_NO_OFFSET, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_BOAT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_AREA_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_MESSAGE_WAIT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_PARTICLE_EFFECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_WIDESCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_CONTACT_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_COORD, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_ONLY_DAMAGED_BY_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_ONLY_DAMAGED_BY_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_PROOFS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_PROOFS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_DEACTIVATE_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_CARS_COLLECTED_BY_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CAR_BEEN_TAKEN_TO_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_SWAT_REQUIRED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FBI_REQUIRED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ARMY_REQUIRED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_IN_WATER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CLOSEST_CHAR_NODE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CLOSEST_CAR_NODE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CAR_GOTO_COORDINATES_ACCURATE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_PACMAN_RACE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_PACMAN_RECORD, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_POWER_PILLS_EATEN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_PACMAN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_PACMAN_SCRAMBLE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_POWER_PILLS_CARRIED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_CARRIED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_ON_SCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_ON_SCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_OBJECT_ON_SCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GOSUB_FILE, INPUT_ARGUMENTS(ARGTYPE_LABEL, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_GROUND_Z_FOR_3D_COORD, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_SCRIPT_FIRE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_SCRIPT_FIRE_EXTINGUISHED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_SCRIPT_FIRE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COMEDY_CONTROLS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_BOAT_GOTO_COORDS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_BOAT_STOP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_SHOOTING_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_SHOOTING_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CURRENT_PLAYER_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CURRENT_CHAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_EATEN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_POWER_PILL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_BOAT_CRUISE_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_RANDOM_CHAR_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_RANDOM_CHAR_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_TAXI, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_SHOOTING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_SHOOTING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_MONEY_PICKUP, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_ACCURACY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAR_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_CUTSCENE, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_CUTSCENE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CUTSCENE_ANIM, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_CUTSCENE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CUTSCENE_TIME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CUTSCENE_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_CUTSCENE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_RESTORE_CAMERA_JUMPCUT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_COLLECTABLE1, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLLECTABLE1_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PROJECTILE_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_DESTROY_PROJECTILES_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DROP_MINE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DROP_NAUTICAL_MINE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_SPECIAL_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_CUTSCENE_HEAD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CUTSCENE_HEAD_ANIM, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SIN, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_COS, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAR_FORWARD_X, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAR_FORWARD_Y, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHANGE_GARAGE_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ACTIVATE_CRUSHER_CRANE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_2_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_2_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_2_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_3_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_3_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_3_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_4_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_4_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_4_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_5_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_5_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_5_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CHAR_IN_FORMATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PLAYER_MADE_PROGRESS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PROGRESS_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_JUMP_DISTANCE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_JUMP_HEIGHT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_JUMP_FLIPS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_JUMP_SPINS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_JUMP_STUNT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_UNIQUE_JUMP_FOUND, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_UNIQUE_JUMPS_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_PASSENGER_DROPPED_OFF_TAXI, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_MONEY_MADE_TAXI, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_MISSION_GIVEN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_MISSION_PASSED, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_RUNNING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_ALL_SCRIPT_FIRES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_FIRST_CAR_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_SECOND_CAR_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CAR_BEEN_DAMAGED_BY_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_CHARS_GROUP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_PLAYERS_GROUP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_EXPLODE_CHAR_HEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_EXPLODE_PLAYER_HEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ANCHOR_BOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ZONE_GROUP, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_CAR_FIRE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_CHAR_FIRE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_RESPRAY_HAPPENED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAMERA_ZOOM, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_PICKUP_WITH_AMMO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_RAM_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_BLOCK_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_CATCH_TRAIN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_CATCH_TRAIN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_NEVER_GETS_TIRED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_FAST_RELOAD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_BLEEDING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_FUNNY_SUSPENSION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_BIG_WHEELS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FREE_RESPRAYS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_VISIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_VISIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_VISIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_AREA_OCCUPIED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_DRUG_RUN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_DRUG_RUN_BEEN_COMPLETED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_DRUG_PLANE_BEEN_SHOT_DOWN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SAVE_PLAYER_FROM_FIRES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DISPLAY_TEXT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_SCALE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_JUSTIFY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_CENTRE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_WRAPX, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_CENTRE_SIZE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_BACKGROUND, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_BACKGROUND_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_BACKGROUND_ONLY_TEXT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_PROPORTIONAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_FONT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_INDUSTRIAL_PASSED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_COMMERCIAL_PASSED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SUBURBAN_PASSED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ROTATE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SLIDE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_CHAR_ELEGANTLY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_STAY_IN_SAME_PLACE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_NASTY_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_UNDRESS_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DRESS_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_CHASE_SCENE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STOP_CHASE_SCENE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_EXPLOSION_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_EXPLOSION_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_DRUG_DROP_OFF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_DROP_OFF_PLANE_BEEN_SHOT_DOWN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FIND_DROP_OFF_PLANE_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_FLOATING_PACKAGE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PLACE_OBJECT_RELATIVE_TO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MAKE_OBJECT_TARGETTABLE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_ARMOUR_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_ARMOUR_TO_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_OPEN_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLOSE_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_WARP_CHAR_FROM_CAR_TO_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_VISIBILITY_OF_CLOSEST_OBJECT_OF_TYPE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CHAR_SPOTTED_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_HAIL_TAXI, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_OBJECT_BEEN_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_KILL_FRENZY_HEADSHOT, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ACTIVATE_MILITARY_CRANE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_WARP_PLAYER_INTO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_WARP_CHAR_INTO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_CAR_RADIO, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_AUDIO_STREAM, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_2_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_3_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_4_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_5_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_WAIT_STATE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAMERA_BEHIND_PLAYER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_MOTION_BLUR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_STRING_IN_STRING, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_RANDOM_CHAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_2_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_2_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_3_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_3_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_4_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_4_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_SNIPER_BULLET_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GIVE_PLAYER_DETONATOR, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_OBJECT_COLLISION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_ICECREAM_JINGLE_ON, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_STRING_IN_STRING_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_STRING_IN_STRING_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_5_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_5_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_6_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_6_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_POINT_OBSCURED_BY_A_MISSION_ENTITY, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_ALL_MODELS_NOW, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_TO_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DRAW_SPRITE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DRAW_RECT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_SPRITE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_TEXTURE_DICTIONARY, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_TEXTURE_DICTIONARY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_OBJECT_DYNAMIC, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_ANIM_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PLAY_MISSION_PASSED_TUNE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FREEZE_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_CAR_SIREN, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_PED_ROADS_ON_ANGLED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_PED_ROADS_OFF_ANGLED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_ROADS_ON_ANGLED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_ROADS_OFF_ANGLED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_WATERTIGHT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_MOVING_PARTICLE_EFFECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_CANT_BE_DRAGGED_OUT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_TURN_CAR_TO_FACE_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CRANE_LIFTING_CAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_DRAW_SPHERE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_STATUS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_MALE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SCRIPT_NAME, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CHANGE_GARAGE_TYPE_WITH_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FIND_DRUG_PLANE_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SAVE_INT_TO_DEBUG_FILE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SAVE_FLOAT_TO_DEBUG_FILE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SAVE_NEWLINE_TO_DEBUG_FILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_POLICE_RADIO_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_STRONG, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_ROUTE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_RUBBISH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_PARTICLE_EFFECTS_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_STREAMING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_GARAGE_OPEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_GARAGE_CLOSED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_CATALINA_HELI, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CATALINA_HELI_TAKE_OFF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_CATALINA_HELI, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_CATALINA_HELI_BEEN_SHOT_DOWN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWAP_NEAREST_BUILDING_MODEL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_WORLD_PROCESSING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_ALL_PLAYER_WEAPONS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GRAB_CATALINA_HELI, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_AREA_OF_CARS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ROTATING_GARAGE_DOOR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_SPHERE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_SPHERE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CATALINA_HELI_FLY_AWAY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_EVERYONE_IGNORE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_CAR_CHAR_IS_IN_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STORE_CAR_PLAYER_IS_IN_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PHONE_DISPLAYING_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_RANDOM_CAR_FOR_CAR_PARK, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_COLLISION_IN_MEMORY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_WANTED_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAMERA_IN_FRONT_OF_PLAYER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_VISIBLY_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_DOES_OBJECT_EXIST, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_SCENE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_STUCK_CAR_CHECK, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_STUCK_CAR_CHECK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_STUCK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_MISSION_AUDIO, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_MISSION_AUDIO_LOADED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_PLAY_MISSION_AUDIO, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_MISSION_AUDIO_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_IMPORT_GARAGE_SLOT_BEEN_FILLED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_THIS_PRINT, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_THIS_BIG_PRINT, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_MISSION_AUDIO_POSITION, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ACTIVATE_SAVE_MENU, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_SAVE_GAME_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_NO_SPECIAL_CAMERA_FOR_THIS_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_PICKUP_OLD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_PICKUP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_PICKUP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PED_DENSITY_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FORCE_RANDOM_PED_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_DRAW_BEFORE_FADE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_COLLECTABLE1S_COLLECTED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_EL_BURRO_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_SPRITES_DRAW_BEFORE_FADE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TEXT_RIGHT_JUSTIFY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PRINT_HELP, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_HELP, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FLASH_HUD_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FLASH_RADAR_BLIP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_IN_CONTROL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GENERATE_CARS_AROUND_CAMERA, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_SMALL_PRINTS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_HAS_MILITARY_CRANE_COLLECTED_ALL_CARS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_UPSIDEDOWN_CAR_NOT_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CAN_PLAYER_START_MISSION, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_MAKE_PLAYER_SAFE_FOR_CUTSCENE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_USE_TEXT_COMMANDS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_THREAT_FOR_PED_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_THREAT_FOR_PED_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAR_COLOURS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ALL_CARS_CAN_BE_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_CAN_BE_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MAKE_PLAYER_UNSAFE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_COLLISION, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_BODY_CAST_HEALTH, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHARS_CHATTING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MAKE_PLAYER_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_STAYS_IN_CURRENT_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_STAYS_IN_CURRENT_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_4X4_ONE_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_4X4_TWO_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_4X4_THREE_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_4X4_MAYHEM_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_LIFE_SAVED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_CRIMINAL_CAUGHT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_AMBULANCE_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_FIRE_EXTINGUISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_TURN_PHONE_ON, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_LONGEST_DODO_FLIGHT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_DEFUSE_BOMB_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TOTAL_NUMBER_OF_KILL_FRENZIES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_BLOW_UP_RC_BUGGY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REMOVE_CAR_FROM_CHASE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_FRENCH_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_GERMAN_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_MISSION_AUDIO, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FADE_IN_AFTER_NEXT_ARREST, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FADE_IN_AFTER_NEXT_DEATH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GANG_PED_MODEL_PREFERENCE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_USE_PEDNODE_SEEK, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SWITCH_VEHICLE_WEAPONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_GET_OUT_OF_JAIL_FREE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_FREE_HEALTH_CARE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_DOOR_CLOSED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_AND_LAUNCH_MISSION, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_OBJECT_DRAW_LAST, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_AMMO_IN_PLAYER_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_AMMO_IN_CHAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_KILL_FRENZY_PASSED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_SAY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_NEAR_CLIP, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_RADIO_CHANNEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_OVERRIDE_HOSPITAL_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_OVERRIDE_POLICE_STATION_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FORCE_RAIN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DOES_GARAGE_CONTAIN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_TRACTION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ARE_MEASUREMENTS_IN_METRES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CONVERT_METRES_TO_FEET, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MARK_ROADS_BETWEEN_LEVELS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MARK_PED_ROADS_BETWEEN_LEVELS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_AVOID_LEVEL_TRANSITIONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_AVOID_LEVEL_TRANSITIONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_THREAT_FOR_PED_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_AREA_OF_CHARS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_TOTAL_NUMBER_OF_MISSIONS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CONVERT_METRES_TO_FEET_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_FASTEST_TIME, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_REGISTER_HIGHEST_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_WARP_CHAR_INTO_CAR_AS_PASSENGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CAR_PASSENGER_SEAT_FREE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CHAR_IN_CAR_PASSENGER_SEAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_IS_CHRIS_CRIMINAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_CREDITS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STOP_CREDITS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ARE_CREDITS_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CREATE_SINGLE_PARTICLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_IGNORE_LEVEL_TRANSITIONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CHASE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_START_BOAT_FOAM_ANIMATION, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_UPDATE_BOAT_FOAM_ANIMATION, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_MUSIC_DOES_FADE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_INTRO_IS_PLAYING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_PLAYER_HOOKER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PLAY_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_STOP_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_SITTING_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_SITTING_IN_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_SCRIPT_FIRE_AUDIO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_LIFTING_A_PHONE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_SITTING_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_SITTING_IN_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_COLLISION_WITH_SCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOAD_SPLASH_SCREEN, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_IGNORE_LEVEL_TRANSITIONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_MAKE_CRAIGS_CAR_A_BIT_STRONGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ 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
+ 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, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_TARGETTING_ANY_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_TARGETTING_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_TARGETTING_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DISPLAY_TEXT_WITH_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_STRING, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DISPLAY_TEXT_WITH_2_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_FAIL_CURRENT_MISSION, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CLOSEST_OBJECT_OF_TYPE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_PLACE_OBJECT_RELATIVE_TO_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ALL_OCCUPANTS_OF_CAR_LEAVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_INTERPOLATION_PARAMETERS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_TOWARDS_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_AWAY_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_POINT_AT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_ATTACH_CHAR_TO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_DETACH_CHAR_FROM_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_CHANGE_LANE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_CHAR_LAST_WEAPON_DAMAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CLEAR_CAR_LAST_WEAPON_DAMAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_RANDOM_COP_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_RANDOM_COP_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_DRIVER_OF_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_FOLLOWERS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GIVE_REMOTE_CONTROLLED_MODEL_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CURRENT_PLAYER_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_CURRENT_CHAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_OBJECT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_OBJECT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_OBJECT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_OBJECT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_OBJECT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_OBJECT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_HANDBRAKE_TURN_LEFT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_HANDBRAKE_TURN_RIGHT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_CAR_HANDBRAKE_STOP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_ON_ANY_BIKE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_SNIPER_BULLET_2D, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_LOCATE_SNIPER_BULLET_3D, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_SEATS_IN_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_PLAYER_ON_ANY_BIKE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_IS_CHAR_LYING_DOWN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_CAN_CHAR_SEE_DEAD_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+#ifndef GTA3_1_1_PATCH
+ REGISTER_COMMAND(COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
+#endif
+#endif
+};
+#undef REGISTER_COMMAND
+#undef INPUT_ARGUMENTS
+#undef OUTPUT_ARGUMENTS
+
+static_assert(ARRAY_SIZE(commands) == LAST_SCRIPT_COMMAND, "commands array not filled");
+
+#if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2
+static FILE* dbg_log;
+#endif
+
+static void PrintToLog(const char* format, ...)
+{
+ va_list va;
+ va_start(va, format);
+ char tmp[1024];
+#ifdef _WIN32
+ vsprintf_s(tmp, 1024, format, va);
+#else
+ vsprintf(tmp, format, va);
+#endif
+ va_end(va);
+
+ printf("%s", tmp);
+#if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2
+ fwrite(tmp, 1, strlen(tmp), dbg_log);
+#endif
+}
+
+#endif
+
+static void FlushLog()
+{
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+#if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2
+ if (dbg_log)
+ fflush(dbg_log);
+#endif
+#endif
+}
+
+#define script_assert(_Expression) FlushLog(); assert(_Expression);
const uint32 CRunningScript::nSaveStructSize =
#ifdef COMPATIBLE_SAVES
@@ -156,7 +1401,7 @@ CMissionCleanupEntity* CMissionCleanup::FindFree()
if (m_sEntities[i].type == CLEANUP_UNUSED)
return &m_sEntities[i];
}
- assert(0);
+ script_assert(0);
return nil;
}
@@ -400,12 +1645,12 @@ void CRunningScript::CollectParameters(uint32* pIp, int16 total)
break;
case ARGUMENT_GLOBALVAR:
varIndex = CTheScripts::Read2BytesFromScript(pIp);
- assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace());
+ script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace());
ScriptParams[i] = *((int32*)&CTheScripts::ScriptSpace[varIndex]);
break;
case ARGUMENT_LOCALVAR:
varIndex = CTheScripts::Read2BytesFromScript(pIp);
- assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables));
+ script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables));
ScriptParams[i] = m_anLocalVariables[varIndex];
break;
case ARGUMENT_INT8:
@@ -419,12 +1664,74 @@ void CRunningScript::CollectParameters(uint32* pIp, int16 total)
ScriptParams[i] = *(int32*)&tmp;
break;
default:
- assert(0);
+ script_assert(0);
break;
}
}
}
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+int CRunningScript::CollectParameterForDebug(char* buf, bool& var)
+{
+ float tmp;
+ uint16 varIndex;
+ char tmpstr[24];
+ var = false;
+ switch (CTheScripts::Read1ByteFromScript(&m_nIp))
+ {
+ case ARGUMENT_INT32:
+ return CTheScripts::Read4BytesFromScript(&m_nIp);
+ case ARGUMENT_GLOBALVAR:
+ varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
+ script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace());
+ var = true;
+ sprintf(tmpstr, " $%d", varIndex / 4);
+ strcat(buf, tmpstr);
+ return *((int32*)&CTheScripts::ScriptSpace[varIndex]);
+ case ARGUMENT_LOCALVAR:
+ varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
+ script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables));
+ var = true;
+ sprintf(tmpstr, " %d@", varIndex);
+ strcat(buf, tmpstr);
+ return m_anLocalVariables[varIndex];
+ case ARGUMENT_INT8:
+ return CTheScripts::Read1ByteFromScript(&m_nIp);
+ case ARGUMENT_INT16:
+ return CTheScripts::Read2BytesFromScript(&m_nIp);
+ case ARGUMENT_FLOAT:
+ tmp = CTheScripts::ReadFloatFromScript(&m_nIp);
+ return *(int32*)&tmp;
+ default:
+ PrintToLog("%s - script assertion failed in CollectParameterForDebug", buf);
+ script_assert(0);
+ break;
+ }
+ return 0;
+}
+
+void CRunningScript::GetStoredParameterForDebug(char* buf)
+{
+ uint16 varIndex;
+ char tmpstr[24];
+ switch (CTheScripts::Read1ByteFromScript(&m_nIp)) {
+ case ARGUMENT_GLOBALVAR:
+ varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
+ sprintf(tmpstr, " $%d", varIndex / 4);
+ strcat(buf, tmpstr);
+ break;
+ case ARGUMENT_LOCALVAR:
+ varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
+ sprintf(tmpstr, " %d@", varIndex);
+ strcat(buf, tmpstr);
+ break;
+ default:
+ PrintToLog("%s - script_assertion failed in GetStoredParameterForDebug", buf);
+ script_assert(0);
+ }
+}
+#endif
+
int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
{
uint32* pIp = &ip;
@@ -445,7 +1752,7 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
tmp = CTheScripts::ReadFloatFromScript(pIp);
return *(int32*)&tmp;
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -461,7 +1768,7 @@ void CRunningScript::StoreParameters(uint32* pIp, int16 number)
m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)] = ScriptParams[i];
break;
default:
- assert(0);
+ script_assert(0);
}
}
}
@@ -471,13 +1778,13 @@ int32 *CRunningScript::GetPointerToScriptVariable(uint32* pIp, int16 type)
switch (CTheScripts::Read1ByteFromScript(pIp))
{
case ARGUMENT_GLOBALVAR:
- assert(type == VAR_GLOBAL);
+ script_assert(type == VAR_GLOBAL);
return (int32*)&CTheScripts::ScriptSpace[CTheScripts::Read2BytesFromScript(pIp)];
case ARGUMENT_LOCALVAR:
- assert(type == VAR_LOCAL);
+ script_assert(type == VAR_LOCAL);
return &m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)];
default:
- assert(0);
+ script_assert(0);
}
return nil;
}
@@ -504,10 +1811,14 @@ void CRunningScript::Init()
}
#ifdef USE_DEBUG_SCRIPT_LOADER
+int scriptToLoad = 0;
+
+#ifdef _WIN32
+#include <Windows.h>
+#endif
int open_script()
{
- static int scriptToLoad = 0;
-
+ // glfwGetKey doesn't work because of CGame::Initialise is blocking
#ifdef _WIN32
if (GetAsyncKeyState('G') & 0x8000)
scriptToLoad = 0;
@@ -606,6 +1917,16 @@ void CTheScripts::Init()
}
for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++)
InvisibilitySettingArray[i] = nil;
+
+#if defined USE_ADVANCED_SCRIPT_DEBUG_OUTPUT && SCRIPT_LOG_FILE_LEVEL == 2
+ CFileMgr::SetDirMyDocuments();
+ if (dbg_log)
+ fclose(dbg_log);
+ dbg_log = fopen("SCRDBG.LOG", "w");
+ static const char* init_msg = "Starting debug script log\n\n";
+ PrintToLog(init_msg);
+ CFileMgr::SetDir("\\");
+#endif
}
void CRunningScript::RemoveScriptFromList(CRunningScript** ppScript)
@@ -630,7 +1951,7 @@ void CRunningScript::AddScriptToList(CRunningScript** ppScript)
CRunningScript* CTheScripts::StartNewScript(uint32 ip)
{
CRunningScript* pNew = pIdleScripts;
- assert(pNew);
+ script_assert(pNew);
pNew->RemoveScriptFromList(&pIdleScripts);
pNew->Init();
pNew->SetIP(ip);
@@ -666,6 +1987,53 @@ void CTheScripts::Process()
if (UseTextCommands == 1)
UseTextCommands = 0;
}
+
+#ifdef MISSION_REPLAY
+ static uint32 TimeToWaitTill;
+ switch (AllowMissionReplay) {
+ case 2:
+ AllowMissionReplay = 3;
+ TimeToWaitTill = CTimer::GetTimeInMilliseconds() + (AddExtraDeathDelay() > 1000 ? 4000 : 2500);
+ break;
+ case 3:
+ if (TimeToWaitTill < CTimer::GetTimeInMilliseconds())
+ AllowMissionReplay = 4;
+ break;
+ case 4:
+ AllowMissionReplay = 5;
+ RetryMission(0, 0);
+ case 6:
+ AllowMissionReplay = 7;
+ TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500;
+ case 7:
+ if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) {
+ AllowMissionReplay = 0;
+ return;
+ }
+ break;
+ }
+ if (WaitForMissionActivate) {
+ if (WaitForMissionActivate > CTimer::GetTimeInMilliseconds())
+ return;
+ WaitForMissionActivate = 0;
+ WaitForSave = CTimer::GetTimeInMilliseconds() + 3000;
+ }
+ if (WaitForSave && WaitForSave > CTimer::GetTimeInMilliseconds())
+ WaitForSave = 0;
+#endif
+
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+#if SCRIPT_LOG_FILE_LEVEL == 1
+ CFileMgr::SetDirMyDocuments();
+ dbg_log = fopen("SCRDBG.LOG", "w");
+ static const char* init_msg = "Starting debug script log\n\n";
+ PrintToLog(init_msg);
+ CFileMgr::SetDir("\\");
+#endif
+ PrintToLog("------------------------\n");
+ PrintToLog("CTheScripts::Process started, CTimer::GetTimeInMilliseconds == %u\n", CTimer::GetTimeInMilliseconds());
+#endif
+
CRunningScript* script = pActiveScripts;
while (script != nil){
CRunningScript* next = script->GetNext();
@@ -675,6 +2043,13 @@ void CTheScripts::Process()
script = next;
}
DbgFlag = false;
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+ PrintToLog("Script processing done, ScriptsUpdated: %d, CommandsExecuted: %d\n", ScriptsUpdated, CommandsExecuted);
+#if SCRIPT_LOG_FILE_LEVEL == 1
+ fclose(dbg_log);
+ dbg_log = nil;
+#endif
+#endif
}
CRunningScript* CTheScripts::StartTestScript()
@@ -689,6 +2064,9 @@ bool CTheScripts::IsPlayerOnAMission()
void CRunningScript::Process()
{
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+ PrintToLog("\n\nProcessing script %s (id %d)\n\n", m_abScriptName, this - CTheScripts::ScriptsArray);
+#endif
if (m_bIsMissionScript)
DoDeatharrestCheck();
if (m_bMissionFlag && CTheScripts::FailCurrentMission == 1 && m_nStackPointer == 1)
@@ -713,40 +2091,114 @@ void CRunningScript::Process()
int8 CRunningScript::ProcessOneCommand()
{
+ int8 retval = -1;
++CTheScripts::CommandsExecuted;
int32 command = CTheScripts::Read2BytesFromScript(&m_nIp);
m_bNotFlag = (command & 0x8000);
command &= 0x7FFF;
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+ char commandInfo[1024];
+ uint32 ip = m_nIp;
+ if (command < ARRAY_SIZE(commands)) {
+ script_assert(commands[command].id == command);
+ sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp);
+ if (m_bNotFlag)
+ strcat(commandInfo, "NOT ");
+ if (commands[command].position == -1)
+ strcat(commandInfo, commands[command].name + sizeof("COMMAND_") - 1);
+ for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
+ char tmp[16];
+ bool var = false;
+ int value;
+ switch (commands[command].input[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
+ case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
+ case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
+ case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
+ case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
+ case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break;
+ default: script_assert(0);
+ }
+ strcat(commandInfo, tmp);
+ if (commands[command].position == i)
+ strcat(commandInfo, commands[command].name_override);
+ }
+ uint32 t = m_nIp;
+ m_nIp = ip;
+ ip = t;
+ }
+#endif
if (command < 100)
- return ProcessCommands0To99(command);
- if (command < 200)
- return ProcessCommands100To199(command);
- if (command < 300)
- return ProcessCommands200To299(command);
- if (command < 400)
- return ProcessCommands300To399(command);
- if (command < 500)
- return ProcessCommands400To499(command);
- if (command < 600)
- return ProcessCommands500To599(command);
- if (command < 700)
- return ProcessCommands600To699(command);
- if (command < 800)
- return ProcessCommands700To799(command);
- if (command < 900)
- return ProcessCommands800To899(command);
- if (command < 1000)
- return ProcessCommands900To999(command);
+ retval = ProcessCommands0To99(command);
+ else if (command < 200)
+ retval = ProcessCommands100To199(command);
+ else if (command < 300)
+ retval = ProcessCommands200To299(command);
+ else if (command < 400)
+ retval = ProcessCommands300To399(command);
+ else if (command < 500)
+ retval = ProcessCommands400To499(command);
+ else if (command < 600)
+ retval = ProcessCommands500To599(command);
+ else if (command < 700)
+ retval = ProcessCommands600To699(command);
+ else if (command < 800)
+ retval = ProcessCommands700To799(command);
+ else if (command < 900)
+ retval = ProcessCommands800To899(command);
+ else if (command < 1000)
+ retval = ProcessCommands900To999(command);
#ifdef GTA_PS2
- if (command < 1200)
- return ProcessCommands1000To1099(command);
+ else if (command < 1200)
+ retval = ProcessCommands1000To1099(command);
#else
- if (command < 1100)
- return ProcessCommands1000To1099(command);
- if (command < 1200)
- return ProcessCommands1100To1199(command);
+ else if (command < 1100)
+ retval = ProcessCommands1000To1099(command);
+ else if (command < 1200)
+ retval = ProcessCommands1100To1199(command);
#endif
- return -1;
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+ if (command < ARRAY_SIZE(commands)) {
+ if (commands[command].cond || commands[command].output[0] != ARGTYPE_NONE) {
+ strcat(commandInfo, " ->");
+ if (commands[command].cond)
+ strcat(commandInfo, m_bCondResult ? " TRUE" : " FALSE");
+ uint32 t = m_nIp;
+ m_nIp = ip;
+ ip = t;
+ for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
+ char tmp[16];
+ switch (commands[command].output[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
+ case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
+ default: script_assert(0 && "Script only returns INTs and FLOATs");
+ }
+ }
+ m_nIp = ip;
+ }
+ PrintToLog("%s\n", commandInfo);
+ if (m_bMissionFlag) {
+ for (int i = 0; commandInfo[i]; i++) {
+ if (commandInfo[i] == '_')
+ commandInfo[i] = ' ';
+ }
+ CDebug::DebugAddText(commandInfo);
+ }
+ }
+#elif defined USE_BASIC_SCRIPT_DEBUG_OUTPUT
+ if (m_bMissionFlag) {
+ char tmp[128];
+ sprintf(tmp, "Comm %d Cmp %d", command, m_bCondResult);
+ CDebug::DebugAddText(tmp);
+ }
+#endif
+ return retval;
}
int8 CRunningScript::ProcessCommands0To99(int32 command)
@@ -759,6 +2211,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
case COMMAND_WAIT:
CollectParameters(&m_nIp, 1);
m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0];
+ m_bSkipWakeTime = false;
return 1;
case COMMAND_GOTO:
CollectParameters(&m_nIp, 1);
@@ -1238,11 +2691,22 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
CTheScripts::bAlreadyRunningAMissionScript = false;
RemoveScriptFromList(&CTheScripts::pActiveScripts);
AddScriptToList(&CTheScripts::pIdleScripts);
+#ifdef MISSION_REPLAY
+ if (m_bMissionFlag) {
+ CPlayerInfo* pPlayerInfo = &CWorld::Players[CWorld::PlayerInFocus];
+ if (pPlayerInfo->m_pPed->GetPedState() != PED_DEAD && pPlayerInfo->m_WBState == WBSTATE_PLAYING && !m_bDeatharrestExecuted)
+ SaveGameForPause(1);
+ oldTargetX = oldTargetY = 0.0f;
+ if (AllowMissionReplay == 1)
+ AllowMissionReplay = 2;
+ // I am fairly sure they forgot to set return value here
+ }
+#endif
return 1;
case COMMAND_START_NEW_SCRIPT:
{
CollectParameters(&m_nIp, 1);
- assert(ScriptParams[0] >= 0);
+ script_assert(ScriptParams[0] >= 0);
CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]);
int8 type = CTheScripts::Read1ByteFromScript(&m_nIp);
float tmp;
@@ -1275,12 +2739,12 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
}
case COMMAND_GOSUB:
CollectParameters(&m_nIp, 1);
- assert(m_nStackPointer < MAX_STACK_DEPTH);
+ script_assert(m_nStackPointer < MAX_STACK_DEPTH);
m_anStack[m_nStackPointer++] = m_nIp;
SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
return 0;
case COMMAND_RETURN:
- assert(m_nStackPointer > 0); /* No more SSU */
+ script_assert(m_nStackPointer > 0); /* No more SSU */
SetIP(m_anStack[--m_nStackPointer]);
return 0;
case COMMAND_LINE:
@@ -1291,7 +2755,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{
CollectParameters(&m_nIp, 4);
int32 index = ScriptParams[0];
- assert(index < 1); /* Constant? Also no more double player glitch */
+ script_assert(index < 1); /* Constant? Also no more double player glitch */
printf("&&&&&&&&&&&&&Creating player: %d\n", index);
if (!CStreaming::HasModelLoaded(MI_PLAYER)) {
CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
@@ -1436,7 +2900,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
*fScriptVar1 -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
default:
- assert(0);
+ script_assert(0);
break;
}
return -1;
@@ -1467,11 +2931,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
- case COMMAND_MULT_INT_LVAR_BY_INT_VAR:
+ case COMMAND_MULT_INT_VAR_BY_INT_LVAR:
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
- case COMMAND_MULT_INT_VAR_BY_INT_LVAR:
+ case COMMAND_MULT_INT_LVAR_BY_INT_VAR:
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1483,11 +2947,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
- case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR:
+ case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
- case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR:
+ case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1499,11 +2963,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
- case COMMAND_DIV_INT_LVAR_BY_INT_VAR:
+ case COMMAND_DIV_INT_VAR_BY_INT_LVAR:
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
- case COMMAND_DIV_INT_VAR_BY_INT_LVAR:
+ case COMMAND_DIV_INT_LVAR_BY_INT_VAR:
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1515,11 +2979,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
- case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR:
+ case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
- case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR:
+ case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1545,11 +3009,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
+#ifdef FIX_BUGS
+ case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
+#else
case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR:
+#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
+#ifdef FIX_BUGS
+ case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR:
+#else
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
+#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1575,11 +3047,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
+#ifdef FIX_BUGS // in SA it was fixed by reversing their order in enum
+ case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
+#else
case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR:
+#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
+#ifdef FIX_BUGS
+ case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR:
+#else
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
+#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1593,13 +3073,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
- case COMMAND_SET_LVAR_INT_TO_VAR_INT:
+ case COMMAND_SET_VAR_INT_TO_LVAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
- case COMMAND_SET_VAR_INT_TO_LVAR_INT:
+ case COMMAND_SET_LVAR_INT_TO_VAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
@@ -1617,13 +3097,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
- case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT:
+ case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
- case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT:
+ case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
@@ -1641,13 +3121,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
- case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT:
+ case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
- case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT:
+ case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
@@ -1665,13 +3145,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
- case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT:
+ case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
- case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT:
+ case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
@@ -1812,7 +3292,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(ped);
+ script_assert(ped);
ped->ClearAll();
int8 path = ScriptParams[1];
if (ScriptParams[1] < 0 || ScriptParams[1] > 7)
@@ -1827,7 +3307,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 4);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(ped);
+ script_assert(ped);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
@@ -1839,7 +3319,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(ped);
+ script_assert(ped);
ped->bScriptObjectiveCompleted = false;
ped->SetObjective(OBJECTIVE_IDLE);
return 0;
@@ -1848,7 +3328,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(ped);
+ script_assert(ped);
CVehicle* vehicle;
CVector pos;
/* Seems a bit clumsy but I'll leave original flow */
@@ -1868,7 +3348,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 4);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(ped);
+ script_assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
@@ -1903,7 +3383,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*
* CollectParameters(&m_nIp, 4);
* CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- * assert(ped);
+ * script_assert(ped);
* CEntity* entityToMove = ped->bInVehicle ? ped->m_pMyVehicle : ped;
* CVector pos = *(CVector*)&ScriptParams[1];
* if (pos.z <= MAP_Z_LOW_LIMIT)
@@ -1926,7 +3406,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 6);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(ped);
+ script_assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
@@ -1951,7 +3431,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 8);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(ped);
+ script_assert(ped);
CVehicle* vehicle;
if (ped->bInVehicle)
vehicle = ped->m_pMyVehicle;
@@ -2041,7 +3521,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 4);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(car);
+ script_assert(car);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
@@ -2052,7 +3532,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
car->SetStatus(STATUS_PHYSICS);
car->bEngineOn = true;
- car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
+ car->AutoPilot.m_nCruiseSpeed = Max(6, car->AutoPilot.m_nCruiseSpeed);
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0;
}
@@ -2060,11 +3540,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(car);
+ script_assert(car);
CCarCtrl::JoinCarWithRoadSystem(car);
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
car->bEngineOn = true;
- car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
+ car->AutoPilot.m_nCruiseSpeed = Max(6, car->AutoPilot.m_nCruiseSpeed);
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0;
}
@@ -2072,7 +3552,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(car);
+ script_assert(car);
car->AutoPilot.m_nCarMission = MISSION_NONE;
return 0;
}
@@ -2080,7 +3560,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(car);
+ script_assert(car);
*(CVector*)&ScriptParams[0] = car->GetPosition();
StoreParameters(&m_nIp, 3);
return 0;
@@ -2089,7 +3569,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 4);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(car);
+ script_assert(car);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
@@ -2147,15 +3627,22 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(car);
+ script_assert(car);
+#if defined MISSION_REPLAY && defined SIMPLIER_MISSIONS
+ 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);
+#else
car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
+#endif
return 0;
}
case COMMAND_SET_CAR_DRIVING_STYLE:
{
CollectParameters(&m_nIp, 2);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(car);
+ script_assert(car);
car->AutoPilot.m_nDrivingStyle = (eCarDrivingStyle)ScriptParams[1];
return 0;
}
@@ -2163,7 +3650,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(car);
+ script_assert(car);
car->AutoPilot.m_nCarMission = (eCarMission)ScriptParams[1];
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
car->bEngineOn = true;
@@ -2173,7 +3660,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 6);
CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(vehicle);
+ script_assert(vehicle);
float x1 = *(float*)&ScriptParams[1];
float y1 = *(float*)&ScriptParams[2];
float x2 = *(float*)&ScriptParams[3];
@@ -2190,7 +3677,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{
CollectParameters(&m_nIp, 8);
CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(vehicle);
+ script_assert(vehicle);
float x1 = *(float*)&ScriptParams[1];
float y1 = *(float*)&ScriptParams[2];
float z1 = *(float*)&ScriptParams[3];
@@ -2213,11 +3700,15 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_SPECIAL_5:
case COMMAND_SPECIAL_6:
case COMMAND_SPECIAL_7:
- assert(0);
+ script_assert(0);
return 0;
case COMMAND_PRINT_BIG:
{
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
+#ifdef MISSION_REPLAY
+ if (strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "M_FAIL") == 0 && CanAllowMissionReplay())
+ AllowMissionReplay = 1;
+#endif
m_nIp += KEY_LENGTH_IN_SCRIPT;
CollectParameters(&m_nIp, 2);
CMessages::AddBigMessage(key, ScriptParams[0], ScriptParams[1] - 1);
@@ -2289,7 +3780,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_VAR_INT:
*/
default:
- assert(0);
+ script_assert(0);
break;
}
return -1;
@@ -2326,7 +3817,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
m_bCondResult = false;
m_nAndOrState++;
}else{
- assert(0 && "COMMAND_ANDOR: invalid ANDOR state");
+ script_assert(0 && "COMMAND_ANDOR: invalid ANDOR state");
}
return 0;
case COMMAND_LAUNCH_MISSION:
@@ -2349,12 +3840,12 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(ped);
+ script_assert(ped);
CVehicle* pCurrent = nil;
if (ped->bInVehicle) {
pCurrent = ped->m_pMyVehicle;
}
- assert(pCurrent); // GetIndex(0) doesn't look good
+ script_assert(pCurrent); // GetIndex(0) doesn't look good
int handle = CPools::GetVehiclePool()->GetIndex(pCurrent);
if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript){
CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex);
@@ -2401,11 +3892,11 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* ped = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(ped);
+ script_assert(ped);
if (!ped->bInVehicle)
return 0; // No value written to output variable
CVehicle* pCurrent = ped->m_pMyVehicle;
- assert(pCurrent); // Here pCurrent shouldn't be NULL anyway
+ script_assert(pCurrent); // Here pCurrent shouldn't be NULL anyway
int handle = CPools::GetVehiclePool()->GetIndex(pCurrent);
if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript) {
CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex);
@@ -2656,7 +4147,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
return 0;
}
@@ -2686,7 +4177,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->m_fearFlags |= ScriptParams[1];
return 0;
}
@@ -2697,7 +4188,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->ClearObjective();
return 0;
@@ -2733,7 +4224,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->OurPedCanSeeThisOne(CWorld::Players[ScriptParams[1]].m_pPed));
return 0;
}
@@ -2745,7 +4236,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->bScriptObjectiveCompleted);
return 0;
}
@@ -2757,7 +4248,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{
CollectParameters(&m_nIp, 3);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
switch (ScriptParams[2]) {
case MI_COP:
if (ScriptParams[1] == PEDTYPE_COP)
@@ -2800,7 +4291,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
pPed->SetPedState(PED_DRIVING);
CPopulation::ms_nTotalMissionPeds++;
- assert(!pVehicle->pDriver);
+ script_assert(!pVehicle->pDriver);
pVehicle->pDriver = pPed;
pVehicle->pDriver->RegisterReference((CEntity**)&pVehicle->pDriver);
pPed->m_pMyVehicle = pVehicle;
@@ -2834,7 +4325,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
if (pPlayer->m_pPed->bInVehicle){
- assert(pPlayer->m_pPed->m_pMyVehicle);
+ script_assert(pPlayer->m_pPed->m_pMyVehicle);
if (pPlayer->m_pPed->m_pMyVehicle->bIsBus)
pPlayer->m_pPed->bRenderPedInCar = true;
if (pPlayer->m_pPed->m_pMyVehicle->pDriver == pPlayer->m_pPed){
@@ -2869,7 +4360,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
case COMMAND_MAKE_CHAR_DO_NOTHING:
*/
default:
- assert(0);
+ script_assert(0);
break;
}
return -1;
@@ -2898,7 +4389,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1];
return 0;
}
@@ -2913,7 +4404,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->GetModelIndex() == ScriptParams[1]);
return 0;
}
@@ -2926,7 +4417,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 6);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
float x1 = *(float*)&ScriptParams[1];
float y1 = *(float*)&ScriptParams[2];
float x2 = *(float*)&ScriptParams[3];
@@ -2944,7 +4435,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 8);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
float x1 = *(float*)&ScriptParams[1];
float y1 = *(float*)&ScriptParams[2];
float z1 = *(float*)&ScriptParams[3];
@@ -2997,9 +4488,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
pCarGen->SwitchOff();
}else if (ScriptParams[1] <= 100){
pCarGen->SwitchOn();
+ pCarGen->SetUsesRemaining(ScriptParams[1]);
}else{
pCarGen->SwitchOn();
- pCarGen->SetUsesRemaining(ScriptParams[1]);
}
return 0;
}
@@ -3012,21 +4503,21 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
}
case COMMAND_DISPLAY_ONSCREEN_TIMER:
{
- assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
+ script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
m_nIp++;
CUserDisplay::OnscnTimer.AddClock(CTheScripts::Read2BytesFromScript(&m_nIp), nil);
return 0;
}
case COMMAND_CLEAR_ONSCREEN_TIMER:
{
- assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
+ script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
m_nIp++;
CUserDisplay::OnscnTimer.ClearClock(CTheScripts::Read2BytesFromScript(&m_nIp));
return 0;
}
case COMMAND_DISPLAY_ONSCREEN_COUNTER:
{
- assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
+ script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
m_nIp++;
int32 counter = CTheScripts::Read2BytesFromScript(&m_nIp);
CollectParameters(&m_nIp, 1);
@@ -3035,7 +4526,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
}
case COMMAND_CLEAR_ONSCREEN_COUNTER:
{
- assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
+ script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR);
m_nIp++;
CUserDisplay::OnscnTimer.ClearCounter(CTheScripts::Read2BytesFromScript(&m_nIp));
return 0;
@@ -3064,7 +4555,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
char label[12];
CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
int zone = CTheZones::FindZoneByLabelAndReturnIndex(label);
@@ -3113,7 +4604,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 3);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT);
return 0;
}
@@ -3121,7 +4612,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT);
return 0;
}
@@ -3154,7 +4645,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle && pVehicle->IsCar());
+ script_assert(pVehicle && pVehicle->IsCar());
CAutomobile* pCar = (CAutomobile*)pVehicle;
UpdateCompareFlag(pCar->GetAllWheelsOffGround());
return 0;
@@ -3180,7 +4671,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 3);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
// Useless call.
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
@@ -3191,7 +4682,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
// Useless call.
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
@@ -3202,7 +4693,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 3);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
// Useless call.
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
ScriptParams[0] = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
@@ -3315,7 +4806,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
if (pPed->bInVehicle){
- // Is assertion required?
+ // Is script_assertion required?
return 0;
}
pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]);
@@ -3326,7 +4817,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
float angle = pPed->bInVehicle ? pPed->m_pMyVehicle->GetForward().Heading() : pPed->GetForward().Heading();
*(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
StoreParameters(&m_nIp, 1);
@@ -3336,9 +4827,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
if (pPed->bInVehicle) {
- // Is assertion required?
+ // Is script_assertion required?
return 0;
}
pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]);
@@ -3349,7 +4840,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
float angle = pVehicle->GetForward().Heading();
*(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
StoreParameters(&m_nIp, 1);
@@ -3359,7 +4850,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
return 0;
}
@@ -3367,7 +4858,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
float angle = pObject->GetForward().Heading();
*(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
StoreParameters(&m_nIp, 1);
@@ -3377,7 +4868,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CWorld::Remove(pObject);
pObject->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
pObject->GetMatrix().UpdateRW();
@@ -3390,7 +4881,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
- assert(pObject);
+ script_assert(pObject);
CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed;
UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject));
return 0;
@@ -3399,9 +4890,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
- assert(pObject);
+ script_assert(pObject);
CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed;
UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject));
return 0;
@@ -3447,7 +4938,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->m_fHealth > ScriptParams[1]);
return 0;
}
@@ -3455,7 +4946,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->m_fHealth > ScriptParams[1]);
return 0;
}
@@ -3463,7 +4954,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
// Useless call.
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int handle = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
@@ -3476,7 +4967,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
// Useless call.
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int handle = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH);
@@ -3489,7 +4980,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
// Useless call.
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int handle = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH);
@@ -3597,12 +5088,12 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(CTheScripts::UpsideDownCars.HasCarBeenUpsideDownForAWhile(ScriptParams[0]));
return 0;
}
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -3614,7 +5105,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CTheScripts::UpsideDownCars.AddCarToCheck(ScriptParams[0]);
return 0;
}
@@ -3622,7 +5113,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CTheScripts::UpsideDownCars.RemoveCarFromCheck(ScriptParams[0]);
return 0;
}
@@ -3630,7 +5121,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_IDLE);
return 0;
@@ -3639,7 +5130,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE);
return 0;
@@ -3648,7 +5139,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 4);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
@@ -3660,7 +5151,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 5);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
float infX = *(float*)&ScriptParams[1];
float infY = *(float*)&ScriptParams[2];
float supX = *(float*)&ScriptParams[3];
@@ -3686,7 +5177,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_WAIT_IN_CAR);
return 0;
@@ -3729,7 +5220,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 3);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
pPed->m_nSelectedWepSlot = pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2]);
return 0;
}
@@ -3737,7 +5228,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->SetCurrentWeapon(pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2]));
if (pPed->bInVehicle)
pPed->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType)->m_nModelId);
@@ -3804,7 +5295,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
*(CVector*)&ScriptParams[0] = pObject->GetPosition();
StoreParameters(&m_nIp, 3);
return 0;
@@ -3813,7 +5304,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 4);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
@@ -3829,7 +5320,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 4);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle;
CVector pos;
if (pPed->bInVehicle)
@@ -3855,7 +5346,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 4);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle;
CVector pos;
if (pPed->bInVehicle)
@@ -3881,7 +5372,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
ScriptParams[0] = pPed->m_pWanted->m_nWantedLevel;
StoreParameters(&m_nIp, 1);
return 0;
@@ -3890,7 +5381,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(CTheScripts::IsVehicleStopped(pVehicle));
return 0;
}
@@ -3925,7 +5416,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
return 0;
}
@@ -3933,7 +5424,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
return 0;
}
@@ -3941,7 +5432,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
return 0;
}
@@ -3949,7 +5440,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 4);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
switch (ScriptParams[2]) {
case MI_COP:
if (ScriptParams[1] == PEDTYPE_COP)
@@ -4021,7 +5512,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget);
@@ -4031,7 +5522,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget);
@@ -4041,7 +5532,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget);
@@ -4051,7 +5542,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget);
@@ -4061,7 +5552,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget);
@@ -4071,7 +5562,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget);
@@ -4081,7 +5572,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget);
@@ -4091,7 +5582,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget);
@@ -4101,7 +5592,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget);
@@ -4111,7 +5602,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget);
@@ -4121,7 +5612,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle);
@@ -4131,7 +5622,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle);
@@ -4141,7 +5632,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
@@ -4156,7 +5647,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_DESTROY_CAR, pVehicle);
@@ -4166,7 +5657,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 5);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
float infX = *(float*)&ScriptParams[1];
float infY = *(float*)&ScriptParams[2];
float supX = *(float*)&ScriptParams[3];
@@ -4197,7 +5688,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
pPed->SetObjective(OBJECTIVE_SET_LEADER, pTarget);
return 0;
@@ -4206,7 +5697,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed;
pPed->SetObjective(OBJECTIVE_SET_LEADER, pTarget);
return 0;
@@ -4215,7 +5706,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->ClearLeader();
return 0;
}
@@ -4223,7 +5714,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]);
return 0;
@@ -4310,7 +5801,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
ScriptParams[0] = pVehicle->m_nNumPassengers;
StoreParameters(&m_nIp, 1);
return 0;
@@ -4319,7 +5810,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
ScriptParams[0] = pVehicle->m_nNumMaxPassengers;
StoreParameters(&m_nIp, 1);
return 0;
@@ -4332,9 +5823,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
}
case COMMAND_SET_CAR_HEAVY:
{
- CollectParameters(&m_nIp, 1);
+ CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->bIsHeavy = (ScriptParams[1] != 0);
return 0;
}
@@ -4342,7 +5833,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->m_fearFlags = 0;
return 0;
}
@@ -4387,12 +5878,12 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->m_nCollisionRecords == 0);
return 0;
}
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -4404,7 +5895,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->GetUp().z <= -0.97f);
return 0;
}
@@ -4412,7 +5903,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
StoreParameters(&m_nIp, 1);
return 0;
@@ -4424,7 +5915,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
if (ScriptParams[1]) {
pPed->m_pWanted->m_bIgnoredByCops = true;
CWorld::StopAllLawEnforcersInTheirTracks();
@@ -4494,7 +5985,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1];
return 0;
}
@@ -4502,7 +5993,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->BlowUpCar(nil);
return 0;
}
@@ -4515,7 +6006,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->GetUp().z >= 0.0f);
return 0;
}
@@ -4577,7 +6068,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVector target;
target.x = *(float*)&ScriptParams[1];
target.y = *(float*)&ScriptParams[2];
@@ -4614,8 +6105,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
((CAutomobile*)pVehicle)->SetTaxiLight(ScriptParams[1] != 0);
return 0;
}
@@ -4690,7 +6181,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
CVehicle* pTarget;
if (ScriptParams[1] >= 0) {
pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
}
else {
pTarget = nil;
@@ -4749,8 +6240,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pCar);
- assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pCar);
+ script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum
return 0;
}
@@ -4762,7 +6253,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
pPed->m_fHealth = ScriptParams[1];
return 0;
}
@@ -4770,7 +6261,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
if (ScriptParams[1]) {
pPed->m_fHealth = ScriptParams[1];
}
@@ -4788,7 +6279,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->m_fHealth = ScriptParams[1];
return 0;
}
@@ -4796,7 +6287,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
ScriptParams[0] = pPed->m_fHealth; // correct cast float to int
StoreParameters(&m_nIp, 1);
return 0;
@@ -4805,7 +6296,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
ScriptParams[0] = pPed->m_fHealth; // correct cast float to int
StoreParameters(&m_nIp, 1);
return 0;
@@ -4814,7 +6305,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
ScriptParams[0] = pVehicle->m_fHealth; // correct cast float to int
StoreParameters(&m_nIp, 1);
return 0;
@@ -4823,8 +6314,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pCar);
- assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pCar);
+ script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR);
UpdateCompareFlag(pCar->m_bombType == ScriptParams[1]); //TODO: enum
return 0;
}
@@ -4890,9 +6381,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pSourcePed);
+ script_assert(pSourcePed);
CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pTargetPed);
+ script_assert(pTargetPed);
pSourcePed->SetLookFlag(pTargetPed, true);
pSourcePed->SetLookTimer(60000);
return 0;
@@ -4901,9 +6392,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pSourcePed);
+ script_assert(pSourcePed);
CPed* pTargetPed = CWorld::Players[ScriptParams[1]].m_pPed;
- assert(pTargetPed);
+ script_assert(pTargetPed);
pSourcePed->SetLookFlag(pTargetPed, true);
pSourcePed->SetLookTimer(60000);
return 0;
@@ -4912,9 +6403,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pSourcePed);
+ script_assert(pSourcePed);
CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pTargetPed);
+ script_assert(pTargetPed);
pSourcePed->SetLookFlag(pTargetPed, true);
pSourcePed->SetLookTimer(60000);
return 0;
@@ -4923,7 +6414,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pSourcePed);
+ script_assert(pSourcePed);
pSourcePed->ClearLookFlag();
pSourcePed->bKeepTryingToLook = false;
if (pSourcePed->GetPedState() == PED_LOOK_HEADING || pSourcePed->GetPedState() == PED_LOOK_ENTITY)
@@ -4934,7 +6425,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pSourcePed);
+ script_assert(pSourcePed);
pSourcePed->ClearLookFlag();
pSourcePed->bKeepTryingToLook = false;
if (pSourcePed->GetPedState() == PED_LOOK_HEADING || pSourcePed->GetPedState() == PED_LOOK_ENTITY)
@@ -4962,7 +6453,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 5);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
float infX = *(float*)&ScriptParams[1];
float infY = *(float*)&ScriptParams[2];
float supX = *(float*)&ScriptParams[3];
@@ -4988,7 +6479,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVector pos;
pos.x = *(float*)&ScriptParams[1];
pos.y = *(float*)&ScriptParams[2];
@@ -5001,7 +6492,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
bool isTouching = false;
if (pPed->bInVehicle)
@@ -5015,7 +6506,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
bool isTouching = false;
if (pPed->InVehicle())
@@ -5046,7 +6537,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->bHasBlip = (ScriptParams[1] != 0);
return 0;
}
@@ -5054,7 +6545,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bHasBlip = (ScriptParams[1] != 0);
return 0;
}
@@ -5062,7 +6553,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
pObject->bHasBlip = (ScriptParams[1] != 0);
return 0;
}
@@ -5074,8 +6565,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
((CAutomobile*)pVehicle)->m_bombType = ScriptParams[1];
((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed();
return 0;
@@ -5084,7 +6575,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->SetPedStats((ePedStats)ScriptParams[1]);
return 0;
}
@@ -5096,7 +6587,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->m_animGroup = (AssocGroupId)ScriptParams[1];
return 0;
}
@@ -5104,7 +6595,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
pPed->m_animGroup = (AssocGroupId)ScriptParams[1];
return 0;
}
@@ -5219,7 +6710,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
}
//case COMMAND_SET_COLL_OBJ_NO_OBJ:
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -5290,7 +6781,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bRespondsToThreats = (ScriptParams[1] != 0);
return 0;
}
@@ -5298,7 +6789,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
pPed->bRespondsToThreats = (ScriptParams[1] != 0);
return 0;
}
@@ -5314,8 +6805,8 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0);
return 0;
}
@@ -5323,7 +6814,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
int mi = pVehicle->GetModelIndex();
UpdateCompareFlag(mi == MI_TAXI || mi == MI_CABBIE || mi == MI_BORGNINE);
return 0;
@@ -5380,7 +6871,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
return 0;
}
@@ -5388,7 +6879,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 5);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
float infX = *(float*)&ScriptParams[1];
float infY = *(float*)&ScriptParams[2];
float supX = *(float*)&ScriptParams[3];
@@ -5451,7 +6942,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int id = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
CRadar::SetBlipSprite(id, ScriptParams[1]);
@@ -5463,7 +6954,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int id = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH);
CRadar::SetBlipSprite(id, ScriptParams[1]);
@@ -5475,7 +6966,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int id = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH);
CRadar::SetBlipSprite(id, ScriptParams[1]);
@@ -5513,7 +7004,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bOnlyDamagedByPlayer = (ScriptParams[1] != 0);
return 0;
}
@@ -5521,7 +7012,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->bOnlyDamagedByPlayer = (ScriptParams[1] != 0);
return 0;
}
@@ -5529,7 +7020,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 6);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bBulletProof = (ScriptParams[1] != 0);
pPed->bFireProof = (ScriptParams[2] != 0);
pPed->bExplosionProof = (ScriptParams[3] != 0);
@@ -5541,7 +7032,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
{
CollectParameters(&m_nIp, 6);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->bBulletProof = (ScriptParams[1] != 0);
pVehicle->bFireProof = (ScriptParams[2] != 0);
pVehicle->bExplosionProof = (ScriptParams[3] != 0);
@@ -5577,7 +7068,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
UpdateCompareFlag(CGarages::HasThisCarBeenCollected(ScriptParams[0], ScriptParams[1] - 1));
return 0;
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -5630,7 +7121,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 4);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
@@ -5679,7 +7170,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(TheCamera.IsSphereVisible(pVehicle->GetBoundCentre(), pVehicle->GetBoundRadius()));
return 0;
}
@@ -5687,7 +7178,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(TheCamera.IsSphereVisible(pPed->GetBoundCentre(), pPed->GetBoundRadius()));
return 0;
}
@@ -5695,14 +7186,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius()));
return 0;
}
case COMMAND_GOSUB_FILE:
{
CollectParameters(&m_nIp, 2);
- assert(m_nStackPointer < MAX_STACK_DEPTH);
+ script_assert(m_nStackPointer < MAX_STACK_DEPTH);
m_anStack[m_nStackPointer++] = m_nIp;
SetIP(ScriptParams[0]);
// ScriptParams[1] == filename
@@ -5739,7 +7230,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->bComedyControls = (ScriptParams[1] != 0);
return 0;
}
@@ -5747,8 +7238,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 4);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
CBoat* pBoat = (CBoat*)pVehicle;
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
@@ -5764,8 +7255,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
CBoat* pBoat = (CBoat*)pVehicle;
pBoat->AutoPilot.m_nCarMission = MISSION_NONE;
pBoat->SetStatus(STATUS_PHYSICS);
@@ -5777,7 +7268,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 6);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
float x1 = *(float*)&ScriptParams[1];
float y1 = *(float*)&ScriptParams[2];
float x2 = *(float*)&ScriptParams[3];
@@ -5794,7 +7285,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 6);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
float x1 = *(float*)&ScriptParams[1];
float y1 = *(float*)&ScriptParams[2];
float x2 = *(float*)&ScriptParams[3];
@@ -5811,7 +7302,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(ScriptParams[1] == pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType);
return 0;
}
@@ -5819,7 +7310,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(ScriptParams[1] == pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType);
return 0;
}
@@ -5839,8 +7330,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
CBoat* pBoat = (CBoat*)pVehicle;
pBoat->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1];
return 0;
@@ -5946,7 +7437,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->IsTaxi());
return 0;
}
@@ -5954,7 +7445,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->bIsShooting);
return 0;
}
@@ -5962,7 +7453,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->bIsShooting);
return 0;
}
@@ -5981,7 +7472,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->m_wepAccuracy = ScriptParams[1];
return 0;
}
@@ -5989,7 +7480,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
*(float*)&ScriptParams[0] = pVehicle->GetSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND;
StoreParameters(&m_nIp, 1);
return 0;
@@ -6015,7 +7506,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
CollectParameters(&m_nIp, 1);
char name[KEY_LENGTH_IN_SCRIPT];
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
m_nIp += KEY_LENGTH_IN_SCRIPT;
CCutsceneMgr::SetCutsceneAnim(name, pObject);
@@ -6124,7 +7615,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(ScriptParams[1] == pPed->GetModelIndex());
return 0;
}
@@ -6143,7 +7634,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CCutsceneHead* pCutHead = CCutsceneMgr::AddCutsceneHead(pObject, ScriptParams[1]);
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pCutHead);
StoreParameters(&m_nIp, 1);
@@ -6153,7 +7644,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pCutHead = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pCutHead);
+ script_assert(pCutHead);
char name[KEY_LENGTH_IN_SCRIPT];
strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
m_nIp += KEY_LENGTH_IN_SCRIPT;
@@ -6211,7 +7702,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
}
CCranes::ActivateCrane(infX, supX, infY, supY,
*(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8],
- DEGTORAD(*(float*)&ScriptParams[8]), true, false,
+ DEGTORAD(*(float*)&ScriptParams[9]), true, false,
*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
return 0;
}
@@ -6324,7 +7815,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, pTargetPed);
@@ -6390,7 +7881,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bIsRunning = (ScriptParams[1] != 0);
return 0;
}
@@ -6401,7 +7892,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->m_currentColour1 == ScriptParams[1]);
return 0;
}
@@ -6409,7 +7900,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->m_currentColour2 == ScriptParams[1]);
return 0;
}
@@ -6436,13 +7927,13 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
CPed* pLeader = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pPed);
- assert(pLeader);
+ script_assert(pPed);
+ script_assert(pLeader);
UpdateCompareFlag(pPed->m_leader == pLeader);
return 0;
}
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -6455,8 +7946,8 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
CPed* pLeader = CWorld::Players[ScriptParams[1]].m_pPed;
- assert(pPed);
- assert(pLeader);
+ script_assert(pPed);
+ script_assert(pLeader);
UpdateCompareFlag(pPed->m_leader == pLeader);
return 0;
}
@@ -6464,7 +7955,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
if (pPed->m_nPedState == PED_DRIVING) {
pPed->SetDead();
if (!pPed->IsPlayer())
@@ -6482,7 +7973,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
if (CGame::nastyGame) {
pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true);
}
@@ -6495,7 +7986,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CBoat* pBoat = (CBoat*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pBoat && pBoat->m_vehType == VEHICLE_TYPE_BOAT);
+ script_assert(pBoat && pBoat->m_vehType == VEHICLE_TYPE_BOAT);
pBoat->m_bIsAnchored = (ScriptParams[1] == 0);
return 0;
}
@@ -6517,7 +8008,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
ScriptParams[0] = gFireManager.StartScriptFire(pVehicle->GetPosition(), pVehicle, 0.8f, 1);
StoreParameters(&m_nIp, 1);
return 0;
@@ -6526,7 +8017,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
ScriptParams[0] = gFireManager.StartScriptFire(pPed->GetPosition(), pPed, 0.8f, 1);
StoreParameters(&m_nIp, 1);
return 0;
@@ -6626,9 +8117,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
CCarAI::TellCarToRamOtherCar(pVehicle, pTarget);
return 0;
}
@@ -6636,9 +8127,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
CCarAI::TellCarToBlockOtherCar(pVehicle, pTarget);
return 0;
}
@@ -6646,7 +8137,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_CATCH_TRAIN);
return 0;
@@ -6670,7 +8161,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bPedIsBleeding = (ScriptParams[1] != 0);
return 0;
}
@@ -6678,7 +8169,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
// no action
return 0;
}
@@ -6686,8 +8177,8 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
CAutomobile* pCar = (CAutomobile*)pVehicle;
pCar->bBigWheels = (ScriptParams[1] != 0);
return 0;
@@ -6700,7 +8191,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
pPed->bIsVisible = (ScriptParams[1] != 0);
return 0;
}
@@ -6708,7 +8199,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bIsVisible = (ScriptParams[1] != 0);
return 0;
}
@@ -6716,7 +8207,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->bIsVisible = (ScriptParams[1] != 0);
return 0;
}
@@ -6858,11 +8349,15 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 4);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
float heading = LimitAngleOnCircle(
RADTODEG(Atan2(-pObject->GetForward().x, pObject->GetForward().y)));
float headingTarget = *(float*)&ScriptParams[1];
+#ifdef FIX_BUGS
+ float rotateBy = *(float*)&ScriptParams[2] * CTimer::GetTimeStepFix();
+#else
float rotateBy = *(float*)&ScriptParams[2];
+#endif
if (headingTarget == heading) { // using direct comparasion here is fine
UpdateCompareFlag(true);
return 0;
@@ -6908,10 +8403,14 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 8);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CVector pos = pObject->GetPosition();
CVector posTarget = *(CVector*)&ScriptParams[1];
+#ifdef FIX_BUGS
+ CVector slideBy = *(CVector*)&ScriptParams[4] * CTimer::GetTimeStepFix();
+#else
CVector slideBy = *(CVector*)&ScriptParams[4];
+#endif
if (posTarget == pos) { // using direct comparasion here is fine
UpdateCompareFlag(true);
return 0;
@@ -6995,7 +8494,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bKindaStayInSamePlace = (ScriptParams[1] != 0);
return 0;
}
@@ -7006,7 +8505,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
char name[KEY_LENGTH_IN_SCRIPT];
CTheScripts::ReadTextLabelFromScript(&m_nIp, name);
for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++)
@@ -7024,7 +8523,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
int mi = pPed->GetModelIndex();
pPed->m_modelIndex = -1;
pPed->SetModelIndex(mi);
@@ -7106,9 +8605,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 5);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pVehicle);
+ script_assert(pVehicle);
CVector offset = *(CVector*)&ScriptParams[2];
CPhysical::PlacePhysicalRelativeToOtherPhysical(pVehicle, pObject, offset);
return 0;
@@ -7117,9 +8616,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CPlayerPed* pPlayerPed = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
- assert(pPlayerPed);
+ script_assert(pPlayerPed);
pPlayerPed->MakeObjectTargettable(ScriptParams[0]);
return 0;
}
@@ -7127,7 +8626,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPlayerPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPlayerPed);
+ script_assert(pPlayerPed);
pPlayerPed->m_fArmour = clamp(pPlayerPed->m_fArmour + ScriptParams[1], 0.0f, 100.0f);
return 0;
}
@@ -7135,7 +8634,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->m_fArmour = clamp(pPed->m_fArmour + ScriptParams[1], 0.0f, 100.0f);
return 0;
}
@@ -7155,7 +8654,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 4);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
@@ -7226,9 +8725,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
UpdateCompareFlag(pPed->OurPedCanSeeThisOne(pTarget));
return 0;
}
@@ -7236,7 +8735,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_HAIL_TAXI);
return 0;
@@ -7245,7 +8744,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
UpdateCompareFlag(pObject->bRenderDamaged || !pObject->bIsVisible);
return 0;
}
@@ -7283,9 +8782,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pVehicle);
+ script_assert(pVehicle);
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
pPed->WarpPedIntoCar(pVehicle);
return 0;
@@ -7294,9 +8793,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pVehicle);
+ script_assert(pVehicle);
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
pPed->WarpPedIntoCar(pVehicle);
return 0;
@@ -7342,7 +8841,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->SetWaitState((eWaitState)ScriptParams[1], ScriptParams[2] >= 0 ? &ScriptParams[2] : nil);
return 0;
}
@@ -7403,7 +8902,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_STEAL_ANY_CAR);
return 0;
@@ -7494,7 +8993,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 4);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
pObject->SetMoveSpeed(*(CVector*)&ScriptParams[1] * METERS_PER_SECOND_TO_GAME_SPEED);
return 0;
}
@@ -7502,7 +9001,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
pObject->bUsesCollision = (ScriptParams[1] != 0);
return 0;
}
@@ -7510,16 +9009,16 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
// Adding this check to correspond to command name.
// All original game scripts always assume that the vehicle is actually Mr. Whoopee,
// but maybe there are mods that use it as "is alarm activated"?
- assert(pVehicle->GetModelIndex() == MI_MRWHOOP);
+ script_assert(pVehicle->GetModelIndex() == MI_MRWHOOP);
UpdateCompareFlag(pVehicle->m_bSirenOrAlarm);
return 0;
}
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -7622,8 +9121,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 4);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
- pObject->SetMoveSpeed(pObject->GetMoveSpeed() + 0.02f * *(CVector*)&ScriptParams[1]);
+ script_assert(pObject);
+ pObject->SetMoveSpeed(pObject->GetMoveSpeed() + METERS_PER_SECOND_TO_GAME_SPEED * *(CVector*)&ScriptParams[1]);
return 0;
}
case COMMAND_DRAW_SPRITE:
@@ -7686,7 +9185,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
if (ScriptParams[1]) {
if (pObject->bIsStatic) {
pObject->bIsStatic = false;
@@ -7705,7 +9204,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CAnimBlendAssociation* pAssoc = RpAnimBlendClumpGetFirstAssociation(pPed->GetClump());
if (pAssoc)
pAssoc->speed = *(float*)&ScriptParams[1];
@@ -7735,7 +9234,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->m_bSirenOrAlarm = ScriptParams[1] != 0;
return 0;
}
@@ -7765,8 +9264,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
CAutomobile* pCar = (CAutomobile*)pVehicle;
pCar->bWaterTight = ScriptParams[1] != 0;
return 0;
@@ -7796,7 +9295,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bDontDragMeOutCar = ScriptParams[1] != 0;
return 0;
}
@@ -7804,7 +9303,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 3);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
const CVector& pos = pVehicle->GetPosition();
float heading = CGeneral::GetATanOfXY(pos.y - *(float*)&ScriptParams[2], pos.x - *(float*)&ScriptParams[1]) + HALFPI;
if (heading > TWOPI)
@@ -7834,7 +9333,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->SetStatus((eEntityStatus)ScriptParams[1]);
return 0;
}
@@ -7842,7 +9341,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->m_nPedType != PEDTYPE_CIVFEMALE && pPed->m_nPedType != PEDTYPE_PROSTITUTE);
return 0;
}
@@ -7882,7 +9381,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->bTakeLessDamage = ScriptParams[1] != 0;
return 0;
}
@@ -7985,7 +9484,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
pPed->ClearWeapons();
return 0;
}
@@ -8047,7 +9546,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
if (ScriptParams[1]) {
pPed->m_pWanted->m_bIgnoredByEveryone = true;
CWorld::StopAllLawEnforcersInTheirTracks();
@@ -8061,7 +9560,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = pPed->bInVehicle ? pPed->m_pMyVehicle : nil;
ScriptParams[0] = CPools::GetVehiclePool()->GetIndex(pVehicle);
StoreParameters(&m_nIp, 1);
@@ -8071,7 +9570,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = pPed->bInVehicle ? pPed->m_pMyVehicle : nil;
ScriptParams[0] = CPools::GetVehiclePool()->GetIndex(pVehicle);
StoreParameters(&m_nIp, 1);
@@ -8083,7 +9582,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
return 0;
case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING:
{
- assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
+ script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
int16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
strncpy(onscreen_str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
@@ -8093,7 +9592,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
}
case COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING:
{
- assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
+ script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
int16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
CollectParameters(&m_nIp, 1);
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
@@ -8118,7 +9617,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
continue;
// desperatly want to believe this was inlined :|
CBaseModelInfo* pInfo = CModelInfo::GetModelInfo(model);
- assert(pInfo->GetModelType() == MITYPE_VEHICLE);
+ script_assert(pInfo->GetModelType() == MITYPE_VEHICLE);
CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo;
if (pVehicleInfo->m_vehicleType != VEHICLE_TYPE_CAR) {
switch (model) {
@@ -8213,7 +9712,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3]));
CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->SetStatus(STATUS_ABANDONED);
- car->bIsLocked = true;
+ car->bIsLocked = false;
car->bIsCarParkVehicle = true;
CCarCtrl::JoinCarWithRoadSystem(car);
car->AutoPilot.m_nCarMission = MISSION_NONE;
@@ -8241,7 +9740,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pVehicle->bIsDamaged);
return 0;
}
@@ -8262,7 +9761,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 3);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CTheScripts::StuckCars.AddCarToCheck(ScriptParams[0], *(float*)&ScriptParams[1], ScriptParams[2]);
return 0;
}
@@ -8420,7 +9919,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CHud::m_ItemToFlash = ScriptParams[0];
return 0;
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -8453,8 +9952,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
CAutomobile* pCar = (CAutomobile*)pVehicle;
pCar->bNotDamagedUpsideDown = (ScriptParams[1] != 0);
return 0;
@@ -8463,15 +9962,19 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CPlayerPed* pPlayerPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPlayerPed);
+ script_assert(pPlayerPed);
UpdateCompareFlag(pPlayerPed->IsPedInControl() || pPlayerPed->m_nPedState == PED_DRIVING);
return 0;
}
case COMMAND_MAKE_PLAYER_SAFE_FOR_CUTSCENE:
{
CollectParameters(&m_nIp, 1);
+#ifdef MISSION_REPLAY
+ AllowMissionReplay = 0;
+ SaveGameForPause(3);
+#endif
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
- CPad::GetPad(ScriptParams[0])->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80;
+ CPad::GetPad(ScriptParams[0])->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
pPlayerInfo->MakePlayerSafe(true);
CCutsceneMgr::StartCutsceneProcessing();
return 0;
@@ -8492,7 +9995,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
ScriptParams[0] = pVehicle->m_currentColour1;
ScriptParams[1] = pVehicle->m_currentColour2;
StoreParameters(&m_nIp, 2);
@@ -8536,7 +10039,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CollectParameters(&m_nIp, 3);
CPed* pPed1 = CPools::GetPedPool()->GetAt(ScriptParams[0]);
CPed* pPed2 = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pPed1 && pPed2);
+ script_assert(pPed1 && pPed2);
pPed1->SetChat(pPed2, ScriptParams[2]);
pPed2->SetChat(pPed1, ScriptParams[2]);
return 0;
@@ -8546,7 +10049,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
if (ScriptParams[1])
pVehicle->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pVehicle->GetPosition());
else
@@ -8557,7 +10060,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
if (ScriptParams[1])
pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition());
else
@@ -8641,7 +10144,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
if (ScriptParams[1])
pPed->m_pNextPathNode = nil;
pPed->bUsePedNodeSeek = !!ScriptParams[1];
@@ -8651,7 +10154,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->bGunSwitchedOff = !ScriptParams[1];
return 0;
}
@@ -8667,7 +10170,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(!pVehicle->IsDoorMissing((eDoors)ScriptParams[1]) && pVehicle->IsDoorClosed((eDoors)ScriptParams[1]));
return 0;
}
@@ -8676,6 +10179,11 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
case COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL:
{
CollectParameters(&m_nIp, 1);
+#ifdef MISSION_REPLAY
+ missionRetryScriptIndex = ScriptParams[0];
+ if (missionRetryScriptIndex == 19)
+ CStats::LastMissionPassedName[0] = '\0';
+#endif
CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
CFileMgr::ChangeDir("\\");
@@ -8687,13 +10195,14 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CTimer::Resume();
pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true;
+ CTheScripts::bAlreadyRunningAMissionScript = true;
return 0;
}
case COMMAND_SET_OBJECT_DRAW_LAST:
{
CollectParameters(&m_nIp, 2);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
pObject->bDrawLast = !!ScriptParams[1];
return 0;
}
@@ -8701,7 +10210,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CWeapon* pWeaponSlot = &pPed->m_weapons[ScriptParams[1]];
if (pWeaponSlot->m_eWeaponType == (eWeaponType)ScriptParams[1])
ScriptParams[0] = pWeaponSlot->m_nAmmoTotal;
@@ -8714,7 +10223,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CWeapon* pWeaponSlot = &pPed->m_weapons[ScriptParams[1]];
if (pWeaponSlot->m_eWeaponType == (eWeaponType)ScriptParams[1])
ScriptParams[0] = pWeaponSlot->m_nAmmoTotal;
@@ -8778,7 +10287,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(CGarages::IsThisCarWithinGarageArea(ScriptParams[0], pVehicle));
return 0;
}
@@ -8787,7 +10296,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
float fTraction = *(float*)&ScriptParams[1];
- assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR || pVehicle->m_vehType == VEHICLE_TYPE_BIKE);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR || pVehicle->m_vehType == VEHICLE_TYPE_BIKE);
if (pVehicle->m_vehType == VEHICLE_TYPE_CAR)
((CAutomobile*)pVehicle)->m_fTraction = fTraction;
else
@@ -8864,7 +10373,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->AutoPilot.m_bStayInCurrentLevel = !!ScriptParams[1];
return 0;
}
@@ -8872,7 +10381,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pPed);
+ script_assert(pPed);
// not implemented
return 0;
}
@@ -8927,8 +10436,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(ScriptParams[1] >= 0 && ScriptParams[1] < ARRAY_SIZE(pVehicle->pPassengers));
+ script_assert(pVehicle);
+ script_assert(ScriptParams[1] >= 0 && ScriptParams[1] < ARRAY_SIZE(pVehicle->pPassengers));
CPed* pPassenger = pVehicle->pPassengers[ScriptParams[1]];
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPassenger);
StoreParameters(&m_nIp, 1);
@@ -8938,7 +10447,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bChrisCriminal = !!ScriptParams[1];
return 0;
}
@@ -8960,7 +10469,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
if (ScriptParams[1])
pPed->m_nZoneLevel = LEVEL_IGNORE;
else
@@ -8984,7 +10493,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CSpecialParticleStuff::UpdateBoatFoamAnimation(&pObject->GetMatrix());
return 0;
}
@@ -9016,7 +10525,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
pPlayerInfo->m_nNextSexMoneyUpdateTime = 0;
} else {
CPed* pHooker = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pHooker);
+ script_assert(pHooker);
pPlayerInfo->m_pHooker = (CCivilianPed*)pHooker;
pPlayerInfo->m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + 1000;
pPlayerInfo->m_nNextSexMoneyUpdateTime = CTimer::GetTimeInMilliseconds() + 3000;
@@ -9034,7 +10543,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
ScriptParams[0] = pVehicle->GetModelIndex();
StoreParameters(&m_nIp, 1);
return 0;
@@ -9043,9 +10552,9 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_pMyVehicle == pVehicle);
return 0;
}
@@ -9053,7 +10562,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING);
return 0;
}
@@ -9068,7 +10577,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->bNoCriticalHits = (ScriptParams[0] == 0);
return 0;
}
@@ -9076,7 +10585,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->GetPedState() == PED_MAKE_CALL);
return 0;
}
@@ -9084,9 +10593,9 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pVehicle);
+ script_assert(pVehicle);
UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_pMyVehicle == pVehicle);
return 0;
}
@@ -9094,7 +10603,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING);
return 0;
}
@@ -9102,7 +10611,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(!pPed->bInVehicle && pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER &&
pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER);
return 0;
@@ -9111,14 +10620,14 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(!pPed->bInVehicle && pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER &&
pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER);
return 0;
}
#ifndef GTA_PS2
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -9159,7 +10668,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
if (ScriptParams[1])
pVehicle->m_nZoneLevel = LEVEL_IGNORE;
else
@@ -9170,8 +10679,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
- assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
+ script_assert(pVehicle);
+ script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
CAutomobile* pCar = (CAutomobile*)pVehicle;
pCar->bMoreResistantToDamage = ScriptParams[1];
return 0;
@@ -9180,7 +10689,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, FindPlayerCoors(), false);
return 0;
}
@@ -9191,7 +10700,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
printf("End preload end of game audio\n");
return 0;
case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA:
- CPad::GetPad(0)->DisablePlayerControls &= PLAYERCONTROL_DISABLED_1;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
return 0;
#ifndef GTA_PS2
// To be precise, on PS2 previous handlers were in 1000-1099 function
@@ -9200,7 +10709,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 4);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CWorld::Remove(pObject);
pObject->SetOrientation(
DEGTORAD(*(float*)&ScriptParams[1]),
@@ -9223,7 +10732,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CEntity* pTarget = pPed->m_pPointGunAt;
UpdateCompareFlag(pTarget && pTarget->IsPed());
return 0;
@@ -9232,9 +10741,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CPed* pTestedPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pTestedPed);
+ script_assert(pTestedPed);
CEntity* pTarget = pPed->m_pPointGunAt;
UpdateCompareFlag(pTarget && pTarget->IsPed() && pTarget == pTestedPed);
return 0;
@@ -9243,9 +10752,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
CObject* pTestedObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
- assert(pTestedObject);
+ script_assert(pTestedObject);
CEntity* pTarget = pPed->m_pPointGunAt;
UpdateCompareFlag(pTarget && pTarget->IsObject() && pTarget == pTestedObject);
return 0;
@@ -9328,7 +10837,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
pClosestEntity = nil;
}
if (pClosestEntity) {
- assert(pClosestEntity->IsObject());
+ script_assert(pClosestEntity->IsObject());
CObject* pObject = (CObject*)pClosestEntity;
pObject->ObjectCreatedBy = MISSION_OBJECT;
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObject);
@@ -9342,9 +10851,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 5);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- assert(pObject);
+ script_assert(pObject);
CObject* pTarget = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
CVector offset = *(CVector*)&ScriptParams[2];
CPhysical::PlacePhysicalRelativeToOtherPhysical(pTarget, pObject, offset);
return 0;
@@ -9353,7 +10862,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
if (pVehicle->pDriver) {
pVehicle->pDriver->bScriptObjectiveCompleted = false;
pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle);
@@ -9415,7 +10924,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->AutoPilot.m_bStayInFastLane = !ScriptParams[1];
return 0;
}
@@ -9423,7 +10932,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
pPed->m_lastWepDam = -1;
return 0;
}
@@ -9531,9 +11040,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pVehicle);
+ script_assert(pVehicle);
pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FLEE_CAR, pVehicle);
return 0;
@@ -9542,7 +11051,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CPed* pDriver = pVehicle->pDriver;
if (pDriver)
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pDriver);
@@ -9555,7 +11064,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pLeader = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pLeader);
+ script_assert(pLeader);
int total = 0;
int i = CPools::GetPedPool()->GetSize();
while (--i) {
@@ -9582,7 +11091,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
ScriptParams[0] = pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType;
StoreParameters(&m_nIp, 1);
return 0;
@@ -9591,7 +11100,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
ScriptParams[0] = pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType;
StoreParameters(&m_nIp, 1);
return 0;
@@ -9608,7 +11117,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKETURNLEFT;
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[1];
return 0;
@@ -9617,7 +11126,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKETURNRIGHT;
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[1];
return 0;
@@ -9626,7 +11135,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
pVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKESTRAIGHT;
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[1];
return 0;
@@ -9635,7 +11144,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle&& pPed->m_pMyVehicle->m_vehType == VEHICLE_TYPE_BIKE);
return 0;
}
@@ -9652,7 +11161,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->m_vehType == VEHICLE_TYPE_BIKE);
return 0;
}
@@ -9660,7 +11169,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
UpdateCompareFlag(pPed->bFallenDown);
return 0;
}
@@ -9668,7 +11177,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
int pedtype = ScriptParams[1];
bool can = false;
for (int i = 0; i < pPed->m_numNearPeds; i++) {
@@ -9699,7 +11208,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
return 0;
#endif
default:
- assert(0);
+ script_assert(0);
}
return -1;
}
@@ -9719,7 +11228,7 @@ int32 CTheScripts::GetActualScriptSphereIndex(int32 index)
return -1;
uint16 check = (uint32)index >> 16;
uint16 array_idx = index & (0xFFFF);
- assert(array_idx < ARRAY_SIZE(ScriptSphereArray));
+ script_assert(array_idx < ARRAY_SIZE(ScriptSphereArray));
if (check != ScriptSphereArray[array_idx].m_Index)
return -1;
return array_idx;
@@ -9957,7 +11466,7 @@ void CRunningScript::LocatePlayerCommand(int32 command, uint32* pIp)
result = pPlayerInfo->m_pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -9990,7 +11499,7 @@ void CRunningScript::LocatePlayerCharCommand(int32 command, uint32* pIp)
CollectParameters(pIp, b3D ? 6 : 5);
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
CVector pos = pPlayerInfo->GetPos();
if (pTarget->bInVehicle) {
X = pTarget->m_pMyVehicle->GetPosition().x;
@@ -10041,7 +11550,7 @@ void CRunningScript::LocatePlayerCharCommand(int32 command, uint32* pIp)
result = pPlayerInfo->m_pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10077,7 +11586,7 @@ void CRunningScript::LocatePlayerCarCommand(int32 command, uint32* pIp)
CollectParameters(pIp, b3D ? 6 : 5);
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
CVector pos = pPlayerInfo->GetPos();
X = pTarget->GetPosition().x;
Y = pTarget->GetPosition().y;
@@ -10122,7 +11631,7 @@ void CRunningScript::LocatePlayerCarCommand(int32 command, uint32* pIp)
result = pPlayerInfo->m_pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10156,7 +11665,7 @@ void CRunningScript::LocateCharCommand(int32 command, uint32* pIp)
}
CollectParameters(pIp, b3D ? 8 : 6);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
switch (command) {
case COMMAND_LOCATE_STOPPED_CHAR_ANY_MEANS_2D:
@@ -10225,7 +11734,7 @@ void CRunningScript::LocateCharCommand(int32 command, uint32* pIp)
result = pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10257,9 +11766,9 @@ void CRunningScript::LocateCharCharCommand(int32 command, uint32* pIp)
}
CollectParameters(pIp, b3D ? 6 : 5);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
if (pTarget->bInVehicle) {
X = pTarget->m_pMyVehicle->GetPosition().x;
@@ -10311,7 +11820,7 @@ void CRunningScript::LocateCharCharCommand(int32 command, uint32* pIp)
result = pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10346,9 +11855,9 @@ void CRunningScript::LocateCharCarCommand(int32 command, uint32* pIp)
}
CollectParameters(pIp, b3D ? 6 : 5);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
X = pTarget->GetPosition().x;
Y = pTarget->GetPosition().y;
@@ -10388,12 +11897,12 @@ void CRunningScript::LocateCharCarCommand(int32 command, uint32* pIp)
case COMMAND_LOCATE_CHAR_ON_FOOT_CAR_3D:
result = !pPed->bInVehicle;
break;
- case COMMAND_LOCATE_CHAR_IN_CAR_CHAR_2D:
- case COMMAND_LOCATE_CHAR_IN_CAR_CHAR_3D:
+ case COMMAND_LOCATE_CHAR_IN_CAR_CAR_2D:
+ case COMMAND_LOCATE_CHAR_IN_CAR_CAR_3D:
result = pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10424,9 +11933,9 @@ void CRunningScript::LocateCharObjectCommand(int32 command, uint32* pIp)
}
CollectParameters(pIp, b3D ? 6 : 5);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CObject* pTarget = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
- assert(pTarget);
+ script_assert(pTarget);
CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
X = pTarget->GetPosition().x;
Y = pTarget->GetPosition().y;
@@ -10471,7 +11980,7 @@ void CRunningScript::LocateCharObjectCommand(int32 command, uint32* pIp)
result = pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10501,7 +12010,7 @@ void CRunningScript::LocateCarCommand(int32 command, uint32* pIp)
}
CollectParameters(pIp, b3D ? 8 : 6);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CVector pos = pVehicle->GetPosition();
switch (command) {
case COMMAND_LOCATE_STOPPED_CAR_2D:
@@ -10698,7 +12207,7 @@ void CRunningScript::PlayerInAreaCheckCommand(int32 command, uint32* pIp)
result = pPlayerInfo->m_pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10820,7 +12329,7 @@ void CRunningScript::PlayerInAngledAreaCheckCommand(int32 command, uint32* pIp)
result = pPlayerInfo->m_pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10858,7 +12367,7 @@ void CRunningScript::CharInAreaCheckCommand(int32 command, uint32* pIp)
}
CollectParameters(pIp, b3D ? 8 : 6);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
- assert(pPed);
+ script_assert(pPed);
CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition();
switch (command) {
case COMMAND_IS_CHAR_STOPPED_IN_AREA_3D:
@@ -10941,7 +12450,7 @@ void CRunningScript::CharInAreaCheckCommand(int32 command, uint32* pIp)
result = pPed->bInVehicle;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -10972,7 +12481,7 @@ void CRunningScript::CarInAreaCheckCommand(int32 command, uint32* pIp)
}
CollectParameters(pIp, b3D ? 8 : 6);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
- assert(pVehicle);
+ script_assert(pVehicle);
CVector pos = pVehicle->GetPosition();
switch (command) {
case COMMAND_IS_CAR_STOPPED_IN_AREA_3D:
@@ -11039,7 +12548,7 @@ void CRunningScript::CarInAreaCheckCommand(int32 command, uint32* pIp)
result = true;
break;
default:
- assert(false);
+ script_assert(false);
break;
}
}
@@ -11064,7 +12573,13 @@ void CRunningScript::DoDeatharrestCheck()
CPlayerInfo* pPlayer = &CWorld::Players[CWorld::PlayerInFocus];
if (!pPlayer->IsRestartingAfterDeath() && !pPlayer->IsRestartingAfterArrest() && !CTheScripts::UpsideDownCars.AreAnyCarsUpsideDown())
return;
- assert(m_nStackPointer > 0);
+#ifdef MISSION_REPLAY
+ if (AllowMissionReplay != 0)
+ return;
+ if (CanAllowMissionReplay())
+ AllowMissionReplay = 1;
+#endif
+ script_assert(m_nStackPointer > 0);
while (m_nStackPointer > 1)
--m_nStackPointer;
m_nIp = m_anStack[--m_nStackPointer];
@@ -11125,6 +12640,19 @@ int16 CRunningScript::GetPadState(uint16 pad, uint16 button)
return 0;
}
+void CTheScripts::PrintListSizes()
+{
+ int active = 0;
+ int idle = 0;
+
+ for (CRunningScript* pScript = pActiveScripts; pScript; pScript = pScript->GetNext())
+ active++;
+ for (CRunningScript* pScript = pIdleScripts; pScript; pScript = pScript->GetNext())
+ idle++;
+
+ debug("active: %d, idle: %d", active, idle);
+}
+
uint32 DbgLineColour = 0x0000FFFF; // r = 0, g = 0, b = 255, a = 255
void CTheScripts::DrawDebugSquare(float infX, float infY, float supX, float supY)
@@ -11331,7 +12859,7 @@ INITSAVEBUF
uint32 varSpace = ReadSaveBuf<uint32>(buf);
for (uint32 i = 0; i < varSpace; i++)
ScriptSpace[i] = ReadSaveBuf<uint8>(buf);
- assert(ReadSaveBuf<uint32>(buf) == SCRIPT_DATA_SIZE);
+ script_assert(ReadSaveBuf<uint32>(buf) == SCRIPT_DATA_SIZE);
OnAMissionFlag = ReadSaveBuf<uint32>(buf);
for (uint32 i = 0; i < MAX_NUM_CONTACTS; i++) {
OnAMissionForContactFlag[i] = ReadSaveBuf<uint32>(buf);
@@ -11354,7 +12882,7 @@ INITSAVEBUF
BuildingSwapArray[i].m_pBuilding = CPools::GetBuildingPool()->GetSlot(handle - 1);
break;
default:
- assert(false);
+ script_assert(false);
}
BuildingSwapArray[i].m_nNewModel = ReadSaveBuf<uint32>(buf);
BuildingSwapArray[i].m_nOldModel = ReadSaveBuf<uint32>(buf);
@@ -11381,17 +12909,17 @@ INITSAVEBUF
InvisibilitySettingArray[i] = CPools::GetDummyPool()->GetSlot(handle - 1);
break;
default:
- assert(false);
+ script_assert(false);
}
if (InvisibilitySettingArray[i])
InvisibilitySettingArray[i]->bIsVisible = false;
}
- assert(ReadSaveBuf<bool>(buf) == bUsingAMultiScriptFile);
+ script_assert(ReadSaveBuf<bool>(buf) == bUsingAMultiScriptFile);
ReadSaveBuf<uint8>(buf);
ReadSaveBuf<uint16>(buf);
- assert(ReadSaveBuf<uint32>(buf) == MainScriptSize);
- assert(ReadSaveBuf<uint32>(buf) == LargestMissionScriptSize);
- assert(ReadSaveBuf<uint16>(buf) == NumberOfMissionScripts);
+ script_assert(ReadSaveBuf<uint32>(buf) == MainScriptSize);
+ script_assert(ReadSaveBuf<uint32>(buf) == LargestMissionScriptSize);
+ script_assert(ReadSaveBuf<uint16>(buf) == NumberOfMissionScripts);
ReadSaveBuf<uint16>(buf);
uint32 runningScripts = ReadSaveBuf<uint32>(buf);
for (uint32 i = 0; i < runningScripts; i++)
@@ -11643,7 +13171,11 @@ void CTheScripts::UpdateObjectIndices()
if (!pModel)
continue;
strcpy(name, pModel->GetName());
+#ifdef FIX_BUGS
+ for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
+#else
for (int k = 0; k < USED_OBJECT_NAME_LENGTH; k++)
+#endif
name[k] = toupper(name[k]);
if (strcmp(name, UsedObjectArray[i].name) == 0) {
found = true;
@@ -11745,3 +13277,43 @@ void CRunningScript::Load(uint8*& buf)
prev = p;
#endif
}
+
+#ifdef MISSION_REPLAY
+
+bool CRunningScript::CanAllowMissionReplay()
+{
+ if (AllowMissionReplay)
+ return false;
+ if (CStats::LastMissionPassedName[0] == '\0')
+ return false;
+ for (int i = 0; i < ARRAY_SIZE(nonMissionScripts); i++) {
+ if (strcmp(m_abScriptName, nonMissionScripts[i]) == 0)
+ return false;
+ }
+ return true;
+}
+
+uint32 AddExtraDeathDelay()
+{
+ if (missionRetryScriptIndex == 63)
+ return 7000;
+ if (missionRetryScriptIndex == 64)
+ return 4000;
+ return 1000;
+}
+
+void RetryMission(int type, int unk)
+{
+ if (type == 0) {
+ doingMissionRetry = true;
+ FrontEndMenuManager.m_nCurrScreen = MENUPAGE_MISSION_RETRY;
+ FrontEndMenuManager.RequestFrontEndStartUp();
+ }
+ else if (type == 2) {
+ doingMissionRetry = false;
+ AllowMissionReplay = 6;
+ CTheScripts::MissionCleanup.Process();
+ }
+}
+
+#endif
diff --git a/src/control/Script.h b/src/control/Script.h
index 1d3a7ad8..e0ed314e 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -350,6 +350,7 @@ private:
static bool IsPlayerStopped(CPlayerInfo*);
static bool IsVehicleStopped(CVehicle*);
+ static void PrintListSizes();
static void ReadObjectNamesFromScript();
static void UpdateObjectIndices();
static void ReadMultiScriptFileOffsetsFromScript();
@@ -372,6 +373,9 @@ private:
friend class CRunningScript;
friend class CHud;
friend void CMissionCleanup::Process();
+#ifdef FIX_BUGS
+ friend void RetryMission(int, int);
+#endif
};
@@ -479,6 +483,15 @@ private:
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
+#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) {
@@ -502,3 +515,19 @@ private:
}
}
};
+
+#ifdef MISSION_REPLAY
+extern int AllowMissionReplay;
+extern uint32 WaitForMissionActivate;
+extern uint32 WaitForSave;
+extern uint32 MissionStartTime;
+extern int missionRetryScriptIndex;
+extern bool doingMissionRetry;
+
+uint32 AddExtraDeathDelay();
+void RetryMission(int, int);
+#endif
+
+#ifdef USE_DEBUG_SCRIPT_LOADER
+extern int scriptToLoad;
+#endif \ No newline at end of file
diff --git a/src/control/ScriptCommands.h b/src/control/ScriptCommands.h
index 77cf3f0f..56908edb 100644
--- a/src/control/ScriptCommands.h
+++ b/src/control/ScriptCommands.h
@@ -1157,7 +1157,38 @@ enum {
COMMAND_CAN_CHAR_SEE_DEAD_CHAR,
COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER,
#ifndef GTA3_1_1_PATCH
- COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER
+ COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER,
#endif
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+ LAST_SCRIPT_COMMAND
#endif
-}; \ No newline at end of file
+#endif
+};
+
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+
+enum eScriptArgument
+{
+ ARGTYPE_NONE = 0,
+ ARGTYPE_INT,
+ ARGTYPE_FLOAT,
+ ARGTYPE_STRING,
+ ARGTYPE_LABEL,
+ ARGTYPE_BOOL,
+ ARGTYPE_PED_HANDLE,
+ ARGTYPE_VEHICLE_HANDLE,
+ ARGTYPE_OBJECT_HANDLE,
+ ARGTYPE_ANDOR
+};
+
+struct tScriptCommandData
+{
+ int id;
+ const char name[64];
+ eScriptArgument input[18];
+ eScriptArgument output[18];
+ bool cond;
+ int position;
+ const char name_override[8];
+};
+#endif \ No newline at end of file
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index f49f811f..c8d8cb56 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -47,6 +47,12 @@ CAnimViewer::Render(void) {
if (pTarget) {
// pTarget->GetPosition() = CVector(0.0f, 0.0f, 0.0f);
if (pTarget) {
+#ifdef FIX_BUGS
+#ifdef PED_SKIN
+ if(pTarget->IsPed())
+ ((CPed*)pTarget)->UpdateRpHAnim();
+#endif
+#endif
pTarget->Render();
CRenderer::RenderOneNonRoad(pTarget);
}
@@ -67,11 +73,7 @@ CAnimViewer::Initialise(void) {
CReferences::Init();
TheCamera.Init();
TheCamera.SetRwCamera(Scene.camera);
-
- // I didn't get which camera og code selects.
- for (int i = 0; i < 3; i++) {
- TheCamera.Cams[i].Distance = 5.0f;
- }
+ TheCamera.Cams[TheCamera.ActiveCam].Distance = 5.0f;
gbModelViewer = true;
CHud::m_Wants_To_Draw_Hud = false;
@@ -146,30 +148,33 @@ int
LastPedModelId(int modelId)
{
CBaseModelInfo *model;
- for (int i = modelId; i >= 0; i--) {
- model = CModelInfo::GetModelInfo(i);
- if (model->GetModelType() == MITYPE_PED)
- return i;
+ for(;;){
+ assert(modelId < MODELINFOSIZE);
+ model = CModelInfo::GetModelInfo(modelId);
+ if (model && model->GetModelType() == MITYPE_PED)
+ break;
+ modelId--;
}
return modelId;
}
int
-LastVehicleModelId(int modelId)
+FirstCarModelId(int modelId)
{
- CBaseModelInfo* model;
- for (int i = modelId; i >= 0; i--) {
- model = CModelInfo::GetModelInfo(i);
- if (model->GetModelType() == MITYPE_VEHICLE)
- return i;
+ CBaseModelInfo *model;
+ for(;;){
+ assert(modelId < MODELINFOSIZE);
+ model = CModelInfo::GetModelInfo(modelId);
+ if (model && model->GetModelType() == MITYPE_VEHICLE)
+ break;
+ modelId++;
}
return modelId;
}
-// It's me that named this.
int
-FindMeAModelID(int modelId, int wantedChange)
+NextModelId(int modelId, int wantedChange)
{
// Max. 2 trials wasn't here, it's me that added it.
@@ -220,7 +225,6 @@ CAnimViewer::Update(void)
AssocGroupId animGroup = ASSOCGRP_STD;
int nextModelId = modelId;
CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId);
- CEntity *newEntity = nil;
if (modelInfo->GetModelType() == MITYPE_PED) {
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
@@ -261,40 +265,30 @@ CAnimViewer::Update(void)
if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo;
- if (veh->m_vehicleType != VEHICLE_TYPE_CAR) {
- // Not ready yet
-/* if (veh->m_vehicleType == VEHICLE_TYPE_BOAT)
- {
- v33 = (CBoat*)CVehicle::operator new((CVehicle*)0x488, v6);
- CBoat::CBoat(v33, modelId, 1u);
- newEntity = (int)v33;
- pTarget = (int)v33;
- }
- else
- {
-*/ newEntity = pTarget = new CObject(modelId, true);
- if (!modelInfo->GetColModel()) {
- modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
- }
-// }
+ if (veh->m_vehicleType == VEHICLE_TYPE_CAR) {
+ pTarget = new CAutomobile(modelId, RANDOM_VEHICLE);
+ } else if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) {
+ pTarget = new CBoat(modelId, RANDOM_VEHICLE);
} else {
- newEntity = pTarget = new CAutomobile(modelId, RANDOM_VEHICLE);
- newEntity->SetStatus(STATUS_ABANDONED);
+ pTarget = new CObject(modelId, true);
+ if (!modelInfo->GetColModel()) {
+ modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
+ }
}
- newEntity->bIsStuck = true;
+ pTarget->SetStatus(STATUS_ABANDONED);
} else if (modelInfo->GetModelType() == MITYPE_PED) {
- pTarget = newEntity = new CPed(PEDTYPE_CIVMALE);
- newEntity->SetModelIndex(modelId);
+ pTarget = new CPed(PEDTYPE_CIVMALE);
+ pTarget->SetModelIndex(modelId);
} else {
- newEntity = pTarget = new CObject(modelId, true);
+ pTarget = new CObject(modelId, true);
if (!modelInfo->GetColModel())
{
modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
}
- newEntity->bIsStuck = true;
+ pTarget->SetStatus(STATUS_ABANDONED);
}
- newEntity->SetPosition(0.0f, 0.0f, 0.0f);
- CWorld::Add(newEntity);
+ pTarget->SetPosition(0.0f, 0.0f, 0.0f);
+ CWorld::Add(pTarget);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT);
}
if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) {
@@ -302,43 +296,26 @@ CAnimViewer::Update(void)
}
pTarget->GetMatrix().GetPosition().z = 0.0f;
- if (modelInfo->GetModelType() != MITYPE_PED) {
-
- if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
-
- if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
- nextModelId = LastPedModelId(modelId);
- AsciiToUnicode("Switched to peds", gUString);
- CMessages::AddMessage(gUString, 1000, 0);
- } else {
- // Start in mobile
- if (pad->NewState.Square && !pad->OldState.Square) {
- CVehicleModelInfo::LoadVehicleColours();
- AsciiToUnicode("Carcols.dat reloaded", gUString);
- CMessages::AddMessage(gUString, 1000, 0);
- }
- }
- }
- } else {
+ if (modelInfo->GetModelType() == MITYPE_PED) {
((CPed*)pTarget)->bKindaStayInSamePlace = true;
// Triangle in mobile
- if (pad->NewState.Square && !pad->OldState.Square) {
+ if (pad->GetSquareJustDown()) {
reloadIFP = 1;
AsciiToUnicode("IFP reloaded", gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.Cross && !pad->OldState.Cross) {
+ } else if (pad->GetCrossJustDown()) {
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
AsciiToUnicode("Animation restarted", gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.Circle && !pad->OldState.Circle) {
+ } else if (pad->GetCircleJustDown()) {
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE);
AsciiToUnicode("Idle animation playing", gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.DPadUp && pad->OldState.DPadUp == 0) {
+ } else if (pad->GetDPadUpJustDown()) {
animId--;
if (animId < 0) {
animId = NUM_ANIMS - 1;
@@ -349,7 +326,7 @@ CAnimViewer::Update(void)
AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.DPadDown && !pad->OldState.DPadDown) {
+ } else if (pad->GetDPadDownJustDown()) {
animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1);
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
@@ -357,42 +334,48 @@ CAnimViewer::Update(void)
AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else {
- if (pad->NewState.Start && !pad->OldState.Start) {
+ } else if (pad->GetStartJustDown()) {
- } else {
- if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
- nextModelId = LastVehicleModelId(modelId);
- AsciiToUnicode("Switched to vehicles", gUString);
- CMessages::AddMessage(gUString, 1000, 0);
- } else {
- // Originally it was GetPad(1)->LeftShoulder2
- if (pad->NewState.Triangle) {
+ } else if (pad->GetLeftShoulder1JustDown()) {
+ nextModelId = FirstCarModelId(modelId);
+ AsciiToUnicode("Switched to vehicles", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
+ // Originally it was GetPad(1)->LeftShoulder2
+ } else if (pad->NewState.Triangle) {
#ifdef PED_SKIN
- if(IsClumpSkinned(pTarget->GetClump()))
- ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump());
- else
+ if(IsClumpSkinned(pTarget->GetClump()))
+ ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump());
+ else
#endif
- CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(),
- RpClumpGetFrame(pTarget->GetClump()));
- AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
- CMessages::AddMessage(gUString, 100, 0);
- }
- }
- }
+ CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(),
+ RpClumpGetFrame(pTarget->GetClump()));
+ AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
+ CMessages::AddMessage(gUString, 100, 0);
+ }
+ } else if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
+
+ if (pad->GetLeftShoulder1JustDown()) {
+ nextModelId = LastPedModelId(modelId);
+ AsciiToUnicode("Switched to peds", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
+ // Start in mobile
+ } else if (pad->GetSquareJustDown()) {
+ CVehicleModelInfo::LoadVehicleColours();
+ AsciiToUnicode("Carcols.dat reloaded", gUString);
+ CMessages::AddMessage(gUString, 1000, 0);
}
}
}
- if (pad->NewState.DPadLeft && pad->OldState.DPadLeft == 0) {
- nextModelId = FindMeAModelID(modelId, -1);
+ if (pad->GetDPadLeftJustDown()) {
+ nextModelId = NextModelId(modelId, -1);
sprintf(gString, "Current model ID: %d", nextModelId);
AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0);
- } else if (pad->NewState.DPadRight && pad->OldState.DPadRight == 0) {
- nextModelId = FindMeAModelID(modelId, 1);
+ } else if (pad->GetDPadRightJustDown()) {
+ nextModelId = NextModelId(modelId, 1);
sprintf(gString, "Current model ID: %d", nextModelId);
AsciiToUnicode(gString, gUString);
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 1b57568d..d038c423 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -5,6 +5,7 @@
#include "World.h"
#include "Vehicle.h"
#include "Automobile.h"
+#include "Boat.h"
#include "Ped.h"
#include "PlayerPed.h"
#include "CopPed.h"
@@ -29,7 +30,7 @@ bool PrintDebugCode = false;
int16 DebugCamMode;
#ifdef FREE_CAM
-bool CCamera::bFreeCam = true;
+bool CCamera::bFreeCam;
int nPreviousMode = -1;
#endif
@@ -39,11 +40,11 @@ CCam::Init(void)
Mode = MODE_FOLLOWPED;
Front = CVector(0.0f, 0.0f, -1.0f);
Up = CVector(0.0f, 0.0f, 1.0f);
- Rotating = 0;
+ Rotating = false;
m_iDoCollisionChecksOnFrameNum = 1;
m_iDoCollisionCheckEveryNumOfFrames = 9;
m_iFrameNumWereAt = 0;
- m_bCollisionChecksOn = 1;
+ m_bCollisionChecksOn = false;
m_fRealGroundDist = 0.0f;
BetaSpeed = 0.0f;
AlphaSpeed = 0.0f;
@@ -51,21 +52,21 @@ CCam::Init(void)
f_max_role_angle = DEGTORAD(5.0f);
Distance = 30.0f;
DistanceSpeed = 0.0f;
- m_pLastCarEntered = 0;
- m_pLastPedLookedAt = 0;
- ResetStatics = 1;
+ m_pLastCarEntered = nil;
+ m_pLastPedLookedAt = nil;
+ ResetStatics = true;
Beta = 0.0f;
- m_bFixingBeta = 0;
+ m_bFixingBeta = false;
CA_MIN_DISTANCE = 0.0f;
CA_MAX_DISTANCE = 0.0f;
- LookingBehind = 0;
- LookingLeft = 0;
- LookingRight = 0;
+ LookingBehind = false;
+ LookingLeft = false;
+ LookingRight = false;
m_fPlayerInFrontSyphonAngleOffSet = DEGTORAD(20.0f);
m_fSyphonModeTargetZOffSet = 0.5f;
m_fRadiusForDead = 1.5f;
DirectionWasLooking = LOOKING_FORWARD;
- LookBehindCamWasInFront = 0;
+ LookBehindCamWasInFront = false;
f_Roll = 0.0f;
f_rollSpeed = 0.0f;
m_fCloseInPedHeightOffset = 0.0f;
@@ -110,7 +111,11 @@ CCam::Process(void)
Fwd.x = CamTargetEntity->GetForward().x;
Fwd.y = CamTargetEntity->GetForward().y;
Fwd.Normalise();
- // Game normalizes again here manually. useless, so skipped
+ float FwdLength = Fwd.Magnitude2D();
+ if(FwdLength != 0.0f){
+ Fwd.x /= FwdLength;
+ Fwd.y /= FwdLength;
+ }
float FwdSpeedX = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().x * Fwd.x;
float FwdSpeedY = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().y * Fwd.y;
@@ -162,7 +167,9 @@ CCam::Process(void)
case MODE_MODELVIEW:
Process_ModelView(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
-// case MODE_BILL:
+ case MODE_BILL:
+ Process_Bill(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
case MODE_SYPHON:
Process_Syphon(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
@@ -210,10 +217,18 @@ CCam::Process(void)
case MODE_PLAYER_FALLEN_WATER:
Process_Player_Fallen_Water(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
-// case MODE_CAM_ON_TRAIN_ROOF:
-// case MODE_CAM_RUNNING_SIDE_TRAIN:
-// case MODE_BLOOD_ON_THE_TRACKS:
-// case MODE_IM_THE_PASSENGER_WOOWOO:
+ case MODE_CAM_ON_TRAIN_ROOF:
+ Process_Cam_On_Train_Roof(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_CAM_RUNNING_SIDE_TRAIN:
+ Process_Cam_Running_Side_Train(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_BLOOD_ON_THE_TRACKS:
+ Process_Blood_On_The_Tracks(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_IM_THE_PASSENGER_WOOWOO:
+ Process_Im_The_Passenger_Woo_Woo(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
case MODE_SYPHON_CRIM_IN_FRONT:
Process_Syphon_Crim_In_Front(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
@@ -263,7 +278,7 @@ CCam::Process(void)
CVector TargetToCam = Source - m_cvecTargetCoorsForFudgeInter;
float DistOnGround = TargetToCam.Magnitude2D();
m_fTrueBeta = CGeneral::GetATanOfXY(TargetToCam.x, TargetToCam.y);
- m_fTrueAlpha = CGeneral::GetATanOfXY(TargetToCam.z, DistOnGround);
+ m_fTrueAlpha = CGeneral::GetATanOfXY(DistOnGround, TargetToCam.z);
if(TheCamera.m_uiTransitionState == 0)
KeepTrackOfTheSpeed(Source, m_cvecTargetCoorsForFudgeInter, Up, m_fTrueAlpha, m_fTrueBeta, FOV);
@@ -419,11 +434,11 @@ CCam::ProcessSpecialHeightRoutines(void)
float DistScale = (2.1f - dist)/2.1f;
if(Mode == MODE_FOLLOWPED){
if(TheCamera.PedZoomIndicator == CAM_ZOOM_1)
- Offset = 0.45*DistScale + PedZDist;
+ Offset = 0.45f*DistScale + PedZDist;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_2)
- Offset = 0.35*DistScale + PedZDist;
+ Offset = 0.35f*DistScale + PedZDist;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_3)
- Offset = 0.25*DistScale + PedZDist;
+ Offset = 0.25f*DistScale + PedZDist;
if(Abs(CGeneral::GetRadianAngleBetweenPoints(CamToPed.x, CamToPed.y, CamToTarget.x, CamToTarget.y)) > HALFPI)
Offset += 0.3f;
m_fPedBetweenCameraHeightOffset = Offset + 1.3f;
@@ -504,11 +519,11 @@ CCam::ProcessSpecialHeightRoutines(void)
switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched)
case SURFACE_GRASS:
- case SURFACE_DIRT:
- case SURFACE_DIRTTRACK:
- case SURFACE_STEEL:
- case SURFACE_TIRE:
- case SURFACE_STONE:
+ case SURFACE_GRAVEL:
+ case SURFACE_MUD_DRY:
+ case SURFACE_THICK_METAL_PLATE:
+ case SURFACE_RUBBER:
+ case SURFACE_STEEP_CLIFF:
OnRoad = true;
if(CCullZones::PlayerNoRain())
@@ -565,9 +580,9 @@ CCam::ProcessSpecialHeightRoutines(void)
if(PreviouslyFailedRoadHeightCheck && m_fCloseInPedHeightOffset < 0.0001f){
if(colPoint.surfaceB != SURFACE_TARMAC &&
colPoint.surfaceB != SURFACE_GRASS &&
- colPoint.surfaceB != SURFACE_DIRT &&
- colPoint.surfaceB != SURFACE_DIRTTRACK &&
- colPoint.surfaceB != SURFACE_STONE){
+ colPoint.surfaceB != SURFACE_GRAVEL &&
+ colPoint.surfaceB != SURFACE_MUD_DRY &&
+ colPoint.surfaceB != SURFACE_STEEP_CLIFF){
if(m_fRoadOffSet > 1.4f)
m_fRoadOffSet = 1.4f;
}else{
@@ -795,7 +810,7 @@ CCam::ClipIfPedInFrontOfPlayer(void)
while(DeltaAngle >= PI) DeltaAngle -= 2*PI;
while(DeltaAngle < -PI) DeltaAngle += 2*PI;
if(Abs(DeltaAngle) < HALFPI){
- fDist = Sqrt(SQR(vDist.x) + SQR(vDist.y));
+ fDist = vDist.Magnitude2D();
if(fDist < 1.25f){
Near = DEFAULT_NEAR - (1.25f - fDist);
if(Near < 0.05f)
@@ -822,9 +837,9 @@ CCam::KeepTrackOfTheSpeed(const CVector &source, const CVector &target, const CV
PreviousUp = up;
}
- m_cvecSourceSpeedOverOneFrame = PreviousSource - source;
- m_cvecTargetSpeedOverOneFrame = PreviousTarget - target;
- m_cvecUpOverOneFrame = PreviousUp - up;
+ m_cvecSourceSpeedOverOneFrame = source - PreviousSource;
+ m_cvecTargetSpeedOverOneFrame = target - PreviousTarget;
+ m_cvecUpOverOneFrame = up - PreviousUp;
m_fFovSpeedOverOneFrame = fov - PreviousFov;
m_fBetaSpeedOverOneFrame = beta - PreviousBeta;
MakeAngleLessThan180(m_fBetaSpeedOverOneFrame);
@@ -846,17 +861,13 @@ CCam::Using3rdPersonMouseCam(void)
(Mode == MODE_FOLLOWPED ||
TheCamera.m_bPlayerIsInGarage &&
FindPlayerPed() && FindPlayerPed()->m_nPedState != PED_DRIVING &&
- Mode != MODE_TOPDOWN && this->CamTargetEntity == FindPlayerPed());
+ Mode != MODE_TOPDOWN && CamTargetEntity == FindPlayerPed());
}
bool
CCam::GetWeaponFirstPersonOn(void)
{
- CEntity *target = this->CamTargetEntity;
- if (target && target->IsPed())
- return ((CPed*)target)->GetWeapon()->m_bAddRotOffset;
-
- return false;
+ return CamTargetEntity && CamTargetEntity->IsPed() && ((CPed*)CamTargetEntity)->GetWeapon()->m_bAddRotOffset;
}
bool
@@ -992,12 +1003,15 @@ CCam::GetPedBetaAngleForClearView(const CVector &Target, float Dist, float BetaO
return 0.0f;
}
-static float DefaultAcceleration = 0.045f;
-static float DefaultMaxStep = 0.15f;
+float DefaultAcceleration = 0.045f;
+float DefaultMaxStep = 0.15f;
void
CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float)
{
+ if(!CamTargetEntity->IsPed())
+ return;
+
const float GroundDist = 1.85f;
CVector TargetCoors, Dist, IdealSource;
@@ -1014,7 +1028,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bool GoingBehind = false;
bool Obscured = false;
bool BuildingCheckObscured = false;
- bool HackPlayerOnStoppingTrain = false;
+ bool StandingInTrain = false;
static int TimeIndicatedWantedToGoDown = 0;
static bool StartedCountingForGoDown = false;
float DeltaBeta;
@@ -1023,12 +1037,6 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bBelowMinDist = false;
bBehindPlayerDesired = false;
-#ifdef FIX_BUGS
- if(!CamTargetEntity->IsPed())
- return;
-#endif
- assert(CamTargetEntity->IsPed());
-
// CenterDist should be > LateralDist because we don't have an angle for safety in this case
float CenterDist, LateralDist;
float AngleToGoToSpeed;
@@ -1094,7 +1102,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
if(FindPlayerVehicle())
if(FindPlayerVehicle()->m_vehType == VEHICLE_TYPE_TRAIN)
- HackPlayerOnStoppingTrain = true;
+ StandingInTrain = true;
if(TheCamera.m_bCamDirectlyInFront){
m_bCollisionChecksOn = true;
@@ -1347,7 +1355,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
if(TheCamera.m_bCamDirectlyBehind || TheCamera.m_bCamDirectlyInFront ||
- HackPlayerOnStoppingTrain || Rotating){
+ StandingInTrain || Rotating){
if(TheCamera.m_bCamDirectlyBehind){
Beta = TargetOrientation + PI;
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
@@ -1358,7 +1366,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
}
- if(HackPlayerOnStoppingTrain){
+ if(StandingInTrain){
Beta = TargetOrientation + PI;
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
@@ -1408,11 +1416,11 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bool foo = false;
switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched)
case SURFACE_GRASS:
- case SURFACE_DIRT:
+ case SURFACE_GRAVEL:
case SURFACE_PAVEMENT:
- case SURFACE_STEEL:
- case SURFACE_TIRE:
- case SURFACE_STONE:
+ case SURFACE_THICK_METAL_PLATE:
+ case SURFACE_RUBBER:
+ case SURFACE_STEEP_CLIFF:
foo = true;
if(foo)
WellBufferMe(TargetHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.4f, 0.05f, false);
@@ -1467,14 +1475,14 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
ResetStatics = false;
}
-static float fBaseDist = 1.7f;
-static float fAngleDist = 2.0f;
-static float fFalloff = 3.0f;
-static float fStickSens = 0.01f;
-static float fTweakFOV = 1.05f;
-static float fTranslateCamUp = 0.8f;
-static int16 nFadeControlThreshhold = 45;
-static float fDefaultAlphaOrient = -0.22f;
+float fBaseDist = 1.7f;
+float fAngleDist = 2.0f;
+float fFalloff = 3.0f;
+float fStickSens = 0.01f;
+float fTweakFOV = 1.05f;
+float fTranslateCamUp = 0.8f;
+int16 nFadeControlThreshhold = 45;
+float fDefaultAlphaOrient = -0.22f;
void
CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float)
@@ -1516,8 +1524,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
- BetaOffset = LookLeftRight * fStickSens * (0.5f/7.0f) * FOV/80.0f * CTimer::GetTimeStep();
- AlphaOffset = LookUpDown * fStickSens * (0.3f/7.0f) * FOV/80.0f * CTimer::GetTimeStep();
+ BetaOffset = LookLeftRight * fStickSens * (1.0f/14.0f) * FOV/80.0f * CTimer::GetTimeStep();
+ AlphaOffset = LookUpDown * fStickSens * (0.6f/14.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
if(TheCamera.GetFading() && TheCamera.GetFadingDirection() == FADE_IN && nFadeControlThreshhold < CDraw::FadeValue ||
@@ -1539,7 +1547,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors = CameraTarget;
TargetCoors.z += fTranslateCamUp;
@@ -1577,7 +1585,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
- if(entity->IsPed() && ColCamDist > 1.0f){
+ if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
@@ -1615,9 +1623,12 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(dist == 0.1f)
Source += (TargetCoors - Source)*0.3f;
+ Near = RwCameraGetNearClipPlane(Scene.camera);
#ifndef FIX_BUGS
// this is totally wrong...
radius = Tan(FOV / 2.0f) * Near;
+#else
+ radius = ViewPlaneWidth*Near;
#endif
// Keep testing
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
@@ -1656,6 +1667,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
}
}
+float fBillsBetaOffset; // made up name, actually in CCam
+
void
CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float)
{
@@ -1675,6 +1688,15 @@ CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, fl
if(Length < 0.002f)
Length = 0.002f;
Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
+#ifdef TOGGLEABLE_BETA_FEATURES
+ // This is completely made up but Bill's cam manipulates an angle before calling this
+ // and otherwise calculating Beta doesn't make much sense.
+ Beta += fBillsBetaOffset;
+ fBillsBetaOffset = 0.0f;
+ Dist.x = -Length*Cos(Beta);
+ Dist.y = -Length*Sin(Beta);
+ Source = TargetCoors + Dist;
+#endif
if(Length > CA_MAX_DISTANCE){
Source.x = TargetCoors.x + Dist.x/Length * CA_MAX_DISTANCE;
Source.y = TargetCoors.y + Dist.y/Length * CA_MAX_DISTANCE;
@@ -1764,8 +1786,13 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation)
else
WellBufferMe(TargetZOffSet, &RoadHeightFix, &RoadHeightFixSpeed, 0.27f, 0.1f, false);
- if((colpoint.surfaceB == SURFACE_DEFAULT || colpoint.surfaceB >= SURFACE_METAL6) &&
- colpoint.surfaceB != SURFACE_STEEL && colpoint.surfaceB != SURFACE_STONE &&
+ if(colpoint.surfaceB != SURFACE_TARMAC &&
+ colpoint.surfaceB != SURFACE_GRASS &&
+ colpoint.surfaceB != SURFACE_GRAVEL &&
+ colpoint.surfaceB != SURFACE_MUD_DRY &&
+ colpoint.surfaceB != SURFACE_PAVEMENT &&
+ colpoint.surfaceB != SURFACE_THICK_METAL_PLATE &&
+ colpoint.surfaceB != SURFACE_STEEP_CLIFF &&
RoadHeightFix > 1.4f)
RoadHeightFix = 1.4f;
@@ -1775,14 +1802,14 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation)
void
CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, float TargetHeight)
{
+ float AlphaOffset = 0.0f;
+ bool CamClear = true;
+
static float LastTargetAlphaWithCollisionOn = 0.0f;
static float LastTopAlphaSpeed = 0.0f;
static float LastAlphaSpeedStep = 0.0f;
static bool PreviousNearCheckNearClipSmall = false;
- bool CamClear = true;
- float ModeAlpha = 0.0f;
-
if(ResetStatics){
LastTargetAlphaWithCollisionOn = 0.0f;
LastTopAlphaSpeed = 0.0f;
@@ -1797,17 +1824,16 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
if(zoomvalue < 0.1f)
zoomvalue = 0.1f;
if(TheCamera.CarZoomIndicator == CAM_ZOOM_1)
- ModeAlpha = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near
+ AlphaOffset = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near
else if(TheCamera.CarZoomIndicator == CAM_ZOOM_2)
- ModeAlpha = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid
+ AlphaOffset = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid
else if(TheCamera.CarZoomIndicator == CAM_ZOOM_3)
- ModeAlpha = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far
+ AlphaOffset = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far
float Length = (Source - TargetCoors).Magnitude2D();
if(m_bCollisionChecksOn){ // there's another variable (on PC) but it's uninitialised
- CVector Forward = CamTargetEntity->GetForward();
- float CarAlpha = CGeneral::GetATanOfXY(Forward.Magnitude2D(), Forward.z);
+ float CarAlpha = CGeneral::GetATanOfXY(CamTargetEntity->GetForward().Magnitude2D(), CamTargetEntity->GetForward().z);
// this shouldn't be necessary....
while(CarAlpha >= PI) CarAlpha -= 2*PI;
while(CarAlpha < -PI) CarAlpha += 2*PI;
@@ -1815,11 +1841,11 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
- float deltaBeta = Beta - TargetOrientation;
- while(deltaBeta >= PI) deltaBeta -= 2*PI;
- while(deltaBeta < -PI) deltaBeta += 2*PI;
+ float DeltaBeta = Beta - TargetOrientation;
+ while(DeltaBeta >= PI) DeltaBeta -= 2*PI;
+ while(DeltaBeta < -PI) DeltaBeta += 2*PI;
- float BehindCarNess = Cos(deltaBeta); // 1 if behind car, 0 if side, -1 if in front
+ float BehindCarNess = Cos(DeltaBeta); // 1 if behind car, 0 if side, -1 if in front
CarAlpha = -CarAlpha * BehindCarNess;
if(CarAlpha < -0.01f)
CarAlpha = -0.01f;
@@ -1829,10 +1855,10 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
while(DeltaAlpha < -PI) DeltaAlpha += 2*PI;
// What's this?? wouldn't it make more sense to clamp?
float AngleLimit = DEGTORAD(1.8f);
- if(DeltaAlpha < -AngleLimit)
- DeltaAlpha += AngleLimit;
- else if(DeltaAlpha > AngleLimit)
+ if(DeltaAlpha > AngleLimit)
DeltaAlpha -= AngleLimit;
+ else if(DeltaAlpha < -AngleLimit)
+ DeltaAlpha += AngleLimit;
else
DeltaAlpha = 0.0f;
@@ -1851,7 +1877,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
float CarRoof = CWorld::FindRoofZFor3DCoord(TargetCoors.x, TargetCoors.y, CarBottom, &FoundRoofCenter);
// Check sides of the car
- Forward = CamTargetEntity->GetForward(); // we actually still have that...
+ CVector Forward = CamTargetEntity->GetForward();
Forward.Normalise(); // shouldn't be necessary
float CarSideAngle = CGeneral::GetATanOfXY(Forward.x, Forward.y) + PI/2.0f;
float SideX = 2.5f * Cos(CarSideAngle);
@@ -1860,7 +1886,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
CWorld::FindRoofZFor3DCoord(TargetCoors.x - SideX, TargetCoors.y - SideY, CarBottom, &FoundRoofSide2);
// Now find out at what height we'd like to place the camera
- float CamGround = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, TargetCoors.z + Length*Sin(Alpha + ModeAlpha) + m_fCloseInCarHeightOffset, &FoundCamGround);
+ float CamGround = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, TargetCoors.z + Length*Sin(Alpha + AlphaOffset) + m_fCloseInCarHeightOffset, &FoundCamGround);
float CamTargetZ = 0.0f;
if(FoundCamGround){
// This is the normal case
@@ -1890,15 +1916,15 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
TargetAlpha = DEGTORAD(-7.0f);
// huh?
- if(TargetAlpha > ModeAlpha)
+ if(TargetAlpha > AlphaOffset)
CamClear = true;
- // Camera is contrained by collision in some way
+ // Camera is constrained by collision in some way
PreviousNearCheckNearClipSmall = false;
if(!CamClear){
PreviousNearCheckNearClipSmall = true;
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
- DeltaAlpha = TargetAlpha - (Alpha + ModeAlpha);
+ DeltaAlpha = TargetAlpha - (Alpha + AlphaOffset);
while(DeltaAlpha >= PI) DeltaAlpha -= 2*PI;
while(DeltaAlpha < -PI) DeltaAlpha += 2*PI;
@@ -1907,43 +1933,42 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
}
// Now do things if CamClear...but what is that anyway?
- float CamZ = TargetCoors.z + Length*Sin(Alpha + DeltaAlpha + ModeAlpha) + m_fCloseInCarHeightOffset;
+ float CamZ = TargetCoors.z + Length*Sin(Alpha + DeltaAlpha + AlphaOffset) + m_fCloseInCarHeightOffset;
bool FoundGround, FoundRoof;
float CamGround2 = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, CamZ, &FoundGround);
- if(FoundGround){
- if(CamClear)
- if(CamZ - CamGround2 < 1.5f){
- PreviousNearCheckNearClipSmall = true;
- RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
-
- float a;
- if(Length == 0.0f || CamGround2 + 1.5f - TargetCoors.z == 0.0f)
- a = Alpha;
- else
- a = CGeneral::GetATanOfXY(Length, CamGround2 + 1.5f - TargetCoors.z);
- while(a > PI) a -= 2*PI;
- while(a < -PI) a += 2*PI;
- DeltaAlpha = a - Alpha;
- }
- }else{
- if(CamClear){
- float CamRoof2 = CWorld::FindRoofZFor3DCoord(Source.x, Source.y, CamZ, &FoundRoof);
- if(FoundRoof && CamZ - CamRoof2 < 1.5f){
- PreviousNearCheckNearClipSmall = true;
- RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
-
- if(CamRoof2 > TargetCoors.z + 3.5f)
- CamRoof2 = TargetCoors.z + 3.5f;
-
- float a;
- if(Length == 0.0f || CamRoof2 + 1.5f - TargetCoors.z == 0.0f)
- a = Alpha;
- else
- a = CGeneral::GetATanOfXY(Length, CamRoof2 + 1.5f - TargetCoors.z);
- while(a > PI) a -= 2*PI;
- while(a < -PI) a += 2*PI;
- DeltaAlpha = a - Alpha;
- }
+ if(FoundGround && CamClear){
+ if(CamZ - CamGround2 < 1.5f){
+ PreviousNearCheckNearClipSmall = true;
+ RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
+
+ float dz = CamGround2 + 1.5f - TargetCoors.z;
+ float a;
+ if(Length == 0.0f || dz == 0.0f)
+ a = Alpha;
+ else
+ a = CGeneral::GetATanOfXY(Length, dz);
+ while(a > PI) a -= 2*PI;
+ while(a < -PI) a += 2*PI;
+ DeltaAlpha = a - Alpha;
+ }
+ }else if(CamClear){
+ float CamRoof2 = CWorld::FindRoofZFor3DCoord(Source.x, Source.y, CamZ, &FoundRoof);
+ if(FoundRoof && CamZ - CamRoof2 < 1.5f){
+ PreviousNearCheckNearClipSmall = true;
+ RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
+
+ if(CamRoof2 > TargetCoors.z + 3.5f)
+ CamRoof2 = TargetCoors.z + 3.5f;
+
+ float dz = CamRoof2 + 1.5f - TargetCoors.z;
+ float a;
+ if(Length == 0.0f || dz == 0.0f)
+ a = Alpha;
+ else
+ a = CGeneral::GetATanOfXY(Length, dz);
+ while(a > PI) a -= 2*PI;
+ while(a < -PI) a += 2*PI;
+ DeltaAlpha = a - Alpha;
}
}
@@ -1957,7 +1982,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
WellBufferMe(LastTargetAlphaWithCollisionOn, &Alpha, &AlphaSpeed, LastTopAlphaSpeed, LastAlphaSpeedStep, true);
- Source.z = TargetCoors.z + Sin(Alpha + ModeAlpha)*Length + m_fCloseInCarHeightOffset;
+ Source.z = TargetCoors.z + Sin(Alpha + AlphaOffset)*Length + m_fCloseInCarHeightOffset;
}
// Rotate cam behind the car when the car is moving forward
@@ -2107,9 +2132,9 @@ CCam::Process_Cam_On_A_String(const CVector &CameraTarget, float TargetOrientati
CBaseModelInfo *mi = CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex());
CVector Dimensions = mi->GetColModel()->boundingBox.max - mi->GetColModel()->boundingBox.min;
+ CVector TargetCoors = CameraTarget;
float BaseDist = Dimensions.Magnitude2D();
- CVector TargetCoors = CameraTarget;
TargetCoors.z += Dimensions.z - 0.1f; // final
Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
while(Alpha >= PI) Alpha -= 2*PI;
@@ -2144,6 +2169,8 @@ CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
if(ResetStatics)
Source = TargetCoors + Dist*(CA_MAX_DISTANCE + 1.0f);
+ Dist = Source - TargetCoors;
+
float Length = Dist.Magnitude2D();
if(Length < 0.001f){
// This probably shouldn't happen. reset view
@@ -2171,7 +2198,7 @@ CCam::FixCamWhenObscuredByVehicle(const CVector &TargetCoors)
static float HeightFixerCarsObscuring = 0.0f;
static float HeightFixerCarsObscuringSpeed = 0.0f;
CColPoint colPoint;
- CEntity *entity;
+ CEntity *entity = nil;
float HeightTarget = 0.0f;
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, false, true, false, false, false, false, false)){
@@ -2468,8 +2495,8 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float)
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
@@ -2570,13 +2597,13 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
#ifdef GTA3_1_1_PATCH
HeadPos.x = 0.0f;
@@ -2682,12 +2709,12 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@@ -2732,9 +2759,9 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
}else{
assert(CamTargetEntity->IsVehicle());
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex());
- CVector CamPos = mi->m_vehicleType == VEHICLE_TYPE_BOAT ? mi->m_positions[BOAT_POS_FRONTSEAT] : mi->m_positions[CAR_POS_FRONTSEAT];
+ CVector CamPos = mi->GetFrontSeatPosn();
CamPos.x = 0.0f;
- CamPos.y += -0.08f;
+ CamPos.y += 0.08f;
CamPos.z += 0.62f;
FOV = 60.0f;
Source = Multiply3x3(CamTargetEntity->GetMatrix(), CamPos);
@@ -2833,7 +2860,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
CVector Fwd = CamTargetEntity->GetForward();
Fwd.z = 0.0f;
Fwd.Normalise();
- HeadPos = (HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition());
+ HeadPos = HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition();
HeadPos.z += 0.59f;
}
Source = HeadPos;
@@ -2861,13 +2888,13 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@@ -2911,13 +2938,8 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
void
CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float, float)
{
- if(CamTargetEntity->m_rwObject == nil)
- return;
-
-#ifdef FIX_BUGS
if(!CamTargetEntity->IsPed())
return;
-#endif
static bool FailedTestTwelveFramesAgo = false;
RwV3d HeadPos;
@@ -2927,9 +2949,9 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
static float TargetFOV = 0.0f;
if(ResetStatics){
- Beta = TargetOrientation;
+ Beta = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI;
Alpha = 0.0f;
- m_fInitialPlayerOrientation = TargetOrientation;
+ m_fInitialPlayerOrientation = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI;
FailedTestTwelveFramesAgo = false;
// static DPadVertical unused
// static DPadHorizontal unused
@@ -2964,13 +2986,13 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
- Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
- Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
+ Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@@ -3175,6 +3197,12 @@ CCam::Process_Syphon_Crim_In_Front(const CVector &CameraTarget, float, float, fl
while(AimingAngle >= PI) AimingAngle -= 2*PI;
while(AimingAngle < -PI) AimingAngle += 2*PI;
+ if(ResetStatics){
+ if(AimingAngle > 0.0f)
+ m_fPlayerInFrontSyphonAngleOffSet = -m_fPlayerInFrontSyphonAngleOffSet;
+ ResetStatics = false;
+ }
+
if(TheCamera.PlayerWeaponMode.Mode == MODE_SYPHON)
Beta = AimingAngle + m_fPlayerInFrontSyphonAngleOffSet;
@@ -3569,8 +3597,7 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
CVector Left = CrossProduct(Up, Front);
Up = CrossProduct(Front, Left);
Up.Normalise();
- FOV = PsuedoFOV;
- }else{
+ }else if(uiTime >= uiFinishTime){
// end
ArrayMarkerSource = (TheCamera.m_arrPathArray[2].m_arr_PathData[0] - 1)*10 + 1;
ArrayMarkerFront = (TheCamera.m_arrPathArray[3].m_arr_PathData[0] - 1)*10 + 1;
@@ -3597,8 +3624,8 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
CVector Left = CrossProduct(Up, Front);
Up = CrossProduct(Front, Left);
Up.Normalise();
- FOV = PsuedoFOV;
}
+ FOV = PsuedoFOV;
}
void
@@ -3618,12 +3645,13 @@ CCam::Process_WheelCam(const CVector&, float, float, float)
}
CVector NewUp(0.0f, 0.0f, 1.0f);
- CVector Left = CrossProduct(Front, NewUp);
- Left.Normalise();
- NewUp = CrossProduct(Left, Front);
+ CVector Right = CrossProduct(Front, NewUp);
+ Right.Normalise();
+ NewUp = CrossProduct(Right, Front);
+ NewUp.Normalise();
float Roll = Cos((CTimer::GetTimeInMilliseconds()&0x1FFFF)/(float)0x1FFFF * TWOPI);
- Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Left;
+ Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Right;
}
void
@@ -3733,18 +3761,18 @@ CCam::Process_Debug(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
- Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
+ Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
if(CPad::GetPad(0)->GetLeftMouse()){
Alpha += DEGTORAD(CPad::GetPad(0)->GetMouseY()/2.0f);
- Beta -= DEGTORAD(CPad::GetPad(0)->GetMouseX()/2.0f);
+ Beta += DEGTORAD(CPad::GetPad(0)->GetMouseX()/2.0f);
}
- TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 3.0f;
- TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 3.0f;
+ TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
+ TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 3.0f;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
- if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
+ else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || KEYDOWN('W'))
Speed += 0.1f;
@@ -3792,7 +3820,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
+ CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors
@@ -3806,7 +3834,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
Source.y += 1.0f;
GetVectorsReadyForRW();
- CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1;
+#ifdef FIX_BUGS
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA);
+#else
+ CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_CAMERA;
+#endif
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
@@ -3830,14 +3862,14 @@ CCam::Process_Debug(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
- Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
+ Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
- TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 3.0f;
- TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 3.0f;
+ TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
+ TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 3.0f;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
- if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
+ else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
Speed += 0.1f;
@@ -3859,8 +3891,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
- CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source;
-
+ CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors
@@ -3903,13 +3934,13 @@ CCam::Process_Editor(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
- Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
+ Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
if(CamTargetEntity && CSceneEdit::m_bCameraFollowActor){
TargetCoors = CamTargetEntity->GetPosition();
}else if(CSceneEdit::m_bRecording){
- TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 7.0f;
- TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 7.0f;
+ TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
+ TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 7.0f;
}else
TargetCoors = CSceneEdit::m_vecCamHeading + Source;
@@ -3917,7 +3948,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
CSceneEdit::m_vecCamHeading = TargetCoors - Source;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
- if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
+ else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
Speed += 0.1f;
@@ -4048,11 +4079,11 @@ bool
CCam::ProcessArrestCamOne(void)
{
FOV = 45.0f;
- if(ResetStatics)
+ if(!ResetStatics)
return true;
#ifdef FIX_BUGS
- if(!CamTargetEntity->IsPed())
+ if(!CamTargetEntity->IsPed() || ((CPlayerPed*)TheCamera.pTargetEntity)->m_pArrestingCop == nil)
return true;
#endif
@@ -4107,18 +4138,18 @@ CCam::ProcessArrestCamTwo(void)
CVector TargetCoors, ToCamera;
float BetaOffset;
float SourceX, SourceY;
- CCam *ActiveCam = &TheCamera.Cams[TheCamera.ActiveCam];
- if(&ActiveCam[1] == this){
+ if(&TheCamera.Cams[TheCamera.ActiveCam] == this){
SourceX = TheCamera.Cams[(TheCamera.ActiveCam + 1) % 2].Source.x;
SourceY = TheCamera.Cams[(TheCamera.ActiveCam + 1) % 2].Source.y;
}else{
- SourceX = ActiveCam[1].Source.x;
- SourceY = ActiveCam[1].Source.y;
+ SourceX = TheCamera.Cams[TheCamera.ActiveCam].Source.x;
+ SourceY = TheCamera.Cams[TheCamera.ActiveCam].Source.y;
}
for(int i = 0; i <= 1; i++){
int Dir = i == 0 ? 1 : -1;
+ FOV = 60.0f;
TargetCoors = player->GetPosition();
Beta = CGeneral::GetATanOfXY(TargetCoors.x-SourceX, TargetCoors.y-SourceY);
BetaOffset = DEGTORAD(Dir*80);
@@ -4412,6 +4443,106 @@ CCam::Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOri
GetVectorsReadyForRW();
}
+void
+CCam::Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar)
+{
+#ifdef FIX_BUGS
+ fBillsBetaOffset += CPad::GetPad(0)->GetRightStickX()/1000.0f;
+#else
+ // just wtf is this? this code must be ancient
+ if(CPad::GetPad(0)->GetStart())
+ fBillsBetaOffset += CPad::GetPad(0)->GetLeftStickX()/1000.0f;
+#endif
+ while(fBillsBetaOffset > TWOPI) fBillsBetaOffset -= TWOPI;
+ while(fBillsBetaOffset < 0.0f) fBillsBetaOffset += TWOPI;
+ TargetOrientation += fBillsBetaOffset;
+ while(TargetOrientation > TWOPI) TargetOrientation -= TWOPI;
+ while(TargetOrientation < 0.0f) TargetOrientation += TWOPI;
+ Process_BehindCar(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+}
+
+void
+CCam::Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 50.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 2.5f;
+ Front = CamTargetEntity->GetForward();
+ Front.Normalise();
+ Source += 1.35f*Front;
+ float heading = CGeneral::GetATanOfXY(Front.x, Front.y) + DEGTORAD(45.0f);
+ Front.x = Cos(heading);
+ Front.y = Sin(heading);
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 50.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 5.45f;
+
+ static CVector Test = -CamTargetEntity->GetForward();
+#ifdef FIX_BUGS
+ if(ResetStatics){
+ Test = -CamTargetEntity->GetForward();
+ ResetStatics = false;
+ }
+#endif
+
+ Source.x += 19.45*Test.x;
+ Source.y += 19.45*Test.y;
+ Front = Test;
+ Front.Normalise();
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 60.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 4.0f;
+ CVector fwd = CamTargetEntity->GetForward();
+ float heading = CGeneral::GetATanOfXY(fwd.x, fwd.y) - DEGTORAD(15.0f);
+ Source.x -= Cos(heading)*10.0f;
+ Source.y -= Sin(heading)*10.0f;
+ heading -= DEGTORAD(5.0f);
+ Front = fwd;
+ Front.x += Cos(heading);
+ Front.y += Sin(heading);
+ Front.z -= 0.056f;
+ Front.Normalise();
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ static float RoofMultiplier = 1.5f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 4.8f;
+ Front = CamTargetEntity->GetForward();
+ Front.Normalise();
+ Source += Front*RoofMultiplier;
+ Up = CamTargetEntity->GetUp();
+ Up.Normalise();
+
+ GetVectorsReadyForRW();
+}
+
+
#ifdef FREE_CAM
void
CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float)
@@ -4494,8 +4625,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
- BetaOffset = LookLeftRight * fStickSens * (0.5f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
- AlphaOffset = LookUpDown * fStickSens * (0.3f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
+ BetaOffset = LookLeftRight * fStickSens * (1.0f/20.0f) * FOV/80.0f * CTimer::GetTimeStep();
+ AlphaOffset = LookUpDown * fStickSens * (0.6f/20.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
// Stop centering once stick has been touched
@@ -4507,7 +4638,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
while(Beta >= PI) Beta -= 2.0f*PI;
while(Beta < -PI) Beta += 2.0f*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
float BetaDiff = TargetOrientation+PI - Beta;
@@ -4567,7 +4698,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
- if(entity->IsPed() && ColCamDist > 1.0f){
+ if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
@@ -4606,6 +4737,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
Source += (TargetCoors - Source)*0.3f;
// Keep testing
+ Near = RwCameraGetNearClipPlane(Scene.camera);
+ radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
i++;
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 05e6588a..340dbaee 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -123,7 +123,7 @@ CCamera::Init(void)
Cams[0].Mode = CCam::MODE_FOLLOWPED;
Cams[1].Mode = CCam::MODE_FOLLOWPED;
unknown = 0;
- m_bJustJumpedOutOf1stPersonBecauseOfTarget = 0;
+ m_bJustJumpedOutOf1stPersonBecauseOfTarget = false;
ClearPlayerWeaponMode();
m_bInATunnelAndABigVehicle = false;
m_iModeObbeCamIsInForCar = OBBE_INVALID;
@@ -141,8 +141,8 @@ CCamera::Init(void)
Cams[1].m_fPlayerVelocity = 0.0f;
Cams[2].m_fPlayerVelocity = 0.0f;
m_bHeadBob = false;
- m_fFractionInterToStopMovingTarget = 0.25f;
- m_fFractionInterToStopCatchUpTarget = 0.75f;
+ m_fFractionInterToStopMoving = 0.25f;
+ m_fFractionInterToStopCatchUp = 0.75f;
m_fGaitSwayBuffer = 0.85f;
m_bScriptParametersSetForInterPol = false;
m_uiCamShakeStart = 0;
@@ -249,13 +249,14 @@ void
CCamera::Process(void)
{
// static bool InterpolatorNotInitialised = true; // unused
+ static CVector PreviousFudgedTargetCoors; // only PS2
static float PlayerMinDist = 1.6f; // not on PS2
- static bool WasPreviouslyInterSyhonFollowPed = false; // only written
+ static bool WasPreviouslyInterSyhonFollowPed = false; // only used on PS2
float FOV = 0.0f;
float oldBeta, newBeta;
float deltaBeta = 0.0f;
bool lookLRBVehicle = false;
- CVector CamFront, CamUp, CamSource, Target;
+ CVector CamFront, CamUp, CamRight, CamSource, Target;
m_bJust_Switched = false;
m_RealPreviousCameraPosition = GetPosition();
@@ -308,19 +309,19 @@ CCamera::Process(void)
// Stop transition when it's done
if(m_uiTransitionState != 0){
-/*
- // PS2:
+#ifdef PS2_CAM_TRANSITION
if(!m_bWaitForInterpolToFinish){
Cams[(ActiveCam+1)%2].Process();
Cams[(ActiveCam+1)%2].ProcessSpecialHeightRoutines();
}
-*/
- // not PS2 (done in CamControl there it seems)
+#else
+ // done in CamControl on PS2 it seems
if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){
m_uiTransitionState = 0;
m_vecDoingSpecialInterPolation = false;
m_bWaitForInterpolToFinish = false;
}
+#endif
}
if(m_bUseNearClipScript)
@@ -343,19 +344,165 @@ CCamera::Process(void)
if(m_uiTransitionState != 0 && !lookLRBVehicle){
// Process transition
- // different on PS2
+#ifdef PS2_CAM_TRANSITION
+ bool lookingAtPlayerNow = false;
+ bool wasLookingAtPlayer = false;
+ bool transitionPedMode = false;
+ bool setWait = false;
+ if(Cams[ActiveCam].CamTargetEntity == Cams[(ActiveCam+1)%2].CamTargetEntity){
+ if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON ||
+ Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
+ Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
+ Cams[ActiveCam].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON)
+ lookingAtPlayerNow = true;
+ if(Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SYPHON ||
+ Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
+ Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FOLLOWPED ||
+ Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON) // checked twice for some reason
+ wasLookingAtPlayer = true;
+
+ if(!m_vecDoingSpecialInterPolation &&
+ (Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED || Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM) &&
+ (Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FOLLOWPED || Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FIGHT_CAM))
+ transitionPedMode = true;
+ }
+
+ if(lookingAtPlayerNow && wasLookingAtPlayer){
+ CVector playerDist;
+ playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x;
+ playerDist.y = FindPlayerPed()->GetPosition().y - GetPosition().y;
+ playerDist.z = FindPlayerPed()->GetPosition().z - GetPosition().z;
+ if(playerDist.Magnitude() > 17.5f &&
+ (Cams[ActiveCam].Mode == CCam::MODE_SYPHON || Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT))
+ setWait = true;
+ }
+ if(setWait)
+ m_bWaitForInterpolToFinish = true;
+
uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart;
if(currentTime >= m_uiTransitionDuration)
currentTime = m_uiTransitionDuration;
+ float inter = (float) currentTime / m_uiTransitionDuration;
+ inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
+
+ if(m_vecDoingSpecialInterPolation){
+ Cams[(ActiveCam+1)%2].Source = m_vecOldSourceForInter;
+ Cams[(ActiveCam+1)%2].Front = m_vecOldFrontForInter;
+ Cams[(ActiveCam+1)%2].Up = m_vecOldUpForInter;
+ Cams[(ActiveCam+1)%2].FOV = m_vecOldFOVForInter;
+ if(WasPreviouslyInterSyhonFollowPed)
+ Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter.z = PreviousFudgedTargetCoors.z;
+ }
+
+ CamSource = inter*Cams[ActiveCam].Source + (1.0f-inter)*Cams[(ActiveCam+1)%2].Source;
+ FOV = inter*Cams[ActiveCam].FOV + (1.0f-inter)*Cams[(ActiveCam+1)%2].FOV;
+
+ CVector tmpFront = Cams[(ActiveCam+1)%2].Front;
+ float Alpha_other = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z);
+ if(Alpha_other > PI) Alpha_other -= TWOPI;
+ float Beta_other = 0.0f;
+ if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
+ Beta_other = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x);
+ tmpFront = Cams[ActiveCam].Front;
+ float Alpha_active = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z);
+ if(Alpha_active > PI) Alpha_active -= TWOPI;
+ float Beta_active = 0.0f;
+ if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
+ Beta_active = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x);
+
+ float DeltaBeta = Beta_active - Beta_other;
+ float Alpha = inter*Alpha_active + (1.0f-inter)*Alpha_other;
+
+ if(m_uiTransitionJUSTStarted){
+ while(DeltaBeta > PI) DeltaBeta -= TWOPI;
+ while(DeltaBeta <= -PI) DeltaBeta += TWOPI;
+ m_uiTransitionJUSTStarted = false;
+ }else{
+ if(DeltaBeta < m_fOldBetaDiff)
+ while(Abs(DeltaBeta - m_fOldBetaDiff) > PI) DeltaBeta += TWOPI;
+ else
+ while(Abs(DeltaBeta - m_fOldBetaDiff) > PI) DeltaBeta -= TWOPI;
+ }
+ m_fOldBetaDiff = DeltaBeta;
+ float Beta = inter*DeltaBeta + Beta_other;
+
+ CVector FudgedTargetCoors;
+ if(lookingAtPlayerNow && wasLookingAtPlayer){
+ // BUG? how is this interpolation ever used when values are overwritten below?
+ float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D();
+ float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating);
+ if(PlayerDist < MinDist){
+ CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(Beta - HALFPI);
+ CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(Beta - HALFPI);
+ }else{
+ CamSource.x = pTargetEntity->GetPosition().x - PlayerDist*Cos(Beta - HALFPI);
+ CamSource.y = pTargetEntity->GetPosition().y - PlayerDist*Sin(Beta - HALFPI);
+ }
+
+ CColPoint colpoint;
+ CEntity *entity = nil;
+ if(CWorld::ProcessLineOfSight(pTargetEntity->GetPosition(), CamSource, colpoint, entity, true, false, false, true, false, true, true)){
+ CamSource = colpoint.point;
+ RwCameraSetNearClipPlane(Scene.camera, 0.05f);
+ }
+
+ CamFront = pTargetEntity->GetPosition() - CamSource;
+ FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter;
+ PreviousFudgedTargetCoors = FudgedTargetCoors;
+ CamFront.Normalise();
+ CamUp = CVector(0.0f, 0.0f, 1.0f);
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+
+ WasPreviouslyInterSyhonFollowPed = true;
+ }else
+ WasPreviouslyInterSyhonFollowPed = false;
+
+ if(transitionPedMode){
+ FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter;
+ PreviousFudgedTargetCoors = FudgedTargetCoors;
+ CVector CamToTarget = pTargetEntity->GetPosition() - CamSource;
+ float tmpBeta = CGeneral::GetATanOfXY(CamToTarget.x, CamToTarget.y);
+ float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D();
+ float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating);
+ if(PlayerDist < MinDist){
+ CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(tmpBeta - HALFPI);
+ CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(tmpBeta - HALFPI);
+ }
+ CamFront = FudgedTargetCoors - CamSource;
+ CamFront.Normalise();
+ CamUp = CVector(0.0f, 0.0f, 1.0f);
+ CamUp.Normalise();
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+ CamUp.Normalise();
+ }else{
+ CamFront.x = Cos(Alpha) * Sin(Beta);
+ CamFront.y = Cos(Alpha) * -Cos(Beta);
+ CamFront.z = Sin(Alpha);
+ CamFront.Normalise();
+ CamUp = inter*Cams[ActiveCam].Up + (1.0f-inter)*Cams[(ActiveCam+1)%2].Up;
+ CamUp.Normalise();
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+ CamUp.Normalise();
+ }
+#else
+ uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart;
+ if(currentTime >= m_uiTransitionDuration)
+ currentTime = m_uiTransitionDuration;
float fractionInter = (float) currentTime / m_uiTransitionDuration;
- if(fractionInter <= m_fFractionInterToStopMovingTarget){
+ if(fractionInter <= m_fFractionInterToStopMoving){
float inter;
- if(m_fFractionInterToStopMovingTarget == 0.0f)
+ if(m_fFractionInterToStopMoving == 0.0f)
inter = 0.0f;
else
- inter = (m_fFractionInterToStopMovingTarget - fractionInter)/m_fFractionInterToStopMovingTarget;
+ inter = (m_fFractionInterToStopMoving - fractionInter)/m_fFractionInterToStopMoving;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter;
@@ -399,22 +546,24 @@ CCamera::Process(void)
if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CamFront.Normalise();
- CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f));
+ CamRight = CVector(-1.0f, 0.0f, 0.0f);
+ CamUp = CrossProduct(CamFront, CamRight);
+ CamUp.Normalise();
}else{
CamFront.Normalise();
CamUp.Normalise();
- CVector right = CrossProduct(CamFront, CamUp);
- right.Normalise();
- CamUp = CrossProduct(right, CamFront);
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+ CamUp.Normalise();
}
- CamUp.Normalise();
FOV = m_fFOVWhenInterPol;
- }else if(fractionInter > m_fFractionInterToStopMovingTarget && fractionInter <= 1.0f){
+ }else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){
float inter;
- if(m_fFractionInterToStopCatchUpTarget == 0.0f)
+ if(m_fFractionInterToStopCatchUp == 0.0f)
inter = 0.0f;
else
- inter = (fractionInter - m_fFractionInterToStopMovingTarget)/m_fFractionInterToStopCatchUpTarget;
+ inter = (fractionInter - m_fFractionInterToStopMoving)/m_fFractionInterToStopCatchUp;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol);
@@ -454,15 +603,17 @@ CCamera::Process(void)
if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CamFront.Normalise();
- CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f));
+ CamRight = CVector(-1.0f, 0.0f, 0.0f);
+ CamUp = CrossProduct(CamFront, CamRight);
+ CamUp.Normalise();
}else{
CamFront.Normalise();
CamUp.Normalise();
- CVector right = CrossProduct(CamFront, CamUp);
- right.Normalise();
- CamUp = CrossProduct(right, CamFront);
+ CamRight = CrossProduct(CamFront, CamUp);
+ CamRight.Normalise();
+ CamUp = CrossProduct(CamRight, CamFront);
+ CamUp.Normalise();
}
- CamUp.Normalise();
#ifndef FIX_BUGS
// BUG: FOV was already interpolated but m_fFOVWhenInterPol was not
FOV = m_fFOVWhenInterPol;
@@ -474,6 +625,7 @@ CCamera::Process(void)
float Alpha = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
float Beta = CGeneral::GetATanOfXY(Dist.x, Dist.y);
Cams[ActiveCam].KeepTrackOfTheSpeed(CamSource, Target, CamUp, Alpha, Beta, FOV);
+#endif
}else{
// No transition, take Cam values directly
if(WorldViewerBeingUsed){
@@ -487,7 +639,7 @@ CCamera::Process(void)
CamUp = Cams[ActiveCam].Up;
FOV = Cams[ActiveCam].FOV;
}
- WasPreviouslyInterSyhonFollowPed = false; // unused
+ WasPreviouslyInterSyhonFollowPed = false; // only used on PS2
}
if(m_uiTransitionState != 0)
@@ -567,8 +719,10 @@ CCamera::Process(void)
LODDistMultiplier = 70.0f/CDraw::GetFOV() * CDraw::GetAspectRatio()/(4.0f/3.0f);
else
LODDistMultiplier = 1.0f;
+ // missing on PS2
GenerationDistMultiplier = LODDistMultiplier;
LODDistMultiplier *= CRenderer::ms_lodDistScale;
+ //
// Keep track of speed
if(m_bJustInitalised || m_bJust_Switched){
@@ -584,7 +738,7 @@ CCamera::Process(void)
}
m_PreviousCameraPosition = GetPosition();
- // PS2: something doing on with forward vector here
+ // PS2 normalizes a CVector2D GetForward() here. is it used anywhere?
if(Cams[ActiveCam].DirectionWasLooking != LOOKING_FORWARD && Cams[ActiveCam].Mode != CCam::MODE_TOP_DOWN_PED){
Cams[ActiveCam].Source = Cams[ActiveCam].SourceBeforeLookBehind;
@@ -630,6 +784,16 @@ CCamera::CamControl(void)
if(Cams[ActiveCam].CamTargetEntity == nil && pTargetEntity == nil)
pTargetEntity = PLAYER;
+#ifdef PS2_CAM_TRANSITION
+ // Stop transition when it's done
+ if(m_uiTransitionState != 0)
+ if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){
+ m_uiTransitionState = 0;
+ m_vecDoingSpecialInterPolation = false;
+ m_bWaitForInterpolToFinish = false;
+ }
+#endif
+
m_iZoneCullFrameNumWereAt++;
if(m_iZoneCullFrameNumWereAt > m_iCheckCullZoneThisNumFrames)
m_iZoneCullFrameNumWereAt = 1;
@@ -638,7 +802,7 @@ CCamera::CamControl(void)
m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer();
if(m_bLookingAtPlayer){
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_1;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
FindPlayerPed()->bIsVisible = true;
}
@@ -906,7 +1070,7 @@ CCamera::CamControl(void)
m_bFirstPersonBeingUsed = false;
if(m_bFirstPersonBeingUsed){
ReqMode = CCam::MODE_1STPERSON;
- CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_1;
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA);
}
// Zoom value
@@ -1015,7 +1179,7 @@ CCamera::CamControl(void)
garageCenter.y = (az->miny + az->maxy)/2.0f;
garageCenter.z = 0.0f;
}else
- garageCenter = pTargetEntity->GetPosition();
+ garageCenter = CVector(pTargetEntity->GetPosition().x, pTargetEntity->GetPosition().y, 0.0f);
}
if(whichDoor == 1)
garageCenterToDoor = garageDoorPos1 - garageCenter;
@@ -1223,6 +1387,7 @@ CCamera::CamControl(void)
// Restore with a jump cut
if(m_bRestoreByJumpCut){
+ // PS2 just sets m_bCamDirectlyBehind here
if(ReqMode != CCam::MODE_FOLLOWPED &&
ReqMode != CCam::MODE_M16_1STPERSON &&
ReqMode != CCam::MODE_SNIPER &&
@@ -1238,6 +1403,7 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity = pTargetEntity;
Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource;
Cams[ActiveCam].m_cvecCamFixedModeUpOffSet = m_vecFixedModeUpOffSet;
+ // PS2 sets this to m_bLookingAtVector
Cams[ActiveCam].m_bCamLookingAtVector = false;
Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition;
m_bRestoreByJumpCut = false;
@@ -1376,7 +1542,7 @@ CCamera::CamControl(void)
switchByJumpCut = true;
if(Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CVector front = Cams[ActiveCam].Source - FindPlayerPed()->GetPosition();
- front.z = 0.0f;
+ front.z = 0.0f; // missing on PS2
front.Normalise();
#ifdef FIX_BUGS
// this is almost as bad as the bugged code
@@ -1413,6 +1579,7 @@ CCamera::CamControl(void)
if((m_uiTransitionState == 0 || switchByJumpCut) && ReqMode != Cams[ActiveCam].Mode){
if(switchByJumpCut){
+ // PS2 just sets m_bCamDirectlyBehind here
if(!m_bPlayerIsInGarage || m_bJustCameOutOfGarage){
if(ReqMode != CCam::MODE_FOLLOWPED &&
ReqMode != CCam::MODE_M16_1STPERSON &&
@@ -1451,6 +1618,8 @@ CCamera::CamControl(void)
if(ReqMode == CCam::MODE_FOLLOWPED && Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM)
startTransition = false;
+#ifndef PS2_CAM_TRANSITION
+ // done in Process on PS2
if(!m_bWaitForInterpolToFinish && m_bLookingAtPlayer && m_uiTransitionState != 0){
CVector playerDist;
playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x;
@@ -1463,6 +1632,7 @@ CCamera::CamControl(void)
m_bWaitForInterpolToFinish = true;
}
}
+#endif
if(m_bWaitForInterpolToFinish)
startTransition = false;
@@ -1472,10 +1642,14 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity);
}
}else if(ReqMode == CCam::MODE_FIXED && pTargetEntity != Cams[ActiveCam].CamTargetEntity && m_bPlayerIsInGarage){
+#ifdef PS2_CAM_TRANSITION
+ StartTransitionWhenNotFinishedInter(ReqMode);
+#else
if(m_uiTransitionState != 0)
StartTransitionWhenNotFinishedInter(ReqMode);
else
StartTransition(ReqMode);
+#endif
pTargetEntity->RegisterReference(&pTargetEntity);
Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity);
}
@@ -1599,7 +1773,7 @@ CCamera::UpdateTargetEntity(void)
pTargetEntity = FindPlayerPed();
if(PLAYER->GetPedState() == PED_DRAG_FROM_CAR)
pTargetEntity = FindPlayerPed();
- if(pTargetEntity->IsVehicle() && CarZoomIndicator != CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED)
+ if(pTargetEntity->IsVehicle() && CarZoomIndicator == CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED)
pTargetEntity = FindPlayerPed();
}
}
@@ -1861,26 +2035,25 @@ CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffS
/*
- * On PS2 the transition happens between Cams[1] and Cams[2].
+ * On PS2 the transition happens between Cams[0] and Cams[1].
* On PC the whole system has been changed.
*/
void
CCamera::StartTransition(int16 newMode)
{
- bool foo = false;
bool switchSyphonMode = false;
bool switchPedToCar = false;
- bool switchPedMode = false;
+ bool switchFromFight = false;
bool switchFromFixed = false;
bool switch1stPersonToVehicle = false;
float betaOffset, targetBeta, camBeta, deltaBeta;
int door;
bool vehicleVertical;
-// missing on PS2
+#ifndef PS2_CAM_TRANSITION
m_bItsOkToLookJustAtThePlayer = false;
- m_fFractionInterToStopMovingTarget = 0.25f;
- m_fFractionInterToStopCatchUpTarget = 0.75f;
+ m_fFractionInterToStopMoving = 0.25f;
+ m_fFractionInterToStopCatchUp = 0.75f;
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
@@ -1894,14 +2067,16 @@ CCamera::StartTransition(int16 newMode)
if(newMode == CCam::MODE_CAM_ON_A_STRING)
switchPedToCar = true;
}
-//
+#endif
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON)
switchSyphonMode = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED)
- switchPedMode = true;
+ switchFromFight = true;
+#ifndef PS2_CAM_TRANSITION
if(Cams[ActiveCam].Mode == CCam::MODE_FIXED)
switchFromFixed = true;
+#endif
m_bUseTransitionBeta = false;
@@ -1920,11 +2095,11 @@ CCamera::StartTransition(int16 newMode)
((CPed*)pTargetEntity)->m_fRotationDest = angle;
}
-/* // PS2
+#ifdef PS2_CAM_TRANSITION
ActiveCam = (ActiveCam+1)%2;
Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode;
- */
+#endif
Cams[ActiveCam].m_cvecCamFixedModeVector = m_vecFixedModeVector;
Cams[ActiveCam].CamTargetEntity = pTargetEntity;
@@ -1955,12 +2130,27 @@ CCamera::StartTransition(int16 newMode)
switch(newMode){
case CCam::MODE_BEHINDCAR:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+ Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
+#endif
+ Cams[ActiveCam].BetaSpeed = 0.0f;
+ break;
+
+ case CCam::MODE_BEHINDBOAT:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+ Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
+#endif
Cams[ActiveCam].BetaSpeed = 0.0f;
break;
case CCam::MODE_FOLLOWPED:
// Getting out of vehicle normally
betaOffset = DEGTORAD(55.0f);
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
if(m_bJustCameOutOfGarage){
m_bUseTransitionBeta = true;
/*
@@ -1974,13 +2164,21 @@ CCamera::StartTransition(int16 newMode)
*/
// this is better:
if(Cams[ActiveCam].Front.x != 0.0f || Cams[ActiveCam].Front.y != 0.0f)
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y) + PI;
+#else
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI;
+#endif
else
Cams[ActiveCam].m_fTransitionBeta = 0.0f;
}
if(m_bTargetJustCameOffTrain)
m_bCamDirectlyInFront = true;
+#ifdef PS2_CAM_TRANSITION
+ if(Cams[(ActiveCam+1)%2].Mode != CCam::MODE_CAM_ON_A_STRING)
+#else
if(Cams[ActiveCam].Mode != CCam::MODE_CAM_ON_A_STRING)
+#endif
break;
m_bUseTransitionBeta = true;
vehicleVertical = false;
@@ -1992,7 +2190,11 @@ CCamera::StartTransition(int16 newMode)
Cams[ActiveCam].m_fTransitionBeta = 0.0f;
break;
}
+#ifdef PS2_CAM_TRANSITION
+ camBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y);
+#else
camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
+#endif
if(((CPed*)pTargetEntity)->m_carInObjective)
targetBeta = CGeneral::GetATanOfXY(((CPed*)pTargetEntity)->m_carInObjective->GetForward().x, ((CPed*)pTargetEntity)->m_carInObjective->GetForward().y);
else
@@ -2048,6 +2250,10 @@ CCamera::StartTransition(int16 newMode)
break;
case CCam::MODE_SYPHON:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
Cams[ActiveCam].Alpha = 0.0f;
Cams[ActiveCam].AlphaSpeed = 0.0f;
break;
@@ -2055,20 +2261,29 @@ CCamera::StartTransition(int16 newMode)
case CCam::MODE_CAM_ON_A_STRING:
// Get into vehicle
betaOffset = DEGTORAD(57.0f);
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage)
break;
m_bUseTransitionBeta = true;
targetBeta = CGeneral::GetATanOfXY(pTargetEntity->GetForward().x, pTargetEntity->GetForward().y);
+#ifdef PS2_CAM_TRANSITION
+ camBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y);
+#else
camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
+#endif
deltaBeta = targetBeta - camBeta;
while(deltaBeta >= PI) deltaBeta -= 2*PI;
while(deltaBeta < -PI) deltaBeta += 2*PI;
deltaBeta = Abs(deltaBeta);
- // switchFromFixed logic again here, skipped
+#ifndef PS2_CAM_TRANSITION
+ switchFromFixed = Cams[ActiveCam].Mode == CCam::MODE_FIXED;
if(switchFromFixed){
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
break;
}
+#endif
door = FindPlayerPed()->m_vehEnterType;
if(deltaBeta > HALFPI){
@@ -2096,15 +2311,23 @@ CCamera::StartTransition(int16 newMode)
}
break;
- case CCam::MODE_BEHINDBOAT:
- Cams[ActiveCam].BetaSpeed = 0.0f;
- break;
-
case CCam::MODE_PED_DEAD_BABY:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
Cams[ActiveCam].Alpha = DEGTORAD(15.0f);
break;
+#ifdef PS2_CAM_TRANSITION
+ case CCam::MODE_PLAYER_FALLEN_WATER:
+ Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition;
+ break;
+#endif
+
case CCam::MODE_FIGHT_CAM:
+#ifdef PS2_CAM_TRANSITION
+ Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
+#endif
Cams[ActiveCam].Beta = 0.0f;
Cams[ActiveCam].BetaSpeed = 0.0f;
Cams[ActiveCam].Alpha = 0.0f;
@@ -2112,33 +2335,40 @@ CCamera::StartTransition(int16 newMode)
break;
}
+#ifndef PS2_CAM_TRANSITION
Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode;
m_uiTransitionDuration = 1350;
if(switchSyphonMode)
m_uiTransitionDuration = 1800;
- else if(switchPedMode)
+ else if(switchFromFight)
m_uiTransitionDuration = 750;
-// not on PS2
else if(switchPedToCar){
- m_fFractionInterToStopMovingTarget = 0.2f;
- m_fFractionInterToStopCatchUpTarget = 0.8f;
+ m_fFractionInterToStopMoving = 0.2f;
+ m_fFractionInterToStopCatchUp = 0.8f;
m_uiTransitionDuration = 950;
}else if(switchFromFixed){
- m_fFractionInterToStopMovingTarget = 0.05f;
- m_fFractionInterToStopCatchUpTarget = 0.95f;
+ m_fFractionInterToStopMoving = 0.05f;
+ m_fFractionInterToStopCatchUp = 0.95f;
}else if(switch1stPersonToVehicle){
- m_fFractionInterToStopMovingTarget = 0.0f;
- m_fFractionInterToStopCatchUpTarget = 1.0f;
+ m_fFractionInterToStopMoving = 0.0f;
+ m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 1;
}else
m_uiTransitionDuration = 1350; // already set above
-//
+#else
+ if(switchSyphonMode)
+ m_uiTransitionDuration = 1800;
+ else if(switchFromFight)
+ m_uiTransitionDuration = 750;
+ else
+ m_uiTransitionDuration = 1350;
+#endif
m_uiTransitionState = 1;
m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds();
m_uiTransitionJUSTStarted = 1;
-// PS2 returns here
+#ifndef PS2_CAM_TRANSITION
if(m_vecDoingSpecialInterPolation){
m_cvecStartingSourceForInterPol = SourceDuringInter;
m_cvecStartingTargetForInterPol = TargetDuringInter;
@@ -2170,19 +2400,27 @@ CCamera::StartTransition(int16 newMode)
m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame;
Cams[ActiveCam].ResetStatics = true;
if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){
- m_fFractionInterToStopMovingTarget = m_fScriptPercentageInterToStopMoving;
- m_fFractionInterToStopCatchUpTarget = m_fScriptPercentageInterToCatchUp;
+ m_fFractionInterToStopMoving = m_fScriptPercentageInterToStopMoving;
+ m_fFractionInterToStopCatchUp = m_fScriptPercentageInterToCatchUp;
m_uiTransitionDuration = m_fScriptTimeForInterPolation;
}
+#endif
}
void
CCamera::StartTransitionWhenNotFinishedInter(int16 mode)
{
+#ifdef PS2_CAM_TRANSITION
+ m_vecOldSourceForInter = GetPosition();
+ m_vecOldFrontForInter = GetForward();
+ m_vecOldUpForInter = GetUp();
+ m_vecOldFOVForInter = CDraw::GetFOV();
+#endif
m_vecDoingSpecialInterPolation = true;
StartTransition(mode);
}
+#ifndef PS2_CAM_TRANSITION
void
CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV)
{
@@ -2195,7 +2433,7 @@ CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up
m_fBetaDuringInterPol = CGeneral::GetATanOfXY(Dist.x, Dist.y);
m_fAlphaDuringInterPol = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
}
-
+#endif
void
@@ -2265,82 +2503,77 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
switch(obbeMode){
case OBBE_WHEEL:
veh = FindPlayerVehicle();
- if(veh == nil){
- if(CTimer::GetTimeInMilliseconds() > t+5000)
+ if(veh){
+ if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO)
return true;
- SetNearClipScript(0.6f);
- return false;
- }
- if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO)
- return true;
- if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){
- if(CTimer::GetTimeInMilliseconds() > t+5000)
+ if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false))
return true;
- SetNearClipScript(0.6f);
- return false;
}
- return true;
+ if(CTimer::GetTimeInMilliseconds() > t+5000)
+ return true;
+ SetNearClipScript(0.6f);
+ return false;
case OBBE_1:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true;
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- // too close
- if(fwd.Magnitude() < 1.6f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ // too close
+ if(fwd.Magnitude() < 1.6f)
+ return true;
+ return false;
case OBBE_2:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true;
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
-
- if(fwd.Magnitude() < 2.0f)
- // very close, fix near clip
- SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f));
- // too far and driving away from cam
- if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- // too close
- if(fwd.Magnitude() < 1.6f)
- return true;
- return false;
- }
- return true;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
+
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ if(fwd.Magnitude() < 2.0f)
+ // very close, fix near clip
+ SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f));
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ // too close
+ if(fwd.Magnitude() < 1.6f)
+ return true;
+ return false;
case OBBE_3:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_1STPERSON:
return CTimer::GetTimeInMilliseconds() > t+3000;
case OBBE_5:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true;
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_ONSTRING:
return CTimer::GetTimeInMilliseconds() > t+3000;
case OBBE_COPCAR:
@@ -2348,59 +2581,58 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
case OBBE_COPCAR_WHEEL:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true;
- if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){
- if(CTimer::GetTimeInMilliseconds() > t+1000)
- return true;
- SetNearClipScript(0.6f);
- return false;
- }
- return true;
+ if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false))
+ return true;
+ if(CTimer::GetTimeInMilliseconds() > t+1000)
+ return true;
+ SetNearClipScript(0.6f);
+ return false;
// Ped modes
case OBBE_9:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_10:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_11:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_12:
- if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
- fwd = FindPlayerCoors() - m_vecFixedModeSource;
- fwd.z = 0.0f;
+ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
+ return true;
- // too far and driving away from cam
- if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
- return true;
- return false;
- }
- return true;
+ fwd = FindPlayerCoors() - m_vecFixedModeSource;
+ fwd.z = 0.0f;
+
+ // too far and driving away from cam
+ if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
+ return true;
+ return false;
case OBBE_13:
return CTimer::GetTimeInMilliseconds() > t+5000;
default:
@@ -2675,7 +2907,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
}
}
-static int32 SequenceOfCams[16] = {
+int32 SequenceOfCams[16] = {
OBBE_WHEEL, OBBE_COPCAR, OBBE_3, OBBE_1, OBBE_3, OBBE_COPCAR_WHEEL,
OBBE_2, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_COPCAR, OBBE_2, OBBE_3,
OBBE_5, OBBE_3,
@@ -2711,7 +2943,7 @@ CCamera::ProcessObbeCinemaCameraCar(void)
bDidWeProcessAnyCinemaCam = true;
}
-static int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 };
+int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 };
void
CCamera::ProcessObbeCinemaCameraPed(void)
@@ -2890,6 +3122,13 @@ CCamera::Process_Train_Camera_Control(void)
if(node >= m_uiNumberOfTrainCamNodes)
node = 0;
}
+#ifdef FIX_BUGS
+ // Not really a bug but be nice and respect the debug mode
+ if(DebugCamMode){
+ TakeControl(target, DebugCamMode, JUMP_CUT, CAMCONTROL_SCRIPT);
+ return;
+ }
+#endif
if(found){
SetWideScreenOn();
@@ -3243,7 +3482,7 @@ CCamera::GetLookDirection(void)
Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED)
return Cams[ActiveCam].DirectionWasLooking;
- return LOOKING_FORWARD;;
+ return LOOKING_FORWARD;
}
bool
@@ -3301,12 +3540,13 @@ CCamera::UpdateAimingCoors(CVector const &coors)
m_cvecAimingTargetCoors = coors;
}
-void
+bool
CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target)
{
if(CPad::GetPad(0)->GetLookBehindForPed()){
source = pos;
target = dist*Cams[ActiveCam].CamTargetEntity->GetForward() + source;
+ return false;
}else{
float angleX = DEGTORAD((m_f3rdPersonCHairMultX-0.5f) * 1.8f * 0.5f * Cams[ActiveCam].FOV * CDraw::GetAspectRatio());
float angleY = DEGTORAD((0.5f-m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV);
@@ -3315,9 +3555,9 @@ CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source,
target += Cams[ActiveCam].Up * Tan(angleY);
target += CrossProduct(Cams[ActiveCam].Front, Cams[ActiveCam].Up) * Tan(angleX);
target.Normalise();
- float dot = DotProduct(pos - source, target);
- source += dot*target;
+ source += DotProduct(pos - source, target)*target;
target = dist*target + source;
+ return true;
}
}
@@ -3346,7 +3586,7 @@ CCamera::CalculateDerivedValues(void)
{
m_cameraMatrix = Invert(m_matrix);
- float hfov = DEGTORAD(CDraw::GetFOV()/2.0f);
+ float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
float c = cos(hfov);
float s = sin(hfov);
diff --git a/src/core/Camera.h b/src/core/Camera.h
index f36071fc..dd78d952 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -188,7 +188,6 @@ public:
CPed *m_pLastPedLookedAt;// So interpolation works
bool m_bFirstPersonRunAboutActive;
-
CCam(void) { Init(); }
void Init(void);
void Process(void);
@@ -250,11 +249,11 @@ public:
// CCam::Process_Look_At_Cars
// CCam::Process_CheesyZoom
// CCam::Process_Aiming
- // CCam::Process_Bill // same as BehindCar due to unused variables
- // CCam::Process_Im_The_Passenger_Woo_Woo
- // CCam::Process_Blood_On_The_Tracks
- // CCam::Process_Cam_Running_Side_Train
- // CCam::Process_Cam_On_Train_Roof
+ void Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar);
+ void Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float);
+ void Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float);
+ void Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float);
+ void Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float);
// custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
@@ -426,9 +425,12 @@ public:
float CarZoomValueSmooth;
float DistanceToWater;
+#ifndef PS2_CAM_TRANSITION
float FOVDuringInter;
+#endif
float LODDistMultiplier;
float GenerationDistMultiplier;
+#ifndef PS2_CAM_TRANSITION
float m_fAlphaSpeedAtStartInter;
float m_fAlphaWhenInterPol;
float m_fAlphaDuringInterPol;
@@ -439,6 +441,7 @@ public:
float m_fFOVSpeedAtStartInter;
float m_fStartingBetaForInterPol;
float m_fStartingAlphaForInterPol;
+#endif
float m_PedOrientForBehindOrInFront;
float m_CameraAverageSpeed;
float m_CameraSpeedSoFar;
@@ -488,7 +491,7 @@ public:
CVector m_vecFixedModeSource;
CVector m_vecFixedModeUpOffSet;
CVector m_vecCutSceneOffset;
-
+#ifndef PS2_CAM_TRANSITION
CVector m_cvecStartingSourceForInterPol;
CVector m_cvecStartingTargetForInterPol;
CVector m_cvecStartingUpForInterPol;
@@ -498,11 +501,13 @@ public:
CVector m_vecSourceWhenInterPol;
CVector m_vecTargetWhenInterPol;
CVector m_vecUpWhenInterPol;
-
+#endif
CVector m_vecGameCamPos;
+#ifndef PS2_CAM_TRANSITION
CVector SourceDuringInter;
CVector TargetDuringInter;
CVector UpDuringInter;
+#endif
RwCamera *m_pRwCamera;
CEntity *pTargetEntity;
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
@@ -518,14 +523,13 @@ public:
CVector m_vecOldSourceForInter;
CVector m_vecOldFrontForInter;
CVector m_vecOldUpForInter;
-
float m_vecOldFOVForInter;
float m_fFLOATingFade;
float m_fFLOATingFadeMusic;
float m_fTimeToFadeOut;
float m_fTimeToFadeMusic;
- float m_fFractionInterToStopMovingTarget;
- float m_fFractionInterToStopCatchUpTarget;
+ float m_fFractionInterToStopMoving;
+ float m_fFractionInterToStopCatchUp;
float m_fGaitSwayBuffer;
float m_fScriptPercentageInterToStopMoving;
float m_fScriptPercentageInterToCatchUp;
@@ -624,7 +628,7 @@ public:
void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom);
void ClearPlayerWeaponMode(void);
void UpdateAimingCoors(CVector const &coors);
- void Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
+ bool Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
float Find3rdPersonQuickAimPitch(void);
// Physical camera
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index 01cc323a..23eaa8dd 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -548,18 +548,18 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
return false;
for(i = 0; i < model.numSpheres; i++)
- if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH)
if(TestLineSphere(newline, model.spheres[i]))
return true;
for(i = 0; i < model.numBoxes; i++)
- if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH)
if(TestLineBox(newline, model.boxes[i]))
return true;
CalculateTrianglePlanes(&model);
for(i = 0; i < model.numTriangles; i++)
- if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH)
if(TestLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i]))
return true;
@@ -1179,16 +1179,16 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float coldist = mindist;
for(i = 0; i < model.numSpheres; i++)
- if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineSphere(newline, model.spheres[i], point, coldist);
for(i = 0; i < model.numBoxes; i++)
- if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineBox(newline, model.boxes[i], point, coldist);
CalculateTrianglePlanes(&model);
for(i = 0; i < model.numTriangles; i++)
- if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist);
if(coldist < mindist){
@@ -1219,17 +1219,17 @@ CCollision::ProcessVerticalLine(const CColLine &line,
float coldist = mindist;
for(i = 0; i < model.numSpheres; i++)
- if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineSphere(newline, model.spheres[i], point, coldist);
for(i = 0; i < model.numBoxes; i++)
- if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineBox(newline, model.boxes[i], point, coldist);
CalculateTrianglePlanes(&model);
TempStoredPoly.valid = false;
for(i = 0; i < model.numTriangles; i++)
- if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD)
+ if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessVerticalLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist, &TempStoredPoly);
if(coldist < mindist){
@@ -1758,15 +1758,15 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
b *= f;
}
- if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
- s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
+ if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE ||
+ s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE)
if(CTimer::GetFrameCounter() & 1){
r = 0;
g = 0;
b = 0;
}
- if(s > SURFACE_GATE){
+ if(s > SURFACE_METAL_GATE){
r = CGeneral::GetRandomNumber();
g = CGeneral::GetRandomNumber();
b = CGeneral::GetRandomNumber();
@@ -1839,8 +1839,8 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
b *= f;
}
- if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
- s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
+ if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE ||
+ s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE)
if(CTimer::GetFrameCounter() & 1){
r = 0;
g = 0;
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index 6e7188c5..3c4ed040 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -945,7 +945,7 @@ CFileLoader::Load2dEffect(const char *line)
&effect->light.dist,
&effect->light.range,
&effect->light.size,
- &effect->light.shadowRange,
+ &effect->light.shadowSize,
&shadowIntens, &lightType, &roadReflection, &flare, &flags);
effect->light.corona = RwTextureRead(corona, nil);
effect->light.shadow = RwTextureRead(shadow, nil);
@@ -977,7 +977,7 @@ CFileLoader::Load2dEffect(const char *line)
&effect->attractor.dir.y,
&effect->attractor.dir.z,
&probability);
- effect->attractor.flags = flags;
+ effect->attractor.type = flags;
effect->attractor.probability = probability;
break;
}
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 28a893d2..3aefa005 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -24,7 +24,6 @@
#include "GenericGameStorage.h"
#include "Script.h"
#include "Camera.h"
-#include "MenuScreens.h"
#include "ControllerConfig.h"
#include "Vehicle.h"
#include "MBlur.h"
@@ -37,6 +36,7 @@
#include "Stats.h"
#include "Messages.h"
#include "FileLoader.h"
+#include "frontendoption.h"
#define TIDY_UP_PBP // ProcessButtonPresses
#define MAX_VISIBLE_LIST_ROW 30
@@ -275,8 +275,9 @@ ScaleAndCenterX(float x)
#define ChangeScreen(screen, option, updateDelay, clearAlpha) \
do { \
m_nPrevScreen = m_nCurrScreen; \
+ int newOpt = option; \
m_nCurrScreen = screen; \
- m_nCurrOption = option; \
+ m_nCurrOption = newOpt; \
if(updateDelay) \
m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); \
if(clearAlpha) \
@@ -316,7 +317,7 @@ ScaleAndCenterX(float x)
// --- Functions not in the game/inlined starts
-inline void
+void
CMenuManager::ScrollUpListByOne()
{
if (m_nSelectedListRow == m_nFirstVisibleRowOnList) {
@@ -330,7 +331,7 @@ CMenuManager::ScrollUpListByOne()
}
}
-inline void
+void
CMenuManager::ScrollDownListByOne()
{
if (m_nSelectedListRow == m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1) {
@@ -346,13 +347,13 @@ CMenuManager::ScrollDownListByOne()
}
}
-inline void
+void
CMenuManager::PageUpList(bool playSoundOnSuccess)
{
if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) {
if (m_nFirstVisibleRowOnList > 0) {
if(playSoundOnSuccess)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nFirstVisibleRowOnList = Max(0, m_nFirstVisibleRowOnList - MAX_VISIBLE_LIST_ROW);
m_nSelectedListRow = Min(m_nSelectedListRow, m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1);
@@ -364,13 +365,13 @@ CMenuManager::PageUpList(bool playSoundOnSuccess)
}
}
-inline void
+void
CMenuManager::PageDownList(bool playSoundOnSuccess)
{
if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) {
if (m_nFirstVisibleRowOnList < m_nTotalListRow - MAX_VISIBLE_LIST_ROW) {
if(playSoundOnSuccess)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nFirstVisibleRowOnList = Min(m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW, m_nTotalListRow - MAX_VISIBLE_LIST_ROW);
m_nSelectedListRow = Max(m_nSelectedListRow, m_nFirstVisibleRowOnList);
@@ -382,8 +383,8 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
}
}
-inline void
-CMenuManager::ThingsToDoBeforeLeavingPage()
+void
+CMenuManager::ThingsToDoBeforeGoingBack()
{
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
@@ -396,9 +397,6 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
#endif
} else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) {
m_nDisplayVideoMode = m_nPrefsVideoMode;
-#ifdef IMPROVED_VIDEOMODE
- m_nSelectedScreenMode = m_nPrefsWindowed;
-#endif
}
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
@@ -408,6 +406,46 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) {
m_nTotalListRow = 0;
}
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ for (int i = 0; i < numCustomFrontendOptions; i++) {
+ FrontendOption &option = customFrontendOptions[i];
+ if (option.type != FEOPTION_REDIRECT && option.type != FEOPTION_GOBACK && m_nCurrScreen == option.screen) {
+ if (option.returnPrevPageFunc)
+ option.returnPrevPageFunc();
+
+ if (m_nCurrOption == option.screenOptionOrder && option.type == FEOPTION_DYNAMIC)
+ option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
+
+ if (option.onlyApplyOnEnter)
+ option.displayedValue = *option.value;
+ }
+ }
+#endif
+}
+
+int8
+CMenuManager::GetPreviousPageOption()
+{
+#ifndef CUSTOM_FRONTEND_OPTIONS
+ return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0];
+#else
+ int8 prevPage = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0];
+
+ if (prevPage == -1) // Game also does same
+ return 0;
+
+ prevPage = prevPage == MENUPAGE_NONE ? (!m_bGameNotLoaded ? MENUPAGE_PAUSE_MENU : MENUPAGE_START_MENU) : prevPage;
+
+ for (int i = 0; i < NUM_MENUROWS; i++) {
+ if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) {
+ return i;
+ }
+ }
+
+ // Couldn't find current screen option on previous page, use default behaviour (maybe save-related screen?)
+ return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0];
+#endif
}
// ------ Functions not in the game/inlined ends
@@ -616,7 +654,7 @@ CMenuManager::DisplayHelperText()
case 0:
{
int action = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
- if (action != MENUACTION_CHANGEMENU && action != MENUACTION_REDEFCTRL && action != MENUACTION_RESTOREDEF) {
+ if (action != MENUACTION_CHANGEMENU && action != MENUACTION_KEYBOARDCTRLS && action != MENUACTION_RESTOREDEF) {
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_MIG"));
}
@@ -923,7 +961,14 @@ CMenuManager::Draw()
}
#endif
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ static int lastOption = m_nCurrOption;
+#endif
+
for (int i = 0; i < NUM_MENUROWS; ++i) {
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ bool isOptionDisabled = false;
+#endif
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') {
wchar *rightText = nil;
wchar *leftText;
@@ -1106,17 +1151,6 @@ CMenuManager::Draw()
AsciiToUnicode(_psGetVideoModeList()[m_nDisplayVideoMode], unicodeTemp);
rightText = unicodeTemp;
break;
-#ifdef IMPROVED_VIDEOMODE
- case MENUACTION_SCREENMODE:
- if (m_nSelectedScreenMode == 0)
- sprintf(asciiTemp, "FULLSCREEN");
- else
- sprintf(asciiTemp, "WINDOWED");
-
- AsciiToUnicode(asciiTemp, unicodeTemp);
- rightText = unicodeTemp;
- break;
-#endif
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex == -1)
rightText = TheText.Get("FEA_NAH");
@@ -1167,6 +1201,27 @@ CMenuManager::Draw()
case MENUACTION_MOUSESTEER:
rightText = TheText.Get(CVehicle::m_bDisableMouseSteering ? "FEM_OFF" : "FEM_ON");
break;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && i == option.screenOptionOrder) {
+ leftText = (wchar*)option.leftText;
+ if (option.type == FEOPTION_SELECT) {
+ if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
+ option.displayedValue = 0;
+
+ rightText = (wchar*)option.rightTexts[option.displayedValue];
+
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ if (option.drawFunc) {
+ rightText = option.drawFunc(&isOptionDisabled);
+ }
+ }
+ } else
+ assert(0 && "Custom frontend options is borked");
+
+ break;
+#endif
}
float nextItemY = headerHeight + nextYToUse;
@@ -1202,7 +1257,7 @@ CMenuManager::Draw()
}
if (oldOption != m_nCurrOption) {
if (oldScreen == m_nCurrScreen && m_bShowMouse)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
oldOption = m_nCurrOption;
oldScreen = m_nCurrScreen;
@@ -1244,10 +1299,15 @@ CMenuManager::Draw()
if (!CFont::Details.centre)
CFont::SetRightJustifyOn();
- if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES")
- && !m_bGameNotLoaded && textLayer == 1) {
- CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255)));
- }
+ if(textLayer == 1)
+ if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES")
+ && !m_bGameNotLoaded
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ || isOptionDisabled
+#endif
+ )
+ CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255)));
+
CFont::PrintString(MENU_X_RIGHT_ALIGNED(columnWidth - textLayer), itemY, rightText);
}
if (i == m_nCurrOption && itemsAreSelectable){
@@ -1288,11 +1348,17 @@ CMenuManager::Draw()
SetHelperText(3);
}
}
-#ifdef IMPROVED_VIDEOMODE
- if (m_nSelectedScreenMode != m_nPrefsWindowed) {
- if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "SCRFOR") != 0
- && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) {
- m_nSelectedScreenMode = m_nPrefsWindowed;
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) {
+ FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
+ if (option.onlyApplyOnEnter && m_nCurrOption != i)
+ option.displayedValue = *option.value;
+
+ if (m_nCurrOption != lastOption && lastOption == i) {
+ FrontendOption &oldOption = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[lastOption].m_TargetMenu];
+ if (oldOption.type == FEOPTION_DYNAMIC)
+ oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
}
}
#endif
@@ -1340,6 +1406,10 @@ CMenuManager::Draw()
}
}
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ lastOption = m_nCurrOption;
+#endif
+
switch (m_nCurrScreen) {
case MENUPAGE_CONTROLLER_SETTINGS:
case MENUPAGE_SOUND_SETTINGS:
@@ -1701,7 +1771,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
if (!m_bKeyIsOK)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_bKeyIsOK = true;
} else {
@@ -1905,7 +1975,7 @@ CMenuManager::DrawControllerSetupScreen()
float curOptY = i * rowHeight + yStart;
if (m_nMousePosY > MENU_Y(curOptY) && m_nMousePosY < MENU_Y(rowHeight + curOptY)) {
if (m_nPrevOption != i && m_nCurrExLayer == HOVEROPTION_LIST)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nPrevOption = i;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
@@ -1919,7 +1989,7 @@ CMenuManager::DrawControllerSetupScreen()
if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(370.0f)) {
#endif
if (m_nSelectedContSetupColumn != CONTSETUP_PED_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN;
#ifdef FIX_BUGS
@@ -1928,7 +1998,7 @@ CMenuManager::DrawControllerSetupScreen()
} else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(370.0f) && m_nMousePosX < SCREEN_WIDTH) {
#endif
if (m_nSelectedContSetupColumn != CONTSETUP_VEHICLE_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
}
@@ -2626,13 +2696,13 @@ CMenuManager::DrawPlayerSetupScreen()
if (rowIdx == m_nSelectedListRow) {
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
if (m_nSkinsTotal > 0) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
SaveSettings();
}
} else {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nCurrExLayer = HOVEROPTION_LIST;
m_nSelectedListRow = rowIdx;
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
@@ -2788,7 +2858,7 @@ CMenuManager::DrawPlayerSetupScreen()
&& m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 26))
|| m_nCurrExLayer == HOVEROPTION_BACK) {
if (m_nHoverOption != HOVEROPTION_BACK)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nHoverOption = HOVEROPTION_BACK;
@@ -2799,7 +2869,7 @@ CMenuManager::DrawPlayerSetupScreen()
&& m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 26))
|| m_nCurrExLayer == HOVEROPTION_USESKIN) {
if (m_nHoverOption != HOVEROPTION_USESKIN)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_nHoverOption = HOVEROPTION_USESKIN;
@@ -2994,6 +3064,11 @@ CMenuManager::InitialiseChangedLanguageSettings()
default:
break;
}
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ RemoveCustomFrontendOptions();
+ CustomFrontendOptionsPopulate();
+#endif
}
}
@@ -3139,6 +3214,9 @@ CMenuManager::LoadSettings()
CFileMgr::Read(fileHandle, m_PrefsSkinFile, 256);
CFileMgr::Read(fileHandle, (char*)&m_ControlMethod, 1);
CFileMgr::Read(fileHandle, (char*)&m_PrefsLanguage, 1);
+#ifdef FREE_CAM
+ CFileMgr::Read(fileHandle, (char*)&TheCamera.bFreeCam, 1);
+#endif
}
}
@@ -3229,6 +3307,9 @@ CMenuManager::SaveSettings()
CFileMgr::Write(fileHandle, m_PrefsSkinFile, 256);
CFileMgr::Write(fileHandle, (char*)&m_ControlMethod, 1);
CFileMgr::Write(fileHandle, (char*)&m_PrefsLanguage, 1);
+#ifdef FREE_CAM
+ CFileMgr::Write(fileHandle, (char*)&TheCamera.bFreeCam, 1);
+#endif
}
CFileMgr::CloseFile(fileHandle);
@@ -3498,7 +3579,17 @@ CMenuManager::Process(void)
SaveLoadFileError_SetUpErrorScreen();
}
if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) {
+#ifdef MISSION_REPLAY
+ if (doingMissionRetry) {
+ RetryMission(2, 0);
+ m_nCurrSaveSlot = SLOT_COUNT;
+ doingMissionRetry = false;
+ }
+#endif
if (CheckSlotDataValid(m_nCurrSaveSlot)) {
+#ifdef USE_DEBUG_SCRIPT_LOADER
+ scriptToLoad = 0;
+#endif
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
@@ -3566,7 +3657,7 @@ CMenuManager::Process(void)
field_535 = true;
} else {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i);
m_bKeyIsOK = false;
@@ -3619,6 +3710,24 @@ CMenuManager::ProcessButtonPresses(void)
bool assumeIncrease = false;
#endif
+#ifdef USE_DEBUG_SCRIPT_LOADER
+ if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) {
+#ifdef RW_GL3
+ if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) {
+ scriptToLoad = 1;
+ DoSettingsBeforeStartingAGame();
+ return;
+ }
+#elif defined _WIN32
+ if (GetAsyncKeyState('R') & 0x8000) {
+ scriptToLoad = 1;
+ DoSettingsBeforeStartingAGame();
+ return;
+ }
+#endif
+ }
+#endif
+
if (!m_bShowMouse && (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY)) {
m_bShowMouse = true;
}
@@ -3675,7 +3784,7 @@ CMenuManager::ProcessButtonPresses(void)
}
if (CPad::GetPad(0)->GetTabJustDown()) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
m_bShowMouse = false;
switch (m_nCurrExLayer) {
case HOVEROPTION_BACK:
@@ -3711,7 +3820,7 @@ CMenuManager::ProcessButtonPresses(void)
if (!m_bPressedUpOnList) {
m_bPressedUpOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
ScrollUpListByOne();
}
} else {
@@ -3733,7 +3842,7 @@ CMenuManager::ProcessButtonPresses(void)
if (!m_bPressedDownOnList) {
m_bPressedDownOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
ScrollDownListByOne();
}
} else {
@@ -3749,7 +3858,7 @@ CMenuManager::ProcessButtonPresses(void)
m_bPressedPgUpOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
PageUpList(false);
}
}
@@ -3761,14 +3870,14 @@ CMenuManager::ProcessButtonPresses(void)
m_bPressedPgDnOnList = true;
lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
PageDownList(false);
}
}
if (CPad::GetPad(0)->GetHome()) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) {
m_nFirstVisibleRowOnList = 0;
}
@@ -3778,7 +3887,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetEnd()) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) {
m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW;
}
@@ -3807,7 +3916,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
case HOVEROPTION_USESKIN:
if (m_nSkinsTotal > 0) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_pSelectedSkin = m_pSkinListHead.nextSkin;
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
@@ -3876,11 +3985,11 @@ CMenuManager::ProcessButtonPresses(void)
} else {
if (CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
goDown = true;
} else if (CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
goUp = true;
}
@@ -3911,7 +4020,7 @@ CMenuManager::ProcessButtonPresses(void)
} else if (CPad::GetPad(0)->GetLeftMouseJustDown()) {
#ifdef TIDY_UP_PBP
if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3925,7 +4034,7 @@ CMenuManager::ProcessButtonPresses(void)
#else
switch (m_nHoverOption) {
case HOVEROPTION_RADIO_0:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = HEAD_RADIO;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3933,7 +4042,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_1:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = DOUBLE_CLEF;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3941,7 +4050,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_2:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = JAH_RADIO;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3949,7 +4058,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_3:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = RISE_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3957,7 +4066,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_4:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = LIPS_106;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3965,7 +4074,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_5:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = GAME_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3973,7 +4082,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_6:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = MSX_FM;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3981,7 +4090,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_7:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = FLASHBACK;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3989,7 +4098,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_8:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = CHATTERBOX;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -3997,7 +4106,7 @@ CMenuManager::ProcessButtonPresses(void)
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_9:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
m_PrefsRadioStation = USERTRACK;
SaveSettings();
DMAudio.SetRadioInCar(m_PrefsRadioStation);
@@ -4127,11 +4236,11 @@ CMenuManager::ProcessButtonPresses(void)
|| CPad::GetPad(0)->GetMouseWheelUpJustDown() || CPad::GetPad(0)->GetMouseWheelDownJustDown()) {
int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
if (option == MENUACTION_BRIGHTNESS || option == MENUACTION_DRAWDIST)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
else if (option == MENUACTION_SFXVOLUME)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_AUDIO_TEST, 0);
else if (option == MENUACTION_MOUSESENS)
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
#ifndef TIDY_UP_PBP
@@ -4191,14 +4300,14 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef PS2_LIKE_MENU
if (CPad::GetPad(0)->GetLeftMouseJustDown() && hoveredBottomBarOption != -1) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
bottomBarActive = false;
curBottomBarOption = hoveredBottomBarOption;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, false);
return;
} else if (bottomBarActive) {
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
bottomBarActive = false;
// If there's a menu change with fade ongoing, finish it now
@@ -4208,7 +4317,7 @@ CMenuManager::ProcessButtonPresses(void)
} else if (CPad::GetPad(0)->GetLeftJustDown() || CPad::GetPad(0)->GetAnaloguePadLeft() || CPad::GetPad(0)->GetDPadLeftJustDown()
|| CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (curBottomBarOption > 0)
curBottomBarOption--;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, true);
@@ -4216,7 +4325,7 @@ CMenuManager::ProcessButtonPresses(void)
} else if (CPad::GetPad(0)->GetRightJustDown() || CPad::GetPad(0)->GetAnaloguePadRight() || CPad::GetPad(0)->GetDPadRightJustDown()
|| CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) {
m_bShowMouse = false;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (curBottomBarOption < bbTabCount-1)
curBottomBarOption++;
ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, true);
@@ -4228,6 +4337,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#endif
+ int prevOption = m_nCurrOption;
if (goDown && (m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME)) {
m_nCurrOption++;
if (m_nCurrOption == NUM_MENUROWS || (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_NOTHING)) {
@@ -4255,9 +4365,9 @@ CMenuManager::ProcessButtonPresses(void)
if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
else
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
} else
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0);
} else {
// This is duplicate, back button already processed below
#ifndef TIDY_UP_PBP
@@ -4273,7 +4383,7 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
} else {
if (m_nCurrScreen != MENUPAGE_NEW_GAME_RELOAD) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
}
} else if (option != MENUACTION_CHANGEMENU && option != MENUACTION_BRIGHTNESS && option != MENUACTION_DRAWDIST
@@ -4281,7 +4391,7 @@ CMenuManager::ProcessButtonPresses(void)
&& option != MENUACTION_CHECKSAVE && option != MENUACTION_UNK24
&& option != MENUACTION_MOUSESENS && option != MENUACTION_SCREENRES) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
if ((m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) || (m_nCurrScreen == MENUPAGE_SKIN_SELECT)) {
@@ -4323,10 +4433,12 @@ CMenuManager::ProcessButtonPresses(void)
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
SaveSettings();
} else {
- if (!m_bGameNotLoaded)
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
- else
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[0], aScreens[m_nCurrScreen].m_ParentEntry[0], true, true);
+#ifndef TIDY_UP_PBP
+ ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
+ GetPreviousPageOption(), true, true);
+#else
+ goBack = true;
+#endif
}
} else if (m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME) {
option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
@@ -4378,26 +4490,6 @@ CMenuManager::ProcessButtonPresses(void)
InitialiseChangedLanguageSettings();
SaveSettings();
break;
-#ifdef MORE_LANGUAGES
- case MENUACTION_LANG_PL:
- m_PrefsLanguage = LANGUAGE_POLISH;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
- case MENUACTION_LANG_RUS:
- m_PrefsLanguage = LANGUAGE_RUSSIAN;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
- case MENUACTION_LANG_JAP:
- m_PrefsLanguage = LANGUAGE_JAPANESE;
- m_bFrontEnd_ReloadObrTxtGxt = true;
- InitialiseChangedLanguageSettings();
- SaveSettings();
- break;
-#endif
case MENUACTION_POPULATESLOTS_CHANGEMENU:
PcSaveHelper.PopulateSlotInfo();
@@ -4427,10 +4519,8 @@ CMenuManager::ProcessButtonPresses(void)
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) {
#ifndef TIDY_UP_PBP
ResetHelperText();
- if (!m_bGameNotLoaded)
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
- else
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[0], aScreens[m_nCurrScreen].m_ParentEntry[0], true, true);
+ ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
+ GetPreviousPageOption(), true, true);
#else
goBack = true;
break;
@@ -4500,7 +4590,7 @@ CMenuManager::ProcessButtonPresses(void)
SaveSettings();
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
break;
- case MENUACTION_REDEFCTRL:
+ case MENUACTION_KEYBOARDCTRLS:
ChangeScreen(MENUPAGE_KEYBOARD_CONTROLS, 0, true, true);
m_nSelectedListRow = 0;
m_nCurrExLayer = HOVEROPTION_LIST;
@@ -4527,7 +4617,8 @@ CMenuManager::ProcessButtonPresses(void)
#endif
break;
case MENUACTION_DONTCANCEL:
- ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
+ ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
+ GetPreviousPageOption(), true, true);
break;
case MENUACTION_SCREENRES:
if (m_nDisplayVideoMode != m_nPrefsVideoMode) {
@@ -4537,23 +4628,13 @@ CMenuManager::ProcessButtonPresses(void)
SaveSettings();
}
break;
-#ifdef IMPROVED_VIDEOMODE
- case MENUACTION_SCREENMODE:
- if (m_nSelectedScreenMode != m_nPrefsWindowed) {
- m_nPrefsWindowed = m_nSelectedScreenMode;
- _psSelectScreenVM(m_nPrefsVideoMode); // apply same resolution
- SetHelperText(0);
- SaveSettings();
- }
- break;
-#endif
case MENUACTION_AUDIOHW:
{
int selectedProvider = m_nPrefsAudio3DProviderIndex;
if (selectedProvider != -1) {
m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex);
if (selectedProvider == m_nPrefsAudio3DProviderIndex) {
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SetHelperText(0);
} else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
@@ -4662,6 +4743,43 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK");
break;
+#ifdef MISSION_REPLAY
+ case MENUACTION_REJECT_RETRY:
+ doingMissionRetry = false;
+ AllowMissionReplay = 0;
+ RequestFrontEndShutDown();
+ break;
+ case MENUACTION_UNK114:
+ doingMissionRetry = false;
+ RequestFrontEndShutDown();
+ RetryMission(2, 0);
+ return;
+#endif
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
+ if (option.type == FEOPTION_SELECT) {
+ if (!option.onlyApplyOnEnter) {
+ option.displayedValue++;
+ if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
+ option.displayedValue = 0;
+ }
+ option.changeFunc(option.displayedValue);
+ *option.value = option.displayedValue;
+
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ option.buttonPressFunc(FEOPTION_ACTION_SELECT);
+ } else if (option.type == FEOPTION_REDIRECT) {
+ ChangeScreen(option.to, option.option, true, option.fadeIn);
+ } else if (option.type == FEOPTION_GOBACK) {
+ goBack = true;
+ }
+ } else
+ assert(0 && "Custom frontend options are borked");
+
+ break;
+#endif
}
}
ProcessOnOffMenuOptions();
@@ -4669,7 +4787,7 @@ CMenuManager::ProcessButtonPresses(void)
if (goBack) {
ResetHelperText();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0);
#ifdef PS2_LIKE_MENU
if (m_nCurrScreen == MENUPAGE_PAUSE_MENU || bottomBarActive) {
#else
@@ -4694,7 +4812,7 @@ CMenuManager::ProcessButtonPresses(void)
#endif
RequestFrontEndShutDown();
}
- // It's now in ThingsToDoBeforeLeavingPage()
+ // It's now in ThingsToDoBeforeGoingBack()
#ifndef TIDY_UP_PBP
else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
DMAudio.StopFrontEndTrack();
@@ -4703,10 +4821,10 @@ CMenuManager::ProcessButtonPresses(void)
#endif
int oldScreen = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0];
- int oldOption = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0];
+ int oldOption = GetPreviousPageOption();
if (oldScreen != -1) {
- ThingsToDoBeforeLeavingPage();
+ ThingsToDoBeforeGoingBack();
#ifdef PS2_LIKE_MENU
if (!bottomBarActive &&
@@ -4782,7 +4900,7 @@ CMenuManager::ProcessButtonPresses(void)
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_RADIO:
m_PrefsRadioStation += changeValueBy;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
if (DMAudio.IsMP3RadioChannelAvailable()) {
if (m_PrefsRadioStation < HEAD_RADIO)
m_PrefsRadioStation = USERTRACK;
@@ -4804,20 +4922,20 @@ CMenuManager::ProcessButtonPresses(void)
if (changeValueBy > 0) {
m_PrefsUseWideScreen++;
if (m_PrefsUseWideScreen > 2)
- m_PrefsUseWideScreen = 2;
+ m_PrefsUseWideScreen = 0;
} else {
m_PrefsUseWideScreen--;
if (m_PrefsUseWideScreen < 0)
- m_PrefsUseWideScreen = 0;
+ m_PrefsUseWideScreen = 2;
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#endif
case MENUACTION_SCREENRES:
if (m_bGameNotLoaded) {
RwChar** videoMods = _psGetVideoModeList();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
if (changeValueBy > 0) {
do {
++m_nDisplayVideoMode;
@@ -4835,18 +4953,12 @@ CMenuManager::ProcessButtonPresses(void)
}
}
break;
-#ifdef IMPROVED_VIDEOMODE
- case MENUACTION_SCREENMODE:
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
- m_nSelectedScreenMode = !m_nSelectedScreenMode;
- break;
-#endif
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex != -1) {
m_nPrefsAudio3DProviderIndex += changeValueBy;
m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1);
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
break;
case MENUACTION_SPEAKERCONF:
if (m_nPrefsAudio3DProviderIndex != -1) {
@@ -4854,15 +4966,43 @@ CMenuManager::ProcessButtonPresses(void)
m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2);
DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
SaveSettings();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
break;
case MENUACTION_CTRLMETHOD:
m_ControlMethod = !m_ControlMethod;
CCamera::m_bUseMouse3rdPerson = !m_ControlMethod;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_TRIGGERFUNC:
+ FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
+ if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
+ if (option.type == FEOPTION_SELECT) {
+ if (changeValueBy > 0) {
+ option.displayedValue++;
+ if (option.displayedValue >= option.numRightTexts)
+ option.displayedValue = 0;
+ } else {
+ option.displayedValue--;
+ if (option.displayedValue < 0)
+ option.displayedValue = option.numRightTexts - 1;
+ }
+ if (!option.onlyApplyOnEnter) {
+ option.changeFunc(option.displayedValue);
+ *option.value = option.displayedValue;
+ }
+ } else if (option.type == FEOPTION_DYNAMIC) {
+ option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT);
+ }
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
+ }
+ else
+ assert(0 && "Custom frontend options are borked");
+
+ break;
+#endif
}
ProcessOnOffMenuOptions();
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
@@ -4871,7 +5011,7 @@ CMenuManager::ProcessButtonPresses(void)
} else {
m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0);
}
}
}
@@ -4887,31 +5027,31 @@ CMenuManager::ProcessOnOffMenuOptions()
CPad::GetPad(0)->StartShake(350, 150);
TimeToStopPadShaking = CTimer::GetTimeInMillisecondsPauseMode() + 500;
}
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_CTRLCONFIG:
CPad::GetPad(0)->Mode++;
if (CPad::GetPad(0)->Mode > 3)
CPad::GetPad(0)->Mode = 0;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_CTRLDISPLAY:
m_DisplayControllerOnFoot = !m_DisplayControllerOnFoot;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_FRAMESYNC:
m_PrefsVsyncDisp = !m_PrefsVsyncDisp;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_FRAMELIMIT:
m_PrefsFrameLimiter = !m_PrefsFrameLimiter;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_TRAILS:
CMBlur::BlurOn = !CMBlur::BlurOn;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
if (CMBlur::BlurOn)
CMBlur::MotionBlurOpen(Scene.camera);
@@ -4920,60 +5060,60 @@ CMenuManager::ProcessOnOffMenuOptions()
break;
case MENUACTION_SUBTITLES:
m_PrefsShowSubtitles = !m_PrefsShowSubtitles;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#ifndef ASPECT_RATIO_SCALE
case MENUACTION_WIDESCREEN:
m_PrefsUseWideScreen = !m_PrefsUseWideScreen;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
#endif
case MENUACTION_SETDBGFLAG:
CTheScripts::InvertDebugFlag();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_SWITCHBIGWHITEDEBUGLIGHT:
gbBigWhiteDebugLightSwitchedOn = !gbBigWhiteDebugLightSwitchedOn;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_PEDROADGROUPS:
gbShowPedRoadGroups = !gbShowPedRoadGroups;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_CARROADGROUPS:
gbShowCarRoadGroups = !gbShowCarRoadGroups;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_COLLISIONPOLYS:
gbShowCollisionPolys = !gbShowCollisionPolys;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
case MENUACTION_MP_PLAYERCOLOR:
PickNewPlayerColour();
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_SHOWHEADBOB:
TheCamera.m_bHeadBob = !TheCamera.m_bHeadBob;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_INVVERT:
MousePointerStateHelper.bInvertVertically = !MousePointerStateHelper.bInvertVertically;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_DYNAMICACOUSTIC:
m_PrefsDMA = !m_PrefsDMA;
DMAudio.SetDynamicAcousticModelingStatus(m_PrefsDMA);
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
case MENUACTION_MOUSESTEER:
CVehicle::m_bDisableMouseSteering = !CVehicle::m_bDisableMouseSteering;
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
break;
}
@@ -5084,7 +5224,7 @@ CMenuManager::SwitchMenuOnAndOff()
bottomBarActive = false;
#endif
#ifdef FIX_BUGS
- ThingsToDoBeforeLeavingPage();
+ ThingsToDoBeforeGoingBack();
#endif
ShutdownJustMenu();
SaveSettings();
@@ -5541,7 +5681,7 @@ CMenuManager::PrintMap(void)
float x = ((mapPoint.x - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f;
float y = 2000.0f - ((mapPoint.y - diffY) / (fMapSize * 2)) * 4000.0f;
CRadar::ToggleTargetMarker(x, y);
- DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
}
@@ -5831,5 +5971,6 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
#undef GetBackJustUp
#undef GetBackJustDown
-
+#undef ChangeScreen
+
#endif \ No newline at end of file
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 97b7960a..b07f7260 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -234,7 +234,7 @@ enum eMenuScreen
MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
- MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile
+ MENUPAGE_MISSION_RETRY = 57,
MENUPAGE_58 = 58,
#ifdef MENU_MAP
MENUPAGE_MAP = 59,
@@ -316,7 +316,7 @@ enum eMenuAction
MENUACTION_UNK69,
MENUACTION_UNK70,
MENUACTION_FINDMP,
- MENUACTION_REDEFCTRL,
+ MENUACTION_KEYBOARDCTRLS,
MENUACTION_UNK73,
MENUACTION_INITMP,
MENUACTION_MP_PLAYERCOLOR,
@@ -355,13 +355,12 @@ enum eMenuAction
MENUACTION_UNK108,
MENUACTION_UNK109,
MENUACTION_UNK110,
-#ifdef MORE_LANGUAGES
- MENUACTION_LANG_PL,
- MENUACTION_LANG_RUS,
- MENUACTION_LANG_JAP,
-#endif
-#ifdef IMPROVED_VIDEOMODE
- MENUACTION_SCREENMODE
+ MENUACTION_UNK111,
+ MENUACTION_UNK112,
+ MENUACTION_REJECT_RETRY,
+ MENUACTION_UNK114,
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ MENUACTION_TRIGGERFUNC
#endif
};
@@ -457,7 +456,7 @@ struct CMenuScreen
int32 m_Action; // eMenuAction
char m_EntryName[8];
int32 m_SaveSlot; // eSaveSlot
- int32 m_TargetMenu; // eMenuScreen
+ int32 m_TargetMenu; // eMenuScreen // FrontendOption ID if it's a custom option
} m_aEntries[NUM_MENUROWS];
};
@@ -649,12 +648,14 @@ public:
int GetNumOptionsCntrlConfigScreens();
int ConstructStatLine(int);
- // New (not in function or inlined in the game)
- void ThingsToDoBeforeLeavingPage();
+ // Those are either inlined in game, not in function yet, or I can't believe that they're not inlined.
+ // Names were made up by me.
+ void ThingsToDoBeforeGoingBack();
void ScrollUpListByOne();
void ScrollDownListByOne();
void PageUpList(bool);
void PageDownList(bool);
+ int8 GetPreviousPageOption();
// uint8 GetNumberOfMenuOptions();
};
@@ -664,4 +665,6 @@ VALIDATE_SIZE(CMenuManager, 0x564);
#endif
extern CMenuManager FrontEndMenuManager;
+extern CMenuScreen aScreens[];
+
#endif \ No newline at end of file
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index c658f9ef..4c8aaa72 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -86,8 +86,7 @@
#include "ZoneCull.h"
#include "Zones.h"
#include "debugmenu.h"
-
-
+#include "frontendoption.h"
eLevelName CGame::currLevel;
bool CGame::bDemoMode = true;
@@ -272,6 +271,9 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetMusicFadeVol(127);
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ CustomFrontendOptionsPopulate();
+#endif
return true;
}
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.cpp
index 6c2ebdb8..7b66a27a 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.cpp
@@ -1,17 +1,14 @@
-#pragma once
+#include "common.h"
+#include "Frontend.h"
-// TODO: There are some missing/wrong entries in here.
+// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp.
-const CMenuScreen aScreens[] = {
+CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0
{ "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// MENUPAGE_STATS = 1
-#ifdef MENU_MAP
- { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
-#else
{ "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
-#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@@ -24,11 +21,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_BRIEFS = 3
-#ifdef MENU_MAP
- { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4,
-#else
{ "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
-#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@@ -62,52 +55,44 @@ const CMenuScreen aScreens[] = {
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
-#ifdef IMPROVED_VIDEOMODE
- MENUACTION_SCREENMODE, "SCRFOR", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
-#endif
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_LANGUAGE_SETTINGS = 7
{ "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
- MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE,
-#ifdef MORE_LANGUAGES
- MENUACTION_LANG_PL, "FEL_POL", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_RUS, "FEL_RUS", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_LANG_JAP, "FEL_JAP", SAVESLOT_NONE, MENUPAGE_NONE,
-#endif
+ MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
+ MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
+ MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
+ MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
+ MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
{ "FET_LG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
- MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL0", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM,
+ MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM,
},
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
{ "FET_DG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
- MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
- MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL0", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL3", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL4", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL5", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL6", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
+ MENUACTION_CHANGEMENU, "FEM_SL7", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
},
// MENUPAGE_NEW_GAME_RELOAD = 10
@@ -284,7 +269,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
- MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
+ MENUACTION_KEYBOARDCTRLS,"FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
@@ -333,11 +318,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_OPTIONS = 41
-#ifdef MENU_MAP
- { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5,
-#else
{ "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
-#endif
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@@ -347,13 +328,9 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_EXIT = 42
-#ifdef MENU_MAP
- { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6,
-#else
{ "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
-#endif
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
- MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_DONTCANCEL, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
},
@@ -412,9 +389,6 @@ const CMenuScreen aScreens[] = {
{ "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
-#ifdef MENU_MAP
- MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP,
-#endif
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
@@ -445,11 +419,19 @@ const CMenuScreen aScreens[] = {
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
+ // MENUPAGE_MISSION_RETRY = 57
+#ifdef MISSION_REPLAY
- // MENUPAGE_57 = 57
+ { "M_FAIL", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ MENUACTION_LABEL, "FESZ_RM", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
+ MENUACTION_REJECT_RETRY, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE
+ },
+#else
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
// mission failed, wanna restart page in mobile
},
+#endif
// MENUPAGE_58 = 58
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
@@ -463,4 +445,4 @@ const CMenuScreen aScreens[] = {
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif
-};
+}; \ No newline at end of file
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index a7ca8704..9065c8ca 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -1068,8 +1068,8 @@ void CPad::UpdatePads(void)
GetPad(0)->UpdateMouse();
#ifdef XINPUT
- GetPad(0)->AffectFromXinput(0);
- GetPad(1)->AffectFromXinput(1);
+ GetPad(0)->AffectFromXinput(m_bMapPadOneToPadTwo ? 1 : 0);
+ GetPad(1)->AffectFromXinput(m_bMapPadOneToPadTwo ? 0 : 1);
#else
CapturePad(0);
#endif
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 77f900f0..6f20571f 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -2,14 +2,14 @@
enum {
PLAYERCONTROL_ENABLED = 0,
- PLAYERCONTROL_DISABLED_1 = 1, // used by first person camera
- PLAYERCONTROL_DISABLED_2 = 2,
+ PLAYERCONTROL_CAMERA = 1,
+ PLAYERCONTROL_UNK2 = 2,
PLAYERCONTROL_GARAGE = 4,
- PLAYERCONTROL_DISABLED_8 = 8,
- PLAYERCONTROL_DISABLED_10 = 16,
- PLAYERCONTROL_DISABLED_20 = 32, // used on CPlayerInfo::MakePlayerSafe
- PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls
- PLAYERCONTROL_DISABLED_80 = 128,// used on cutscenes
+ PLAYERCONTROL_UNK8 = 8,
+ PLAYERCONTROL_UNK10 = 16,
+ PLAYERCONTROL_PLAYERINFO = 32,
+ PLAYERCONTROL_PHONE = 64,
+ PLAYERCONTROL_CUTSCENE = 128,
};
class CControllerState
@@ -442,6 +442,7 @@ public:
bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; }
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; }
+ bool GetStart() { return !!NewState.Start; }
int16 GetLeftStickX(void) { return NewState.LeftStickX; }
int16 GetLeftStickY(void) { return NewState.LeftStickY; }
int16 GetRightStickX(void) { return NewState.RightStickX; }
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index 487f536f..128b22b4 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -174,7 +174,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
CTheScripts::ResetCountdownToMakePlayerUnsafe();
m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
CWorld::StopAllLawEnforcersInTheirTracks();
- CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20;
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
CPad::StopPadsShaking();
m_pPed->bBulletProof = true;
m_pPed->bFireProof = true;
@@ -194,7 +194,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
} else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
- CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
m_pPed->bBulletProof = false;
m_pPed->bFireProof = false;
m_pPed->bCollisionProof = false;
@@ -397,7 +397,7 @@ CPlayerInfo::Process(void)
else
enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();
- if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_ODE) {
+ if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) {
if (m_pPed->bInVehicle) {
if (!m_pRemoteVehicle) {
CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 17b9e08d..bd0814d0 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -4,6 +4,9 @@
#include "Boat.h"
#include "CarCtrl.h"
+#ifdef MISSION_REPLAY
+#include "GenericGameStorage.h"
+#endif
#include "Population.h"
#include "ProjectileInfo.h"
#include "Streaming.h"
@@ -206,11 +209,24 @@ INITSAVEBUF
if (pVehicle->pPassengers[j])
bHasPassenger = true;
}
+#ifdef MISSION_REPLAY
+ bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave;
+#ifdef FIX_BUGS
+ if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) {
+#else
+ if (!pVehicle->pDriver && !bHasPassenger) {
+#endif
+ if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
+ ++nNumCars;
+ if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
+ ++nNumBoats;
+#else
if (!pVehicle->pDriver && !bHasPassenger) {
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumCars;
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumBoats;
+#endif
}
}
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
@@ -226,23 +242,42 @@ INITSAVEBUF
if (pVehicle->pPassengers[j])
bHasPassenger = true;
}
+#ifdef MISSION_REPLAY
+ bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave;
+#endif
+#if defined FIX_BUGS && defined MISSION_REPLAY
+ if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) {
+#else
if (!pVehicle->pDriver && !bHasPassenger) {
+#endif
#ifdef COMPATIBLE_SAVES
+#ifdef MISSION_REPLAY
+ if ((pVehicle->IsCar() || pVehicle->IsBoat()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
WriteSaveBuf<int32>(buf, GetVehicleRef(pVehicle));
pVehicle->Save(buf);
}
#else
+#ifdef MISSION_REPLAY
+ if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
memcpy(buf, pVehicle, sizeof(CAutomobile));
SkipSaveBuf(buf, sizeof(CAutomobile));
}
+#ifdef MISSION_REPLAY
+ if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
@@ -400,7 +435,11 @@ INITSAVEBUF
CPed* pPed = GetPedPool()->GetSlot(i);
if (!pPed)
continue;
+#ifdef MISSION_REPLAY
+ if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1)
+#else
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1)
+#endif
nNumPeds++;
}
*size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + CPlayerPed::nSaveStructSize +
@@ -410,7 +449,11 @@ INITSAVEBUF
CPed* pPed = GetPedPool()->GetSlot(i);
if (!pPed)
continue;
+#ifdef MISSION_REPLAY
+ if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1) {
+#else
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) {
+#endif
CopyToBuf(buf, pPed->m_nPedType);
CopyToBuf(buf, pPed->m_modelIndex);
int32 ref = GetPedRef(pPed);
diff --git a/src/core/Radar.h b/src/core/Radar.h
index 7d07671d..ec2bacd0 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -26,27 +26,27 @@ enum eRadarSprite
RADAR_SPRITE_COORD_BLIP = -1,
#endif
RADAR_SPRITE_NONE = 0,
- RADAR_SPRITE_ASUKA = 1,
- RADAR_SPRITE_BOMB = 2,
- RADAR_SPRITE_CAT = 3,
- RADAR_SPRITE_CENTRE = 4,
- RADAR_SPRITE_COPCAR = 5,
- RADAR_SPRITE_DON = 6,
- RADAR_SPRITE_EIGHT = 7,
- RADAR_SPRITE_EL = 8,
- RADAR_SPRITE_ICE = 9,
- RADAR_SPRITE_JOEY = 10,
- RADAR_SPRITE_KENJI = 11,
- RADAR_SPRITE_LIZ = 12,
- RADAR_SPRITE_LUIGI = 13,
- RADAR_SPRITE_NORTH = 14,
- RADAR_SPRITE_RAY = 15,
- RADAR_SPRITE_SAL = 16,
- RADAR_SPRITE_SAVE = 17,
- RADAR_SPRITE_SPRAY = 18,
- RADAR_SPRITE_TONY = 19,
- RADAR_SPRITE_WEAPON = 20,
- RADAR_SPRITE_COUNT = 21,
+ RADAR_SPRITE_ASUKA,
+ RADAR_SPRITE_BOMB,
+ RADAR_SPRITE_CAT,
+ RADAR_SPRITE_CENTRE,
+ RADAR_SPRITE_COPCAR,
+ RADAR_SPRITE_DON,
+ RADAR_SPRITE_EIGHT,
+ RADAR_SPRITE_EL,
+ RADAR_SPRITE_ICE,
+ RADAR_SPRITE_JOEY,
+ RADAR_SPRITE_KENJI,
+ RADAR_SPRITE_LIZ,
+ RADAR_SPRITE_LUIGI,
+ RADAR_SPRITE_NORTH,
+ RADAR_SPRITE_RAY,
+ RADAR_SPRITE_SAL,
+ RADAR_SPRITE_SAVE,
+ RADAR_SPRITE_SPRAY,
+ RADAR_SPRITE_TONY,
+ RADAR_SPRITE_WEAPON,
+ RADAR_SPRITE_COUNT
};
enum
@@ -104,7 +104,7 @@ public:
static CSprite2d SpraySprite;
static CSprite2d TonySprite;
static CSprite2d WeaponSprite;
- static CSprite2d *RadarSprites[21];
+ static CSprite2d *RadarSprites[RADAR_SPRITE_COUNT];
static float cachedCos;
static float cachedSin;
#ifdef MENU_MAP
diff --git a/src/core/Range2D.cpp b/src/core/Range2D.cpp
new file mode 100644
index 00000000..33eafd0e
--- /dev/null
+++ b/src/core/Range2D.cpp
@@ -0,0 +1,28 @@
+#include "common.h"
+#include "Range2D.h"
+#include "General.h"
+
+CRange2D::CRange2D(CVector2D _min, CVector2D _max) : min(_min), max(_max) {}
+
+bool
+CRange2D::IsInRange(CVector2D vec)
+{
+ return min.x < vec.x && max.x > vec.x && min.y < vec.y && max.y > vec.y;
+}
+
+void
+CRange2D::DebugShowRange(float, int)
+{
+}
+
+CVector2D
+CRange2D::GetRandomPointInRange()
+{
+ int distX = Abs(max.x - min.x);
+ int distY = Abs(max.y - min.y);
+
+ float outX = CGeneral::GetRandomNumber() % distX + min.x;
+ float outY = CGeneral::GetRandomNumber() % distY + min.y;
+
+ return CVector2D(outX, outY);
+}
diff --git a/src/core/Range2D.h b/src/core/Range2D.h
new file mode 100644
index 00000000..f239e7de
--- /dev/null
+++ b/src/core/Range2D.h
@@ -0,0 +1,11 @@
+#pragma once
+
+class CRange2D
+{
+ CVector2D min, max;
+public:
+ CRange2D(CVector2D _min, CVector2D _max);
+ bool IsInRange(CVector2D vec);
+ void DebugShowRange(float, int);
+ CVector2D GetRandomPointInRange();
+}; \ No newline at end of file
diff --git a/src/core/Range3D.cpp b/src/core/Range3D.cpp
new file mode 100644
index 00000000..7fa28d67
--- /dev/null
+++ b/src/core/Range3D.cpp
@@ -0,0 +1,30 @@
+#include "common.h"
+#include "Range3D.h"
+#include "General.h"
+
+CRange3D::CRange3D(CVector _min, CVector _max) : min(_min), max(_max) {}
+
+bool
+CRange3D::IsInRange(CVector vec)
+{
+ return min.x < vec.x && max.x > vec.x && min.y < vec.y && max.y > vec.y && min.z < vec.z && max.z > vec.z;
+}
+
+void
+CRange3D::DebugShowRange(float, int)
+{
+}
+
+CVector
+CRange3D::GetRandomPointInRange()
+{
+ int distX = Abs(max.x - min.x);
+ int distY = Abs(max.y - min.y);
+ int distZ = Abs(max.z - min.z);
+
+ float outX = CGeneral::GetRandomNumber() % distX + min.x;
+ float outY = CGeneral::GetRandomNumber() % distY + min.y;
+ float outZ = CGeneral::GetRandomNumber() % distZ + min.z;
+
+ return CVector(outX, outY, outZ);
+}
diff --git a/src/core/Range3D.h b/src/core/Range3D.h
new file mode 100644
index 00000000..f42b523b
--- /dev/null
+++ b/src/core/Range3D.h
@@ -0,0 +1,11 @@
+#pragma once
+
+class CRange3D
+{
+ CVector min, max;
+public:
+ CRange3D(CVector _min, CVector _max);
+ bool IsInRange(CVector vec);
+ void DebugShowRange(float, int);
+ CVector GetRandomPointInRange();
+}; \ No newline at end of file
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 4445ecf4..ae3c0cb4 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -10,7 +10,7 @@ public:
TOTAL_HIGHEST_SCORES = 16
};
static int32 DaysPassed;
- static int32 HeadsPopped;
+ static int32 HeadsPopped;
static int32 CommercialPassed;
static int32 IndustrialPassed;
static int32 SuburbanPassed;
@@ -52,14 +52,14 @@ public:
static int32 LongestFlightInDodo;
static int32 TimeTakenDefuseMission;
static int32 TotalNumberKillFrenzies;
- static int32 TotalNumberMissions;
- static int32 RoundsFiredByPlayer;
- static int32 KgsOfExplosivesUsed;
- static int32 InstantHitsFiredByPlayer;
- static int32 InstantHitsHitByPlayer;
- static int32 BestTimeBombDefusal;
- static int32 mmRain;
- static int32 CarsCrushed;
+ static int32 TotalNumberMissions;
+ static int32 RoundsFiredByPlayer;
+ static int32 KgsOfExplosivesUsed;
+ static int32 InstantHitsFiredByPlayer;
+ static int32 InstantHitsHitByPlayer;
+ static int32 BestTimeBombDefusal;
+ static int32 mmRain;
+ static int32 CarsCrushed;
static int32 FastestTimes[TOTAL_FASTEST_TIMES];
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp
index 08a84cfd..b1bcceb6 100644
--- a/src/core/SurfaceTable.cpp
+++ b/src/core/SurfaceTable.cpp
@@ -56,40 +56,40 @@ int
CSurfaceTable::GetAdhesionGroup(uint8 surfaceType)
{
switch(surfaceType){
- case SURFACE_0: return ADHESIVE_ROAD;
- case SURFACE_1: return ADHESIVE_ROAD;
- case SURFACE_2: return ADHESIVE_LOOSE;
- case SURFACE_3: return ADHESIVE_LOOSE;
- case SURFACE_4: return ADHESIVE_HARD;
- case SURFACE_5: return ADHESIVE_ROAD;
- case SURFACE_6: return ADHESIVE_HARD;
- case SURFACE_7: return ADHESIVE_HARD;
- case SURFACE_8: return ADHESIVE_HARD;
- case SURFACE_9: return ADHESIVE_HARD;
- case SURFACE_10: return ADHESIVE_HARD;
- case SURFACE_11: return ADHESIVE_HARD;
- case SURFACE_12: return ADHESIVE_HARD;
- case SURFACE_13: return ADHESIVE_HARD;
- case SURFACE_14: return ADHESIVE_HARD;
- case SURFACE_15: return ADHESIVE_HARD;
- case SURFACE_16: return ADHESIVE_HARD;
- case SURFACE_17: return ADHESIVE_RUBBER;
- case SURFACE_18: return ADHESIVE_LOOSE;
- case SURFACE_19: return ADHESIVE_WET;
- case SURFACE_20: return ADHESIVE_ROAD;
- case SURFACE_21: return ADHESIVE_ROAD;
- case SURFACE_22: return ADHESIVE_ROAD;
- case SURFACE_23: return ADHESIVE_RUBBER;
- case SURFACE_24: return ADHESIVE_HARD;
- case SURFACE_25: return ADHESIVE_LOOSE;
- case SURFACE_26: return ADHESIVE_LOOSE;
- case SURFACE_27: return ADHESIVE_HARD;
- case SURFACE_28: return ADHESIVE_HARD;
- case SURFACE_29: return ADHESIVE_RUBBER;
- case SURFACE_30: return ADHESIVE_LOOSE;
- case SURFACE_31: return ADHESIVE_HARD;
- case SURFACE_32: return ADHESIVE_HARD;
- default: return ADHESIVE_ROAD;
+ case SURFACE_DEFAULT: return ADHESIVE_ROAD;
+ case SURFACE_TARMAC: return ADHESIVE_ROAD;
+ case SURFACE_GRASS: return ADHESIVE_LOOSE;
+ case SURFACE_GRAVEL: return ADHESIVE_LOOSE;
+ case SURFACE_MUD_DRY: return ADHESIVE_HARD;
+ case SURFACE_PAVEMENT: return ADHESIVE_ROAD;
+ case SURFACE_CAR: return ADHESIVE_HARD;
+ case SURFACE_GLASS: return ADHESIVE_HARD;
+ case SURFACE_TRANSPARENT_CLOTH: return ADHESIVE_HARD;
+ case SURFACE_GARAGE_DOOR: return ADHESIVE_HARD;
+ case SURFACE_CAR_PANEL: return ADHESIVE_HARD;
+ case SURFACE_THICK_METAL_PLATE: return ADHESIVE_HARD;
+ case SURFACE_SCAFFOLD_POLE: return ADHESIVE_HARD;
+ case SURFACE_LAMP_POST: return ADHESIVE_HARD;
+ case SURFACE_FIRE_HYDRANT: return ADHESIVE_HARD;
+ case SURFACE_GIRDER: return ADHESIVE_HARD;
+ case SURFACE_METAL_CHAIN_FENCE: return ADHESIVE_HARD;
+ case SURFACE_PED: return ADHESIVE_RUBBER;
+ case SURFACE_SAND: return ADHESIVE_LOOSE;
+ case SURFACE_WATER: return ADHESIVE_WET;
+ case SURFACE_WOOD_CRATES: return ADHESIVE_ROAD;
+ case SURFACE_WOOD_BENCH: return ADHESIVE_ROAD;
+ case SURFACE_WOOD_SOLID: return ADHESIVE_ROAD;
+ case SURFACE_RUBBER: return ADHESIVE_RUBBER;
+ case SURFACE_PLASTIC: return ADHESIVE_HARD;
+ case SURFACE_HEDGE: return ADHESIVE_LOOSE;
+ case SURFACE_STEEP_CLIFF: return ADHESIVE_LOOSE;
+ case SURFACE_CONTAINER: return ADHESIVE_HARD;
+ case SURFACE_NEWS_VENDOR: return ADHESIVE_HARD;
+ case SURFACE_WHEELBASE: return ADHESIVE_RUBBER;
+ case SURFACE_CARDBOARDBOX: return ADHESIVE_LOOSE;
+ case SURFACE_TRANSPARENT_STONE: return ADHESIVE_HARD;
+ case SURFACE_METAL_GATE: return ADHESIVE_HARD;
+ default: return ADHESIVE_ROAD;
}
}
@@ -97,38 +97,38 @@ float
CSurfaceTable::GetWetMultiplier(uint8 surfaceType)
{
switch(surfaceType){
- case SURFACE_0:
- case SURFACE_1:
- case SURFACE_4:
- case SURFACE_5:
- case SURFACE_8:
- case SURFACE_20:
- case SURFACE_21:
- case SURFACE_22:
- case SURFACE_25:
- case SURFACE_30:
- case SURFACE_31:
+ case SURFACE_DEFAULT:
+ case SURFACE_TARMAC:
+ case SURFACE_MUD_DRY:
+ case SURFACE_PAVEMENT:
+ case SURFACE_TRANSPARENT_CLOTH:
+ case SURFACE_WOOD_CRATES:
+ case SURFACE_WOOD_BENCH:
+ case SURFACE_WOOD_SOLID:
+ case SURFACE_HEDGE:
+ case SURFACE_CARDBOARDBOX:
+ case SURFACE_TRANSPARENT_STONE:
return 1.0f - CWeather::WetRoads*0.25f;
- case SURFACE_2:
- case SURFACE_6:
- case SURFACE_7:
- case SURFACE_9:
- case SURFACE_10:
- case SURFACE_11:
- case SURFACE_12:
- case SURFACE_13:
- case SURFACE_14:
- case SURFACE_15:
- case SURFACE_16:
- case SURFACE_17:
- case SURFACE_23:
- case SURFACE_24:
- case SURFACE_26:
- case SURFACE_27:
- case SURFACE_28:
- case SURFACE_29:
- case SURFACE_32:
+ case SURFACE_GRASS:
+ case SURFACE_CAR:
+ case SURFACE_GLASS:
+ 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_PED:
+ case SURFACE_RUBBER:
+ case SURFACE_PLASTIC:
+ case SURFACE_STEEP_CLIFF:
+ case SURFACE_CONTAINER:
+ case SURFACE_NEWS_VENDOR:
+ case SURFACE_WHEELBASE:
+ case SURFACE_METAL_GATE:
return 1.0f - CWeather::WetRoads*0.4f;
default:
diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h
index 12246dce..25b5e57d 100644
--- a/src/core/SurfaceTable.h
+++ b/src/core/SurfaceTable.h
@@ -1,86 +1,44 @@
#pragma once
-
-enum
-{
- SURFACE_0,
- SURFACE_1,
- SURFACE_2,
- SURFACE_3,
- SURFACE_4,
- SURFACE_5,
- SURFACE_6,
- SURFACE_7,
- SURFACE_8,
- SURFACE_9,
- SURFACE_10,
- SURFACE_11,
- SURFACE_12,
- SURFACE_13,
- SURFACE_14,
- SURFACE_15,
- SURFACE_16,
- SURFACE_17,
- SURFACE_18,
- SURFACE_19,
- SURFACE_20,
- SURFACE_21,
- SURFACE_22,
- SURFACE_23,
- SURFACE_24,
- SURFACE_25,
- SURFACE_26,
- SURFACE_27,
- SURFACE_28,
- SURFACE_29,
- SURFACE_30,
- SURFACE_31,
- SURFACE_32,
-
- NUMSURFACETYPES
-};
-
-// From nick
-// TODO: check and use this
enum eSurfaceType
{
SURFACE_DEFAULT,
SURFACE_TARMAC,
SURFACE_GRASS,
- SURFACE_DIRT,
- SURFACE_DIRTTRACK,
+ SURFACE_GRAVEL,
+ SURFACE_MUD_DRY,
SURFACE_PAVEMENT,
- SURFACE_METAL6,
+ SURFACE_CAR,
SURFACE_GLASS,
- SURFACE_SCAFFOLD,
- SURFACE_METAL_DOOR, // garage door
- SURFACE_BILLBOARD,
- SURFACE_STEEL, //?
- SURFACE_METAL_POLE, // ?
- SURFACE_STREET_LIGHT,
- SURFACE_METAL14,
- SURFACE_METAL15,
- SURFACE_METAL_FENCE,
- SURFACE_FLESH,
+ SURFACE_TRANSPARENT_CLOTH,
+ SURFACE_GARAGE_DOOR,
+ SURFACE_CAR_PANEL,
+ SURFACE_THICK_METAL_PLATE,
+ SURFACE_SCAFFOLD_POLE,
+ SURFACE_LAMP_POST,
+ SURFACE_FIRE_HYDRANT,
+ SURFACE_GIRDER,
+ SURFACE_METAL_CHAIN_FENCE,
+ SURFACE_PED,
SURFACE_SAND,
- SURFACE_PUDDLE,
- SURFACE_WOOD,
- SURFACE_WOOD_BOX,
- SURFACE_WOOD_PLANK,
- SURFACE_TIRE,
- SURFACE_HARD24,
+ SURFACE_WATER,
+ SURFACE_WOOD_CRATES,
+ SURFACE_WOOD_BENCH,
+ SURFACE_WOOD_SOLID,
+ SURFACE_RUBBER,
+ SURFACE_PLASTIC,
SURFACE_HEDGE,
- SURFACE_STONE,
- SURFACE_METAL27,
- SURFACE_METAL28,
- SURFACE_RUBBER29,
- SURFACE_LOOSE30,
- SURFACE_BOLLARD,
- SURFACE_GATE,
+ SURFACE_STEEP_CLIFF,
+ SURFACE_CONTAINER,
+ SURFACE_NEWS_VENDOR,
+ SURFACE_WHEELBASE,
+ SURFACE_CARDBOARDBOX,
+ SURFACE_TRANSPARENT_STONE,
+ SURFACE_METAL_GATE,
// These are illegal
- SURFACE_SAND33,
- SURFACE_ROAD34,
+ SURFACE_SAND_BEACH,
+ SURFACE_CONCRETE_BEACH,
};
enum
diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp
index 79d6252b..1252e2c7 100644
--- a/src/core/TempColModels.cpp
+++ b/src/core/TempColModels.cpp
@@ -65,7 +65,7 @@ CTempColModels::Initialise(void)
#else
for (i = 0; i < ARRAY_SIZE(s_aPedGSpheres); i++) {
#endif
- s_aPedSpheres[i].surface = SURFACE_FLESH;
+ s_aPedSpheres[i].surface = SURFACE_PED;
s_aPedSpheres[i].piece = 0;
}
@@ -84,7 +84,7 @@ CTempColModels::Initialise(void)
s_aPed2Spheres[2].center = CVector(0.0f, -0.35f, -0.9f);
for (i = 0; i < ARRAY_SIZE(s_aPed2Spheres); i++) {
- s_aPed2Spheres[i].surface = SURFACE_FLESH;
+ s_aPed2Spheres[i].surface = SURFACE_PED;
s_aPed2Spheres[i].piece = 0;
}
@@ -105,10 +105,10 @@ CTempColModels::Initialise(void)
s_aPedGSpheres[2].center = CVector(0.0f, 0.25f, -0.9f);
s_aPedGSpheres[3].center = CVector(0.0f, 0.65f, -0.9f);
- s_aPedGSpheres[0].surface = SURFACE_FLESH;
- s_aPedGSpheres[1].surface = SURFACE_FLESH;
- s_aPedGSpheres[2].surface = SURFACE_FLESH;
- s_aPedGSpheres[3].surface = SURFACE_FLESH;
+ s_aPedGSpheres[0].surface = SURFACE_PED;
+ s_aPedGSpheres[1].surface = SURFACE_PED;
+ s_aPedGSpheres[2].surface = SURFACE_PED;
+ s_aPedGSpheres[3].surface = SURFACE_PED;
s_aPedGSpheres[0].piece = 4;
s_aPedGSpheres[1].piece = 1;
s_aPedGSpheres[2].piece = 0;
@@ -130,7 +130,7 @@ CTempColModels::Initialise(void)
s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f);
for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) {
- s_aDoorSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aDoorSpheres[i].surface = SURFACE_CAR_PANEL;
s_aDoorSpheres[i].piece = 0;
}
@@ -150,12 +150,12 @@ CTempColModels::Initialise(void)
s_aBumperSpheres[3].center = CVector(-0.85f, -0.05f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBumperSpheres); i++) {
- s_aBumperSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aBumperSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBumperSpheres[i].piece = 0;
}
ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0);
- ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f), SURFACE_DEFAULT, 0);
+ ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, 0.2f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres);
@@ -170,7 +170,7 @@ CTempColModels::Initialise(void)
s_aPanelSpheres[3].center = CVector(-0.15f, 0.45f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aPanelSpheres); i++) {
- s_aPanelSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aPanelSpheres[i].surface = SURFACE_CAR_PANEL;
s_aPanelSpheres[i].piece = 0;
}
@@ -190,7 +190,7 @@ CTempColModels::Initialise(void)
s_aBonnetSpheres[3].center = CVector(0.4f, 0.9f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBonnetSpheres); i++) {
- s_aBonnetSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aBonnetSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBonnetSpheres[i].piece = 0;
}
@@ -210,7 +210,7 @@ CTempColModels::Initialise(void)
s_aBootSpheres[3].center = CVector(0.4f, -0.6f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
- s_aBootSpheres[i].surface = SURFACE_BILLBOARD;
+ s_aBootSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBootSpheres[i].piece = 0;
}
@@ -232,7 +232,7 @@ CTempColModels::Initialise(void)
#else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif
- s_aWheelSpheres[i].surface = SURFACE_RUBBER29;
+ s_aWheelSpheres[i].surface = SURFACE_WHEELBASE;
s_aWheelSpheres[i].piece = 0;
}
@@ -254,7 +254,7 @@ CTempColModels::Initialise(void)
#else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif
- s_aBodyPartSpheres1[i].surface = SURFACE_FLESH;
+ s_aBodyPartSpheres1[i].surface = SURFACE_PED;
s_aBodyPartSpheres1[i].piece = 0;
}
@@ -276,7 +276,7 @@ CTempColModels::Initialise(void)
#else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif
- s_aBodyPartSpheres2[i].surface = SURFACE_FLESH;
+ s_aBodyPartSpheres2[i].surface = SURFACE_PED;
s_aBodyPartSpheres2[i].piece = 0;
}
diff --git a/src/core/Timer.h b/src/core/Timer.h
index 1fbe51f5..393242dd 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -18,7 +18,7 @@ public:
static const float &GetTimeStep(void) { return ms_fTimeStep; }
static void SetTimeStep(float ts) { ms_fTimeStep = ts; }
static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; }
- static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
+ static uint32 GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; }
static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; }
@@ -59,7 +59,7 @@ public:
friend class CMemoryCard;
#ifdef FIX_BUGS
- static float GetDefaultTimeStep(void) { return 5.0f / 3.0f; }
+ static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); }
#endif
};
diff --git a/src/core/World.cpp b/src/core/World.cpp
index c15c134d..8bcce8e7 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -33,22 +33,22 @@
CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
-CPtrList CWorld::ms_bigBuildingsList[4];// = (CPtrList*)0x6FAB60;
-CPtrList CWorld::ms_listMovingEntityPtrs;// = *(CPtrList*)0x8F433C;
-CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];// = (CSector (*)[NUMSECTORS_Y])0x665608;
-uint16 CWorld::ms_nCurrentScanCode;// = *(uint16*)0x95CC64;
+CPtrList CWorld::ms_bigBuildingsList[4];
+CPtrList CWorld::ms_listMovingEntityPtrs;
+CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];
+uint16 CWorld::ms_nCurrentScanCode;
-uint8 CWorld::PlayerInFocus;// = *(uint8 *)0x95CD61;
+uint8 CWorld::PlayerInFocus;
CPlayerInfo CWorld::Players[NUMPLAYERS];
-bool CWorld::bNoMoreCollisionTorque;// = *(bool*)0x95CDCC;
-CEntity *CWorld::pIgnoreEntity;// = *(CEntity**)0x8F6494;
-bool CWorld::bIncludeDeadPeds;// = *(bool*)0x95CD8F;
-bool CWorld::bSecondShift;// = *(bool*)0x95CD54;
-bool CWorld::bForceProcessControl;// = *(bool*)0x95CD6C;
-bool CWorld::bProcessCutsceneOnly;// = *(bool*)0x95CD8B;
+bool CWorld::bNoMoreCollisionTorque;
+CEntity *CWorld::pIgnoreEntity;
+bool CWorld::bIncludeDeadPeds;
+bool CWorld::bSecondShift;
+bool CWorld::bForceProcessControl;
+bool CWorld::bProcessCutsceneOnly;
-bool CWorld::bDoingCarCollisions;// = *(bool*)0x95CD8C;
-bool CWorld::bIncludeCarTyres;// = *(bool*)0x95CDAA;
+bool CWorld::bDoingCarCollisions;
+bool CWorld::bIncludeCarTyres;
void
CWorld::Initialise()
@@ -120,14 +120,14 @@ CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemov
for(int32 i = 0; i < pedPool->GetSize(); i++) {
CPed *pPed = pedPool->GetSlot(i);
if(pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() &&
- CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < radius) {
+ CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < SQR(radius)) {
CPopulation::RemovePed(pPed);
}
}
CVehiclePool *VehiclePool = CPools::GetVehiclePool();
for(int32 i = 0; i < VehiclePool->GetSize(); i++) {
CVehicle *pVehicle = VehiclePool->GetSlot(i);
- if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < radius &&
+ if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < SQR(radius) &&
!pVehicle->bIsLocked && pVehicle->CanBeDeleted()) {
if(pVehicle->pDriver) {
CPopulation::RemovePed(pVehicle->pDriver);
@@ -659,8 +659,8 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
}
void
-CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, short *nextObject,
- short lastObject, CEntity **objects)
+CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects,
+ int16 lastObject, CEntity **objects)
{
float radiusSqr = radius * radius;
float objDistSqr;
@@ -676,16 +676,16 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, floa
else
objDistSqr = diff.MagnitudeSqr();
- if(objDistSqr < radiusSqr && *nextObject < lastObject) {
- if(objects) { objects[*nextObject] = object; }
- (*nextObject)++;
+ if(objDistSqr < radiusSqr && *numObjects < lastObject) {
+ if(objects) { objects[*numObjects] = object; }
+ (*numObjects)++;
}
}
}
}
void
-CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject,
+CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject,
CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds,
bool checkObjects, bool checkDummies)
{
@@ -711,39 +711,39 @@ CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, sh
AdvanceCurrentScanCode();
- *nextObject = 0;
+ *numObjects = 0;
for(int curY = minY; curY <= maxY; curY++) {
for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY);
if(checkBuildings) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre,
- radius, ignoreZ, nextObject, lastObject, objects);
+ radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkVehicles) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre,
- radius, ignoreZ, nextObject, lastObject, objects);
+ radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkPeds) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ,
- nextObject, lastObject, objects);
+ numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
}
if(checkObjects) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre,
- radius, ignoreZ, nextObject, lastObject, objects);
+ radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkDummies) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius,
- ignoreZ, nextObject, lastObject, objects);
+ ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre,
- radius, ignoreZ, nextObject, lastObject, objects);
+ radius, ignoreZ, numObjects, lastObject, objects);
}
}
}
@@ -949,7 +949,11 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
if(e != entityToIgnore && e->bUsesCollision &&
!(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
+#ifdef FIX_BUGS
+ CVector diff = spherePos - e->GetBoundCentre();
+#else
CVector diff = spherePos - e->GetPosition();
+#endif
float distance = diff.Magnitude();
if(e->GetBoundRadius() + radius > distance) {
@@ -1823,7 +1827,7 @@ void
CWorld::RepositionOneObject(CEntity *pEntity)
{
int16 modelId = pEntity->GetModelIndex();
- if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
+ if (IsStreetLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
diff --git a/src/core/World.h b/src/core/World.h
index 2bcc4e43..9465a914 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -102,8 +102,8 @@ public:
static CEntity *TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects);
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
- static void FindObjectsInRangeSectorList(CPtrList&, Const CVector&, float, bool, short*, short, CEntity**);
- static void FindObjectsInRange(Const CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
+ static void FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects);
+ static void FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies);
static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies);
static float FindGroundZForCoord(float x, float y);
diff --git a/src/core/common.h b/src/core/common.h
index 01455840..4bf1aebd 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -29,14 +29,14 @@
#define STREAMFILE(str) (((rw::StreamFile*)(str))->file)
#define HIERNODEINFO(hier) ((hier)->nodeInfo)
#define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id)
-#define HANIMFRAMES(anim) ((anim)->keyframes)
+#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->keyframes + (i)*(anim)->interpInfo->animKeyFrameSize)
#else
#define RWHALFPIXEL // always d3d
#define STREAMPOS(str) ((str)->Type.memory.position)
#define STREAMFILE(str) ((str)->Type.file.fpFile)
#define HIERNODEINFO(hier) ((hier)->pNodeInfo)
#define HIERNODEID(hier, i) ((hier)->pNodeInfo[i].nodeID)
-#define HANIMFRAMES(anim) ((anim)->pFrames)
+#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->pFrames + (i)*(anim)->interpInfo->keyFrameSize)
#endif
#ifdef RWHALFPIXEL
@@ -113,7 +113,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
-#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
+#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
// This scales from PS2 pixel coordinates to the real resolution
#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)
@@ -416,7 +416,7 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
WriteSaveBuf(buf, b);\
WriteSaveBuf(buf, c);\
WriteSaveBuf(buf, d);\
- WriteSaveBuf(buf, size);
+ WriteSaveBuf<uint32>(buf, size);
#define CheckSaveHeader(buf,a,b,c,d,size)\
assert(ReadSaveBuf<char>(buf) == a);\
diff --git a/src/core/config.h b/src/core/config.h
index d9f892a6..98f031b3 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -65,8 +65,6 @@ enum Config {
NUMATTRIBZONES = 288,
NUMZONEINDICES = 55000,
- NUMHANDLINGS = 57,
-
PATHNODESIZE = 4500,
NUMWEATHERS = 4,
@@ -188,21 +186,20 @@ enum Config {
# define NO_CDCHECK
# define CHATTYSPLASH // print what the game is loading
# define DEBUGMENU
-//# define TIMEBARS // print debug timers
+# define TIMEBARS // print debug timers
#endif
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
#define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things
#define MORE_LANGUAGES // Add more translations to the game
+#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
+
+// Rendering/display
+#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
//#define USE_TEXTURE_POOL
-#ifdef _WIN32
-#define AUDIO_MSS
-#else
-#define AUDIO_OAL
-#endif
// Particle
//#define PC_PARTICLE
@@ -219,7 +216,6 @@ enum Config {
#define REGISTER_START_BUTTON
// Hud, frontend and radar
-#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
@@ -229,13 +225,20 @@ enum Config {
// #define CIRCLE_BACK_BUTTON
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
#define BETA_SLIDING_TEXT
+#define CUSTOM_FRONTEND_OPTIONS
// Script
-#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
+#define USE_DEBUG_SCRIPT_LOADER // Loads main.scm by default. Hold R for main_freeroam.scm and D for main_d.scm
#define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script
#define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
+#define MISSION_REPLAY // mobile feature
+//#define SIMPLIER_MISSIONS // apply simplifications from mobile
+#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+#define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log
-#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
+#ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
+#endif
// Replay
//#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool!
@@ -257,5 +260,6 @@ enum Config {
#define CANCELLABLE_CAR_ENTER
// Camera
+//#define PS2_CAM_TRANSITION // old way of transitioning between cam modes
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
#define FREE_CAM // Rotating cam
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 7c50e81e..1e26381a 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -74,6 +74,9 @@ float FramesPerSecond = 30.0f;
bool gbPrintShite = false;
bool gbModelViewer;
+#ifdef TIMEBARS
+bool gbShowTimebars;
+#endif
int32 frameCount;
@@ -96,7 +99,6 @@ void TheGame(void);
void DebugMenuPopulate(void);
#endif
-
void
ValidateVersion()
{
@@ -138,9 +140,13 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
+#ifndef ASPECT_RATIO_SCALE
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f / 9.f : 4.f / 3.f));
+#else
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
- RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
+ RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
return false;
@@ -156,7 +162,11 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{
+#ifndef ASPECT_RATIO_SCALE
+ CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f/9.f : 4.f/3.f));
+#else
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
+#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@@ -342,7 +352,7 @@ PluginAttach(void)
static RwBool
Initialise3D(void *param)
{
- if (RsRwInitialise(param))
+ if (RsRwInitialize(param))
{
#ifdef DEBUGMENU
DebugMenuInit();
@@ -1118,8 +1128,10 @@ Idle(void *arg)
#endif
CCredits::Render();
+
#ifdef TIMEBARS
- tbDisplay();
+ if (gbShowTimebars)
+ tbDisplay();
#endif
DoRWStuffEndOfFrame();
@@ -1175,10 +1187,10 @@ AppEventHandler(RsEvent event, void *param)
{
switch( event )
{
- case rsINITIALISE:
+ case rsINITIALIZE:
{
CGame::InitialiseOnceBeforeRW();
- return RsInitialise() ? rsEVENTPROCESSED : rsEVENTERROR;
+ return RsInitialize() ? rsEVENTPROCESSED : rsEVENTERROR;
}
case rsCAMERASIZE:
@@ -1190,7 +1202,7 @@ AppEventHandler(RsEvent event, void *param)
return rsEVENTPROCESSED;
}
- case rsRWINITIALISE:
+ case rsRWINITIALIZE:
{
return Initialise3D(param) ? rsEVENTPROCESSED : rsEVENTERROR;
}
diff --git a/src/core/main.h b/src/core/main.h
index 32a880d6..9ad4ed1c 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -14,6 +14,9 @@ extern wchar gUString[256];
extern wchar gUString2[256];
extern bool gbPrintShite;
extern bool gbModelViewer;
+#ifdef TIMEBARS
+extern bool gbShowTimebars;
+#endif
class CSprite2d;
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 9bc6400c..56ee9aa7 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -27,6 +27,9 @@
#include "Radar.h"
#include "debugmenu.h"
#include "Frontend.h"
+#include "Text.h"
+#include "WaterLevel.h"
+#include "main.h"
#ifndef _WIN32
#include "assert.h"
@@ -66,6 +69,100 @@ mysrand(unsigned int seed)
myrand_seed = seed;
}
+#ifdef CUSTOM_FRONTEND_OPTIONS
+#include "frontendoption.h"
+#include "platform.h"
+
+void ReloadFrontendOptions(void)
+{
+ RemoveCustomFrontendOptions();
+ CustomFrontendOptionsPopulate();
+}
+
+#ifdef MORE_LANGUAGES
+void LangPolSelect(int8 action)
+{
+ if (action == FEOPTION_ACTION_SELECT) {
+ FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_POLISH;
+ FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
+ FrontEndMenuManager.InitialiseChangedLanguageSettings();
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+
+void LangRusSelect(int8 action)
+{
+ if (action == FEOPTION_ACTION_SELECT) {
+ FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_RUSSIAN;
+ FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
+ FrontEndMenuManager.InitialiseChangedLanguageSettings();
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+
+void LangJapSelect(int8 action)
+{
+ if (action == FEOPTION_ACTION_SELECT) {
+ FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_JAPANESE;
+ FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
+ FrontEndMenuManager.InitialiseChangedLanguageSettings();
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+#endif
+
+#ifdef IMPROVED_VIDEOMODE
+void ScreenModeChange(int8 displayedValue)
+{
+ if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) {
+ FrontEndMenuManager.m_nPrefsWindowed = displayedValue;
+ _psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution
+ FrontEndMenuManager.SetHelperText(0);
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+#endif
+
+#ifdef FREE_CAM
+void ToggleFreeCam(int8 action)
+{
+ if (action == FEOPTION_ACTION_SELECT) {
+ TheCamera.bFreeCam = !TheCamera.bFreeCam;
+ FrontEndMenuManager.SaveSettings();
+ }
+}
+#endif
+
+// Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind
+void
+CustomFrontendOptionsPopulate(void)
+{
+#ifdef MORE_LANGUAGES
+ FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS);
+ FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil);
+ FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, LangRusSelect, nil);
+ FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, LangJapSelect, nil);
+#endif
+
+#ifdef IMPROVED_VIDEOMODE
+ static const wchar *screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" };
+ FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 8);
+ FrontendOptionAddSelect(TheText.Get("SCRFOR"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil);
+#endif
+
+#ifdef MENU_MAP
+ FrontendOptionSetPosition(MENUPAGE_PAUSE_MENU, 2);
+ FrontendOptionAddRedirect(TheText.Get("FEG_MAP"), MENUPAGE_MAP);
+#endif
+
+#ifdef FREE_CAM
+ static const wchar *text = (wchar*)L"TOGGLE FREE CAM";
+ FrontendOptionSetPosition(MENUPAGE_CONTROLLER_PC, 1);
+ FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil);
+#endif
+}
+#endif
+
#ifdef DEBUGMENU
void WeaponCheat();
void HealthCheat();
@@ -160,6 +257,13 @@ TeleportToWaypoint(void)
}
#endif
+static void
+SwitchCarCollision(void)
+{
+ if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar())
+ FindPlayerVehicle()->bUsesCollision = !FindPlayerVehicle()->bUsesCollision;
+}
+
static int engineStatus;
static void
SetEngineStatus(void)
@@ -357,11 +461,14 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Don't render Peds", &gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
+ DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
+ DebugMenuAddVarBool8("Debug", "pad 1 -> pad 2", &CPad::m_bMapPadOneToPadTwo, nil);
DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
#ifdef MENU_MAP
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
#endif
+ DebugMenuAddCmd("Debug", "Switch car collision", SwitchCarCollision);
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
@@ -374,6 +481,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions);
+#endif
#ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil);
DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", &CPed::bMakePedsRunToPhonesToReportCrimes, nil);
@@ -382,6 +492,11 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
+ DebugMenuAddVarBool8("Debug", "Show DebugStuffInRelease", &gbDebugStuffInRelease, nil);
+#ifdef TIMEBARS
+ DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil);
+#endif
+
extern bool PrintDebugCode;
extern int16 DebugCamMode;
DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil);
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index ec50dd30..31da489f 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -683,7 +683,7 @@ CEntity::ProcessLightsForEntity(void)
lightOn = true;
break;
case LIGHT_FLICKER_NIGHT:
- if(CClock::GetHours() > 18 || CClock::GetHours() < 7){
+ if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60)
lightOn = true;
else
@@ -803,12 +803,12 @@ CEntity::ProcessLightsForEntity(void)
}
// Light shadow
- if(effect->light.shadowRange != 0.0f){
+ if(effect->light.shadowSize != 0.0f){
if(lightOn){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos,
- effect->light.shadowRange, 0.0f,
- 0.0f, -effect->light.shadowRange,
+ effect->light.shadowSize, 0.0f,
+ 0.0f, -effect->light.shadowSize,
128,
effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
@@ -817,8 +817,8 @@ CEntity::ProcessLightsForEntity(void)
}else if(lightFlickering){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos,
- effect->light.shadowRange, 0.0f,
- 0.0f, -effect->light.shadowRange,
+ effect->light.shadowSize, 0.0f,
+ 0.0f, -effect->light.shadowSize,
0, 0.0f, 0.0f, 0.0f,
15.0f, 1.0f, 40.0f, false, 0.0f);
}
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index 64358cbf..e89b4858 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -21,6 +21,10 @@ CPhysical::CPhysical(void)
{
int i;
+#ifdef FIX_BUGS
+ m_nLastTimeCollided = 0;
+#endif
+
m_fForceMultiplier = 1.0f;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
@@ -45,9 +49,9 @@ CPhysical::CPhysical(void)
bUsesCollision = true;
m_audioEntityId = -5;
- unk1 = 100.0f;
+ m_phys_unused1 = 100.0f;
m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f);
- field_EC = 0;
+ m_phys_unused2 = 0;
bIsHeavy = false;
bAffectedByGravity = true;
@@ -63,6 +67,9 @@ CPhysical::CPhysical(void)
m_phy_flagA10 = false;
m_phy_flagA20 = false;
+#ifdef FIX_BUGS
+ m_nSurfaceTouched = SURFACE_DEFAULT;
+#endif
m_nZoneLevel = LEVEL_NONE;
}
@@ -527,26 +534,26 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
bool ispedcontactA = false;
bool ispedcontactB = false;
- float timestepA;
+ float massFactorA;
if(B->bPedPhysics){
- timestepA = 10.0f;
+ massFactorA = 10.0f;
if(B->IsPed() && ((CPed*)B)->m_pCurrentPhysSurface == A)
ispedcontactA = true;
}else
- timestepA = A->bIsHeavy ? 2.0f : 1.0f;
+ massFactorA = A->bIsHeavy ? 2.0f : 1.0f;
- float timestepB;
+ float massFactorB;
if(A->bPedPhysics){
if(A->IsPed() && ((CPed*)A)->IsPlayer() && B->IsVehicle() &&
(B->GetStatus() == STATUS_ABANDONED || B->GetStatus() == STATUS_WRECKED || A->bHasHitWall))
- timestepB = 2200.0f / B->m_fMass;
+ massFactorB = 2200.0f / B->m_fMass;
else
- timestepB = 10.0f;
+ massFactorB = 10.0f;
if(A->IsPed() && ((CPed*)A)->m_pCurrentPhysSurface == B)
ispedcontactB = true;
}else
- timestepB = B->bIsHeavy ? 2.0f : 1.0f;
+ massFactorB = B->bIsHeavy ? 2.0f : 1.0f;
float speedA, speedB;
if(B->IsStatic()){
@@ -646,14 +653,17 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
// positive if B is moving towards A
// not interested in how much B moves into A apparently?
// only interested in cases where A collided into B
- speedB = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
+ speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
+ float speedSum = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
// A has moved into B
- if(speedA < speedB){
- if(!A->bHasHitWall)
- speedB -= (speedA - speedB) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
- impulseA = (speedB-speedA) * A->m_fMass * timestepA;
+ if(speedA < speedSum){
+ if(A->bHasHitWall)
+ eA = speedSum;
+ else
+ eA = speedSum - (speedA - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
+ impulseA = (eA-speedA) * A->m_fMass * massFactorA;
if(!A->bInfiniteMass)
- A->ApplyMoveForce(colpoint.normal*(impulseA/timestepA));
+ A->ApplyMoveForce(colpoint.normal*(impulseA/massFactorA));
return true;
}
}else if(A->bPedPhysics){
@@ -661,9 +671,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal);
- float a = A->m_fMass*timestepA;
- float b = B->GetMassTime(pointposB, colpoint.normal, timestepB);
- float speedSum = (b*speedB + a*speedA)/(a + b);
+ float mA = A->m_fMass*massFactorA;
+ float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB);
+ float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){
if(A->bHasHitWall)
eA = speedSum;
@@ -673,10 +683,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum;
else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
- impulseA = (eA - speedA) * a;
- impulseB = -(eB - speedB) * b;
- CVector fA = colpoint.normal*(impulseA/timestepA);
- CVector fB = colpoint.normal*(-impulseB/timestepB);
+ impulseA = (eA - speedA) * mA;
+ impulseB = -(eB - speedB) * mB;
+ CVector fA = colpoint.normal*(impulseA/massFactorA);
+ CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(!A->bInfiniteMass){
if(fA.z < 0.0f) fA.z = 0.0f;
if(ispedcontactB){
@@ -696,9 +706,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal);
speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
- float a = A->GetMassTime(pointposA, colpoint.normal, timestepA);
- float b = B->m_fMass*timestepB;
- float speedSum = (b*speedB + a*speedA)/(a + b);
+ float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA);
+ float mB = B->m_fMass*massFactorB;
+ float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){
if(A->bHasHitWall)
eA = speedSum;
@@ -708,10 +718,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum;
else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
- impulseA = (eA - speedA) * a;
- impulseB = -(eB - speedB) * b;
- CVector fA = colpoint.normal*(impulseA/timestepA);
- CVector fB = colpoint.normal*(-impulseB/timestepB);
+ impulseA = (eA - speedA) * mA;
+ impulseB = -(eB - speedB) * mB;
+ CVector fA = colpoint.normal*(impulseA/massFactorA);
+ CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(!A->bInfiniteMass && !ispedcontactA){
if(fA.z < 0.0f) fA.z = 0.0f;
A->ApplyMoveForce(fA);
@@ -736,9 +746,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
CVector pointposB = colpoint.point - B->GetPosition();
speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal);
speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal);
- float a = A->GetMassTime(pointposA, colpoint.normal, timestepA);
- float b = B->GetMassTime(pointposB, colpoint.normal, timestepB);
- float speedSum = (b*speedB + a*speedA)/(a + b);
+ float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA);
+ float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB);
+ float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){
if(A->bHasHitWall)
eA = speedSum;
@@ -748,10 +758,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum;
else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
- impulseA = (eA - speedA) * a;
- impulseB = -(eB - speedB) * b;
- CVector fA = colpoint.normal*(impulseA/timestepA);
- CVector fB = colpoint.normal*(-impulseB/timestepB);
+ impulseA = (eA - speedA) * mA;
+ impulseB = -(eB - speedB) * mB;
+ CVector fA = colpoint.normal*(impulseA/massFactorA);
+ CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(A->IsVehicle() && !A->bHasHitWall){
fA.x *= 1.4f;
fA.y *= 1.4f;
@@ -767,7 +777,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(B->IsVehicle() && !B->bHasHitWall){
fB.x *= 1.4f;
fB.y *= 1.4f;
- if(colpoint.normal.z < 0.7f)
+ if(-colpoint.normal.z < 0.7f)
fB.z *= 0.3f;
if(B->GetStatus() == STATUS_PLAYER)
pointposB *= 0.8f;
@@ -813,7 +823,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
speed = GetSpeed(pointpos);
normalSpeed = DotProduct(speed, colpoint.normal);
if(normalSpeed < 0.0f){
- float minspeed = 0.0104f * CTimer::GetTimeStep();
+ float minspeed = 1.3f*GRAVITY * CTimer::GetTimeStep();
#ifdef GTA3_1_1_PATCH
if ((IsObject() || IsVehicle() && (GetUp().z < -0.3f || ((CVehicle*)this)->IsBike() && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED))) &&
#else
@@ -1015,7 +1025,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos);
if(fOtherSpeed > 0.1f &&
- colpoint.surfaceB != SURFACE_2 && colpoint.surfaceB != SURFACE_4 &&
+ colpoint.surfaceB != SURFACE_GRASS && colpoint.surfaceB != SURFACE_MUD_DRY &&
CSurfaceTable::GetAdhesionGroup(colpoint.surfaceA) == ADHESIVE_HARD){
CVector v = frictionDir * fOtherSpeed * 0.25f;
for(int i = 0; i < 4; i++)
@@ -1064,7 +1074,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
canshift = true;
else
canshift = A->IsPed() &&
- B->IsObject() && B->bInfiniteMass && !Bobj->bHasBeenDamaged;
+ B->IsObject() && B->bIsStatic && !Bobj->bHasBeenDamaged;
if(B == A ||
B->m_scanCode == CWorld::GetCurrentScanCode() ||
!B->bUsesCollision ||
@@ -1076,15 +1086,14 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
if(B->IsBuilding())
skipShift = false;
- else if(IsTrafficLight(A->GetModelIndex()) &&
+ else if(IsStreetLight(A->GetModelIndex()) &&
(B->IsVehicle() || B->IsPed()) &&
A->GetUp().z < 0.66f)
skipShift = true;
else if((A->IsVehicle() || A->IsPed()) &&
B->GetUp().z < 0.66f &&
- IsTrafficLight(B->GetModelIndex()))
+ IsStreetLight(B->GetModelIndex()))
skipShift = true;
-// TODO: maybe flip some ifs here
else if(A->IsObject() && B->IsVehicle()){
CObject *Aobj = (CObject*)A;
if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
@@ -1407,7 +1416,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
if(B->IsBuilding())
skipCollision = false;
- else if(IsTrafficLight(A->GetModelIndex()) &&
+ else if(IsStreetLight(A->GetModelIndex()) &&
(B->IsVehicle() || B->IsPed()) &&
A->GetUp().z < 0.66f){
skipCollision = true;
@@ -1415,7 +1424,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
Aobj->m_pCollidingEntity = B;
}else if((A->IsVehicle() || A->IsPed()) &&
B->GetUp().z < 0.66f &&
- IsTrafficLight(B->GetModelIndex())){
+ IsStreetLight(B->GetModelIndex())){
skipCollision = true;
A->bSkipLineCol = true;
Bobj->m_pCollidingEntity = A;
@@ -1699,16 +1708,16 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
}
if(B->IsPed() && A->IsVehicle() &&
- (!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > 0.0025f))
+ (!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > SQR(0.05f)))
Bped->KillPedWithCar((CVehicle*)A, maxImpulseB);
else if(B->GetModelIndex() == MI_TRAIN && A->IsPed() &&
(!Aped->IsPlayer() || A->bHasHitWall))
Aped->KillPedWithCar((CVehicle*)B, maxImpulseA*2.0f);
else if(B->IsObject() && B->bUsesCollision && A->IsVehicle()){
+ // BUG? not impulseA?
if(Bobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
Bobj->ObjectDamage(maxImpulseB);
}else if(A->IsObject() && A->bUsesCollision && B->IsVehicle()){
- // BUG? not impulseA?
if(Aobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
Aobj->ObjectDamage(maxImpulseB);
}
@@ -1774,7 +1783,7 @@ CPhysical::ProcessShift(void)
m_bIsVehicleBeingShifted = true;
CEntryInfoNode *node;
- bool hasshifted = false; // whatever that means...
+ bool hasshifted = false;
for(node = m_entryInfoList.first; node; node = node->next)
hasshifted |= ProcessShiftSectorList(node->sector->m_lists);
m_bIsVehicleBeingShifted = false;
@@ -1831,7 +1840,7 @@ CPhysical::ProcessCollision(void)
int8 n = 1; // The number of steps we divide the time step into
float step = 0.0f; // divided time step
- float distSq = GetDistanceSq();
+ float distSq = m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep());
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
if(ped->IsPlayer())
@@ -1920,8 +1929,11 @@ CPhysical::ProcessCollision(void)
bSkipLineCol = false;
if(!m_vecMoveSpeed.IsZero() ||
!m_vecTurnSpeed.IsZero() ||
+#ifdef GTA_TRAIN
bHitByTrain ||
- GetStatus() == STATUS_PLAYER || IsPed() && ped->IsPlayer()){
+#endif
+ GetStatus() == STATUS_PLAYER ||
+ IsPed() && ped->IsPlayer()){
if(IsVehicle())
((CVehicle*)this)->bVehicleColProcessed = true;
if(CheckCollision()){
diff --git a/src/entities/Physical.h b/src/entities/Physical.h
index c84686ed..f8921a5c 100644
--- a/src/entities/Physical.h
+++ b/src/entities/Physical.h
@@ -18,7 +18,7 @@ public:
// The not properly indented fields haven't been checked properly yet
int32 m_audioEntityId;
- float unk1;
+ float m_phys_unused1;
CTreadable *m_treadable[2]; // car and ped
uint32 m_nLastTimeCollided;
CVector m_vecMoveSpeed; // velocity
@@ -37,7 +37,7 @@ public:
CEntryInfoList m_entryInfoList;
CPtrNode *m_movingListNode;
- char field_EC;
+ int8 m_phys_unused2;
uint8 m_nStaticFrames;
uint8 m_nCollisionRecords;
bool m_bIsVehicleBeingShifted;
@@ -86,7 +86,6 @@ public:
void RemoveRefsToEntity(CEntity *ent);
static void PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos);
- float GetDistanceSq(void) { return m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep()); }
// get speed of point p relative to entity center
CVector GetSpeed(const CVector &r);
CVector GetSpeed(void) { return GetSpeed(CVector(0.0f, 0.0f, 0.0f)); }
@@ -94,7 +93,7 @@ public:
return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/m_fTurnMass +
1.0f/m_fMass);
}
- float GetMassTime(const CVector &pos, const CVector &dir, float t) {
+ float GetMassTweak(const CVector &pos, const CVector &dir, float t) {
return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/(m_fTurnMass*t) +
1.0f/(m_fMass*t));
}
diff --git a/src/extras/debugmenu.cpp b/src/extras/debugmenu.cpp
index f6b6eeb8..3a4c4175 100644
--- a/src/extras/debugmenu.cpp
+++ b/src/extras/debugmenu.cpp
@@ -1028,12 +1028,6 @@ DebugMenuProcess(void)
}
-#ifdef LIBRW
-#define CURRENTCAM (rw::engine->currentCamera)
-#else
-#define CURRENTCAM ((RwCamera*)RWSRCGLOBAL(curCamera))
-#endif
-
void
DebugMenuRender(void)
{
@@ -1048,7 +1042,7 @@ DebugMenuRender(void)
RwRenderStateSet(rwRENDERSTATEFOGENABLE, 0);
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
- RwCamera *cam = CURRENTCAM;
+ RwCamera *cam = RwCameraGetCurrentCamera();
screenWidth = RwRasterGetWidth(RwCameraGetRaster(cam));
screenHeight = RwRasterGetHeight(RwCameraGetRaster(cam));
@@ -1080,7 +1074,7 @@ drawArrow(RwRect r, int direction, int style)
static RwImVertexIndex indices[] = { 0, 1, 2, 2, 1, 3 };
static RwIm2DVertex arrowVerts[4];
- RwCamera *cam = CURRENTCAM;
+ RwCamera *cam = RwCameraGetCurrentCamera();
float recipz = 1.0f/RwCameraGetNearClipPlane(cam);
int width = RwRasterGetWidth(arrow);
@@ -1183,7 +1177,7 @@ drawMouse(void)
static RwIm2DVertex vertices[4];
RwIm2DVertex *vert;
RwCamera *cam;
- cam = CURRENTCAM;
+ cam = RwCameraGetCurrentCamera();
float x = mouseX;
float y = mouseY;
float w = RwRasterGetWidth(cursor);
diff --git a/src/extras/frontendoption.cpp b/src/extras/frontendoption.cpp
new file mode 100644
index 00000000..6ab2801c
--- /dev/null
+++ b/src/extras/frontendoption.cpp
@@ -0,0 +1,168 @@
+#include "common.h"
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+#include "frontendoption.h"
+
+int numCustomFrontendOptions = 0;
+FrontendOption *customFrontendOptions;
+
+int optionCursor = -1;
+eMenuScreen currentMenu;
+
+void ChangeScreen(eMenuScreen screen, int option, bool fadeIn)
+{
+ FrontEndMenuManager.m_nPrevScreen = FrontEndMenuManager.m_nCurrScreen;
+ FrontEndMenuManager.m_nCurrScreen = screen;
+ FrontEndMenuManager.m_nCurrOption = option;
+ if (fadeIn)
+ FrontEndMenuManager.m_nMenuFadeAlpha = 0;
+}
+
+void GoBack(bool fadeIn)
+{
+ int screen = !FrontEndMenuManager.m_bGameNotLoaded ?
+ aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[0];
+ int option = !FrontEndMenuManager.m_bGameNotLoaded ?
+ aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[0];
+
+ FrontEndMenuManager.ThingsToDoBeforeGoingBack();
+
+ ChangeScreen((eMenuScreen)screen, option, fadeIn);
+}
+
+uint8
+GetNumberOfMenuOptions(int screen)
+{
+ uint8 Rows = 0;
+ for (int i = 0; i < NUM_MENUROWS; i++) {
+ if (aScreens[screen].m_aEntries[i].m_Action == MENUACTION_NOTHING)
+ break;
+
+ ++Rows;
+ }
+ return Rows;
+}
+
+// Used before reloading in InitialiseChangedLanguageSettings and debugmenu
+void
+RemoveCustomFrontendOptions()
+{
+ for (int i = 0; i < MENUPAGES; i++) {
+ for (int j = 0; j < NUM_MENUROWS; j++) {
+ if (aScreens[i].m_aEntries[j].m_Action == MENUACTION_TRIGGERFUNC) {
+ int k;
+ for (k = j; k < NUM_MENUROWS-1; k++) {
+ memcpy(&aScreens[i].m_aEntries[k], &aScreens[i].m_aEntries[k+1], sizeof(CMenuScreen::CMenuEntry));
+ }
+ aScreens[i].m_aEntries[k].m_Action = MENUACTION_NOTHING;
+ aScreens[i].m_aEntries[k].m_EntryName[0] = '\0';
+ j--;
+ }
+ }
+ }
+ free(customFrontendOptions);
+ numCustomFrontendOptions = 0;
+}
+
+int8 RegisterNewOption(int screen)
+{
+ numCustomFrontendOptions++;
+ if (numCustomFrontendOptions == 1)
+ customFrontendOptions = (FrontendOption*)malloc(numCustomFrontendOptions * sizeof(FrontendOption));
+ else
+ customFrontendOptions = (FrontendOption*)realloc(customFrontendOptions, numCustomFrontendOptions * sizeof(FrontendOption));
+
+ uint8 nth = GetNumberOfMenuOptions(screen);
+ if (optionCursor < 0) {
+ if (optionCursor == -1) {
+ if (!strcmp(aScreens[screen].m_aEntries[nth - 1].m_EntryName, "FEDS_TB") || !strcmp(aScreens[screen].m_aEntries[nth - 1].m_EntryName, "FESZ_CA")) {
+ // Move back button one below
+ memcpy(&aScreens[screen].m_aEntries[nth], &aScreens[screen].m_aEntries[nth - 1], sizeof(CMenuScreen::CMenuEntry));
+ nth--;
+ }
+ }
+ } else {
+ if (aScreens[screen].m_aEntries[optionCursor].m_Action != MENUACTION_NOTHING) {
+ for (int i = nth - 1; i >= optionCursor; i--) {
+ memcpy(&aScreens[screen].m_aEntries[i + 1], &aScreens[screen].m_aEntries[i], sizeof(CMenuScreen::CMenuEntry));
+ }
+ }
+ nth = optionCursor;
+ optionCursor++;
+ }
+
+ aScreens[screen].m_aEntries[nth].m_Action = MENUACTION_TRIGGERFUNC;
+ aScreens[screen].m_aEntries[nth].m_TargetMenu = numCustomFrontendOptions - 1;
+ aScreens[screen].m_aEntries[nth].m_EntryName[0] = 1; // just something to fool it
+ return nth;
+}
+
+void FrontendOptionSetPosition(eMenuScreen screen, int8 option)
+{
+ currentMenu = screen;
+ optionCursor = option;
+}
+
+void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc)
+{
+ int8 screenOptionOrder = RegisterNewOption(currentMenu);
+
+ FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
+ option.screen = currentMenu;
+ option.type = FEOPTION_SELECT;
+ option.leftText = leftText;
+ option.rightTexts = rightTexts;
+ option.numRightTexts = numRightTexts;
+ option.value = var;
+ option.displayedValue = *var;
+ option.onlyApplyOnEnter = onlyApplyOnEnter;
+ option.changeFunc = changeFunc;
+ option.screenOptionOrder = screenOptionOrder;
+ option.returnPrevPageFunc = returnPrevPageFunc;
+}
+
+void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc)
+{
+ int8 screenOptionOrder = RegisterNewOption(currentMenu);
+
+ FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
+ option.screen = currentMenu;
+ option.type = FEOPTION_DYNAMIC;
+ option.drawFunc = drawFunc;
+ option.buttonPressFunc = buttonPressFunc;
+ option.leftText = leftText;
+ option.onlyApplyOnEnter = false;
+ option.screenOptionOrder = screenOptionOrder;
+ option.returnPrevPageFunc = returnPrevPageFunc;
+}
+
+void FrontendOptionAddRedirect(const wchar* text, eMenuScreen to, int8 selectedOption, bool fadeIn)
+{
+ int8 screenOptionOrder = RegisterNewOption(currentMenu);
+
+ FrontendOption &option = customFrontendOptions[numCustomFrontendOptions - 1];
+ option.screen = currentMenu;
+ option.type = FEOPTION_REDIRECT;
+ option.to = to;
+ option.option = selectedOption;
+ option.fadeIn = fadeIn;
+ option.leftText = text;
+ option.onlyApplyOnEnter = false;
+ option.screenOptionOrder = screenOptionOrder;
+ option.returnPrevPageFunc = nil;
+}
+
+void FrontendOptionAddBackButton(const wchar* text, bool fadeIn)
+{
+ int8 screenOptionOrder = RegisterNewOption(currentMenu);
+
+ FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
+ option.screen = currentMenu;
+ option.type = FEOPTION_GOBACK;
+ option.fadeIn = fadeIn;
+ option.leftText = text;
+ option.onlyApplyOnEnter = false;
+ option.screenOptionOrder = screenOptionOrder;
+ option.returnPrevPageFunc = nil;
+}
+#endif \ No newline at end of file
diff --git a/src/extras/frontendoption.h b/src/extras/frontendoption.h
new file mode 100644
index 00000000..7cfc09a7
--- /dev/null
+++ b/src/extras/frontendoption.h
@@ -0,0 +1,87 @@
+#pragma once
+#include "common.h"
+
+#ifdef CUSTOM_FRONTEND_OPTIONS
+#include "Frontend.h"
+
+// Warning: All of the code relies on that you won't use more then NUM_MENUROWS(18) options on one page. Also congrats if you can make 18 options visible at once.
+
+
+// Static/select: User allocates variable, passes it to function and it's set automatically from input among the strings given to function,
+// then you can handle ChangeFunc and ReturnPrevPageFunc if needed.
+//
+// Dynamic: Function doesn't accept value pointer, user should do operations with handling ButtonPressFunc.
+// Right-side text can be set via DrawFunc, which is called on every draw. ReturnPrevPageFunc is also here if needed.
+
+#define FEOPTION_SELECT 0
+#define FEOPTION_DYNAMIC 1
+#define FEOPTION_REDIRECT 2
+#define FEOPTION_GOBACK 3
+
+#define FEOPTION_ACTION_LEFT 0
+#define FEOPTION_ACTION_RIGHT 1
+#define FEOPTION_ACTION_SELECT 2
+#define FEOPTION_ACTION_FOCUSLOSS 3
+
+void RemoveCustomFrontendOptions();
+void CustomFrontendOptionsPopulate();
+
+// for static and dynamic options
+typedef void (*ReturnPrevPageFunc)();
+
+// for static options
+typedef void (*ChangeFunc)(int8 displayedValue); // called before updating the value
+
+// for dynamic options
+typedef wchar* (*DrawFunc)(bool* disabled); // should return pointer to right text. *disabled = true will make it dark yellow
+typedef void (*ButtonPressFunc)(int8 action); // see FEOPTION_ACTIONs above
+
+struct FrontendOption
+{
+ int8 type;
+ int8 screenOptionOrder;
+ eMenuScreen screen;
+ const wchar* leftText;
+ ReturnPrevPageFunc returnPrevPageFunc;
+
+ union {
+ // Only for dynamic
+ struct {
+ DrawFunc drawFunc;
+ ButtonPressFunc buttonPressFunc;
+ };
+
+ // Only for static/select
+ struct {
+ const wchar** rightTexts;
+ int8 numRightTexts;
+ int8 *value;
+ int8 displayedValue; // if onlyApplyOnEnter enabled
+ bool onlyApplyOnEnter;
+ ChangeFunc changeFunc;
+ };
+
+ // Only for redirect
+ struct {
+ eMenuScreen to;
+ int8 option;
+ bool fadeIn;
+ };
+ };
+};
+
+extern int numCustomFrontendOptions;
+extern FrontendOption* customFrontendOptions;
+
+// To be used in ButtonPressFunc / ChangeFunc(but that would be weird):
+void ChangeScreen(eMenuScreen screen, int option = 0, bool fadeIn = true);
+void GoBack(bool fadeIn = true);
+
+// If option is positive number, all calls will increase it before using it (you can think it as cursor). -1 means before the back button, -2 is end of page
+void FrontendOptionSetPosition(eMenuScreen screen, int8 option = -1);
+
+void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc);
+void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc rightTextDrawFunc, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc);
+void FrontendOptionAddRedirect(const wchar* text, eMenuScreen to, int8 selectedOption = 0, bool fadeIn = true);
+void FrontendOptionAddBackButton(const wchar* text, bool fadeIn = true);
+#endif \ No newline at end of file
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index 50d12b2f..f95845a8 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -152,7 +152,7 @@ RwReal RwCameraGetNearClipPlane(const RwCamera *camera) { return camera->n
RwReal RwCameraGetFarClipPlane(const RwCamera *camera) { return camera->farPlane; }
RwCamera *RwCameraSetFogDistance(RwCamera *camera, RwReal fogDistance) { camera->fogPlane = fogDistance; return camera; }
RwReal RwCameraGetFogDistance(const RwCamera *camera) { return camera->fogPlane; }
-RwCamera *RwCameraGetCurrentCamera(void);
+RwCamera *RwCameraGetCurrentCamera(void) { return rw::engine->currentCamera; }
RwCameraProjection RwCameraGetProjection(const RwCamera *camera);
const RwV2d *RwCameraGetViewWindow(const RwCamera *camera) { return &camera->viewWindow; }
RwMatrix *RwCameraGetViewMatrix(RwCamera *camera) { return &camera->viewMatrix; }
@@ -470,7 +470,7 @@ RwBool RwRenderStateSet(RwRenderState state, void *value)
uint32 uival = (uintptr)value;
uint32 fog;
switch(state){
- case rwRENDERSTATETEXTURERASTER: SetRenderState(TEXTURERASTER, uival); return true;
+ case rwRENDERSTATETEXTURERASTER: SetRenderStatePtr(TEXTURERASTER, value); return true;
case rwRENDERSTATETEXTUREADDRESS: SetRenderState(TEXTUREADDRESS, uival); return true;
case rwRENDERSTATETEXTUREADDRESSU: SetRenderState(TEXTUREADDRESSU, uival); return true;
case rwRENDERSTATETEXTUREADDRESSV: SetRenderState(TEXTUREADDRESSV, uival); return true;
@@ -615,8 +615,8 @@ RpGeometry *RpGeometryCreateSpace(RwReal radius);
RpMorphTarget *RpMorphTargetSetBoundingSphere(RpMorphTarget *morphTarget, const RwSphere *boundingSphere) { morphTarget->boundingSphere = *boundingSphere; return morphTarget; }
RwSphere *RpMorphTargetGetBoundingSphere(RpMorphTarget *morphTarget) { return &morphTarget->boundingSphere; }
const RpMorphTarget *RpMorphTargetCalcBoundingSphere(const RpMorphTarget *morphTarget, RwSphere *boundingSphere) { *boundingSphere = morphTarget->calculateBoundingSphere(); return morphTarget; }
-RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount);
-RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry);
+RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount) { RwInt32 n = geometry->numMorphTargets; geometry->addMorphTargets(mtcount); return n; }
+RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry) { return RpGeometryAddMorphTargets(geometry, 1); }
RpGeometry *RpGeometryRemoveMorphTarget(RpGeometry *geometry, RwInt32 morphTarget);
RwInt32 RpGeometryGetNumMorphTargets(const RpGeometry *geometry);
RpMorphTarget *RpGeometryGetMorphTarget(const RpGeometry *geometry, RwInt32 morphTarget) { return &geometry->morphTargets[morphTarget]; }
@@ -790,6 +790,12 @@ RpMaterial *RpMatFXMaterialSetEnvMapFrame( RpMaterial *material, RwFrame *frame
mfx->setEnvFrame(frame);
return material;
}
+RpMaterial *RpMatFXMaterialSetEnvMapFrameBufferAlpha( RpMaterial *material, RwBool useFrameBufferAlpha )
+{
+ MatFX *mfx = MatFX::get(material);
+ mfx->setEnvFBAlpha(useFrameBufferAlpha);
+ return material;
+}
RpMaterial *RpMatFXMaterialSetEnvMapCoefficient( RpMaterial *material, RwReal coef )
{
MatFX *mfx = MatFX::get(material);
diff --git a/src/math/Matrix.h b/src/math/Matrix.h
index b7e055c5..d8920a65 100644
--- a/src/math/Matrix.h
+++ b/src/math/Matrix.h
@@ -30,7 +30,11 @@ public:
RwMatrixDestroy(m_attachment);
}
void Attach(RwMatrix *matrix, bool owner = false){
+#ifdef FIX_BUGS
+ if(m_attachment && m_hasRwMatrix)
+#else
if(m_hasRwMatrix && m_attachment)
+#endif
RwMatrixDestroy(m_attachment);
m_attachment = matrix;
m_hasRwMatrix = owner;
@@ -223,6 +227,7 @@ public:
void SetRotate(float xAngle, float yAngle, float zAngle);
void Rotate(float x, float y, float z);
void RotateX(float x);
+ void RotateY(float y);
void RotateZ(float z);
void Reorthogonalise(void);
diff --git a/src/math/Quaternion.h b/src/math/Quaternion.h
index 1d04bdff..dac49362 100644
--- a/src/math/Quaternion.h
+++ b/src/math/Quaternion.h
@@ -60,6 +60,7 @@ public:
}
void Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, float invSin, float t);
+ void Set(RwV3d *axis, float angle);
void Get(RwMatrix *matrix);
};
diff --git a/src/math/math.cpp b/src/math/math.cpp
index eeb9d3fa..0cfc2ce9 100644
--- a/src/math/math.cpp
+++ b/src/math/math.cpp
@@ -60,6 +60,12 @@ CMatrix::RotateX(float x)
}
void
+CMatrix::RotateY(float y)
+{
+ Rotate(0.0f, y, 0.0f);
+}
+
+void
CMatrix::RotateZ(float z)
{
Rotate(0.0f, 0.0f, z);
@@ -178,6 +184,17 @@ CQuaternion::Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, fl
}
void
+CQuaternion::Set(RwV3d *axis, float angle)
+{
+ float halfCos = Cos(angle*0.5f);
+ float halfSin = Sin(angle*0.5f);
+ x = axis->x*halfSin;
+ y = axis->y*halfSin;
+ z = axis->z*halfSin;
+ w = halfCos;
+}
+
+void
CQuaternion::Get(RwMatrix *matrix)
{
float x2 = x+x;
diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp
index 9a6a74d0..056c3733 100644
--- a/src/modelinfo/ModelIndices.cpp
+++ b/src/modelinfo/ModelIndices.cpp
@@ -3,14 +3,14 @@
#include "General.h"
#include "ModelIndices.h"
-#define X(name, var, addr) int16 var;
+#define X(name, var) int16 var;
MODELINDICES
#undef X
void
InitModelIndices(void)
{
-#define X(name, var, addr) var = -1;
+#define X(name, var) var = -1;
MODELINDICES
#undef X
}
@@ -18,7 +18,7 @@ InitModelIndices(void)
void
MatchModelString(const char *modelname, int16 id)
{
-#define X(name, var, addr) \
+#define X(name, var) \
if(!CGeneral::faststrcmp(name, modelname)){ \
var = id; \
return; \
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index cc6ed25c..c0f01929 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -1,164 +1,164 @@
#pragma once
#define MODELINDICES \
- X("fire_hydrant", MI_FIRE_HYDRANT, 0x5F5A00) \
- X("bagelstnd02", MI_BAGELSTAND2, 0x5F59FC) \
- X("fish01", MI_FISHSTALL01, 0x5F59EC) \
- X("fishstall02", MI_FISHSTALL02, 0x5F59F0) \
- X("fishstall03", MI_FISHSTALL03, 0x5F59F4) \
- X("fishstall04", MI_FISHSTALL04, 0x5F59F8) \
- X("taxisign", MI_TAXISIGN, 0x5F59E8) \
- X("phonesign", MI_PHONESIGN, 0x5F59E4) \
- X("noparkingsign1", MI_NOPARKINGSIGN1, 0x5F59E0) \
- X("bussign1", MI_BUSSIGN1, 0x5F59DC) \
- X("roadworkbarrier1", MI_ROADWORKBARRIER1, 0x5F59D8) \
- X("dump1", MI_DUMP1, 0x5F59D4) \
- X("trafficcone", MI_TRAFFICCONE, 0x5F59D0) \
- X("newsstand1", MI_NEWSSTAND, 0x5F59CC) \
- X("postbox1", MI_POSTBOX1, 0x5F59C8) \
- X("bin1", MI_BIN, 0x5F59C4) \
- X("wastebin", MI_WASTEBIN, 0x5F59C0) \
- X("phonebooth1", MI_PHONEBOOTH1, 0x5F59BC) \
- X("parkingmeter", MI_PARKINGMETER, 0x5F59B8) \
- X("trafficlight1", MI_TRAFFICLIGHTS, 0x5F5958) \
- X("lamppost1", MI_SINGLESTREETLIGHTS1, 0x5F595C) \
- X("lamppost2", MI_SINGLESTREETLIGHTS2, 0x5F5960) \
- X("lamppost3", MI_SINGLESTREETLIGHTS3, 0x5F5964) \
- X("doublestreetlght1", MI_DOUBLESTREETLIGHTS, 0x5F5968) \
- X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART, 0x5F596C) \
- X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND, 0x5F5970) \
- X("veg_tree1", MI_TREE1, 0x5F5974) \
- X("veg_tree3", MI_TREE2, 0x5F5978) \
- X("veg_treea1", MI_TREE3, 0x5F597C) \
- X("veg_treenew01", MI_TREE4, 0x5F5980) \
- X("veg_treenew05", MI_TREE5, 0x5F5984) \
- X("veg_treeb1", MI_TREE6, 0x5F5988) \
- X("veg_treenew10", MI_TREE7, 0x5F598C) \
- X("veg_treea3", MI_TREE8, 0x5F5990) \
- X("veg_treenew09", MI_TREE9, 0x5F5994) \
- X("veg_treenew08", MI_TREE10, 0x5F5998) \
- X("veg_treenew03", MI_TREE11, 0x5F599C) \
- X("veg_treenew16", MI_TREE12, 0x5F59A0) \
- X("veg_treenew17", MI_TREE13, 0x5F59A4) \
- X("veg_treenew06", MI_TREE14, 0x5F59A8) \
- X("doc_crane_cab", MODELID_CRANE_1, 0x5F59AC) \
- X("cranetopb", MODELID_CRANE_2, 0x5F59B0) \
- X("cranetopa", MODELID_CRANE_3, 0x5F59B4) \
- X("package1", MI_COLLECTABLE1, 0x5F5A04) \
- X("Money", MI_MONEY, 0x5F5A08) \
- X("barrel1", MI_CARMINE, 0x5F5A0C) \
- X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10) \
- X("bombdoor", MI_GARAGEDOOR2, 0x5F5A14) \
- X("door_bombshop", MI_GARAGEDOOR3, 0x5F5A18) \
- X("vheistlocdoor", MI_GARAGEDOOR4, 0x5F5A1C) \
- X("door2_garage", MI_GARAGEDOOR5, 0x5F5A20) \
- X("ind_slidedoor", MI_GARAGEDOOR6, 0x5F5A24) \
- X("bankjobdoor", MI_GARAGEDOOR7, 0x5F5A28) \
- X("door_jmsgrage", MI_GARAGEDOOR9, 0x5F5A2C) \
- X("jamesgrge_kb", MI_GARAGEDOOR10, 0x5F5A30) \
- X("door_sfehousegrge", MI_GARAGEDOOR11, 0x5F5A34) \
- X("shedgaragedoor", MI_GARAGEDOOR12, 0x5F5A38) \
- X("door4_garage", MI_GARAGEDOOR13, 0x5F5A3C) \
- X("door_col_compnd_01", MI_GARAGEDOOR14, 0x5F5A40) \
- X("door_col_compnd_02", MI_GARAGEDOOR15, 0x5F5A44) \
- X("door_col_compnd_03", MI_GARAGEDOOR16, 0x5F5A48) \
- X("door_col_compnd_04", MI_GARAGEDOOR17, 0x5F5A4C) \
- X("door_col_compnd_05", MI_GARAGEDOOR18, 0x5F5A50) \
- X("impex_door", MI_GARAGEDOOR19, 0x5F5A54) \
- X("SalvGarage", MI_GARAGEDOOR20, 0x5F5A58) \
- X("door3_garage", MI_GARAGEDOOR21, 0x5F5A5C) \
- X("leveldoor2", MI_GARAGEDOOR22, 0x5F5A60) \
- X("double_garage_dr", MI_GARAGEDOOR23, 0x5F5A64) \
- X("amcogaragedoor", MI_GARAGEDOOR24, 0x5F5A68) \
- X("towergaragedoor1", MI_GARAGEDOOR25, 0x5F5A6C) \
- X("towergaragedoor2", MI_GARAGEDOOR26, 0x5F5A70) \
- X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74) \
- X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78) \
- X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C) \
- X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80) \
- X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84) \
- X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88) \
- X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \
- X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \
- X("crushertop", MI_CRUSHERLID, 0x5F5A94) \
- X("donkeymag", MI_DONKEYMAG, 0x5F5A98) \
- X("bullion", MI_BULLION, 0x5F5A9C) \
- X("floatpackge1", MI_FLOATPACKAGE1, 0x5F5AA0) \
- X("briefcase", MI_BRIEFCASE, 0x5F5AA4) \
- X("chinabanner1", MI_CHINABANNER1, 0x5F5AA8) \
- X("chinabanner2", MI_CHINABANNER2, 0x5F5AAC) \
- X("chinabanner3", MI_CHINABANNER3, 0x5F5AB0) \
- X("chinabanner4", MI_CHINABANNER4, 0x5F5AB4) \
- X("iten_chinatown5", MI_CHINABANNER5, 0x5F5AB8) \
- X("iten_chinatown7", MI_CHINABANNER6, 0x5F5ABC) \
- X("iten_chinatown3", MI_CHINABANNER7, 0x5F5AC0) \
- X("iten_chinatown2", MI_CHINABANNER8, 0x5F5AC4) \
- X("iten_chinatown4", MI_CHINABANNER9, 0x5F5AC8) \
- X("iten_washline01", MI_CHINABANNER10, 0x5F5ACC) \
- X("iten_washline02", MI_CHINABANNER11, 0x5F5AD0) \
- X("iten_washline03", MI_CHINABANNER12, 0x5F5AD4) \
- X("chinalanterns", MI_CHINALANTERN, 0x5F5AD8) \
- X("glassfx1", MI_GLASS1, 0x5F5ADC) \
- X("glassfx2", MI_GLASS2, 0x5F5AE0) \
- X("glassfx3", MI_GLASS3, 0x5F5AE4) \
- X("glassfx4", MI_GLASS4, 0x5F5AE8) \
- X("glassfx55", MI_GLASS5, 0x5F5AEC) \
- X("glassfxsub1", MI_GLASS6, 0x5F5AF0) \
- X("glassfxsub2", MI_GLASS7, 0x5F5AF4) \
- X("glassfx_composh", MI_GLASS8, 0x5F5AF8) \
- X("bridge_liftsec", MI_BRIDGELIFT, 0x5F5AFC) \
- X("bridge_liftweight", MI_BRIDGEWEIGHT, 0x5F5B00) \
- X("subbridge_lift", MI_BRIDGEROADSEGMENT, 0x5F5B04) \
- X("barrel4", MI_EXPLODINGBARREL, 0x5F5B08) \
- X("flagsitaly", MI_ITALYBANNER1, 0x5F5B0C) \
- X("adrenaline", MI_PICKUP_ADRENALINE, 0x5F5B10) \
- X("bodyarmour", MI_PICKUP_BODYARMOUR, 0x5F5B14) \
- X("info", MI_PICKUP_INFO, 0x5F5B18) \
- X("health", MI_PICKUP_HEALTH, 0x5F5B1C) \
- X("bonus", MI_PICKUP_BONUS, 0x5F5B20) \
- X("bribe", MI_PICKUP_BRIBE, 0x5F5B24) \
- X("killfrenzy", MI_PICKUP_KILLFRENZY, 0x5F5B28) \
- X("camerapickup", MI_PICKUP_CAMERA, 0x5F5B2C) \
- X("bollardlight", MI_BOLLARDLIGHT, 0x5F5B30) \
- X("magnet", MI_MAGNET, 0x5F5B34) \
- X("streetlamp1", MI_STREETLAMP1, 0x5F5B38) \
- X("streetlamp2", MI_STREETLAMP2, 0x5F5B3C) \
- X("railtrax_lo4b", MI_RAILTRACKS, 0x5F5B40) \
- X("bar_barrier10", MI_FENCE, 0x5F5B44) \
- X("bar_barrier12", MI_FENCE2, 0x5F5B48) \
- X("petrolpump", MI_PETROLPUMP, 0x5F5B4C) \
- X("bodycast", MI_BODYCAST, 0x5F5B50) \
- X("backdoor", MI_BACKDOOR, 0x5F5B54) \
- X("coffee", MI_COFFEE, 0x5F5B58) \
- X("bouy", MI_BUOY, 0x5F5B5C) \
- X("parktable1", MI_PARKTABLE, 0x5F5B60) \
- X("sbwy_tunl_start", MI_SUBWAY1, 0x5F5B64) \
- X("sbwy_tunl_bit", MI_SUBWAY2, 0x5F5B68) \
- X("sbwy_tunl_bend", MI_SUBWAY3, 0x5F5B6C) \
- X("sbwy_tunl_cstm6", MI_SUBWAY4, 0x5F5B70) \
- X("sbwy_tunl_cstm7", MI_SUBWAY5, 0x5F5B74) \
- X("sbwy_tunl_cstm8", MI_SUBWAY6, 0x5F5B78) \
- X("sbwy_tunl_cstm10", MI_SUBWAY7, 0x5F5B7C) \
- X("sbwy_tunl_cstm9", MI_SUBWAY8, 0x5F5B80) \
- X("sbwy_tunl_cstm11", MI_SUBWAY9, 0x5F5B84) \
- X("sbwy_tunl_cstm1", MI_SUBWAY10, 0x5F5B88) \
- X("sbwy_tunl_cstm2", MI_SUBWAY11, 0x5F5B8C) \
- X("sbwy_tunl_cstm4", MI_SUBWAY12, 0x5F5B90) \
- X("sbwy_tunl_cstm3", MI_SUBWAY13, 0x5F5B94) \
- X("sbwy_tunl_cstm5", MI_SUBWAY14, 0x5F5B98) \
- X("subplatform_n2", MI_SUBWAY15, 0x5F5B9C) \
- X("suby_tunl_start", MI_SUBWAY16, 0x5F5BA0) \
- X("sbwy_tunl_start2", MI_SUBWAY17, 0x5F5BA4) \
- X("indy_tunl_start", MI_SUBWAY18, 0x5F5BA8) \
- X("indsubway03", MI_SUBPLATFORM_IND, 0x5F5BAC) \
- X("comerside_subway", MI_SUBPLATFORM_COMS, 0x5F5BB0) \
- X("subplatform", MI_SUBPLATFORM_COMS2, 0x5F5BB4) \
- X("subplatform_n", MI_SUBPLATFORM_COMN, 0x5F5BB8) \
- X("Otherside_subway", MI_SUBPLATFORM_SUB, 0x5F5BBC) \
- X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \
- X("files", MI_FILES, 0x5F5BC4)
+ X("fire_hydrant", MI_FIRE_HYDRANT) \
+ X("bagelstnd02", MI_BAGELSTAND2) \
+ X("fish01", MI_FISHSTALL01) \
+ X("fishstall02", MI_FISHSTALL02) \
+ X("fishstall03", MI_FISHSTALL03) \
+ X("fishstall04", MI_FISHSTALL04) \
+ X("taxisign", MI_TAXISIGN) \
+ X("phonesign", MI_PHONESIGN) \
+ X("noparkingsign1", MI_NOPARKINGSIGN1) \
+ X("bussign1", MI_BUSSIGN1) \
+ X("roadworkbarrier1", MI_ROADWORKBARRIER1) \
+ X("dump1", MI_DUMP1) \
+ X("trafficcone", MI_TRAFFICCONE) \
+ X("newsstand1", MI_NEWSSTAND) \
+ X("postbox1", MI_POSTBOX1) \
+ X("bin1", MI_BIN) \
+ X("wastebin", MI_WASTEBIN) \
+ X("phonebooth1", MI_PHONEBOOTH1) \
+ X("parkingmeter", MI_PARKINGMETER) \
+ X("trafficlight1", MI_TRAFFICLIGHTS) \
+ X("lamppost1", MI_SINGLESTREETLIGHTS1) \
+ X("lamppost2", MI_SINGLESTREETLIGHTS2) \
+ X("lamppost3", MI_SINGLESTREETLIGHTS3) \
+ X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \
+ X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART) \
+ X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND) \
+ X("veg_tree1", MI_TREE1) \
+ X("veg_tree3", MI_TREE2) \
+ X("veg_treea1", MI_TREE3) \
+ X("veg_treenew01", MI_TREE4) \
+ X("veg_treenew05", MI_TREE5) \
+ X("veg_treeb1", MI_TREE6) \
+ X("veg_treenew10", MI_TREE7) \
+ X("veg_treea3", MI_TREE8) \
+ X("veg_treenew09", MI_TREE9) \
+ X("veg_treenew08", MI_TREE10) \
+ X("veg_treenew03", MI_TREE11) \
+ X("veg_treenew16", MI_TREE12) \
+ X("veg_treenew17", MI_TREE13) \
+ X("veg_treenew06", MI_TREE14) \
+ X("doc_crane_cab", MODELID_CRANE_1) \
+ X("cranetopb", MODELID_CRANE_2) \
+ X("cranetopa", MODELID_CRANE_3) \
+ X("package1", MI_COLLECTABLE1) \
+ X("Money", MI_MONEY) \
+ X("barrel1", MI_CARMINE) \
+ X("oddjgaragdoor", MI_GARAGEDOOR1) \
+ X("bombdoor", MI_GARAGEDOOR2) \
+ X("door_bombshop", MI_GARAGEDOOR3) \
+ X("vheistlocdoor", MI_GARAGEDOOR4) \
+ X("door2_garage", MI_GARAGEDOOR5) \
+ X("ind_slidedoor", MI_GARAGEDOOR6) \
+ X("bankjobdoor", MI_GARAGEDOOR7) \
+ X("door_jmsgrage", MI_GARAGEDOOR9) \
+ X("jamesgrge_kb", MI_GARAGEDOOR10) \
+ X("door_sfehousegrge", MI_GARAGEDOOR11) \
+ X("shedgaragedoor", MI_GARAGEDOOR12) \
+ X("door4_garage", MI_GARAGEDOOR13) \
+ X("door_col_compnd_01", MI_GARAGEDOOR14) \
+ X("door_col_compnd_02", MI_GARAGEDOOR15) \
+ X("door_col_compnd_03", MI_GARAGEDOOR16) \
+ X("door_col_compnd_04", MI_GARAGEDOOR17) \
+ X("door_col_compnd_05", MI_GARAGEDOOR18) \
+ X("impex_door", MI_GARAGEDOOR19) \
+ X("SalvGarage", MI_GARAGEDOOR20) \
+ X("door3_garage", MI_GARAGEDOOR21) \
+ X("leveldoor2", MI_GARAGEDOOR22) \
+ X("double_garage_dr", MI_GARAGEDOOR23) \
+ X("amcogaragedoor", MI_GARAGEDOOR24) \
+ X("towergaragedoor1", MI_GARAGEDOOR25) \
+ X("towergaragedoor2", MI_GARAGEDOOR26) \
+ X("towergaragedoor3", MI_GARAGEDOOR27) \
+ X("plysve_gragedoor", MI_GARAGEDOOR28) \
+ X("impexpsubgrgdoor", MI_GARAGEDOOR29) \
+ X("Sub_sprayshopdoor", MI_GARAGEDOOR30) \
+ X("ind_plyrwoor", MI_GARAGEDOOR31) \
+ X("8ballsuburbandoor", MI_GARAGEDOOR32) \
+ X("barrel2", MI_NAUTICALMINE) \
+ X("crushercrush", MI_CRUSHERBODY) \
+ X("crushertop", MI_CRUSHERLID) \
+ X("donkeymag", MI_DONKEYMAG) \
+ X("bullion", MI_BULLION) \
+ X("floatpackge1", MI_FLOATPACKAGE1) \
+ X("briefcase", MI_BRIEFCASE) \
+ X("chinabanner1", MI_CHINABANNER1) \
+ X("chinabanner2", MI_CHINABANNER2) \
+ X("chinabanner3", MI_CHINABANNER3) \
+ X("chinabanner4", MI_CHINABANNER4) \
+ X("iten_chinatown5", MI_CHINABANNER5) \
+ X("iten_chinatown7", MI_CHINABANNER6) \
+ X("iten_chinatown3", MI_CHINABANNER7) \
+ X("iten_chinatown2", MI_CHINABANNER8) \
+ X("iten_chinatown4", MI_CHINABANNER9) \
+ X("iten_washline01", MI_CHINABANNER10) \
+ X("iten_washline02", MI_CHINABANNER11) \
+ X("iten_washline03", MI_CHINABANNER12) \
+ X("chinalanterns", MI_CHINALANTERN) \
+ X("glassfx1", MI_GLASS1) \
+ X("glassfx2", MI_GLASS2) \
+ X("glassfx3", MI_GLASS3) \
+ X("glassfx4", MI_GLASS4) \
+ X("glassfx55", MI_GLASS5) \
+ X("glassfxsub1", MI_GLASS6) \
+ X("glassfxsub2", MI_GLASS7) \
+ X("glassfx_composh", MI_GLASS8) \
+ X("bridge_liftsec", MI_BRIDGELIFT) \
+ X("bridge_liftweight", MI_BRIDGEWEIGHT) \
+ X("subbridge_lift", MI_BRIDGEROADSEGMENT) \
+ X("barrel4", MI_EXPLODINGBARREL) \
+ X("flagsitaly", MI_ITALYBANNER1) \
+ X("adrenaline", MI_PICKUP_ADRENALINE) \
+ X("bodyarmour", MI_PICKUP_BODYARMOUR) \
+ X("info", MI_PICKUP_INFO) \
+ X("health", MI_PICKUP_HEALTH) \
+ X("bonus", MI_PICKUP_BONUS) \
+ X("bribe", MI_PICKUP_BRIBE) \
+ X("killfrenzy", MI_PICKUP_KILLFRENZY) \
+ X("camerapickup", MI_PICKUP_CAMERA) \
+ X("bollardlight", MI_BOLLARDLIGHT) \
+ X("magnet", MI_MAGNET) \
+ X("streetlamp1", MI_STREETLAMP1) \
+ X("streetlamp2", MI_STREETLAMP2) \
+ X("railtrax_lo4b", MI_RAILTRACKS) \
+ X("bar_barrier10", MI_FENCE) \
+ X("bar_barrier12", MI_FENCE2) \
+ X("petrolpump", MI_PETROLPUMP) \
+ X("bodycast", MI_BODYCAST) \
+ X("backdoor", MI_BACKDOOR) \
+ X("coffee", MI_COFFEE) \
+ X("bouy", MI_BUOY) \
+ X("parktable1", MI_PARKTABLE) \
+ X("sbwy_tunl_start", MI_SUBWAY1) \
+ X("sbwy_tunl_bit", MI_SUBWAY2) \
+ X("sbwy_tunl_bend", MI_SUBWAY3) \
+ X("sbwy_tunl_cstm6", MI_SUBWAY4) \
+ X("sbwy_tunl_cstm7", MI_SUBWAY5) \
+ X("sbwy_tunl_cstm8", MI_SUBWAY6) \
+ X("sbwy_tunl_cstm10", MI_SUBWAY7) \
+ X("sbwy_tunl_cstm9", MI_SUBWAY8) \
+ X("sbwy_tunl_cstm11", MI_SUBWAY9) \
+ X("sbwy_tunl_cstm1", MI_SUBWAY10) \
+ X("sbwy_tunl_cstm2", MI_SUBWAY11) \
+ X("sbwy_tunl_cstm4", MI_SUBWAY12) \
+ X("sbwy_tunl_cstm3", MI_SUBWAY13) \
+ X("sbwy_tunl_cstm5", MI_SUBWAY14) \
+ X("subplatform_n2", MI_SUBWAY15) \
+ X("suby_tunl_start", MI_SUBWAY16) \
+ X("sbwy_tunl_start2", MI_SUBWAY17) \
+ X("indy_tunl_start", MI_SUBWAY18) \
+ X("indsubway03", MI_SUBPLATFORM_IND) \
+ X("comerside_subway", MI_SUBPLATFORM_COMS) \
+ X("subplatform", MI_SUBPLATFORM_COMS2) \
+ X("subplatform_n", MI_SUBPLATFORM_COMN) \
+ X("Otherside_subway", MI_SUBPLATFORM_SUB) \
+ X("subplatform_sub", MI_SUBPLATFORM_SUB2) \
+ X("files", MI_FILES)
-#define X(name, var, addr) extern int16 var;
+#define X(name, var) extern int16 var;
MODELINDICES
#undef X
@@ -255,7 +255,9 @@ enum
MI_BUSKER4,
// three more peds possible
- MI_FIRST_VEHICLE = 90,
+ MI_LAST_PED = 89,
+ MI_FIRST_VEHICLE,
+
MI_LANDSTAL = MI_FIRST_VEHICLE,
MI_IDAHO,
MI_STINGER,
@@ -382,7 +384,7 @@ IsGlass(int16 id)
}
inline bool
-IsTrafficLight(int16 id)
+IsStreetLight(int16 id)
{
return id == MI_TRAFFICLIGHTS ||
id == MI_SINGLESTREETLIGHTS1 ||
@@ -410,7 +412,7 @@ IsBoatModel(int16 id)
inline bool
IsPedModel(int16 id)
{
- return id >= 0 && id <= 89;
+ return id >= MI_PLAYER && id <= MI_LAST_PED;
}
inline bool
diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp
index 0cb0fc36..1d8aa4dc 100644
--- a/src/modelinfo/PedModelInfo.cpp
+++ b/src/modelinfo/PedModelInfo.cpp
@@ -21,16 +21,19 @@ CPedModelInfo::DeleteRwObject(void)
frame = RpAtomicGetFrame(m_head);
RpAtomicDestroy(m_head);
RwFrameDestroy(frame);
+ m_head = nil;
}
if(m_lhand){
frame = RpAtomicGetFrame(m_lhand);
RpAtomicDestroy(m_lhand);
RwFrameDestroy(frame);
+ m_lhand = nil;
}
if(m_rhand){
frame = RpAtomicGetFrame(m_rhand);
RpAtomicDestroy(m_rhand);
RwFrameDestroy(frame);
+ m_rhand = nil;
}
#endif
CClumpModelInfo::DeleteRwObject(); // PC calls this first
@@ -248,7 +251,7 @@ CPedModelInfo::CreateHitColModel(void)
center.x = mat->pos.x + m_pColNodeInfos[i].x;
center.y = mat->pos.y + 0.0f;
center.z = mat->pos.z + m_pColNodeInfos[i].z;
- spheres[i].Set(radius, center, SURFACE_FLESH, m_pColNodeInfos[i].pieceType);
+ spheres[i].Set(radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType);
}
}
RwMatrixDestroy(mat);
@@ -332,7 +335,7 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump)
center.x = pos.x + m_pColNodeInfos[i].x;
center.y = pos.y + 0.0f;
center.z = pos.z + m_pColNodeInfos[i].z;
- spheres[i].Set(m_pColNodeInfos[i].radius, center, SURFACE_FLESH, m_pColNodeInfos[i].pieceType);
+ spheres[i].Set(m_pColNodeInfos[i].radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType);
}
RwMatrixDestroy(invmat);
RwMatrixDestroy(mat);
diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h
index 52f75894..d73d3646 100644
--- a/src/modelinfo/PedModelInfo.h
+++ b/src/modelinfo/PedModelInfo.h
@@ -36,7 +36,14 @@ public:
static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX];
- CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { m_hitColModel = nil; }
+ CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) {
+ m_hitColModel = nil;
+#ifdef PED_SKIN
+ m_head = nil;
+ m_lhand = nil;
+ m_rhand = nil;
+#endif
+ }
~CPedModelInfo(void) { delete m_hitColModel; }
void DeleteRwObject(void);
void SetClump(RpClump *);
diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp
index a781cf58..32204500 100644
--- a/src/modelinfo/SimpleModelInfo.cpp
+++ b/src/modelinfo/SimpleModelInfo.cpp
@@ -157,6 +157,13 @@ CSimpleModelInfo::SetupBigBuilding(void)
if(related)
m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier;
else
+#ifdef FIX_BUGS
+ if(toupper(m_name[0]) == 'L' && toupper(m_name[1]) == 'O' && toupper(m_name[2]) == 'D')
m_lodDistances[2] = 100.0f;
+ else
+ m_lodDistances[2] = 0.0f;
+#else
+ m_lodDistances[2] = 100.0f;
+#endif
}
}
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index 74285c19..d8b388d5 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -16,6 +16,7 @@
#include "Train.h"
#include "Plane.h"
#include "Heli.h"
+#include "Bike.h"
#include "ModelIndices.h"
#include "ModelInfo.h"
@@ -120,16 +121,16 @@ RwObjectNameIdAssocation planeIds[] = {
};
RwObjectNameIdAssocation bikeIds[] = {
- { "chassis_dummy", 1, 0 },
- { "forks_front", 2, 0 },
- { "forks_rear", 3, 0 },
- { "wheel_front", 4, 0 },
- { "wheel_rear", 5, 0 },
- { "mudguard", 6, 0 },
- { "ped_frontseat", 2, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
- { "headlights", 0, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
- { "taillights", 1, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
- { "exhaust", 9, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "chassis_dummy", BIKE_CHASSIS, 0 },
+ { "forks_front", BIKE_FORKS_FRONT, 0 },
+ { "forks_rear", BIKE_FORKS_REAR, 0 },
+ { "wheel_front", BIKE_WHEEL_FRONT, 0 },
+ { "wheel_rear", BIKE_WHEEL_REAR, 0 },
+ { "mudguard", BIKE_MUDGUARD, 0 },
+ { "ped_frontseat", CAR_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "headlights", CAR_POS_HEADLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "taillights", CAR_POS_TAILLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
+ { "exhaust", CAR_POS_EXHAUST, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "extra1", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },
{ "extra2", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },
{ "extra3", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },
diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h
index ba25d3cd..468ce96d 100644
--- a/src/modelinfo/VehicleModelInfo.h
+++ b/src/modelinfo/VehicleModelInfo.h
@@ -35,6 +35,43 @@ enum eVehicleType {
NUM_VEHICLE_TYPES
};
+enum eCarPositions
+{
+ CAR_POS_HEADLIGHTS,
+ CAR_POS_TAILLIGHTS,
+ CAR_POS_FRONTSEAT,
+ CAR_POS_BACKSEAT,
+ // these are unused so we don't know the actual values
+ CAR_POS_REVERSELIGHTS,
+ CAR_POS_BRAKELIGHTS,
+ CAR_POS_INDICATORS_FRONT,
+ CAR_POS_INDICATORS_BACK,
+ CAR_POS_STEERWHEEL,
+ //
+ CAR_POS_EXHAUST
+};
+
+enum eBoatPositions
+{
+ BOAT_POS_FRONTSEAT
+};
+
+enum eTrainPositions
+{
+ TRAIN_POS_LIGHT_FRONT,
+ TRAIN_POS_LIGHT_REAR,
+ TRAIN_POS_LEFT_ENTRY,
+ TRAIN_POS_MID_ENTRY,
+ TRAIN_POS_RIGHT_ENTRY
+};
+
+enum ePlanePositions
+{
+ PLANE_POS_LIGHT_LEFT,
+ PLANE_POS_LIGHT_RIGHT,
+ PLANE_POS_LIGHT_TAIL,
+};
+
enum {
NUM_VEHICLE_POSITIONS = 10
};
@@ -100,6 +137,7 @@ public:
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
void PreprocessHierarchy(void);
void GetWheelPosn(int32 n, CVector &pos);
+ CVector &GetFrontSeatPosn(void) { return m_positions[m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT]; };
int32 ChooseComponent(void);
int32 ChooseSecondComponent(void);
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index cd2cd688..c5f73987 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -11,6 +11,7 @@
#include "ObjectData.h"
#include "World.h"
#include "Floater.h"
+#include "soundlist.h"
int16 CObject::nNoTempObjects;
int16 CObject::nBodyCastHealth = 1000;
@@ -219,7 +220,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
}
- PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos);
+ PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos);
break;
}
case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
@@ -242,7 +243,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
}
- PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos);
+ PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_1, vecPos);
break;
}
case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
@@ -267,7 +268,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
}
- PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos);
+ PlayOneShotScriptObject(SCRIPT_SOUND_TIRE_COLLISION, vecPos);
break;
}
case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
@@ -292,7 +293,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
}
- PlayOneShotScriptObject(_SCRSOUND_COL_CAR, vecPos);
+ PlayOneShotScriptObject(SCRIPT_SOUND_METAL_COLLISION, vecPos);
break;
}
}
diff --git a/src/objects/Object.h b/src/objects/Object.h
index 79589dc9..c9a1bba8 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -55,14 +55,7 @@ public:
uint8 m_nCollisionDamageEffect;
uint8 m_nSpecialCollisionResponseCases;
bool m_bCameraToAvoidThisObject;
-
- // this batch is unused
- int8 field_17B;
- int8 field_17C;
- int8 field_17D;
- int8 field_17E;
- int8 field_17F;
-
+ uint32 m_obj_unused1;
uint32 m_nEndOfLifeTime;
int16 m_nRefModelIndex;
CEntity *m_pCurSurface;
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index fd8fd540..cf254cf4 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -57,56 +57,15 @@
#include "Timecycle.h"
#include "ParticleObject.h"
#include "Floater.h"
+#include "Range2D.h"
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
CPed *gapTempPedList[50];
uint16 gnNumTempPedList;
-CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
-
-// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
-PedAudioData CommentWaitTime[39] = {
- {500, 800, 500, 2},
- {500, 800, 500, 2},
- {500, 800, 500, 2},
- {500, 800, 500, 2},
- {100, 2, 100, 2},
- {700, 500, 1000, 500},
- {700, 500, 1000, 500},
- {5000, 2000, 15000, 3000},
- {5000, 2000, 15000, 3000},
- {5000, 2000, 15000, 3000},
- {6000, 6000, 6000, 6000},
- {1000, 1000, 2000, 2000},
- {1000, 500, 2000, 1500},
- {1000, 500, 2000, 1500},
- {800, 200, 1000, 500},
- {800, 200, 1000, 500},
- {800, 400, 2000, 1000},
- {800, 400, 2000, 1000},
- {400, 300, 2000, 1000},
- {2000, 1000, 2500, 1500},
- {200, 200, 200, 200},
- {6000, 3000, 5000, 6000},
- {6000, 3000, 9000, 5000},
- {6000, 3000, 9000, 5000},
- {6000, 3000, 9000, 5000},
- {400, 300, 4000, 1000},
- {400, 300, 4000, 1000},
- {400, 300, 4000, 1000},
- {1000, 500, 3000, 1000},
- {1000, 500, 1000, 1000},
- {3000, 2000, 3000, 2000},
- {1000, 500, 3000, 6000},
- {1000, 500, 2000, 4000},
- {1000, 500, 2000, 5000},
- {1000, 500, 3000, 2000},
- {1600, 1000, 2000, 2000},
- {3000, 2000, 5000, 3000},
- {1000, 1000, 1000, 1000},
- {1000, 1000, 5000, 5000},
-};
+static CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
+
uint16 nPlayerInComboMove;
RpClump *flyingClumpTemp;
@@ -159,228 +118,11 @@ void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->N
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); }
-static char ObjectiveText[][28] = {
- "No Obj",
- "Wait on Foot",
- "Flee on Foot Till Safe",
- "Guard Spot",
- "Guard Area",
- "Wait in Car",
- "Wait in Car then Getout",
- "Kill Char on Foot",
- "Kill Char Any Means",
- "Flee Char on Foot Till Safe",
- "Flee Char on Foot Always",
- "GoTo Char on Foot",
- "Follow Char in Formation",
- "Leave Car",
- "Enter Car as Passenger",
- "Enter Car as Driver",
- "Follow Car in Car",
- "Fire at Obj from Vehicle",
- "Destroy Obj",
- "Destroy Car",
- "GoTo Area Any Means",
- "GoTo Area on Foot",
- "Run to Area",
- "GoTo Area in Car",
- "Follow Car on Foot Woffset",
- "Guard Attack",
- "Set Leader",
- "Follow Route",
- "Solicit",
- "Take Taxi",
- "Catch Train",
- "Buy IceCream",
- "Steal Any Car",
- "Mug Char",
-#ifdef VC_PED_PORTS
- "Leave Car and Die"
-#endif
-};
-
-static char StateText[][18] = {
- "None",
- "Idle",
- "Look Entity",
- "Look Heading",
- "Wander Range",
- "Wander Path",
- "Seek Pos",
- "Seek Entity",
- "Flee Pos",
- "Flee Entity",
- "Pursue",
- "Follow Path",
- "Sniper Mode",
- "Rocket Mode",
- "Dummy",
- "Pause",
- "Attack",
- "Fight",
- "Face Phone",
- "Make Call",
- "Chat",
- "Mug",
- "AimGun",
- "AI Control",
- "Seek Car",
- "Seek InBoat",
- "Follow Route",
- "C.P.R.",
- "Solicit",
- "Buy IceCream",
- "Investigate",
- "Step away",
- "On Fire",
- "Unknown",
- "STATES_NO_AI",
- "Jump",
- "Fall",
- "GetUp",
- "Stagger",
- "Dive away",
- "STATES_NO_ST",
- "Enter Train",
- "Exit Train",
- "Arrest Plyr",
- "Driving",
- "Passenger",
- "Taxi Passngr",
- "Open Door",
- "Die",
- "Dead",
- "CarJack",
- "Drag fm Car",
- "Enter Car",
- "Steal Car",
- "Exit Car",
- "Hands Up",
- "Arrested",
-};
-
-static char PersonalityTypeText[][18] = {
- "Player",
- "Cop",
- "Medic",
- "Fireman",
- "Gang 1",
- "Gang 2",
- "Gang 3",
- "Gang 4",
- "Gang 5",
- "Gang 6",
- "Gang 7",
- "Street Guy",
- "Suit Guy",
- "Sensible Guy",
- "Geek Guy",
- "Old Guy",
- "Tough Guy",
- "Street Girl",
- "Suit Girl",
- "Sensible Girl",
- "Geek Girl",
- "Old Girl",
- "Tough Girl",
- "Tramp Male",
- "Tramp Female",
- "Tourist",
- "Prostitute",
- "Criminal",
- "Busker",
- "Taxi Driver",
- "Psycho",
- "Steward",
- "Sports Fan",
- "Shopper",
- "Old Shopper"
-};
-
-static char WaitStateText[][16] = {
- "No Wait",
- "Traffic Lights",
- "Pause CrossRoad",
- "Look CrossRoad",
- "Look Ped",
- "Look Shop",
- "Look Accident",
- "FaceOff Gang",
- "Double Back",
- "Hit Wall",
- "Turn 180deg",
- "Surprised",
- "Ped Stuck",
- "Look About",
- "Play Duck",
- "Play Cower",
- "Play Taxi",
- "Play HandsUp",
- "Play HandsCower",
- "Play Chat",
- "Finish Flee",
-};
-
#ifdef TOGGLEABLE_BETA_FEATURES
bool CPed::bPopHeadsOnHeadshot = false;
bool CPed::bMakePedsRunToPhonesToReportCrimes = false;
#endif
-#ifndef MASTER
-int nDisplayDebugInfo = 0;
-
-void
-CPed::SwitchDebugDisplay(void)
-{
- nDisplayDebugInfo = !nDisplayDebugInfo;
-}
-
-void
-CPed::DebugRenderOnePedText(void)
-{
- if ((GetPosition() - TheCamera.GetPosition()).MagnitudeSqr() < sq(30.0f)) {
- float width, height;
- RwV3d screenCoords;
- CVector bitAbove = GetPosition();
- bitAbove.z += 2.0f;
- if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) {
-
- float lineHeight = SCREEN_SCALE_Y(Min(height/100.0f, 0.7f) * 22.0f);
-
- DefinedState();
- CFont::SetPropOn();
- CFont::SetBackgroundOn();
-
- // Originally both of them were being divided by 60.0f.
- float xScale = Min(width / 240.0f, 0.7f);
- float yScale = Min(height / 80.0f, 0.7f);
-
- CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale));
- CFont::SetCentreOn();
- CFont::SetCentreSize(SCREEN_WIDTH);
- CFont::SetJustifyOff();
- CFont::SetColor(CRGBA(255, 255, 0, 255));
- CFont::SetBackGroundOnlyTextOn();
- CFont::SetFontStyle(0);
- AsciiToUnicode(StateText[m_nPedState], gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y, gUString);
- AsciiToUnicode(ObjectiveText[m_objective], gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y + lineHeight, gUString);
- AsciiToUnicode(PersonalityTypeText[m_pedStats->m_type], gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y + 2 * lineHeight, gUString);
- AsciiToUnicode(WaitStateText[m_nWaitState], gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y + 3 * lineHeight, gUString);
- if (m_nPedState == PED_SEEK_POS || m_nPedState == PED_SEEK_ENTITY) {
- sprintf(gString, "Safe distance to target: %.2f", m_distanceToCountSeekDone);
- AsciiToUnicode(gString, gUString);
- CFont::PrintString(screenCoords.x, screenCoords.y + 4 * lineHeight, gUString);
- }
- DefinedState();
- }
- }
-}
-#endif
-
CPed::~CPed(void)
{
CWorld::Remove(this);
@@ -441,10 +183,13 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedType = pedType;
m_lastSoundStart = 0;
m_soundStart = 0;
- m_lastQueuedSound = SOUND_TOTAL_PED_SOUNDS;
- m_queuedSound = SOUND_TOTAL_PED_SOUNDS;
+ m_lastQueuedSound = SOUND_NO_SOUND;
+ m_queuedSound = SOUND_NO_SOUND;
m_objective = OBJECTIVE_NONE;
m_prevObjective = OBJECTIVE_NONE;
+#ifdef FIX_BUGS
+ m_objectiveTimer = 0;
+#endif
CharCreatedBy = RANDOM_CHAR;
m_leader = nil;
m_pedInObjective = nil;
@@ -498,6 +243,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedState = PED_IDLE;
m_nLastPedState = PED_NONE;
m_nMoveState = PEDMOVE_STILL;
+#ifdef FIX_BUGS
+ m_nPrevMoveState = PEDMOVE_NONE;
+#endif
m_nStoredMoveState = PEDMOVE_NONE;
m_pFire = nil;
m_pPointGunAt = nil;
@@ -1087,6 +835,9 @@ CPed::ClearAimFlag(void)
bIsAimingGun = false;
bIsRestoringGun = true;
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
+#ifdef VC_PED_PORTS
+ m_lookTimer = 0;
+#endif
}
if (IsPlayer())
@@ -1682,11 +1433,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
switch (component) {
case CAR_DOOR_RF:
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
-
+ vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos.x += seatOffset;
vehDoorOffset.x = -vehDoorOffset.x;
break;
@@ -1698,11 +1445,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
break;
case CAR_DOOR_LF:
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
-
+ vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
break;
@@ -1712,11 +1455,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
break;
default:
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
-
+ vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorOffset = CVector(0.0f, 0.0f, 0.0f);
}
return vehDoorPos - vehDoorOffset;
@@ -2037,7 +1776,7 @@ particleProduceFootDust(CPed *ped, CVector const &pos, float size, int times)
switch (ped->m_nSurfaceTouched)
{
case SURFACE_TARMAC:
- case SURFACE_DIRT:
+ case SURFACE_GRAVEL:
case SURFACE_PAVEMENT:
case SURFACE_SAND:
for (int i = 0; i < times; ++i) {
@@ -2190,7 +1929,7 @@ CPed::PlayFootSteps(void)
}
}
- if (m_nSurfaceTouched == SURFACE_PUDDLE) {
+ if (m_nSurfaceTouched == SURFACE_WATER) {
float pedSpeed = CVector2D(m_vecMoveSpeed).Magnitude();
if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) {
#ifdef PC_PARTICLE
@@ -2380,7 +2119,7 @@ CPed::SetupLighting(void)
#ifndef MASTER
// Originally this was being called through iteration of Sectors, but putting it here is better.
- if (nDisplayDebugInfo && !IsPlayer())
+ if (GetDebugDisplay() != 0 && !IsPlayer())
DebugRenderOnePedText();
#endif
@@ -2514,37 +2253,37 @@ CPed::CalculateNewVelocity(void)
if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc) {
#endif
LimbOrientation newUpperLegs;
- newUpperLegs.phi = localWalkAngle;
+ newUpperLegs.yaw = localWalkAngle;
- if (newUpperLegs.phi < -DEGTORAD(100.0f)) {
- newUpperLegs.phi += PI;
- } else if (newUpperLegs.phi > DEGTORAD(100.0f)) {
- newUpperLegs.phi -= PI;
+ if (newUpperLegs.yaw < -DEGTORAD(100.0f)) {
+ newUpperLegs.yaw += PI;
+ } else if (newUpperLegs.yaw > DEGTORAD(100.0f)) {
+ newUpperLegs.yaw -= PI;
}
- if (newUpperLegs.phi > -DEGTORAD(50.0f) && newUpperLegs.phi < DEGTORAD(50.0f)) {
+ if (newUpperLegs.yaw > -DEGTORAD(50.0f) && newUpperLegs.yaw < DEGTORAD(50.0f)) {
#ifdef PED_SKIN
if(IsClumpSkinned(GetClump())){
/*
// this looks shit
- newUpperLegs.theta = 0.0f;
+ newUpperLegs.pitch = 0.0f;
RwV3d axis = { -1.0f, 0.0f, 0.0f };
- RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.phi), rwCOMBINEPRECONCAT);
- RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.phi), rwCOMBINEPRECONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPRECONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPRECONCAT);
*/
- newUpperLegs.theta = 0.1f;
+ newUpperLegs.pitch = 0.1f;
RwV3d Xaxis = { 1.0f, 0.0f, 0.0f };
RwV3d Zaxis = { 0.0f, 0.0f, 1.0f };
- RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT);
- RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT);
- RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT);
- RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT);
bDontAcceptIKLookAts = true;
}else
#endif
{
- newUpperLegs.theta = 0.0f;
+ newUpperLegs.pitch = 0.0f;
m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGL], &newUpperLegs, false);
m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGR], &newUpperLegs, false);
}
@@ -2588,7 +2327,7 @@ CPed::CanPedDriveOff(void)
bool
CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil)
{
- if (m_nSurfaceTouched == SURFACE_PUDDLE)
+ if (m_nSurfaceTouched == SURFACE_WATER)
return true;
CVector pos = GetPosition();
@@ -3648,9 +3387,14 @@ CPed::SetStoredState(void)
if (m_nMoveState == PEDMOVE_NONE || m_nMoveState == PEDMOVE_STILL)
m_nMoveState = PEDMOVE_WALK;
}
- m_nLastPedState = m_nPedState;
- if (m_nMoveState >= m_nPrevMoveState)
- m_nPrevMoveState = m_nMoveState;
+#ifdef VC_PED_PORTS
+ if (m_nPedState != PED_IDLE)
+#endif
+ {
+ m_nLastPedState = m_nPedState;
+ if (m_nMoveState >= m_nPrevMoveState)
+ m_nPrevMoveState = m_nMoveState;
+ }
}
void
@@ -5419,7 +5163,10 @@ CPed::SetWaitState(eWaitState state, void *time)
case WAITSTATE_DOUBLEBACK:
m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 3500;
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
+#ifdef FIX_BUGS
+ animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
+#endif
break;
case WAITSTATE_HITWALL:
m_headingRate = 2.0f;
@@ -5453,7 +5200,10 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000;
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
+#ifdef FIX_BUGS
+ animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
+#endif
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective();
@@ -5466,7 +5216,11 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000;
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
+#ifdef FIX_BUGS
+ animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
+#endif
+
break;
case WAITSTATE_PLAYANIM_COWER:
waitAnim = ANIM_HANDSCOWER;
@@ -5508,7 +5262,10 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 2500;
- CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
+#ifdef FIX_BUGS
+ animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
+#endif
break;
default:
m_nWaitState = WAITSTATE_FALSE;
@@ -5537,7 +5294,7 @@ CPed::PlayHitSound(CPed *hitTo)
S42 = SOUND_FIGHT_PUNCH_FROM_BEHIND_42,
S43 = SOUND_FIGHT_KNEE_OR_KICK_43,
S44 = SOUND_FIGHT_KICK_44,
- NO_SND = SOUND_TOTAL_PED_SOUNDS
+ NO_SND = SOUND_NO_SOUND
};
uint16 hitSoundsByFightMoves[12][10] = {
{S39,S42,S43,S43,S39,S39,S39,S39,S39,S42},
@@ -5577,78 +5334,6 @@ CPed::PlayHitSound(CPed *hitTo)
}
void
-CPed::Say(uint16 audio)
-{
- uint16 audioToPlay = audio;
-
- if (IsPlayer()) {
-
- // Ofc this part isn't in VC.
- switch (audio) {
- case SOUND_PED_DEATH:
- audioToPlay = SOUND_PED_DAMAGE;
- break;
- case SOUND_PED_DAMAGE:
- case SOUND_PED_HIT:
- case SOUND_PED_LAND:
- break;
- case SOUND_PED_BULLET_HIT:
- case SOUND_PED_CAR_JACKED:
- case SOUND_PED_DEFEND:
- audioToPlay = SOUND_PED_HIT;
- break;
- default:
- return;
- }
- } else {
- if (3.0f + TheCamera.GetPosition().z < GetPosition().z)
- return;
-
- if (TheCamera.m_CameraAverageSpeed > 1.65f) {
-#ifdef VC_PED_PORTS
- if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND)
-#endif
- return;
-
- } else if (TheCamera.m_CameraAverageSpeed > 1.25f) {
- if (audio != SOUND_PED_DEATH &&
-#ifdef VC_PED_PORTS
- audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND &&
-#endif
- audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE)
- return;
-
- } else if (TheCamera.m_CameraAverageSpeed > 0.9f) {
- switch (audio) {
- case SOUND_PED_DEATH:
-#ifdef VC_PED_PORTS
- case SOUND_PED_DAMAGE:
- case SOUND_PED_HIT:
- case SOUND_PED_LAND:
-#endif
- case SOUND_PED_BURNING:
- case SOUND_PED_FLEE_SPRINT:
- case SOUND_PED_TAXI_WAIT:
- case SOUND_PED_EVADE:
- case SOUND_PED_CAR_COLLISION:
- break;
- default:
- return;
- }
- }
- }
-
- if (audioToPlay < m_queuedSound) {
- if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH
- || CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
- + m_lastSoundStart
- + (uint32) CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) <= CTimer::GetTimeInMilliseconds()) {
- m_queuedSound = audioToPlay;
- }
- }
-}
-
-void
CPed::CollideWithPed(CPed *collideWith)
{
CAnimBlendAssociation *animAssoc;
@@ -6072,6 +5757,9 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
m_nPedState = PED_CHAT;
SetMoveState(PEDMOVE_STILL);
+#ifdef VC_PED_PORTS
+ m_lookTimer = 0;
+#endif
SetLookFlag(chatWith, true);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time;
m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000;
@@ -6080,10 +5768,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
void
CPed::SetDead(void)
{
-#ifdef VC_PED_PORTS
- if (!RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DROWN))
-#endif
- bUsesCollision = false;
+ bUsesCollision = false;
m_fHealth = 0.0f;
if (m_nPedState == PED_DRIVING)
@@ -6187,6 +5872,9 @@ CPed::Die(void)
uint8
CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
{
+#ifdef FIX_BUGS
+ return 1;
+#else
uint8 retVal = 2;
float headZ = GetNodePosition(PED_HEAD).z;
@@ -6202,6 +5890,7 @@ CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
retVal = 0;
return retVal;
+#endif
}
bool
@@ -8955,11 +8644,11 @@ CPed::LookForInterestingNodes(void)
return false;
}
- switch (effect->attractor.flags) {
- case ATTRACTORFLAG_ICECREAM:
+ switch (effect->attractor.type) {
+ case ATTRACTORTYPE_ICECREAM:
SetInvestigateEvent(EVENT_ICECREAM, CVector2D(effectPos), 0.1f, 15000, angleToFace);
break;
- case ATTRACTORFLAG_STARE:
+ case ATTRACTORTYPE_STARE:
SetInvestigateEvent(EVENT_SHOPSTALL, CVector2D(effectPos), 1.0f,
CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500),
angleToFace);
@@ -9578,17 +9267,6 @@ CPed::ProcessControl(void)
float oldDestRot = CGeneral::LimitRadianAngle(m_fRotationDest);
-#ifdef VC_PED_PORTS
- if (m_nPedState == PED_FOLLOW_PATH) {
- if (DotProduct(m_vecDamageNormal, GetForward()) < -0.866f && CanPedJumpThis(collidingEnt, &m_vecDamageNormal)) {
- SetJump();
-
- // Moved break into here, for compatibility with III
- break;
- }
- // break;
- }
-#endif
if (m_pedInObjective &&
(m_objective == OBJECTIVE_GOTO_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT)) {
@@ -10414,7 +10092,7 @@ CPed::ProcessControl(void)
case PED_SEEK_ENTITY:
case PED_PURSUE:
case PED_SNIPER_MODE:
- case PED_ROCKET_ODE:
+ case PED_ROCKET_MODE:
case PED_DUMMY:
case PED_FACE_PHONE:
case PED_MAKE_CALL:
@@ -11055,7 +10733,7 @@ CPed::SetJump(void)
#ifdef VC_PED_PORTS
m_nPedState != PED_JUMP && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_JUMP_LAUNCH) &&
#endif
- (m_nSurfaceTouched != SURFACE_STONE || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
+ (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
SetStoredState();
m_nPedState = PED_JUMP;
CAnimBlendAssociation *jumpAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_JUMP_LAUNCH, 8.0f);
@@ -11064,12 +10742,6 @@ CPed::SetJump(void)
}
}
-bool
-CPed::ServiceTalkingWhenDead(void)
-{
- return m_queuedSound == SOUND_PED_DEATH;
-}
-
void
CPed::RemoveInCarAnims(void)
{
@@ -14781,7 +14453,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
#endif
m_nSurfaceTouched = intersectionPoint.surfaceB;
- if (m_nSurfaceTouched == SURFACE_STONE) {
+ if (m_nSurfaceTouched == SURFACE_STEEP_CLIFF) {
bHitSteepSlope = true;
m_vecDamageNormal = intersectionPoint.normal;
}
@@ -14889,7 +14561,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
#endif
sphereNormal.Normalise();
collidingPoints[sphere].normal = sphereNormal;
- if (collidingPoints[sphere].surfaceB == SURFACE_STONE)
+ if (collidingPoints[sphere].surfaceB == SURFACE_STEEP_CLIFF)
bHitSteepSlope = true;
}
}
@@ -14939,17 +14611,9 @@ CPed::WanderRange(void)
bool arrived = Seek();
if (arrived) {
Idle();
- if (((m_randomSeed % 256) + 3 * CTimer::GetFrameCounter()) % 1000 > 997) {
-
- int xDiff = Abs(m_wanderRangeBounds[1].x - m_wanderRangeBounds[0].x);
- int yDiff = Abs(m_wanderRangeBounds[1].y - m_wanderRangeBounds[0].y);
-
- CVector newCoords(
- (CGeneral::GetRandomNumber() % xDiff) + m_wanderRangeBounds[0].x,
- (CGeneral::GetRandomNumber() % yDiff) + m_wanderRangeBounds[0].y,
- GetPosition().z);
-
- SetSeek(newCoords, 2.5f);
+ if ((m_randomSeed + 3 * CTimer::GetFrameCounter()) % 1000 > 997) {
+ CVector2D newCoords2D = m_wanderRangeBounds->GetRandomPointInRange();
+ SetSeek(CVector(newCoords2D.x, newCoords2D.y, GetPosition().z), 2.5f);
}
}
}
@@ -15031,11 +14695,7 @@ CPed::SeekBoatPosition(void)
CVehicleModelInfo *boatModel = m_carInObjective->GetModelInfo();
CVector enterOffset;
- if (boatModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- enterOffset = boatModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- enterOffset = boatModel->m_positions[CAR_POS_FRONTSEAT];
-
+ enterOffset = boatModel->GetFrontSeatPosn();
enterOffset.x = 0.0f;
CMatrix boatMat(m_carInObjective->GetMatrix());
SetMoveState(PEDMOVE_WALK);
@@ -16274,34 +15934,6 @@ CPed::SeekCar(void)
}
void
-CPed::ServiceTalking(void)
-{
- if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) {
- if (CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber")) {
- if (m_nPedState == PED_ON_FIRE)
- m_queuedSound = SOUND_PED_BURNING;
- } else {
- m_queuedSound = SOUND_PED_BOMBER;
- }
- if (m_queuedSound != SOUND_TOTAL_PED_SOUNDS) {
- if (m_queuedSound == SOUND_PED_DEATH)
- m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
-
- if (CTimer::GetTimeInMilliseconds() > m_soundStart) {
- DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f);
- m_lastSoundStart = CTimer::GetTimeInMilliseconds();
- m_soundStart =
- CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime
- + CTimer::GetTimeInMilliseconds()
- + CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime);
- m_lastQueuedSound = m_queuedSound;
- m_queuedSound = SOUND_TOTAL_PED_SOUNDS;
- }
- }
- }
-}
-
-void
CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
{
if (m_nPedState == PED_DEAD) {
@@ -16749,7 +16381,7 @@ CPed::UpdatePosition(void)
velocityChange = m_moved + velocityOfSurface - m_vecMoveSpeed;
m_fRotationCur += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep();
m_fRotationDest += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep();
- } else if (m_nSurfaceTouched != SURFACE_STONE || m_vecDamageNormal.x == 0.0f && m_vecDamageNormal.y == 0.0f) {
+ } else if (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || m_vecDamageNormal.x == 0.0f && m_vecDamageNormal.y == 0.0f) {
velocityChange = m_moved - m_vecMoveSpeed;
} else {
// Ped got damaged by steep slope
@@ -16817,29 +16449,20 @@ CPed::SetPedPositionInCar(void)
CMatrix newMat(m_pMyVehicle->GetMatrix());
CVector seatPos;
if (m_pMyVehicle->pDriver == this) {
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
-
+ seatPos = vehModel->GetFrontSeatPosn();
if (!m_pMyVehicle->IsBoat() && m_pMyVehicle->m_vehType != VEHICLE_TYPE_BIKE)
seatPos.x = -seatPos.x;
} else if (m_pMyVehicle->pPassengers[0] == this) {
- if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
- seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
- else
- seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
+ seatPos = vehModel->GetFrontSeatPosn();
} else if (m_pMyVehicle->pPassengers[1] == this) {
seatPos = vehModel->m_positions[CAR_POS_BACKSEAT];
seatPos.x = -seatPos.x;
} else {
if (m_pMyVehicle->pPassengers[2] == this) {
seatPos = vehModel->m_positions[CAR_POS_BACKSEAT];
- } else if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) {
- seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
} else {
- seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
+ seatPos = vehModel->GetFrontSeatPosn();
}
}
newMat.GetPosition() += Multiply3x3(newMat, seatPos);
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 56e527c5..6e536ede 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -231,7 +231,7 @@ enum PedState
PED_PURSUE,
PED_FOLLOW_PATH,
PED_SNIPER_MODE,
- PED_ROCKET_ODE,
+ PED_ROCKET_MODE,
PED_DUMMY,
PED_PAUSE,
PED_ATTACK,
@@ -468,7 +468,7 @@ public:
CEntity *m_pCollidingEntity;
uint8 m_stateUnused;
uint32 m_timerUnused;
- CVector2D *m_wanderRangeBounds; // array with 2 CVector2D (actually unused CRange2D class) - unused
+ class CRange2D *m_wanderRangeBounds;
CWeapon m_weapons[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS];
eWeaponType m_storedWeapon;
uint8 m_currentWeapon; // eWeaponType
@@ -879,8 +879,21 @@ public:
#ifndef MASTER
// Mobile things
+ void DebugDrawPedDestination(CPed *, int, int);
+ void DebugDrawPedDesiredHeading(CPed *, int, int);
+ void DebugDrawCollisionRadius(float, float, float, float, int);
+ void DebugDrawVisionRange(CVector, float);
+ void DebugDrawVisionSimple(CVector, float);
+ void DebugDrawLook();
+ void DebugDrawPedPsyche();
+ void DebugDrawDebugLines();
+
static void SwitchDebugDisplay(void);
+ static int GetDebugDisplay(void);
+
+ void DebugDrawLookAtPoints();
void DebugRenderOnePedText(void);
+ void DebugRenderClosePedText();
#endif
#ifdef PED_SKIN
diff --git a/src/peds/PedChat.cpp b/src/peds/PedChat.cpp
new file mode 100644
index 00000000..9045a2e0
--- /dev/null
+++ b/src/peds/PedChat.cpp
@@ -0,0 +1,153 @@
+#include "common.h"
+#include "Camera.h"
+#include "DMAudio.h"
+#include "General.h"
+#include "Ped.h"
+
+// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
+PedAudioData CommentWaitTime[39] = {
+ {500, 800, 500, 2},
+ {500, 800, 500, 2},
+ {500, 800, 500, 2},
+ {500, 800, 500, 2},
+ {100, 2, 100, 2},
+ {700, 500, 1000, 500},
+ {700, 500, 1000, 500},
+ {5000, 2000, 15000, 3000},
+ {5000, 2000, 15000, 3000},
+ {5000, 2000, 15000, 3000},
+ {6000, 6000, 6000, 6000},
+ {1000, 1000, 2000, 2000},
+ {1000, 500, 2000, 1500},
+ {1000, 500, 2000, 1500},
+ {800, 200, 1000, 500},
+ {800, 200, 1000, 500},
+ {800, 400, 2000, 1000},
+ {800, 400, 2000, 1000},
+ {400, 300, 2000, 1000},
+ {2000, 1000, 2500, 1500},
+ {200, 200, 200, 200},
+ {6000, 3000, 5000, 6000},
+ {6000, 3000, 9000, 5000},
+ {6000, 3000, 9000, 5000},
+ {6000, 3000, 9000, 5000},
+ {400, 300, 4000, 1000},
+ {400, 300, 4000, 1000},
+ {400, 300, 4000, 1000},
+ {1000, 500, 3000, 1000},
+ {1000, 500, 1000, 1000},
+ {3000, 2000, 3000, 2000},
+ {1000, 500, 3000, 6000},
+ {1000, 500, 2000, 4000},
+ {1000, 500, 2000, 5000},
+ {1000, 500, 3000, 2000},
+ {1600, 1000, 2000, 2000},
+ {3000, 2000, 5000, 3000},
+ {1000, 1000, 1000, 1000},
+ {1000, 1000, 5000, 5000},
+};
+
+bool
+CPed::ServiceTalkingWhenDead(void)
+{
+ return m_queuedSound == SOUND_PED_DEATH;
+}
+
+void
+CPed::ServiceTalking(void)
+{
+ if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) {
+ if (!CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber"))
+ m_queuedSound = SOUND_PED_BOMBER;
+ else if (m_nPedState == PED_ON_FIRE)
+ m_queuedSound = SOUND_PED_BURNING;
+
+ if (m_queuedSound != SOUND_NO_SOUND) {
+ if (m_queuedSound == SOUND_PED_DEATH)
+ m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
+
+ if (CTimer::GetTimeInMilliseconds() > m_soundStart) {
+ DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f);
+ m_lastSoundStart = CTimer::GetTimeInMilliseconds();
+ m_soundStart =
+ CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime
+ + CTimer::GetTimeInMilliseconds()
+ + CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime);
+ m_lastQueuedSound = m_queuedSound;
+ m_queuedSound = SOUND_NO_SOUND;
+ }
+ }
+ }
+}
+
+void
+CPed::Say(uint16 audio)
+{
+ uint16 audioToPlay = audio;
+
+ if (IsPlayer()) {
+
+ // Ofc this part isn't in VC.
+ switch (audio) {
+ case SOUND_PED_DEATH:
+ audioToPlay = SOUND_PED_DAMAGE;
+ break;
+ case SOUND_PED_DAMAGE:
+ case SOUND_PED_HIT:
+ case SOUND_PED_LAND:
+ break;
+ case SOUND_PED_BULLET_HIT:
+ case SOUND_PED_CAR_JACKED:
+ case SOUND_PED_DEFEND:
+ audioToPlay = SOUND_PED_HIT;
+ break;
+ default:
+ return;
+ }
+ } else {
+ if (TheCamera.GetPosition().z + 3.0f < GetPosition().z)
+ return;
+
+ if (TheCamera.m_CameraAverageSpeed > 1.65f) {
+#ifdef VC_PED_PORTS
+ if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND)
+#endif
+ return;
+
+ } else if (TheCamera.m_CameraAverageSpeed > 1.25f) {
+ if (audio != SOUND_PED_DEATH &&
+#ifdef VC_PED_PORTS
+ audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND &&
+#endif
+ audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE)
+ return;
+
+ } else if (TheCamera.m_CameraAverageSpeed > 0.9f) {
+ switch (audio) {
+ case SOUND_PED_DEATH:
+#ifdef VC_PED_PORTS
+ case SOUND_PED_DAMAGE:
+ case SOUND_PED_HIT:
+ case SOUND_PED_LAND:
+#endif
+ case SOUND_PED_BURNING:
+ case SOUND_PED_FLEE_SPRINT:
+ case SOUND_PED_TAXI_WAIT:
+ case SOUND_PED_EVADE:
+ case SOUND_PED_CAR_COLLISION:
+ break;
+ default:
+ return;
+ }
+ }
+ }
+
+ if (audioToPlay < m_queuedSound) {
+ if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH
+ || CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
+ + m_lastSoundStart
+ + (uint32) CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) <= CTimer::GetTimeInMilliseconds()) {
+ m_queuedSound = audioToPlay;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/peds/PedDebug.cpp b/src/peds/PedDebug.cpp
new file mode 100644
index 00000000..1c22963e
--- /dev/null
+++ b/src/peds/PedDebug.cpp
@@ -0,0 +1,310 @@
+#include "common.h"
+#ifndef MASTER
+#include "main.h"
+#include "Camera.h"
+#include "Font.h"
+#include "Ped.h"
+#include "Sprite.h"
+#include "Text.h"
+
+
+static char ObjectiveText[][28] = {
+ "No Obj",
+ "Wait on Foot",
+ "Flee on Foot Till Safe",
+ "Guard Spot",
+ "Guard Area",
+ "Wait in Car",
+ "Wait in Car then Getout",
+ "Kill Char on Foot",
+ "Kill Char Any Means",
+ "Flee Char on Foot Till Safe",
+ "Flee Char on Foot Always",
+ "GoTo Char on Foot",
+ "Follow Char in Formation",
+ "Leave Car",
+ "Enter Car as Passenger",
+ "Enter Car as Driver",
+ "Follow Car in Car",
+ "Fire at Obj from Vehicle",
+ "Destroy Obj",
+ "Destroy Car",
+ "GoTo Area Any Means",
+ "GoTo Area on Foot",
+ "Run to Area",
+ "GoTo Area in Car",
+ "Follow Car on Foot Woffset",
+ "Guard Attack",
+ "Set Leader",
+ "Follow Route",
+ "Solicit",
+ "Take Taxi",
+ "Catch Train",
+ "Buy IceCream",
+ "Steal Any Car",
+ "Mug Char",
+#ifdef VC_PED_PORTS
+ "Leave Car and Die"
+#endif
+};
+
+static char StateText[][18] = {
+ "None",
+ "Idle",
+ "Look Entity",
+ "Look Heading",
+ "Wander Range",
+ "Wander Path",
+ "Seek Pos",
+ "Seek Entity",
+ "Flee Pos",
+ "Flee Entity",
+ "Pursue",
+ "Follow Path",
+ "Sniper Mode",
+ "Rocket Mode",
+ "Dummy",
+ "Pause",
+ "Attack",
+ "Fight",
+ "Face Phone",
+ "Make Call",
+ "Chat",
+ "Mug",
+ "AimGun",
+ "AI Control",
+ "Seek Car",
+ "Seek InBoat",
+ "Follow Route",
+ "C.P.R.",
+ "Solicit",
+ "Buy IceCream",
+ "Investigate",
+ "Step away",
+ "On Fire",
+ "Unknown",
+ "STATES_NO_AI",
+ "Jump",
+ "Fall",
+ "GetUp",
+ "Stagger",
+ "Dive away",
+ "STATES_NO_ST",
+ "Enter Train",
+ "Exit Train",
+ "Arrest Plyr",
+ "Driving",
+ "Passenger",
+ "Taxi Passngr",
+ "Open Door",
+ "Die",
+ "Dead",
+ "CarJack",
+ "Drag fm Car",
+ "Enter Car",
+ "Steal Car",
+ "Exit Car",
+ "Hands Up",
+ "Arrested",
+};
+
+static char PersonalityTypeText[][18] = {
+ "Player",
+ "Cop",
+ "Medic",
+ "Fireman",
+ "Gang 1",
+ "Gang 2",
+ "Gang 3",
+ "Gang 4",
+ "Gang 5",
+ "Gang 6",
+ "Gang 7",
+ "Street Guy",
+ "Suit Guy",
+ "Sensible Guy",
+ "Geek Guy",
+ "Old Guy",
+ "Tough Guy",
+ "Street Girl",
+ "Suit Girl",
+ "Sensible Girl",
+ "Geek Girl",
+ "Old Girl",
+ "Tough Girl",
+ "Tramp Male",
+ "Tramp Female",
+ "Tourist",
+ "Prostitute",
+ "Criminal",
+ "Busker",
+ "Taxi Driver",
+ "Psycho",
+ "Steward",
+ "Sports Fan",
+ "Shopper",
+ "Old Shopper"
+};
+
+static char WaitStateText[][16] = {
+ "No Wait",
+ "Traffic Lights",
+ "Pause CrossRoad",
+ "Look CrossRoad",
+ "Look Ped",
+ "Look Shop",
+ "Look Accident",
+ "FaceOff Gang",
+ "Double Back",
+ "Hit Wall",
+ "Turn 180deg",
+ "Surprised",
+ "Ped Stuck",
+ "Look About",
+ "Play Duck",
+ "Play Cower",
+ "Play Taxi",
+ "Play HandsUp",
+ "Play HandsCower",
+ "Play Chat",
+ "Finish Flee",
+};
+
+void
+CPed::DebugDrawPedDestination(CPed *, int, int)
+{
+#ifndef FINAL
+ // TODO: something was here
+#endif // !FINAL
+}
+
+void
+CPed::DebugDrawPedDesiredHeading(CPed *, int, int)
+{
+#ifndef FINAL
+ // TODO: something was here
+#endif // !FINAL
+}
+
+void
+CPed::DebugDrawCollisionRadius(float, float, float, float, int)
+{
+#ifndef FINAL
+ // TODO: something was here
+#endif // !FINAL
+}
+
+void
+CPed::DebugDrawVisionRange(CVector a1, float)
+{
+ for (int i = a1.x - 90; i < a1.x + 89; i += 30) {
+#ifndef FINAL
+ // TODO: something was here
+#endif // !FINAL
+ }
+}
+
+void
+CPed::DebugDrawVisionSimple(CVector, float)
+{
+#ifndef FINAL
+ // TODO: something was here
+#endif // !FINAL
+}
+
+void
+CPed::DebugDrawLook()
+{
+#ifndef FINAL
+ // TODO: something was here
+#endif // !FINAL
+}
+
+void
+CPed::DebugDrawPedPsyche()
+{
+#ifndef FINAL
+ // TODO: something was here
+#endif // !FINAL
+}
+
+void
+CPed::DebugDrawDebugLines()
+{
+#ifndef FINAL
+ // TODO: something was here
+#endif // !FINAL
+}
+
+int nDisplayDebugInfo = 0;
+
+void
+CPed::SwitchDebugDisplay(void)
+{
+ if (++nDisplayDebugInfo > 2)
+ nDisplayDebugInfo = 0;
+}
+
+int
+CPed::GetDebugDisplay(void)
+{
+ return nDisplayDebugInfo;
+}
+
+void
+CPed::DebugDrawLookAtPoints()
+{
+ // TODO: mobile code
+}
+
+void
+CPed::DebugRenderOnePedText(void)
+{
+ if ((GetPosition() - TheCamera.GetPosition()).MagnitudeSqr() < sq(30.0f)) {
+ float width, height;
+ RwV3d screenCoords;
+ CVector bitAbove = GetPosition();
+ bitAbove.z += 2.0f;
+ if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) {
+
+ float lineHeight = SCREEN_SCALE_Y(Min(height / 100.0f, 0.7f) * 22.0f);
+
+ DefinedState();
+ CFont::SetPropOn();
+ CFont::SetBackgroundOn();
+
+ // Originally both of them were being divided by 60.0f.
+ float xScale = Min(width / 240.0f, 0.7f);
+ float yScale = Min(height / 80.0f, 0.7f);
+
+ CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale));
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(SCREEN_WIDTH);
+ CFont::SetJustifyOff();
+ CFont::SetColor(CRGBA(255, 255, 0, 255));
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetFontStyle(0);
+ AsciiToUnicode(StateText[m_nPedState], gUString);
+ CFont::PrintString(screenCoords.x, screenCoords.y, gUString);
+ AsciiToUnicode(ObjectiveText[m_objective], gUString);
+ CFont::PrintString(screenCoords.x, screenCoords.y + lineHeight, gUString);
+ AsciiToUnicode(PersonalityTypeText[m_pedStats->m_type], gUString);
+ CFont::PrintString(screenCoords.x, screenCoords.y + 2 * lineHeight, gUString);
+ AsciiToUnicode(WaitStateText[m_nWaitState], gUString);
+ CFont::PrintString(screenCoords.x, screenCoords.y + 3 * lineHeight, gUString);
+ if (m_nPedState == PED_SEEK_POS || m_nPedState == PED_SEEK_ENTITY) {
+ sprintf(gString, "Safe distance to target: %.2f", m_distanceToCountSeekDone);
+ AsciiToUnicode(gString, gUString);
+ CFont::PrintString(screenCoords.x, screenCoords.y + 4 * lineHeight, gUString);
+ }
+ DefinedState();
+ }
+ }
+}
+
+void
+CPed::DebugRenderClosePedText()
+{
+ // TODO: mobile code
+}
+#endif \ No newline at end of file
diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp
index ae9a85b4..ebd41296 100644
--- a/src/peds/PedIK.cpp
+++ b/src/peds/PedIK.cpp
@@ -21,14 +21,14 @@ CPedIK::CPedIK(CPed *ped)
{
m_ped = ped;
m_flags = 0;
- m_headOrient.phi = 0.0f;
- m_headOrient.theta = 0.0f;
- m_torsoOrient.phi = 0.0f;
- m_torsoOrient.theta = 0.0f;
- m_upperArmOrient.phi = 0.0f;
- m_upperArmOrient.theta = 0.0f;
- m_lowerArmOrient.phi = 0.0f;
- m_lowerArmOrient.theta = 0.0f;
+ m_headOrient.yaw = 0.0f;
+ m_headOrient.pitch = 0.0f;
+ m_torsoOrient.yaw = 0.0f;
+ m_torsoOrient.pitch = 0.0f;
+ m_upperArmOrient.yaw = 0.0f;
+ m_upperArmOrient.pitch = 0.0f;
+ m_lowerArmOrient.yaw = 0.0f;
+ m_lowerArmOrient.pitch = 0.0f;
}
#ifdef PED_SKIN
@@ -55,8 +55,8 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
RtQuat *q = &node->hanimFrame->q;
#ifndef FIX_BUGS
// this is what the game does (also VC), but it does not look great
- RtQuatRotate(q, &XaxisIK, RADTODEG(limb->phi), rwCOMBINEPRECONCAT);
- RtQuatRotate(q, &ZaxisIK, RADTODEG(limb->theta), rwCOMBINEPRECONCAT); // pitch
+ RtQuatRotate(q, &XaxisIK, RADTODEG(limb->yaw), rwCOMBINEPRECONCAT);
+ RtQuatRotate(q, &ZaxisIK, RADTODEG(limb->pitch), rwCOMBINEPRECONCAT); // pitch
#else
// copied the code from the non-skinned case
// this seems to work ok
@@ -78,8 +78,8 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
vec2.z = -(c*mat->at.x + s*mat->at.y);
// Not sure what exactly to do here
- RtQuatRotate(q, &vec1, RADTODEG(limb->phi), rwCOMBINEPRECONCAT);
- RtQuatRotate(q, &vec2, RADTODEG(limb->theta), rwCOMBINEPRECONCAT);
+ RtQuatRotate(q, &vec1, RADTODEG(limb->yaw), rwCOMBINEPRECONCAT);
+ RtQuatRotate(q, &vec2, RADTODEG(limb->pitch), rwCOMBINEPRECONCAT);
#endif
m_ped->bDontAcceptIKLookAts = true;
}else
@@ -122,14 +122,14 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
float curYaw, curPitch;
ExtractYawAndPitchWorld(mat, &curYaw, &curPitch);
- RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->theta), rwCOMBINEPOSTCONCAT);
- RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->phi - (curYaw - m_ped->m_fRotationCur)), rwCOMBINEPOSTCONCAT);
+ RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->pitch), rwCOMBINEPOSTCONCAT);
+ RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->yaw - (curYaw - m_ped->m_fRotationCur)), rwCOMBINEPOSTCONCAT);
RwMatrixRotate(RwFrameGetMatrix(f), &forwardVector, RADTODEG(alpha), rwCOMBINEPOSTCONCAT);
}else{
// pitch
- RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->theta), rwCOMBINEPOSTCONCAT);
+ RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->pitch), rwCOMBINEPOSTCONCAT);
// yaw
- RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->phi), rwCOMBINEPOSTCONCAT);
+ RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->yaw), rwCOMBINEPOSTCONCAT);
}
RwFrameGetMatrix(f)->pos = pos;
RwMatrixDestroy(mat);
@@ -176,43 +176,43 @@ CPedIK::GetWorldMatrix(RwFrame *source, RwMatrix *destination)
}
LimbMoveStatus
-CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo)
+CPedIK::MoveLimb(LimbOrientation &limb, float targetYaw, float targetPitch, LimbMovementInfo &moveInfo)
{
LimbMoveStatus result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY;
- // phi
+ // yaw
- if (limb.phi > approxPhi) {
- limb.phi -= moveInfo.yawD;
- } else if (limb.phi < approxPhi) {
- limb.phi += moveInfo.yawD;
+ if (limb.yaw > targetYaw) {
+ limb.yaw -= moveInfo.yawD;
+ } else if (limb.yaw < targetYaw) {
+ limb.yaw += moveInfo.yawD;
}
- if (Abs(limb.phi - approxPhi) < moveInfo.yawD) {
- limb.phi = approxPhi;
+ if (Abs(limb.yaw - targetYaw) < moveInfo.yawD) {
+ limb.yaw = targetYaw;
result = ANGLES_SET_EXACTLY;
}
- if (limb.phi > moveInfo.maxYaw || limb.phi < moveInfo.minYaw) {
- limb.phi = clamp(limb.phi, moveInfo.minYaw, moveInfo.maxYaw);
+ if (limb.yaw > moveInfo.maxYaw || limb.yaw < moveInfo.minYaw) {
+ limb.yaw = clamp(limb.yaw, moveInfo.minYaw, moveInfo.maxYaw);
result = ANGLES_SET_TO_MAX;
}
- // theta
+ // pitch
- if (limb.theta > approxTheta) {
- limb.theta -= moveInfo.pitchD;
- } else if (limb.theta < approxTheta) {
- limb.theta += moveInfo.pitchD;
+ if (limb.pitch > targetPitch) {
+ limb.pitch -= moveInfo.pitchD;
+ } else if (limb.pitch < targetPitch) {
+ limb.pitch += moveInfo.pitchD;
}
- if (Abs(limb.theta - approxTheta) < moveInfo.pitchD)
- limb.theta = approxTheta;
+ if (Abs(limb.pitch - targetPitch) < moveInfo.pitchD)
+ limb.pitch = targetPitch;
else
result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY;
- if (limb.theta > moveInfo.maxPitch || limb.theta < moveInfo.minPitch) {
- limb.theta = clamp(limb.theta, moveInfo.minPitch, moveInfo.maxPitch);
+ if (limb.pitch > moveInfo.maxPitch || limb.pitch < moveInfo.minPitch) {
+ limb.pitch = clamp(limb.pitch, moveInfo.minPitch, moveInfo.maxPitch);
result = ANGLES_SET_TO_MAX;
}
return result;
@@ -231,14 +231,14 @@ void
CPedIK::RotateHead(void)
{
RtQuat *q = &m_ped->m_pFrames[PED_HEAD]->hanimFrame->q;
- RtQuatRotate(q, &XaxisIK, RADTODEG(m_headOrient.phi), rwCOMBINEREPLACE);
- RtQuatRotate(q, &ZaxisIK, RADTODEG(m_headOrient.theta), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(q, &XaxisIK, RADTODEG(m_headOrient.yaw), rwCOMBINEREPLACE);
+ RtQuatRotate(q, &ZaxisIK, RADTODEG(m_headOrient.pitch), rwCOMBINEPOSTCONCAT);
m_ped->bDontAcceptIKLookAts = true;
}
#endif
bool
-CPedIK::LookInDirection(float phi, float theta)
+CPedIK::LookInDirection(float targetYaw, float targetPitch)
{
bool success = true;
float yaw, pitch;
@@ -246,21 +246,21 @@ CPedIK::LookInDirection(float phi, float theta)
if(IsClumpSkinned(m_ped->GetClump())){
if (!(m_ped->m_pFrames[PED_HEAD]->flag & AnimBlendFrameData::IGNORE_ROTATION)) {
m_ped->m_pFrames[PED_HEAD]->flag |= AnimBlendFrameData::IGNORE_ROTATION;
- ExtractYawAndPitchLocalSkinned(m_ped->m_pFrames[PED_HEAD], &m_headOrient.phi, &m_headOrient.theta);
+ ExtractYawAndPitchLocalSkinned(m_ped->m_pFrames[PED_HEAD], &m_headOrient.yaw, &m_headOrient.pitch);
}
// parent of head is torso
RwMatrix worldMat = *GetBoneMatrix(m_ped, BONE_torso);
ExtractYawAndPitchWorld(&worldMat, &yaw, &pitch);
- LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(phi - yaw),
+ LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(targetYaw - yaw),
CGeneral::LimitRadianAngle(DEGTORAD(10.0f)), ms_headInfo);
if (headStatus == ANGLES_SET_TO_MAX)
success = false;
if (headStatus != ANGLES_SET_EXACTLY){
if (!(m_flags & LOOKAROUND_HEAD_ONLY)){
- if (MoveLimb(m_torsoOrient, CGeneral::LimitRadianAngle(phi), theta, ms_torsoInfo))
+ if (MoveLimb(m_torsoOrient, CGeneral::LimitRadianAngle(targetYaw), targetPitch, ms_torsoInfo))
success = true;
}else{
RotateHead();
@@ -279,7 +279,7 @@ CPedIK::LookInDirection(float phi, float theta)
if (!(m_ped->m_pFrames[PED_HEAD]->flag & AnimBlendFrameData::IGNORE_ROTATION)) {
m_ped->m_pFrames[PED_HEAD]->flag |= AnimBlendFrameData::IGNORE_ROTATION;
- ExtractYawAndPitchLocal(frameMat, &m_headOrient.phi, &m_headOrient.theta);
+ ExtractYawAndPitchLocal(frameMat, &m_headOrient.yaw, &m_headOrient.pitch);
}
RwMatrix *worldMat = RwMatrixCreate();
@@ -288,25 +288,25 @@ CPedIK::LookInDirection(float phi, float theta)
ExtractYawAndPitchWorld(worldMat, &yaw, &pitch);
RwMatrixDestroy(worldMat);
- yaw += m_torsoOrient.phi;
- float neededPhiTurn = CGeneral::LimitRadianAngle(phi - yaw);
- pitch *= Cos(neededPhiTurn);
+ yaw += m_torsoOrient.yaw;
+ float neededYawTurn = CGeneral::LimitRadianAngle(targetYaw - yaw);
+ pitch *= Cos(neededYawTurn);
- float neededThetaTurn = CGeneral::LimitRadianAngle(theta - pitch);
- LimbMoveStatus headStatus = MoveLimb(m_headOrient, neededPhiTurn, neededThetaTurn, ms_headInfo);
+ float neededPitchTurn = CGeneral::LimitRadianAngle(targetPitch - pitch);
+ LimbMoveStatus headStatus = MoveLimb(m_headOrient, neededYawTurn, neededPitchTurn, ms_headInfo);
if (headStatus == ANGLES_SET_TO_MAX)
success = false;
if (headStatus != ANGLES_SET_EXACTLY && !(m_flags & LOOKAROUND_HEAD_ONLY)) {
- float remainingTurn = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur);
- if (MoveLimb(m_torsoOrient, remainingTurn, theta, ms_torsoInfo))
+ float remainingTurn = CGeneral::LimitRadianAngle(targetYaw - m_ped->m_fRotationCur);
+ if (MoveLimb(m_torsoOrient, remainingTurn, targetPitch, ms_torsoInfo))
success = true;
}
CMatrix nextFrame = CMatrix(frameMat);
CVector framePos = nextFrame.GetPosition();
- nextFrame.SetRotateZ(m_headOrient.theta);
- nextFrame.RotateX(m_headOrient.phi);
+ nextFrame.SetRotateZ(m_headOrient.pitch);
+ nextFrame.RotateX(m_headOrient.yaw);
nextFrame.GetPosition() += framePos;
nextFrame.UpdateRW();
@@ -320,32 +320,32 @@ CPedIK::LookInDirection(float phi, float theta)
bool
CPedIK::LookAtPosition(CVector const &pos)
{
- float phiToFace = CGeneral::GetRadianAngleBetweenPoints(
+ float yawToFace = CGeneral::GetRadianAngleBetweenPoints(
pos.x, pos.y,
m_ped->GetPosition().x, m_ped->GetPosition().y);
- float thetaToFace = CGeneral::GetRadianAngleBetweenPoints(
+ float pitchToFace = CGeneral::GetRadianAngleBetweenPoints(
pos.z, (m_ped->GetPosition() - pos).Magnitude2D(),
m_ped->GetPosition().z, 0.0f);
- return LookInDirection(phiToFace, thetaToFace);
+ return LookInDirection(yawToFace, pitchToFace);
}
bool
-CPedIK::PointGunInDirection(float phi, float theta)
+CPedIK::PointGunInDirection(float targetYaw, float targetPitch)
{
bool result = true;
bool armPointedToGun = false;
- float angle = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur);
+ float angle = CGeneral::LimitRadianAngle(targetYaw - m_ped->m_fRotationCur);
m_flags &= (~GUN_POINTED_SUCCESSFULLY);
m_flags |= LOOKAROUND_HEAD_ONLY;
if (m_flags & AIMS_WITH_ARM) {
- armPointedToGun = PointGunInDirectionUsingArm(angle, theta);
- angle = CGeneral::LimitRadianAngle(angle - m_upperArmOrient.phi);
+ armPointedToGun = PointGunInDirectionUsingArm(angle, targetPitch);
+ angle = CGeneral::LimitRadianAngle(angle - m_upperArmOrient.yaw);
}
if (armPointedToGun) {
- if (m_flags & AIMS_WITH_ARM && m_torsoOrient.phi * m_upperArmOrient.phi < 0.0f)
- MoveLimb(m_torsoOrient, 0.0f, m_torsoOrient.theta, ms_torsoInfo);
+ if (m_flags & AIMS_WITH_ARM && m_torsoOrient.yaw * m_upperArmOrient.yaw < 0.0f)
+ MoveLimb(m_torsoOrient, 0.0f, m_torsoOrient.pitch, ms_torsoInfo);
} else {
// Unused code
RwMatrix *matrix;
@@ -365,7 +365,7 @@ CPedIK::PointGunInDirection(float phi, float theta)
}
//
- LimbMoveStatus status = MoveLimb(m_torsoOrient, angle, theta, ms_torsoInfo);
+ LimbMoveStatus status = MoveLimb(m_torsoOrient, angle, targetPitch, ms_torsoInfo);
if (status == ANGLES_SET_TO_MAX)
result = false;
else if (status == ANGLES_SET_EXACTLY)
@@ -379,7 +379,7 @@ CPedIK::PointGunInDirection(float phi, float theta)
}
bool
-CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
+CPedIK::PointGunInDirectionUsingArm(float targetYaw, float targetPitch)
{
bool result = false;
@@ -410,18 +410,18 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
RwV3d rightVector = { 0.0f, 0.0f, 1.0f };
RwV3d forwardVector = { 1.0f, 0.0f, 0.0f };
- float uaPhi, uaTheta;
+ float uaYaw, uaPitch;
#ifdef PED_SKIN
if(IsClumpSkinned(m_ped->GetClump())){
- uaPhi = phi;
- uaTheta = theta + DEGTORAD(10.0f);
+ uaYaw = targetYaw;
+ uaPitch = targetPitch + DEGTORAD(10.0f);
}else
#endif
{
- uaPhi = phi - m_torsoOrient.phi - DEGTORAD(15.0f);
- uaTheta = CGeneral::LimitRadianAngle(theta - pitch);
+ uaYaw = targetYaw - m_torsoOrient.yaw - DEGTORAD(15.0f);
+ uaPitch = CGeneral::LimitRadianAngle(targetPitch - pitch);
}
- LimbMoveStatus uaStatus = MoveLimb(m_upperArmOrient, uaPhi, uaTheta, ms_upperArmInfo);
+ LimbMoveStatus uaStatus = MoveLimb(m_upperArmOrient, uaYaw, uaPitch, ms_upperArmInfo);
if (uaStatus == ANGLES_SET_EXACTLY) {
m_flags |= GUN_POINTED_SUCCESSFULLY;
result = true;
@@ -433,13 +433,13 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
if(!IsClumpSkinned(m_ped->GetClump()))
#endif
if (uaStatus == ANGLES_SET_TO_MAX) {
- float laPhi = uaPhi - m_upperArmOrient.phi;
+ float laYaw = uaYaw - m_upperArmOrient.yaw;
LimbMoveStatus laStatus;
- if (laPhi > 0.0f)
- laStatus = MoveLimb(m_lowerArmOrient, laPhi, -DEGTORAD(45.0f), ms_lowerArmInfo);
+ if (laYaw > 0.0f)
+ laStatus = MoveLimb(m_lowerArmOrient, laYaw, -DEGTORAD(45.0f), ms_lowerArmInfo);
else
- laStatus = MoveLimb(m_lowerArmOrient, laPhi, 0.0f, ms_lowerArmInfo);
+ laStatus = MoveLimb(m_lowerArmOrient, laYaw, 0.0f, ms_lowerArmInfo);
if (laStatus == ANGLES_SET_EXACTLY) {
m_flags |= GUN_POINTED_SUCCESSFULLY;
@@ -447,16 +447,16 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
}
RwFrame *child = GetFirstChild(m_ped->m_pFrames[PED_UPPERARMR]->frame);
RwV3d pos = RwFrameGetMatrix(child)->pos;
- RwMatrixRotate(RwFrameGetMatrix(child), &forwardVector, RADTODEG(m_lowerArmOrient.theta), rwCOMBINEPOSTCONCAT);
- RwMatrixRotate(RwFrameGetMatrix(child), &rightVector, RADTODEG(-m_lowerArmOrient.phi), rwCOMBINEPOSTCONCAT);
+ RwMatrixRotate(RwFrameGetMatrix(child), &forwardVector, RADTODEG(m_lowerArmOrient.pitch), rwCOMBINEPOSTCONCAT);
+ RwMatrixRotate(RwFrameGetMatrix(child), &rightVector, RADTODEG(-m_lowerArmOrient.yaw), rwCOMBINEPOSTCONCAT);
RwFrameGetMatrix(child)->pos = pos;
}
#ifdef PED_SKIN
if(IsClumpSkinned(m_ped->GetClump())){
RtQuat *q = &m_ped->m_pFrames[PED_UPPERARMR]->hanimFrame->q;
- RtQuatRotate(q, &XaxisIK, RADTODEG(m_upperArmOrient.phi), rwCOMBINEPOSTCONCAT);
- RtQuatRotate(q, &ZaxisIK, RADTODEG(m_upperArmOrient.theta), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(q, &XaxisIK, RADTODEG(m_upperArmOrient.yaw), rwCOMBINEPOSTCONCAT);
+ RtQuatRotate(q, &ZaxisIK, RADTODEG(m_upperArmOrient.pitch), rwCOMBINEPOSTCONCAT);
m_ped->bDontAcceptIKLookAts = true;
}else
#endif
@@ -464,8 +464,8 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
RwFrame *frame = m_ped->m_pFrames[PED_UPPERARMR]->frame;
// with PED_SKIN we're also getting upVector here
RwV3d pos = RwFrameGetMatrix(frame)->pos;
- RwMatrixRotate(RwFrameGetMatrix(frame), &rightVector, RADTODEG(m_upperArmOrient.theta), rwCOMBINEPOSTCONCAT);
- RwMatrixRotate(RwFrameGetMatrix(frame), &upVector, RADTODEG(m_upperArmOrient.phi), rwCOMBINEPOSTCONCAT);
+ RwMatrixRotate(RwFrameGetMatrix(frame), &rightVector, RADTODEG(m_upperArmOrient.pitch), rwCOMBINEPOSTCONCAT);
+ RwMatrixRotate(RwFrameGetMatrix(frame), &upVector, RADTODEG(m_upperArmOrient.yaw), rwCOMBINEPOSTCONCAT);
RwFrameGetMatrix(frame)->pos = pos;
}
return result;
@@ -511,8 +511,8 @@ CPedIK::RestoreLookAt(void)
CMatrix matrix(mat);
CVector pos = matrix.GetPosition();
- matrix.SetRotateZ(m_headOrient.theta);
- matrix.RotateX(m_headOrient.phi);
+ matrix.SetRotateZ(m_headOrient.pitch);
+ matrix.RotateX(m_headOrient.yaw);
matrix.Translate(pos);
matrix.UpdateRW();
}
diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h
index a1cb5d13..e91d7c06 100644
--- a/src/peds/PedIK.h
+++ b/src/peds/PedIK.h
@@ -4,8 +4,8 @@
struct LimbOrientation
{
- float phi;
- float theta;
+ float yaw;
+ float pitch;
};
struct LimbMovementInfo {
@@ -48,8 +48,8 @@ public:
static LimbMovementInfo ms_lowerArmInfo;
CPedIK(CPed *ped);
- bool PointGunInDirection(float phi, float theta);
- bool PointGunInDirectionUsingArm(float phi, float theta);
+ bool PointGunInDirection(float targetYaw, float targetPitch);
+ bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
bool PointGunAtPosition(CVector const& position);
void GetComponentPosition(RwV3d *pos, uint32 node);
static RwMatrix *GetWorldMatrix(RwFrame *source, RwMatrix *destination);
@@ -57,10 +57,10 @@ public:
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch);
void ExtractYawAndPitchWorld(RwMatrix *mat, float *yaw, float *pitch);
- LimbMoveStatus MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo);
+ LimbMoveStatus MoveLimb(LimbOrientation &limb, float targetYaw, float targetPitch, LimbMovementInfo &moveInfo);
bool RestoreGunPosn(void);
void RotateHead(void);
- bool LookInDirection(float phi, float theta);
+ bool LookInDirection(float targetYaw, float targetPitch);
bool LookAtPosition(CVector const& pos);
bool RestoreLookAt(void);
};
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 3c6fad57..6613ea1b 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -35,6 +35,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
{
m_fMoveSpeed = 0.0f;
SetModelIndex(MI_PLAYER);
+#ifdef FIX_BUGS
+ m_fCurrentStamina = m_fMaxStamina = 150.0f;
+#endif
SetInitialState();
m_pWanted = new CWanted();
@@ -46,8 +49,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_bSpeedTimerFlag = false;
m_pPointGunAt = nil;
m_nPedState = PED_IDLE;
- m_fMaxStamina = 150.0f;
- m_fCurrentStamina = m_fMaxStamina;
+#ifndef FIX_BUGS
+ m_fCurrentStamina = m_fMaxStamina = 150.0f;
+#endif
m_fStaminaProgress = 0.0f;
m_nEvadeAmount = 0;
field_1367 = 0;
@@ -227,7 +231,7 @@ CPlayerPed::SetInitialState(void)
{
m_bAdrenalineActive = false;
m_nAdrenalineTime = 0;
- CTimer::SetTimeStep(1.0f);
+ CTimer::SetTimeScale(1.0f);
m_pSeekTarget = nil;
m_vecSeekPos = { 0.0f, 0.0f, 0.0f };
m_fleeFromPosX = 0.0f;
@@ -1058,6 +1062,9 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
}
#ifdef FREE_CAM
+ static int8 changedHeadingRate = 0;
+ if (changedHeadingRate == 2) changedHeadingRate = 1;
+
// Rotate player/arm when shooting. We don't have auto-rotation anymore
if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam &&
m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
@@ -1081,6 +1088,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#endif
} else {
m_fRotationDest = limitedCam;
+ changedHeadingRate = 2;
m_headingRate = 50.0f;
// Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly)
@@ -1099,10 +1107,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
}
} else if (weaponInfo->m_bCanAimWithArm)
ClearPointGunAt();
- else
- RestoreHeadingRate();
}
}
+ if (changedHeadingRate == 1) {
+ changedHeadingRate = 0;
+ RestoreHeadingRate();
+ }
#endif
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
@@ -1347,7 +1357,7 @@ CPlayerPed::ProcessControl(void)
case PED_WANDER_PATH:
case PED_PURSUE:
case PED_FOLLOW_PATH:
- case PED_ROCKET_ODE:
+ case PED_ROCKET_MODE:
case PED_DUMMY:
case PED_PAUSE:
case PED_FACE_PHONE:
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 1566ba3d..e2257a28 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -966,18 +966,11 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (!obj)
return;
- bool makeInvisible;
CWorld::Remove(dummy);
delete dummy;
CWorld::Add(obj);
- int16 mi = obj->GetModelIndex();
- if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 ||
- mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8)
- makeInvisible = true;
- else
- makeInvisible = false;
- if (makeInvisible) {
+ if (IsGlass(obj->GetModelIndex())) {
obj->bIsVisible = false;
} else if (obj->GetModelIndex() == MI_BUOY) {
obj->bIsStatic = false;
@@ -996,17 +989,8 @@ CPopulation::ConvertToDummyObject(CObject *obj)
dummy->GetMatrix().UpdateRW();
dummy->UpdateRwFrame();
- bool makeInvisible;
- int16 mi = obj->GetModelIndex();
- if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 ||
- mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8)
- makeInvisible = true;
- else
- makeInvisible = false;
-
- if (makeInvisible) {
+ if (IsGlass(obj->GetModelIndex()))
dummy->bIsVisible = false;
- }
CWorld::Remove(obj);
delete obj;
diff --git a/src/render/2dEffect.h b/src/render/2dEffect.h
index 2a71a8d5..628d64c2 100644
--- a/src/render/2dEffect.h
+++ b/src/render/2dEffect.h
@@ -25,8 +25,8 @@ enum {
};
enum {
- ATTRACTORFLAG_ICECREAM,
- ATTRACTORFLAG_STARE
+ ATTRACTORTYPE_ICECREAM,
+ ATTRACTORTYPE_STARE
};
enum {
@@ -44,7 +44,7 @@ public:
float dist;
float range; // of pointlight
float size;
- float shadowRange;
+ float shadowSize;
uint8 lightType; // LIGHT_
uint8 roadReflection;
uint8 flareType;
@@ -60,7 +60,7 @@ public:
};
struct Attractor {
CVector dir;
- uint8 flags;
+ int8 type;
uint8 probability;
};
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index 9c0fde0f..60450213 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -69,8 +69,13 @@ void
CClouds::Update(void)
{
float s = Sin(TheCamera.Orientation - 0.85f);
+#ifdef FIX_BUGS
+ CloudRotation += CWeather::Wind*s*0.0025f*CTimer::GetTimeStepFix();
+ IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f*CTimer::GetTimeStepFix()) * 60.0f;
+#else
CloudRotation += CWeather::Wind*s*0.0025f;
IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f;
+#endif
}
void
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index de3b5c78..5bf89403 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -506,18 +506,18 @@ CCoronas::DoSunAndMoon(void)
{
// yeah, moon is done somewhere else....
- CVector sunCoors = CTimeCycle::GetSunPosition();
+ CVector sunCoors = CTimeCycle::GetSunDirection();
sunCoors *= 150.0f;
sunCoors += TheCamera.GetPosition();
- if(CTimeCycle::GetSunPosition().z > -0.2f){
+ if(CTimeCycle::GetSunDirection().z > -0.2f){
float size = ((CGeneral::GetRandomNumber()&0xFF) * 0.005f + 10.0f) * CTimeCycle::GetSunSize();
RegisterCorona(SUN_CORE,
CTimeCycle::GetSunCoreRed(), CTimeCycle::GetSunCoreGreen(), CTimeCycle::GetSunCoreBlue(),
255, sunCoors, size,
999999.88f, TYPE_STAR, FLARE_NONE, REFLECTION_OFF, LOSCHECK_OFF, STREAK_OFF, 0.0f);
- if(CTimeCycle::GetSunPosition().z > 0.0f)
+ if(CTimeCycle::GetSunDirection().z > 0.0f)
RegisterCorona(SUN_CORONA,
CTimeCycle::GetSunCoronaRed(), CTimeCycle::GetSunCoronaGreen(), CTimeCycle::GetSunCoronaBlue(),
255, sunCoors, 25.0f * CTimeCycle::GetSunSize(),
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index b31cc624..bb37a3a3 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -6,6 +6,7 @@
#ifdef ASPECT_RATIO_SCALE
float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
+float CDraw::ms_fScaledFOV = 45.0f;
#endif
float CDraw::ms_fNearClipZ;
@@ -61,8 +62,7 @@ void
CDraw::SetFOV(float fov)
{
#ifdef ASPECT_RATIO_SCALE
- ms_fFOV = ConvertFOV(fov);
-#else
- ms_fFOV = fov;
+ ms_fScaledFOV = ConvertFOV(fov);
#endif
+ ms_fFOV = fov;
}
diff --git a/src/render/Draw.h b/src/render/Draw.h
index 55958a2a..5c4f95b1 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -16,14 +16,15 @@ private:
static float ms_fNearClipZ;
static float ms_fFarClipZ;
static float ms_fFOV;
-public:
- static float ms_fLODDistance; // set but unused?
-
#ifdef ASPECT_RATIO_SCALE
// we use this variable to scale a lot of 2D elements
// so better cache it
static float ms_fAspectRatio;
+ // similar thing for 3D rendering
+ static float ms_fScaledFOV;
#endif
+public:
+ static float ms_fLODDistance; // set but unused?
static uint8 FadeValue;
static uint8 FadeRed;
@@ -37,6 +38,11 @@ public:
static void SetFOV(float fov);
static float GetFOV(void) { return ms_fFOV; }
+#ifdef ASPECT_RATIO_SCALE
+ static float GetScaledFOV(void) { return ms_fScaledFOV; }
+#else
+ static float GetScaledFOV(void) { return ms_fFOV; }
+#endif
static float FindAspectRatio(void);
#ifdef ASPECT_RATIO_SCALE
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index 1be53825..da29daec 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -142,11 +142,11 @@ void CMovingThings::Init()
void CMovingThings::Shutdown()
{
int i;
- for (i = 0; i < 11; ++i)
+ for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
aScrollBars[i].SetVisibility(false);
- for (i = 0; i < 2; ++i)
+ for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
aTowerClocks[i].SetVisibility(false);
- for (i = 0; i < 3; ++i)
+ for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
aDigitalClocks[i].SetVisibility(false);
}
@@ -168,17 +168,17 @@ void CMovingThings::Update()
aMovingThings[i].Update();
}
- for (i = 0; i < 11; ++i)
+ for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
{
if (aScrollBars[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aScrollBars[i].Update();
}
- for (i = 0; i < 2; ++i)
+ for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
{
if (aTowerClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aTowerClocks[i].Update();
}
- for (i = 0; i < 3; ++i)
+ for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
{
if (aDigitalClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aDigitalClocks[i].Update();
@@ -188,17 +188,17 @@ void CMovingThings::Update()
void CMovingThings::Render()
{
int i;
- for (i = 0; i < 11; ++i)
+ for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
{
if (aScrollBars[i].IsVisible())
aScrollBars[i].Render();
}
- for (i = 0; i < 2; ++i)
+ for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
{
if (aTowerClocks[i].IsVisible())
aTowerClocks[i].Render();
}
- for (i = 0; i < 3; ++i)
+ for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
{
if (aDigitalClocks[i].IsVisible())
aDigitalClocks[i].Render();
@@ -297,7 +297,8 @@ const char* FindDigitalClockMessage()
}
else
{
- int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) * 0.0043611112f - 1.0f);
+ // they didn't use rad2deg here because of 3.14
+ int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) / (4.0f * 180.0f / 3.14f) - 1.0f);
String_DigitalClock[0] = '0' + temperature / 10;
if (String_DigitalClock[0] == '0')
String_DigitalClock[0] = ' ';
@@ -312,7 +313,7 @@ const char* FindDigitalClockMessage()
// ---------- CScrollBar ----------
void CScrollBar::Init(CVector position, uint8 type, float sizeX, float sizeY, float sizeZ, uint8 red, uint8 green, uint8 blue, float scale)
{
- for (int i = 0; i < 40; ++i)
+ for (int i = 0; i < ARRAY_SIZE(m_MessageBar); ++i)
m_MessageBar[i] = 0;
m_pMessage = ". ";
@@ -618,16 +619,16 @@ void CScrollBar::Update()
}
// Scroll
- for (int i = 0; i < 39; i++)
+ for (int i = 0; i < ARRAY_SIZE(m_MessageBar)-1; i++)
m_MessageBar[i] = m_MessageBar[i + 1];
- m_MessageBar[39] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0;
+ m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0;
// Introduce some random displaying glitches; signs aren't supposed to be perfect :P
switch (CGeneral::GetRandomNumber() & 0xFF)
{
- case 0x0D: m_MessageBar[39] = 0; break;
- case 0xE3: m_MessageBar[39] = 0xE3; break;
- case 0x64: m_MessageBar[39] = ~m_MessageBar[39]; break;
+ case 0x0D: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = 0; break;
+ case 0xE3: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = 0xE3; break;
+ case 0x64: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = ~m_MessageBar[ARRAY_SIZE(m_MessageBar)-1]; break;
}
}
@@ -654,7 +655,7 @@ void CScrollBar::Render()
CVector coronaCoord, screenCoord;
float screenW, screenH;
- for (int i = 1; i < 40; ++i)
+ for (int i = 1; i < ARRAY_SIZE(m_MessageBar); ++i)
{
for (int j = 0; j < 5; ++j)
{
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index ef665fae..de7de81a 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -483,6 +483,8 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
xstart;
#ifdef MORE_LANGUAGES
PrintString(xleft, y, start, s, spaceWidth, xstart);
+#else
+ PrintString(xleft, y, start, s, spaceWidth);
#endif
// reset things
lineLength = 0.0f;
diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp
index 6f17013c..ac892ddb 100644
--- a/src/render/Glass.cpp
+++ b/src/render/Glass.cpp
@@ -13,6 +13,7 @@
#include "Shadows.h"
#include "ModelIndices.h"
#include "main.h"
+#include "soundlist.h"
uint32 CGlass::NumGlassEntities;
@@ -101,7 +102,7 @@ CFallingGlassPane::Update(void)
pos = CVector(GetPosition().x, GetPosition().y, m_fGroundZ);
- PlayOneShotScriptObject(_SCRSOUND_GLASS_SHARD, pos);
+ PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_LIGHT_BREAK, pos);
RwRGBA color = { 255, 255, 255, 255 };
@@ -627,7 +628,7 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed,
if ( amount > 300.0f )
{
- PlayOneShotScriptObject(_SCRSOUND_GLASS_SMASH_1, object->GetPosition());
+ PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_BREAK_L, object->GetPosition());
GeneratePanesForWindow(0,
CVector(minx, miny, minz),
@@ -637,7 +638,7 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed,
}
else
{
- PlayOneShotScriptObject(_SCRSOUND_GLASS_SMASH_2, object->GetPosition());
+ PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_BREAK_S, object->GetPosition());
GeneratePanesForWindow(1,
CVector(minx, miny, minz),
@@ -659,7 +660,7 @@ CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount)
if ( amount > 50.0f && !object->bGlassCracked )
{
- PlayOneShotScriptObject(_SCRSOUND_GLASS_CRACK, object->GetPosition());
+ PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_CRACK, object->GetPosition());
object->bGlassCracked = true;
}
}
@@ -675,7 +676,7 @@ CGlass::WasGlassHitByBullet(CEntity *entity, CVector point)
{
if ( !object->bGlassCracked )
{
- PlayOneShotScriptObject(_SCRSOUND_GLASS_CRACK, object->GetPosition());
+ PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_CRACK, object->GetPosition());
object->bGlassCracked = true;
}
else
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index a39408cd..1e536382 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -21,6 +21,26 @@
#include "User.h"
#include "World.h"
+// Game has colors inlined in code.
+// For easier modification we collect them here:
+CRGBA MONEY_COLOR(89, 115, 150, 255);
+CRGBA AMMO_COLOR(0, 0, 0, 255);
+CRGBA HEALTH_COLOR(186, 101, 50, 255);
+CRGBA ARMOUR_COLOR(124, 140, 95, 255);
+CRGBA WANTED_COLOR(193, 164, 120, 255);
+CRGBA ZONE_COLOR(152, 154, 82, 255);
+CRGBA VEHICLE_COLOR(194, 165, 120, 255);
+CRGBA CLOCK_COLOR(194, 165, 120, 255);
+CRGBA TIMER_COLOR(186, 101, 50, 255);
+CRGBA COUNTER_COLOR(0, 106, 164, 255);
+CRGBA PAGER_COLOR(32, 162, 66, 205);
+CRGBA RADARDISC_COLOR(0, 0, 0, 255);
+CRGBA BIGMESSAGE_COLOR(85, 119, 133, 255);
+CRGBA WASTEDBUSTED_COLOR(170, 123, 87, 255);
+CRGBA ODDJOB_COLOR(89, 115, 150, 255);
+CRGBA ODDJOB2_COLOR(156, 91, 40, 255);
+CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255);
+
wchar CHud::m_HelpMessage[256];
wchar CHud::m_LastHelpMessage[256];
uint32 CHud::m_HelpMessageState;
@@ -111,16 +131,16 @@ void CHud::Draw()
return;
if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) {
- bool DrawCrossHair = 0;
- bool DrawCrossHairPC = 0;
+ bool DrawCrossHair = false;
+ bool DrawCrossHairPC = false;
int32 WeaponType = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_eWeaponType;
int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_M16_1STPERSON || Mode == CCam::MODE_HELICANNON_1STPERSON)
- DrawCrossHair = 1;
+ DrawCrossHair = true;
if (Mode == CCam::MODE_M16_1STPERSON_RUNABOUT || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT || Mode == CCam::MODE_SNIPER_RUNABOUT)
- DrawCrossHairPC = 1;
+ DrawCrossHairPC = true;
/*
Draw Crosshairs
@@ -129,7 +149,7 @@ void CHud::Draw()
(!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == CCam::MODE_1STPERSON_RUNABOUT) {
if (FindPlayerPed() && !FindPlayerPed()->EnteringCar()) {
if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER)
- DrawCrossHairPC = 1;
+ DrawCrossHairPC = true;
}
}
@@ -252,7 +272,7 @@ void CHud::Draw()
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(43.0f + 2.0f), sPrint);
- CFont::SetColor(CRGBA(89, 115, 150, 255));
+ CFont::SetColor(MONEY_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint);
/*
@@ -312,7 +332,7 @@ void CHud::Draw()
CFont::SetFontStyle(FONT_BANK);
if (!CDarkel::FrenzyOnGoing() && WeaponType != WEAPONTYPE_UNARMED && WeaponType != WEAPONTYPE_BASEBALLBAT) {
- CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::SetColor(AMMO_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(66.0f), SCREEN_SCALE_Y(73.0f), sPrint);
}
@@ -349,7 +369,7 @@ void CHud::Draw()
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) {
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon);
}
- CFont::SetColor(CRGBA(186, 101, 50, 255));
+ CFont::SetColor(HEALTH_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint);
@@ -380,7 +400,7 @@ void CHud::Draw()
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon);
}
- CFont::SetColor(CRGBA(124, 140, 95, 255));
+ CFont::SetColor(ARMOUR_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint);
@@ -410,7 +430,7 @@ void CHud::Draw()
&& (CTimer::GetTimeInMilliseconds() > FindPlayerPed()->m_pWanted->m_nLastWantedLevelChange
+ 2000 || CTimer::GetFrameCounter() & 4)) {
- CFont::SetColor(CRGBA(193, 164, 120, 255));
+ CFont::SetColor(WANTED_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(60.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
}
}
@@ -504,7 +524,7 @@ void CHud::Draw()
CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint);
- CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha));
+ CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint);
}
}
@@ -598,7 +618,7 @@ void CHud::Draw()
CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint);
- CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha));
+ CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint);
}
}
@@ -630,7 +650,7 @@ void CHud::Draw()
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), sPrint);
- CFont::SetColor(CRGBA(194, 165, 120, 255));
+ CFont::SetColor(CLOCK_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
/*
@@ -674,7 +694,7 @@ void CHud::Draw()
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), sTimer);
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
- CFont::SetColor(CRGBA(186, 101, 50, 255));
+ CFont::SetColor(TIMER_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(110.0f), sTimer);
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) {
@@ -683,7 +703,7 @@ void CHud::Draw()
CFont::SetScale(SCREEN_SCALE_X(0.64f), SCREEN_SCALE_Y(1.35f));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
- CFont::SetColor(CRGBA(186, 101, 50, 255));
+ CFont::SetColor(TIMER_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f), SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
}
}
@@ -718,7 +738,7 @@ void CHud::Draw()
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), sTimer);
- CFont::SetColor(CRGBA(0, 106, 164, 255));
+ CFont::SetColor(COUNTER_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(132.0f), sTimer);
} else {
int counter = atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer);
@@ -735,7 +755,7 @@ void CHud::Draw()
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
- CFont::SetColor(CRGBA(0, 106, 164, 255));
+ CFont::SetColor(COUNTER_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f), SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
}
}
@@ -782,7 +802,7 @@ void CHud::Draw()
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.84f), SCREEN_SCALE_Y(1.0f));
- CFont::SetColor(CRGBA(32, 162, 66, 205));
+ CFont::SetColor(PAGER_COLOR);
CFont::SetRightJustifyOff();
CFont::SetBackgroundOff();
CFont::SetCentreOff();
@@ -804,7 +824,7 @@ void CHud::Draw()
rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
#endif
rect.Grow(4.0f);
- Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255));
+ Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR);
CRadar::DrawBlips();
}
}
@@ -959,7 +979,7 @@ void CHud::Draw()
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]);
#endif
- CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0]));
+ CFont::SetColor(CRGBA(BIGMESSAGE_COLOR.r, BIGMESSAGE_COLOR.g, BIGMESSAGE_COLOR.b, BigMessageAlpha[0]));
CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f), m_BigMessage[0]);
}
else {
@@ -994,7 +1014,7 @@ void CHud::Draw()
CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]);
- CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2]));
+ CFont::SetColor(CRGBA(WASTEDBUSTED_COLOR.r, WASTEDBUSTED_COLOR.g, WASTEDBUSTED_COLOR.b, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
}
else {
@@ -1024,7 +1044,7 @@ void CHud::DrawAfterFade()
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
- DMAudio.PlayFrontEndSound(SOUND_A0, 0);
+ DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
break;
case 1:
case 2:
@@ -1186,7 +1206,7 @@ void CHud::DrawAfterFade()
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]);
- CFont::SetColor(CRGBA(89, 115, 150, 255));
+ CFont::SetColor(ODDJOB_COLOR);
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[3]);
}
@@ -1202,7 +1222,7 @@ void CHud::DrawAfterFade()
CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]);
- CFont::SetColor(CRGBA(89, 115, 150, 255));
+ CFont::SetColor(ODDJOB_COLOR);
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[4]);
}
@@ -1260,12 +1280,12 @@ void CHud::DrawAfterFade()
#ifdef BETA_SLIDING_TEXT
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);
- CFont::SetColor(CRGBA(156, 91, 40, 255));
+ CFont::SetColor(ODDJOB2_COLOR);
CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]);
#else
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]);
- CFont::SetColor(CRGBA(156, 91, 40, 255));
+ CFont::SetColor(ODDJOB2_COLOR);
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]);
#endif
}
@@ -1310,7 +1330,7 @@ void CHud::DrawAfterFade()
CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]);
- CFont::SetColor(CRGBA(220, 172, 2, BigMessageAlpha[1]));
+ CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]);
}
else {
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 4223ac10..a867ae13 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -11,6 +11,7 @@
#include "AudioScriptObject.h"
#include "ParticleObject.h"
#include "Particle.h"
+#include "soundlist.h"
#define MAX_PARTICLES_ON_SCREEN (1000)
@@ -1268,7 +1269,7 @@ void CParticle::Update()
nil,
particle->m_fSize, color, particle->m_nRotationStep, 0, 0, 0);
- PlayOneShotScriptObject(_SCRSOUND_BULLET_SHELL_HIT_GROUND_1, particle->m_vecPosition);
+ PlayOneShotScriptObject(SCRIPT_SOUND_GUNSHELL_DROP, particle->m_vecPosition);
}
break;
@@ -1287,7 +1288,7 @@ void CParticle::Update()
nil,
particle->m_fSize, color, 0, 0, 0, 0);
- PlayOneShotScriptObject(_SCRSOUND_BULLET_SHELL_HIT_GROUND_2, particle->m_vecPosition);
+ PlayOneShotScriptObject(SCRIPT_SOUND_GUNSHELL_DROP_SOFT, particle->m_vecPosition);
}
break;
diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp
index 69f9dce0..d07c302a 100644
--- a/src/render/Shadows.cpp
+++ b/src/render/Shadows.cpp
@@ -642,12 +642,12 @@ CShadows::StoreShadowForPole(CEntity *pPole, float fOffsetX, float fOffsetY, flo
PolePos.y += fOffsetX * pPole->GetRight().y + fOffsetY * pPole->GetForward().y;
PolePos.z += fOffsetZ;
- PolePos.x += -CTimeCycle::GetSunPosition().x * (fPoleHeight / 2);
- PolePos.y += -CTimeCycle::GetSunPosition().y * (fPoleHeight / 2);
+ PolePos.x += -CTimeCycle::GetSunDirection().x * (fPoleHeight / 2);
+ PolePos.y += -CTimeCycle::GetSunDirection().y * (fPoleHeight / 2);
StoreStaticShadow((uintptr)pPole + nID + _TODOCONST(51), SHADOWTYPE_DARK, gpPostShadowTex, &PolePos,
- -CTimeCycle::GetSunPosition().x * (fPoleHeight / 2),
- -CTimeCycle::GetSunPosition().y * (fPoleHeight / 2),
+ -CTimeCycle::GetSunDirection().x * (fPoleHeight / 2),
+ -CTimeCycle::GetSunDirection().y * (fPoleHeight / 2),
CTimeCycle::GetShadowSideX() * fPoleWidth,
CTimeCycle::GetShadowSideY() * fPoleWidth,
2 * (int32)((pPole->GetUp().z - 0.5f) * CTimeCycle::GetShadowStrength() * 2.0f) / 3,
diff --git a/src/render/Skidmarks.h b/src/render/Skidmarks.h
index 085b4c6d..c061782d 100644
--- a/src/render/Skidmarks.h
+++ b/src/render/Skidmarks.h
@@ -11,7 +11,7 @@ public:
bool m_isMuddy;
uintptr m_id;
int16 m_last;
- uint32 m_lastUpdate;;
+ uint32 m_lastUpdate;
uint32 m_fadeStart;
uint32 m_fadeEnd;
CVector m_pos[SKIDMARK_LENGTH];
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index 1dd1aaab..0789769a 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -22,8 +22,8 @@ CSprite::CalcHorizonCoors(void)
bool
CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, bool farclip)
{
- CVector viewvec = TheCamera.m_viewMatrix * *(CVector*)&in;
- *out = *(RwV3d*)&viewvec;
+ CVector viewvec = TheCamera.m_viewMatrix * in;
+ *out = viewvec;
if(out->z <= CDraw::GetNearClipZ() + 1.0f) return false;
if(out->z >= CDraw::GetFarClipZ() && farclip) return false;
float recip = 1.0f/out->z;
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index 84b6f2fe..162983dd 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -298,7 +298,7 @@ CTimeCycle::Update(void)
m_CurrentStoredValue = (m_CurrentStoredValue+1)&0xF;
float sunAngle = 2*PI*(CClock::GetMinutes() + CClock::GetHours()*60)/(24*60);
- CVector &sunPos = GetSunPosition();
+ CVector &sunPos = GetSunDirection();
sunPos.x = Sin(sunAngle);
sunPos.y = 1.0f;
sunPos.z = 0.2f - Cos(sunAngle);
diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h
index 28a0b7dd..0cb02b67 100644
--- a/src/render/Timecycle.h
+++ b/src/render/Timecycle.h
@@ -122,7 +122,7 @@ public:
static float GetSpriteSize(void) { return m_fCurrentSpriteSize; }
static int GetShadowStrength(void) { return m_nCurrentShadowStrength; }
static int GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; }
- static int GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
+ static float GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
static float GetFarClip(void) { return m_fCurrentFarClip; }
static float GetFogStart(void) { return m_fCurrentFogStart; }
@@ -142,7 +142,7 @@ public:
static void Initialise(void);
static void Update(void);
- static CVector &GetSunPosition(void) { return m_VectorToSun[m_CurrentStoredValue]; }
+ static CVector &GetSunDirection(void) { return m_VectorToSun[m_CurrentStoredValue]; }
static float GetShadowFrontX(void) { return m_fShadowFrontX[m_CurrentStoredValue]; }
static float GetShadowFrontY(void) { return m_fShadowFrontY[m_CurrentStoredValue]; }
static float GetShadowSideX(void) { return m_fShadowSideX[m_CurrentStoredValue]; }
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index 1a28ce83..6133b1d7 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -35,6 +35,8 @@ bool CWaterLevel::WavesCalculatedThisFrame;
RpAtomic *CWaterLevel::ms_pWavyAtomic;
RpGeometry *CWaterLevel::apGeomArray[8];
int16 CWaterLevel::nGeomUsed;
+//"Custom" Don´t Render Water Toggle
+bool gbDontRenderWater;
//RwTexture *gpWaterTex;
//RwRaster *gpWaterRaster;
@@ -332,6 +334,11 @@ SectorRadius(float fSize)
void
CWaterLevel::RenderWater()
{
+//"Custom" Don´t Render Water Toggle
+#ifndef MASTER
+ if (gbDontRenderWater)
+ return;
+#endif
bool bUseCamEndX = false;
bool bUseCamStartY = false;
diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h
index 985c9744..269d6091 100644
--- a/src/render/WaterLevel.h
+++ b/src/render/WaterLevel.h
@@ -65,6 +65,7 @@
#define MAX_BOAT_WAKES 8
extern RwRaster* gpWaterRaster;
+extern bool gbDontRenderWater;
class CWaterLevel
{
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 5026e2c8..cd2a1bf6 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -59,6 +59,16 @@ void FlushObrsPrintfs()
void *
RwMallocAlign(RwUInt32 size, RwUInt32 align)
{
+#ifdef FIX_BUGS
+ uintptr ptralign = align-1;
+ void *mem = (void *)malloc(size + sizeof(uintptr) + ptralign);
+
+ ASSERT(mem != nil);
+
+ void *addr = (void *)((((uintptr)mem) + sizeof(uintptr) + ptralign) & ~ptralign);
+
+ ASSERT(addr != nil);
+#else
void *mem = (void *)malloc(size + align);
ASSERT(mem != nil);
@@ -66,6 +76,7 @@ RwMallocAlign(RwUInt32 size, RwUInt32 align)
void *addr = (void *)((((uintptr)mem) + align) & ~(align - 1));
ASSERT(addr != nil);
+#endif
*(((void **)addr) - 1) = mem;
@@ -308,14 +319,20 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier)
RpHAnimAnimation *anim = RpHAnimAnimationCreate(rpHANIMSTDKEYFRAMETYPEID, numNodes, 0, 0.0f);
if(anim == nil)
return nil;
- RpHAnimStdKeyFrame *frame = (RpHAnimStdKeyFrame*)HANIMFRAMES(anim);
+ RpHAnimStdKeyFrame *frame;
for(i = 0; i < numNodes; i++){
+ frame = (RpHAnimStdKeyFrame*)HANIMFRAME(anim, i); // games uses struct size here, not safe
frame->q.real = 1.0f;
frame->q.imag.x = frame->q.imag.y = frame->q.imag.z = 0.0f;
frame->t.x = frame->t.y = frame->t.z = 0.0f;
+#ifdef FIX_BUGS
+ // times are subtracted and divided giving NaNs
+ // so they can't both be 0
+ frame->time = i/hier->numNodes;
+#else
frame->time = 0.0f;
+#endif
frame->prevFrame = nil;
- frame++;
}
return anim;
}
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 8aae4011..eff0f2ff 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -42,6 +42,11 @@
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
+#ifdef MISSION_REPLAY
+int8 IsQuickSave;
+const int PAUSE_SAVE_SLOT = SLOT_COUNT;
+#endif
+
char DefaultPCSaveFileName[260];
char ValidSaveName[260];
char LoadFileName[256];
@@ -134,7 +139,12 @@ GenericSave(int file)
WriteDataToBufferPointer(buf, saveName);
GetLocalTime(&saveTime);
WriteDataToBufferPointer(buf, saveTime);
+#ifdef MISSION_REPLAY
+ int32 data = IsQuickSave << 24 | SIZE_OF_ONE_GAME_IN_BYTES;
+ WriteDataToBufferPointer(buf, data);
+#else
WriteDataToBufferPointer(buf, SIZE_OF_ONE_GAME_IN_BYTES);
+#endif
WriteDataToBufferPointer(buf, CGame::currLevel);
WriteDataToBufferPointer(buf, TheCamera.GetPosition().x);
WriteDataToBufferPointer(buf, TheCamera.GetPosition().y);
@@ -240,6 +250,9 @@ GenericLoad()
uint8 *buf;
int32 file;
uint32 size;
+#ifdef MISSION_REPLAY
+ int8 qs;
+#endif
int32 saveSize;
CPad *currPad;
@@ -254,6 +267,9 @@ GenericLoad()
ReadDataFromFile(file, work_buff, size);
buf = (work_buff + 0x40);
ReadDataFromBufferPointer(buf, saveSize);
+#ifdef MISSION_REPLAY // a hack to keep compatibility but get new data from save
+ qs = saveSize >> 24;
+#endif
ReadDataFromBufferPointer(buf, CGame::currLevel);
ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().x);
ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().y);
@@ -296,6 +312,11 @@ GenericLoad()
ReadDataFromBufferPointer(buf, TheCamera.PedZoomIndicator);
#endif
assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
+#ifdef MISSION_REPLAY
+ WaitForSave = 0;
+ if (FrontEndMenuManager.m_nCurrSaveSlot == PAUSE_SAVE_SLOT && qs == 3)
+ WaitForMissionActivate = CTimer::GetTimeInMilliseconds() + 2000;
+#endif
ReadDataFromBlock("Loading Scripts \n", CTheScripts::LoadAllScripts);
// Load the rest
@@ -563,3 +584,27 @@ align4bytes(int32 size)
{
return (size + 3) & 0xFFFFFFFC;
}
+
+#ifdef MISSION_REPLAY
+
+void DisplaySaveResult(int unk, char* name)
+{}
+
+bool SaveGameForPause(int type)
+{
+ if (AllowMissionReplay != 0 || type != 3 && WaitForSave > CTimer::GetTimeInMilliseconds())
+ return false;
+ WaitForSave = 0;
+ if (gGameState != GS_PLAYING_GAME || CTheScripts::IsPlayerOnAMission() || CStats::LastMissionPassedName[0] == '\0') {
+ DisplaySaveResult(3, CStats::LastMissionPassedName);
+ return false;
+ }
+ IsQuickSave = type;
+ MissionStartTime = 0;
+ int res = PcSaveHelper.SaveSlot(PAUSE_SAVE_SLOT);
+ PcSaveHelper.PopulateSlotInfo();
+ IsQuickSave = 0;
+ DisplaySaveResult(res, CStats::LastMissionPassedName);
+ return true;
+}
+#endif
diff --git a/src/save/GenericGameStorage.h b/src/save/GenericGameStorage.h
index b913c305..ee8a52a1 100644
--- a/src/save/GenericGameStorage.h
+++ b/src/save/GenericGameStorage.h
@@ -40,4 +40,10 @@ extern uint32 TimeToStayFadedBeforeFadeOut;
extern char SaveFileNameJustSaved[260]; // 8F2570
-const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; \ No newline at end of file
+const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET";
+
+#ifdef MISSION_REPLAY
+extern int8 IsQuickSave; // originally int
+
+bool SaveGameForPause(int);
+#endif
diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp
index 3dc80f73..3103c7ab 100644
--- a/src/save/PCSave.cpp
+++ b/src/save/PCSave.cpp
@@ -41,7 +41,10 @@ C_PcSave::SaveSlot(int32 slot)
_psGetUserFilesFolder();
int file = CFileMgr::OpenFile(ValidSaveName, "wb");
if (file != 0) {
- DoGameSpecificStuffBeforeSave();
+#ifdef MISSION_REPLAY
+ if (!IsQuickSave)
+#endif
+ DoGameSpecificStuffBeforeSave();
if (GenericSave(file)) {
if (!!CFileMgr::CloseFile(file))
nErrorCode = SAVESTATUS_ERR_SAVE_CLOSE;
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index fc23e900..3ef0ab63 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -274,7 +274,7 @@ psNativeTextureSupport(void)
*****************************************************************************
*/
RwBool
-psInitialise(void)
+psInitialize(void)
{
PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f;
@@ -789,7 +789,7 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode)
useDefault = TRUE;
- if ( RsEventHandler(rsRWINITIALISE, &openParams) == rsEVENTERROR )
+ if ( RsEventHandler(rsRWINITIALIZE, &openParams) == rsEVENTERROR )
return FALSE;
RwInitialised = TRUE;
@@ -1312,7 +1312,7 @@ main(int argc, char *argv[])
* Initialize the platform independent data.
* This will in turn initialize the platform specific data...
*/
- if( RsEventHandler(rsINITIALISE, nil) == rsEVENTERROR )
+ if( RsEventHandler(rsINITIALIZE, nil) == rsEVENTERROR )
{
return FALSE;
}
@@ -1355,7 +1355,7 @@ main(int argc, char *argv[])
/*
* Initialize the 3D (RenderWare) components of the app...
*/
- if( rsEVENTERROR == RsEventHandler(rsRWINITIALISE, &openParams) )
+ if( rsEVENTERROR == RsEventHandler(rsRWINITIALIZE, &openParams) )
{
RsEventHandler(rsTERMINATE, nil);
@@ -1747,7 +1747,7 @@ void CapturePad(RwInt32 padID)
void joysChangeCB(int jid, int event)
{
- if (event == GLFW_CONNECTED)
+ if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid))
{
if (PSGLOBAL(joy1id) == -1)
PSGLOBAL(joy1id) = jid;
diff --git a/src/skel/platform.h b/src/skel/platform.h
index 65e20673..cbb1be28 100644
--- a/src/skel/platform.h
+++ b/src/skel/platform.h
@@ -15,7 +15,7 @@ extern RwUInt32 psTimer(void);
extern double psTimer(void);
#endif
-extern RwBool psInitialise(void);
+extern RwBool psInitialize(void);
extern void psTerminate(void);
extern void psCameraShowRaster(RwCamera *camera);
diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp
index 5191eda7..8191107e 100644
--- a/src/skel/skeleton.cpp
+++ b/src/skel/skeleton.cpp
@@ -246,8 +246,8 @@ RsEventHandler(RsEvent event, void *param)
result = (rsEVENTPROCESSED);
break;
- case rsRWINITIALISE:
- result = (RsRwInitialise(param) ?
+ case rsRWINITIALIZE:
+ result = (RsRwInitialize(param) ?
rsEVENTPROCESSED : rsEVENTERROR);
break;
@@ -256,9 +256,9 @@ RsEventHandler(RsEvent event, void *param)
result = (rsEVENTPROCESSED);
break;
- case rsINITIALISE:
+ case rsINITIALIZE:
result =
- (RsInitialise()? rsEVENTPROCESSED : rsEVENTERROR);
+ (RsInitialize()? rsEVENTPROCESSED : rsEVENTERROR);
break;
default:
@@ -294,7 +294,7 @@ RsRwTerminate(void)
*****************************************************************************
*/
RwBool
-RsRwInitialise(void *displayID)
+RsRwInitialize(void *displayID)
{
RwEngineOpenParams openParams;
@@ -383,7 +383,7 @@ RsTerminate(void)
*****************************************************************************
*/
RwBool
-RsInitialise(void)
+RsInitialize(void)
{
/*
* Initialize Platform independent data...
@@ -415,7 +415,7 @@ RsInitialise(void)
RsGlobal.pad.inputEventHandler = nil;
RsGlobal.pad.used = FALSE;
- result = psInitialise();
+ result = psInitialize();
return result;
}
diff --git a/src/skel/skeleton.h b/src/skel/skeleton.h
index 8303bd9a..b5ea5abf 100644
--- a/src/skel/skeleton.h
+++ b/src/skel/skeleton.h
@@ -61,10 +61,10 @@ enum RsEvent
_rs_18,
_rs_19,
_rs_20,
- rsRWINITIALISE,
+ rsRWINITIALIZE,
rsRWTERMINATE,
rsSELECTDEVICE,
- rsINITIALISE,
+ rsINITIALIZE,
rsTERMINATE,
rsIDLE,
rsFRONTENDIDLE,
@@ -241,19 +241,19 @@ extern RsEventStatus RsEventHandler(RsEvent event, void *param);
extern RsEventStatus RsKeyboardEventHandler(RsEvent event, void *param);
extern RsEventStatus RsPadEventHandler(RsEvent event, void *param);
-extern RwBool
-RsInitialise(void);
+extern RwBool
+RsInitialize(void);
-extern RwBool
+extern RwBool
RsRegisterImageLoader(void);
-extern RwBool
-RsRwInitialise(void *param);
+extern RwBool
+RsRwInitialize(void *param);
-extern RwBool
+extern RwBool
RsSelectDevice(void);
-extern RwBool
+extern RwBool
RsInputDeviceAttach(RsInputDeviceType inputDevice,
RsInputEventHandler inputEventHandler);
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index 2b083f06..d923d93d 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -586,7 +586,7 @@ void _psPrintCpuInfo()
*****************************************************************************
*/
RwBool
-psInitialise(void)
+psInitialize(void)
{
PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f;
@@ -1570,7 +1570,7 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode)
useDefault = TRUE;
- if ( RsEventHandler(rsRWINITIALISE, PSGLOBAL(window)) == rsEVENTERROR )
+ if ( RsEventHandler(rsRWINITIALIZE, PSGLOBAL(window)) == rsEVENTERROR )
return FALSE;
RwInitialised = TRUE;
@@ -1940,7 +1940,7 @@ WinMain(HINSTANCE instance,
* Initialize the platform independent data.
* This will in turn initialize the platform specific data...
*/
- if( RsEventHandler(rsINITIALISE, nil) == rsEVENTERROR )
+ if( RsEventHandler(rsINITIALIZE, nil) == rsEVENTERROR )
{
return FALSE;
}
@@ -2006,7 +2006,7 @@ WinMain(HINSTANCE instance,
/*
* Initialize the 3D (RenderWare) components of the app...
*/
- if( rsEVENTERROR == RsEventHandler(rsRWINITIALISE, PSGLOBAL(window)) )
+ if( rsEVENTERROR == RsEventHandler(rsRWINITIALIZE, PSGLOBAL(window)) )
{
DestroyWindow(PSGLOBAL(window));
diff --git a/src/text/Text.cpp b/src/text/Text.cpp
index 926ccd1c..c9e22a84 100644
--- a/src/text/Text.cpp
+++ b/src/text/Text.cpp
@@ -97,7 +97,11 @@ CText::Unload(void)
wchar*
CText::Get(const char *key)
{
+#ifdef FIX_BUGS
+ return keyArray.Search(key, data.chars);
+#else
return keyArray.Search(key);
+#endif
}
wchar UpperCaseTable[128] = {
@@ -196,9 +200,11 @@ CKeyArray::Unload(void)
void
CKeyArray::Update(wchar *chars)
{
+#ifndef FIX_BUGS
int i;
for(i = 0; i < numEntries; i++)
entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value);
+#endif
}
CKeyEntry*
@@ -222,15 +228,25 @@ CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 hi
}
wchar*
+#ifdef FIX_BUGS
+CKeyArray::Search(const char *key, wchar *data)
+#else
CKeyArray::Search(const char *key)
+#endif
{
CKeyEntry *found;
char errstr[25];
int i;
+#ifdef FIX_BUGS
+ found = BinarySearch(key, entries, 0, numEntries-1);
+ if(found)
+ return (wchar*)((uint8*)data + found->valueOffset);
+#else
found = BinarySearch(key, entries, 0, numEntries-1);
if(found)
return found->value;
+#endif
sprintf(errstr, "%s missing", key);
for(i = 0; i < 25; i++)
WideErrorString[i] = errstr[i];
diff --git a/src/text/Text.h b/src/text/Text.h
index cb6a88c0..bd6544d2 100644
--- a/src/text/Text.h
+++ b/src/text/Text.h
@@ -11,7 +11,11 @@ void TextCopy(wchar *dst, const wchar *src);
struct CKeyEntry
{
+#ifdef FIX_BUGS
+ uint32 valueOffset;
+#else
wchar *value;
+#endif
char key[8];
};
@@ -30,7 +34,11 @@ public:
void Unload(void);
void Update(wchar *chars);
CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high);
+#ifdef FIX_BUGS
+ wchar *Search(const char *key, wchar *data);
+#else
wchar *Search(const char *key);
+#endif
};
class CData
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 83fe44d5..eb1bad97 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -67,7 +67,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id);
m_fFireBlowUpTimer = 0.0f;
- field_4E0 = 0;
+ m_auto_unk1 = 0;
bTaxiLight = m_sAllTaxiLights;
bFixedColour = false;
bBigWheels = false;
@@ -77,8 +77,8 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId);
- field_49C = 20.0f;
- field_4D8 = 0;
+ m_auto_unused1 = 20.0f;
+ m_auto_unused2 = 0;
mi->ChooseVehicleColour(m_currentColour1, m_currentColour2);
@@ -145,8 +145,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
for(i = 0; i < 4; i++){
m_aGroundPhysical[i] = nil;
m_aGroundOffset[i] = CVector(0.0f, 0.0f, 0.0f);
- m_aSuspensionSpringRatio[i] = 1.0f;
- m_aSuspensionSpringRatioPrev[i] = m_aSuspensionSpringRatio[i];
+ m_aSuspensionSpringRatioPrev[i] = m_aSuspensionSpringRatio[i] = 1.0f;
m_aWheelTimer[i] = 0.0f;
m_aWheelRotation[i] = 0.0f;
m_aWheelSpeed[i] = 0.0f;
@@ -175,7 +174,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
m_nNumPassengers = 0;
m_bombType = CARBOMB_NONE;
- bHadDriver = false;
+ bDriverLastFrame = false;
m_pBombRigger = nil;
if(m_nDoorLock == CARLOCK_UNLOCKED &&
@@ -221,6 +220,7 @@ void
CAutomobile::ProcessControl(void)
{
int i;
+ float wheelRot;
CColModel *colModel;
if(bUsingSpecialColModel)
@@ -236,23 +236,16 @@ CAutomobile::ProcessControl(void)
// Improve grip of vehicles in certain cases
bool strongGrip1 = false;
bool strongGrip2 = false;
- if(FindPlayerVehicle() && this != FindPlayerVehicle()){
- switch(AutoPilot.m_nCarMission){
- case MISSION_RAMPLAYER_FARAWAY:
- case MISSION_RAMPLAYER_CLOSE:
- case MISSION_BLOCKPLAYER_FARAWAY:
- case MISSION_BLOCKPLAYER_CLOSE:
- if(FindPlayerSpeed().Magnitude() > 0.3f){
- strongGrip1 = true;
- if(FindPlayerSpeed().Magnitude() > 0.4f){
- if(m_vecMoveSpeed.Magnitude() < 0.3f)
- strongGrip2 = true;
- }else{
- if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f)
- strongGrip2 = true;
- }
- }
- default: break;
+ if(FindPlayerVehicle() && this != FindPlayerVehicle() &&
+ (AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE ||
+ AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE)){
+ if(FindPlayerSpeed().Magnitude() > 0.3f){
+ strongGrip1 = true;
+ if(FindPlayerSpeed().Magnitude() > 0.4f &&
+ m_vecMoveSpeed.Magnitude() < 0.3f)
+ strongGrip2 = true;
+ else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f)
+ strongGrip2 = true;
}
}
@@ -263,7 +256,7 @@ CAutomobile::ProcessControl(void)
// Scan if this car sees the player committing any crimes
if(GetStatus() != STATUS_ABANDONED && GetStatus() != STATUS_WRECKED &&
- GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PLAYER_DISABLED){
+ GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PLAYER_DISABLED){
switch(GetModelIndex())
case MI_FBICAR:
case MI_POLICE:
@@ -276,7 +269,7 @@ CAutomobile::ProcessControl(void)
// Process driver
if(pDriver){
- if(!bHadDriver && m_bombType == CARBOMB_ONIGNITIONACTIVE){
+ if(!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE){
// If someone enters the car and there is a bomb, detonate
m_nBombTimer = 1000;
m_pBlowUpEntity = m_pBombRigger;
@@ -284,7 +277,7 @@ CAutomobile::ProcessControl(void)
m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
}
- bHadDriver = true;
+ bDriverLastFrame = true;
if(IsUpsideDown() && CanPedEnterCar()){
if(!pDriver->IsPlayer() &&
@@ -293,7 +286,7 @@ CAutomobile::ProcessControl(void)
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this);
}
}else
- bHadDriver = false;
+ bDriverLastFrame = false;
// Process passengers
if(m_nNumPassengers != 0 && IsUpsideDown() && CanPedEnterCar()){
@@ -380,11 +373,9 @@ CAutomobile::ProcessControl(void)
pHandling->Transmission.CalculateGearForSimpleCar(AutoPilot.m_fMaxTrafficSpeed/50.0f, m_nCurrentGear);
- {
- float wheelRot = ProcessWheelRotation(WHEEL_STATE_NORMAL, GetForward(), m_vecMoveSpeed, 0.35f);
+ wheelRot = ProcessWheelRotation(WHEEL_STATE_NORMAL, GetForward(), m_vecMoveSpeed, 0.35f);
for(i = 0; i < 4; i++)
m_aWheelRotation[i] += wheelRot;
- }
PlayHornIfNecessary();
ReduceHornCounter();
@@ -596,7 +587,7 @@ CAutomobile::ProcessControl(void)
m_aSuspensionSpringRatio[i] = (m_aSuspensionSpringRatio[i]-wheelRadius)/(1.0f-wheelRadius);
}
- float fwdSpeed = DotProduct(m_vecMoveSpeed, GetForward());
+ float fwdSpeed = Abs(DotProduct(m_vecMoveSpeed, GetForward()));
CVector contactPoints[4]; // relative to model
CVector contactSpeeds[4]; // speed at contact points
CVector springDirections[4]; // normalized, in model space
@@ -626,7 +617,7 @@ CAutomobile::ProcessControl(void)
for(i = 0; i < 4; i++){
if(m_aSuspensionSpringRatio[i] < 1.0f){
float bias = pHandling->fSuspensionBias;
- if(i == 1 || i == 3) // rear
+ if(i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT)
bias = 1.0f - bias;
ApplySpringCollision(pHandling->fSuspensionForceLevel,
@@ -634,7 +625,7 @@ CAutomobile::ProcessControl(void)
m_aSuspensionSpringRatio[i], bias);
m_aWheelSkidmarkMuddy[i] =
m_aWheelColPoints[i].surfaceB == SURFACE_GRASS ||
- m_aWheelColPoints[i].surfaceB == SURFACE_DIRTTRACK ||
+ m_aWheelColPoints[i].surfaceB == SURFACE_MUD_DRY ||
m_aWheelColPoints[i].surfaceB == SURFACE_SAND;
}else{
contactPoints[i] = Multiply3x3(GetMatrix(), colModel->lines[i].p1);
@@ -689,7 +680,7 @@ CAutomobile::ProcessControl(void)
float brakeBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fBrakeBias;
float brakeBiasRear = neutralHandling ? 1.0f : 2.0f*(1.0f-pHandling->fBrakeBias);
float tractionBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fTractionBias;
- float tractionBiasRear = neutralHandling ? 1.0f : 2.0f*(1.0f-pHandling->fTractionBias);
+ float tractionBiasRear = neutralHandling ? 1.0f : 2.0f-tractionBiasFront;
// Count how many wheels are touching the ground
@@ -771,7 +762,7 @@ CAutomobile::ProcessControl(void)
else
fThrust = acceleration;
- m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_RUBBER29;
+ m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_WHEELBASE;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_LEFT])*traction;
if(GetStatus() == STATUS_PLAYER)
adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceB);
@@ -805,7 +796,7 @@ CAutomobile::ProcessControl(void)
else
fThrust = acceleration;
- m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_RUBBER29;
+ m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_WHEELBASE;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT])*traction;
if(GetStatus() == STATUS_PLAYER)
adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceB);
@@ -871,8 +862,14 @@ CAutomobile::ProcessControl(void)
CVector wheelFwd = GetForward();
CVector wheelRight = GetRight();
+#ifdef FIX_BUGS
+ // Not sure if this is needed, but brake usually has timestep as a factor
+ if(bIsHandbrakeOn)
+ brake = 20000.0f * CTimer::GetTimeStepFix();
+#else
if(bIsHandbrakeOn)
brake = 20000.0f;
+#endif
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f){
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
@@ -880,7 +877,7 @@ CAutomobile::ProcessControl(void)
else
fThrust = acceleration;
- m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_RUBBER29;
+ m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_WHEELBASE;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_LEFT])*traction;
if(GetStatus() == STATUS_PLAYER)
adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceB);
@@ -914,7 +911,7 @@ CAutomobile::ProcessControl(void)
else
fThrust = acceleration;
- m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_RUBBER29;
+ m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_WHEELBASE;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_RIGHT])*traction;
if(GetStatus() == STATUS_PLAYER)
adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceB);
@@ -1129,10 +1126,10 @@ CAutomobile::ProcessControl(void)
}
uint8 surf = m_aWheelColPoints[i].surfaceB;
- if(surf == SURFACE_DIRT || surf == SURFACE_PUDDLE || surf == SURFACE_HEDGE){
+ if(surf == SURFACE_GRAVEL || surf == SURFACE_WATER || surf == SURFACE_HEDGE){
if(surfShake < 0.2f)
surfShake = 0.3f;
- }else if(surf == SURFACE_DIRTTRACK || surf == SURFACE_SAND){
+ }else if(surf == SURFACE_MUD_DRY || surf == SURFACE_SAND){
if(surfShake < 0.1f)
surfShake = 0.2f;
}else if(surf == SURFACE_GRASS){
@@ -1154,7 +1151,7 @@ CAutomobile::ProcessControl(void)
uint8 freq = Min(200.0f*suspShake*speed*2000.0f/m_fMass + 100.0f, 250.0f);
CPad::GetPad(0)->StartShake(20000.0f*CTimer::GetTimeStep()/freq, freq);
}else{
- uint8 freq = Min(200.0f*surfShake*speed*2000.0f/m_fMass + 40.0f, 145.0f);
+ uint8 freq = Min(200.0f*surfShake*speed*2000.0f/m_fMass + 40.0f, 150.0f);
CPad::GetPad(0)->StartShake(5000.0f*CTimer::GetTimeStep()/freq, freq);
}
}
@@ -1296,7 +1293,7 @@ CAutomobile::PreRender(void)
int drawParticles = Abs(fwdSpeed) < 90.0f;
if(GetStatus() == STATUS_SIMPLE || GetStatus() == STATUS_PHYSICS ||
- GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PLAYER_PLAYBACKFROMBUFFER){
+ GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PLAYER_PLAYBACKFROMBUFFER){
bool rearSkidding = false;
if(m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SKIDDING ||
m_aWheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SKIDDING)
@@ -1428,7 +1425,7 @@ CAutomobile::PreRender(void)
n = 6.0f*CWeather::Rain;
for(j = 0; j <= n; j++)
CParticle::AddParticle(PARTICLE_RAIN_SPLASHUP,
- c + CVector(CGeneral::GetRandomNumberInRange(-.04f, 0.4f), CGeneral::GetRandomNumberInRange(-.04f, 0.4f), 0.0f),
+ c + CVector(CGeneral::GetRandomNumberInRange(-0.4f, 0.4f), CGeneral::GetRandomNumberInRange(-0.4f, 0.4f), 0.0f),
CVector(0.0f, 0.0f, 0.0f),
nil, 0.0f, 0, 0, CGeneral::GetRandomNumber() & 1);
}
@@ -1616,11 +1613,9 @@ CAutomobile::PreRender(void)
break;
}
- if(GetModelIndex() == MI_RCBANDIT || GetModelIndex() == MI_DODO ||
- GetModelIndex() == MI_RHINO) {
- CShadows::StoreShadowForCar(this);
- return;
- }
+ if(GetModelIndex() != MI_RCBANDIT && GetModelIndex() != MI_DODO &&
+ GetModelIndex() != MI_RHINO) {
+ // Process lights
// Turn lights on/off
bool shouldLightsBeOn =
@@ -1867,14 +1862,9 @@ CAutomobile::PreRender(void)
CPointLights::FOG_NONE, false);
}
}
- }else{
+ }else if(GetStatus() != STATUS_ABANDONED && GetStatus() != STATUS_WRECKED){
// Lights off
- if(GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED) {
- CShadows::StoreShadowForCar(this);
- return;
- }
-
CVector lightPos = mi->m_positions[CAR_POS_TAILLIGHTS];
CVector lightR = GetMatrix() * lightPos;
CVector lightL = lightR;
@@ -1931,6 +1921,8 @@ CAutomobile::PreRender(void)
CCoronas::UpdateCoronaCoors((uintptr)this + 3, lightR, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
}
}
+ // end of lights
+ }
CShadows::StoreShadowForCar(this);
}
@@ -2247,22 +2239,22 @@ CAutomobile::ProcessControlInputs(uint8 pad)
// Steer left/right
if(CCamera::m_bUseMouse3rdPerson && !CVehicle::m_bDisableMouseSteering){
if(CPad::GetPad(pad)->GetMouseX() != 0.0f){
- m_fSteerRatio += fMouseSteerSens*CPad::GetPad(pad)->GetMouseX();
+ m_fSteerInput += fMouseSteerSens*CPad::GetPad(pad)->GetMouseX();
nLastControlInput = 2;
- if(Abs(m_fSteerRatio) < fMouseCentreRange)
- m_fSteerRatio *= Pow(fMouseCentreMult, CTimer::GetTimeStep());
+ if(Abs(m_fSteerInput) < fMouseCentreRange)
+ m_fSteerInput *= Pow(fMouseCentreMult, CTimer::GetTimeStep());
}else if(CPad::GetPad(pad)->GetSteeringLeftRight() || nLastControlInput != 2){
// mouse hasn't move, steer with pad like below
- m_fSteerRatio += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerRatio)*
+ m_fSteerInput += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerInput)*
0.2f*CTimer::GetTimeStep();
nLastControlInput = 0;
}
}else{
- m_fSteerRatio += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerRatio)*
+ m_fSteerInput += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerInput)*
0.2f*CTimer::GetTimeStep();
nLastControlInput = 0;
}
- m_fSteerRatio = clamp(m_fSteerRatio, -1.0f, 1.0f);
+ m_fSteerInput = clamp(m_fSteerInput, -1.0f, 1.0f);
// Accelerate/Brake
float acceleration = (CPad::GetPad(pad)->GetAccelerate() - CPad::GetPad(pad)->GetBrake())/255.0f;
@@ -2313,13 +2305,24 @@ CAutomobile::ProcessControlInputs(uint8 pad)
// Actually turn wheels
static float fValue; // why static?
- if(m_fSteerRatio < 0.0f)
- fValue = -sq(m_fSteerRatio);
+ if(m_fSteerInput < 0.0f)
+ fValue = -sq(m_fSteerInput);
else
- fValue = sq(m_fSteerRatio);
+ fValue = sq(m_fSteerInput);
m_fSteerAngle = DEGTORAD(pHandling->fSteeringLock) * fValue;
if(bComedyControls){
+#if 0 // old comedy controls from PS2 - same as bike's
+ if(((CTimer::GetTimeInMilliseconds() >> 10) & 0xF) < 12)
+ m_fGasPedal = 1.0f;
+ if((((CTimer::GetTimeInMilliseconds() >> 10)+6) & 0xF) < 12)
+ m_fBrakePedal = 0.0f;
+ bIsHandbrakeOn = false;
+ if(CTimer::GetTimeInMilliseconds() & 0x800)
+ m_fSteerAngle += 0.08f;
+ else
+ m_fSteerAngle -= 0.03f;
+#else
int rnd = CGeneral::GetRandomNumber() % 10;
switch(m_comedyControlState){
case 0:
@@ -2339,8 +2342,10 @@ CAutomobile::ProcessControlInputs(uint8 pad)
m_comedyControlState = 0;
break;
}
- }else
+ }else{
m_comedyControlState = 0;
+#endif
+ }
// Brake if player isn't in control
// BUG: game always uses pad 0 here
@@ -2501,7 +2506,7 @@ CAutomobile::TankControl(void)
float f = i/15.0f;
CParticle::AddParticle(PARTICLE_GUNSMOKE2, point1,
shotDir*CGeneral::GetRandomNumberInRange(0.3f, 1.0f)*f,
- nil, CGeneral::GetRandomNumberInRange(0.5f, 1.0f)*f, black);
+ nil, CGeneral::GetRandomNumberInRange(0.5f, 1.5f)*f, black);
}
// And some gun flashes near the gun
@@ -2533,6 +2538,9 @@ CAutomobile::TankControl(void)
}
}
+#define HYDRAULIC_UPPER_EXT (-0.12f)
+#define HYDRAULIC_LOWER_EXT (0.14f)
+
void
CAutomobile::HydraulicControl(void)
{
@@ -2595,8 +2603,8 @@ CAutomobile::HydraulicControl(void)
m_hydraulicState = 20;
else{
m_hydraulicState = 0;
- normalUpperLimit += -0.12f;
- normalSpringLength = normalUpperLimit - (normalLowerLimit+0.14f);
+ normalUpperLimit += HYDRAULIC_UPPER_EXT;
+ normalSpringLength = normalUpperLimit - (normalLowerLimit+HYDRAULIC_LOWER_EXT);
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_HYDRAULIC_2, 0.0f);
}
@@ -2629,7 +2637,7 @@ CAutomobile::HydraulicControl(void)
float radius = Max(specialColModel->boundingBox.min.Magnitude(), specialColModel->boundingBox.max.Magnitude());
if(specialColModel->boundingSphere.radius < radius)
specialColModel->boundingSphere.radius = radius;
-
+ return;
}
if(playerInfo->m_WBState != WBSTATE_PLAYING)
@@ -2668,8 +2676,8 @@ CAutomobile::HydraulicControl(void)
if(m_hydraulicState < 100){
if(m_hydraulicState == 0){
- normalUpperLimit += -0.12f;
- normalLowerLimit += 0.14f;
+ normalUpperLimit += HYDRAULIC_UPPER_EXT;
+ normalLowerLimit += HYDRAULIC_LOWER_EXT;
normalSpringLength = normalUpperLimit - normalLowerLimit;
}
@@ -2734,8 +2742,8 @@ CAutomobile::HydraulicControl(void)
// Lowered, move wheels up
if(m_hydraulicState == 0){
- normalUpperLimit += -0.12f;
- normalLowerLimit += 0.14f;
+ normalUpperLimit += HYDRAULIC_UPPER_EXT;
+ normalLowerLimit += HYDRAULIC_LOWER_EXT;
normalSpringLength = normalUpperLimit - normalLowerLimit;
}
@@ -2776,8 +2784,8 @@ CAutomobile::HydraulicControl(void)
}
if(m_fVelocityChangeForAudio < 0.1f){
- normalUpperLimit += -0.12f;
- normalLowerLimit += 0.14f;
+ normalUpperLimit += HYDRAULIC_UPPER_EXT;
+ normalLowerLimit += HYDRAULIC_LOWER_EXT;
normalSpringLength = normalUpperLimit - normalLowerLimit;
}
@@ -2914,7 +2922,7 @@ CAutomobile::ProcessBuoyancy(void)
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WATER_FALL, 0.0f);
}
- if(nGenerateWaterCircles > 0 && nGenerateWaterCircles < CTimer::GetTimeInMilliseconds()){
+ if(nGenerateWaterCircles > 0 && nGenerateWaterCircles <= CTimer::GetTimeInMilliseconds()){
CVector pos = GetPosition();
float waterLevel = 0.0f;
if(CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &waterLevel, false))
@@ -2934,7 +2942,7 @@ CAutomobile::ProcessBuoyancy(void)
}
}
- if(nGenerateRaindrops > 0 && nGenerateRaindrops < CTimer::GetTimeInMilliseconds()){
+ if(nGenerateRaindrops > 0 && nGenerateRaindrops <= CTimer::GetTimeInMilliseconds()){
CVector pos = GetPosition();
float waterLevel = 0.0f;
if(CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &waterLevel, false))
@@ -2955,7 +2963,7 @@ CAutomobile::ProcessBuoyancy(void)
static RwRGBA smokeCol = {255, 255, 255, 255};
for(i = 0; i < 4; i++){
- if(m_aSuspensionSpringRatio[i] < 1.0f && m_aWheelColPoints[i].surfaceB == SURFACE_PUDDLE){
+ if(m_aSuspensionSpringRatio[i] < 1.0f && m_aWheelColPoints[i].surfaceB == SURFACE_WATER){
CVector pos = m_aWheelColPoints[i].point + 0.3f*GetUp() - GetPosition();
CVector vSpeed = GetSpeed(pos);
vSpeed.z = 0.0f;
@@ -3226,7 +3234,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
if(impulse > 25.0f && GetStatus() != STATUS_WRECKED){
if(bIsLawEnforcer &&
FindPlayerVehicle() && FindPlayerVehicle() == m_pDamageEntity &&
- GetStatus() != STATUS_ABANDONED &&
+ GetStatus() != STATUS_ABANDONED &&
FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() >= m_vecMoveSpeed.Magnitude() &&
FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() > 0.1f)
FindPlayerPed()->SetWantedLevelNoDrop(1);
@@ -3270,6 +3278,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
case CAR_PIECE_BONNET:
GetComponentWorldPosition(CAR_BONNET, pos);
dmgDrawCarCollidingParticles(pos, impulse);
+ if(GetModelIndex() != MI_DODO)
if(Damage.ApplyDamage(COMPONENT_DOOR_BONNET, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){
SetDoorDamage(CAR_BONNET, DOOR_BONNET);
doubleMoney = true;
@@ -3280,7 +3289,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
case CAR_PIECE_BUMP_REAR:
GetComponentWorldPosition(CAR_BUMP_REAR, pos);
dmgDrawCarCollidingParticles(pos, impulse);
- if(Damage.ApplyDamage(COMPONENT_BUMPER_FRONT, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){
+ if(Damage.ApplyDamage(COMPONENT_BUMPER_REAR, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){
SetBumperDamage(CAR_BUMP_REAR, VEHBUMPER_REAR);
doubleMoney = true;
}
@@ -3536,8 +3545,8 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed)
int i;
CVector dir;
static RwRGBA grassCol = { 8, 24, 8, 255 };
- static RwRGBA dirtCol = { 64, 64, 64, 255 };
- static RwRGBA dirttrackCol = { 64, 32, 16, 255 };
+ static RwRGBA gravelCol = { 64, 64, 64, 255 };
+ static RwRGBA mudCol = { 64, 32, 16, 255 };
static RwRGBA waterCol = { 48, 48, 64, 0 };
if(!belowEffectSpeed)
@@ -3553,22 +3562,22 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed)
CGeneral::GetRandomNumberInRange(0.02f, 0.1f), grassCol);
}
return 0;
- case SURFACE_DIRT:
+ case SURFACE_GRAVEL:
dir.x = -0.05f*m_vecMoveSpeed.x;
dir.y = -0.05f*m_vecMoveSpeed.y;
for(i = 0; i < 4; i++){
dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil,
- CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirtCol);
+ CGeneral::GetRandomNumberInRange(0.02f, 0.06f), gravelCol);
}
return 1;
- case SURFACE_DIRTTRACK:
+ case SURFACE_MUD_DRY:
dir.x = -0.05f*m_vecMoveSpeed.x;
dir.y = -0.05f*m_vecMoveSpeed.y;
for(i = 0; i < 4; i++){
dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil,
- CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirttrackCol);
+ CGeneral::GetRandomNumberInRange(0.02f, 0.06f), mudCol);
}
return 0;
default:
@@ -3912,19 +3921,19 @@ CAutomobile::SetUpWheelColModel(CColModel *colModel)
CMatrix mat;
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LF]));
- colModel->spheres[0].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_LF);
+ colModel->spheres[0].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_LF);
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LB]));
- colModel->spheres[1].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_LR);
+ colModel->spheres[1].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_LR);
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RF]));
- colModel->spheres[2].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RF);
+ colModel->spheres[2].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_RF);
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RB]));
- colModel->spheres[3].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RR);
+ colModel->spheres[3].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_RR);
if(m_aCarNodes[CAR_WHEEL_LM] != nil && m_aCarNodes[CAR_WHEEL_RM] != nil){
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LM]));
- colModel->spheres[4].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RF);
+ colModel->spheres[4].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_LR);
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RM]));
- colModel->spheres[5].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RR);
+ colModel->spheres[5].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_RR);
colModel->numSpheres = 6;
}else
colModel->numSpheres = 4;
@@ -3952,8 +3961,8 @@ CAutomobile::BurstTyre(uint8 wheel)
CCarCtrl::SwitchVehicleToRealPhysics(this);
}
- ApplyMoveForce(GetRight() * CGeneral::GetRandomNumberInRange(-0.3f, 0.3f));
- ApplyTurnForce(GetRight() * CGeneral::GetRandomNumberInRange(-0.3f, 0.3f), GetForward());
+ ApplyMoveForce(GetRight() * m_fMass * CGeneral::GetRandomNumberInRange(-0.03f, 0.03f));
+ ApplyTurnForce(GetRight() * m_fTurnMass * CGeneral::GetRandomNumberInRange(-0.03f, 0.03f), GetForward());
}
}
@@ -3968,10 +3977,10 @@ CAutomobile::IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset)
CVector seatPos;
switch(component){
case CAR_DOOR_RF:
- seatPos = mi->m_positions[mi->m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT];
+ seatPos = mi->GetFrontSeatPosn();
break;
case CAR_DOOR_LF:
- seatPos = mi->m_positions[mi->m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT];
+ seatPos = mi->GetFrontSeatPosn();
seatPos.x = -seatPos.x;
break;
case CAR_DOOR_RR:
@@ -4308,7 +4317,7 @@ GetCurrentAtomicObjectCB(RwObject *object, void *data)
return object;
}
-CColPoint spherepoints[MAX_COLLISION_POINTS];
+static CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
CObject*
CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
@@ -4414,7 +4423,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
dist += GetUp();
if(GetUp().z > 0.0f){
// simulate fast upward movement if going fast
- float speed = CVector2D(m_vecMoveSpeed).MagnitudeSqr();
+ float speed = CVector2D(m_vecMoveSpeed).Magnitude();
obj->GetMatrix().Translate(GetUp()*speed);
}
}
@@ -4428,7 +4437,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
if(CCollision::ProcessColModels(obj->GetMatrix(), *obj->GetColModel(),
this->GetMatrix(), *this->GetColModel(),
- spherepoints, nil, nil) > 0)
+ aTempPedColPts, nil, nil) > 0)
obj->m_pCollidingEntity = this;
if(bRenderScorched)
@@ -4446,8 +4455,11 @@ CAutomobile::RemoveBonnetInPedCollision(void)
if(Damage.GetDoorStatus(DOOR_BONNET) == DOOR_STATUS_SWINGING &&
Doors[DOOR_BONNET].RetAngleWhenOpen()*0.4f < Doors[DOOR_BONNET].m_fAngle){
- // BUG? why not COMPGROUP_BONNET?
+#ifdef FIX_BUGS
+ obj = SpawnFlyingComponent(CAR_BONNET, COMPGROUP_BONNET);
+#else
obj = SpawnFlyingComponent(CAR_BONNET, COMPGROUP_DOOR);
+#endif
// make both doors invisible on car
SetComponentVisibility(m_aCarNodes[CAR_BONNET], ATOMIC_FLAG_NONE);
Damage.SetDoorStatus(DOOR_BONNET, DOOR_STATUS_MISSING);
@@ -4508,13 +4520,16 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents
status = DOOR_STATUS_MISSING;
}
- if(status == DOOR_STATUS_SMASHED){
+ switch(status){
+ case DOOR_STATUS_SMASHED:
// show damaged part
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_DAM);
- }else if(status == DOOR_STATUS_SWINGING){
+ break;
+ case DOOR_STATUS_SWINGING:
// turn off angle cull for swinging doors
RwFrameForAllObjects(m_aCarNodes[component], CVehicleModelInfo::SetAtomicFlagCB, (void*)ATOMIC_FLAG_NOCULL);
- }else if(status == DOOR_STATUS_MISSING){
+ break;
+ case DOOR_STATUS_MISSING:
if(!noFlyingComponents){
if(door == DOOR_BONNET)
SpawnFlyingComponent(component, COMPGROUP_BONNET);
@@ -4525,6 +4540,7 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents
}
// hide both
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_NONE);
+ break;
}
}
@@ -4555,7 +4571,7 @@ CAutomobile::SetupModelNodes(void)
int i;
for(i = 0; i < NUM_CAR_NODES; i++)
m_aCarNodes[i] = nil;
- CClumpModelInfo::FillFrameArray((RpClump*)m_rwObject, m_aCarNodes);
+ CClumpModelInfo::FillFrameArray(GetClump(), m_aCarNodes);
}
void
diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h
index a3e8ac17..604bed17 100644
--- a/src/vehicles/Automobile.h
+++ b/src/vehicles/Automobile.h
@@ -30,15 +30,6 @@ enum eCarNodes
NUM_CAR_NODES,
};
-enum eCarPositions
-{
- CAR_POS_HEADLIGHTS,
- CAR_POS_TAILLIGHTS,
- CAR_POS_FRONTSEAT,
- CAR_POS_BACKSEAT,
- CAR_POS_EXHAUST = 9,
-};
-
// These are used for all the wheel arrays
// DON'T confuse with VEHWHEEL, which are vehicle components
enum {
@@ -77,23 +68,23 @@ public:
float m_aSuspensionSpringRatio[4];
float m_aSuspensionSpringRatioPrev[4];
float m_aWheelTimer[4]; // set to 4.0 when wheel is touching ground, then decremented
- float field_49C;
+ float m_auto_unused1;
bool m_aWheelSkidmarkMuddy[4];
bool m_aWheelSkidmarkBloody[4];
float m_aWheelRotation[4];
float m_aWheelPosition[4];
float m_aWheelSpeed[4];
- uint8 field_4D8;
+ uint8 m_auto_unused2;
uint8 m_bombType : 3;
uint8 bTaxiLight : 1;
- uint8 bHadDriver : 1; // for bombs
+ uint8 bDriverLastFrame : 1; // for bombs
uint8 bFixedColour : 1;
uint8 bBigWheels : 1;
uint8 bWaterTight : 1; // no damage for non-player peds
uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1;
CEntity *m_pBombRigger;
- int16 field_4E0;
+ int16 m_auto_unk1;
uint16 m_hydraulicState;
uint32 m_nBusDoorTimerEnd;
uint32 m_nBusDoorTimerStart;
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 72fca542..d86627de 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -79,7 +79,7 @@ CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner)
bIsInWater = true;
- unk1 = 0.0f;
+ m_phys_unused1 = 0.0f;
m_bIsAnchored = true;
m_fOrientation = INVALID_ORIENTATION;
bTouchingWater = true;
@@ -904,6 +904,8 @@ CBoat::AddWakePoint(CVector point)
}
m_avec2dWakePoints[0] = point;
m_afWakePointLifeTime[0] = 400.0f;
+ if(m_nNumWakePoints < ARRAY_SIZE(m_afWakePointLifeTime))
+ m_nNumWakePoints++;
}
}else{
m_avec2dWakePoints[0] = point;
diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp
index 72b6c30c..cb21b918 100644
--- a/src/vehicles/CarGen.cpp
+++ b/src/vehicles/CarGen.cpp
@@ -226,7 +226,7 @@ INITSAVEBUF
WriteSaveBuf(buffer, ProcessCounter);
WriteSaveBuf(buffer, GenerateEvenIfPlayerIsCloseCounter);
WriteSaveBuf(buffer, (int16)0); // alignment
- WriteSaveBuf(buffer, sizeof(CarGeneratorArray));
+ WriteSaveBuf(buffer, (uint32)sizeof(CarGeneratorArray));
for (int i = 0; i < NUM_CARGENS; i++)
WriteSaveBuf(buffer, CarGeneratorArray[i]);
VALIDATESAVEBUF(*size)
diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp
index 9c8f9fda..757974a6 100644
--- a/src/vehicles/Cranes.cpp
+++ b/src/vehicles/Cranes.cpp
@@ -184,7 +184,7 @@ bool CCranes::IsThisCarPickedUp(float X, float Y, CVehicle* pVehicle)
result = true;
}
}
- return true;
+ return result;
}
void CCranes::UpdateCranes(void)
@@ -243,8 +243,11 @@ void CCrane::Update(void)
Abs(m_pVehiclePickedUp->GetMoveSpeed().x) > CAR_MOVING_SPEED_THRESHOLD ||
Abs(m_pVehiclePickedUp->GetMoveSpeed().y) > CAR_MOVING_SPEED_THRESHOLD ||
Abs(m_pVehiclePickedUp->GetMoveSpeed().z) > CAR_MOVING_SPEED_THRESHOLD ||
- FindPlayerPed()->GetPedState() == PED_ENTER_CAR && // TODO: fix carjack bug
- FindPlayerPed()->m_pSeekTarget == m_pVehiclePickedUp) {
+ (FindPlayerPed()->GetPedState() == PED_ENTER_CAR
+#ifdef FIX_BUGS
+ || FindPlayerPed()->GetPedState() == PED_CARJACK
+#endif
+ ) && FindPlayerPed()->m_pSeekTarget == m_pVehiclePickedUp) {
m_pVehiclePickedUp = nil;
m_nCraneState = IDLE;
}
@@ -395,7 +398,7 @@ bool CCrane::RotateCarriedCarProperly()
float fDeltaThisFrame = CAR_ROTATION_SPEED * CTimer::GetTimeStep();
if (Abs(fAngleDelta) <= fDeltaThisFrame) // no rotation is actually applied?
return true;
- m_pVehiclePickedUp->GetMatrix().RotateZ(Abs(fDeltaThisFrame));
+ m_pVehiclePickedUp->GetMatrix().RotateZ(fAngleDelta < 0 ? -fDeltaThisFrame : fDeltaThisFrame);
return false;
}
diff --git a/src/vehicles/DamageManager.cpp b/src/vehicles/DamageManager.cpp
index 6b59ccda..c625a4e7 100644
--- a/src/vehicles/DamageManager.cpp
+++ b/src/vehicles/DamageManager.cpp
@@ -11,7 +11,7 @@ CDamageManager::CDamageManager(void)
{
ResetDamageStatus();
m_fWheelDamageEffect = 0.75f;
- field_24 = 1;
+ field_18 = 1;
}
void
@@ -28,12 +28,8 @@ CDamageManager::FuckCarCompletely(void)
m_wheelStatus[0] = WHEEL_STATUS_MISSING;
// wheels 1-3 not reset?
- m_doorStatus[0] = DOOR_STATUS_MISSING;
- m_doorStatus[1] = DOOR_STATUS_MISSING;
- m_doorStatus[2] = DOOR_STATUS_MISSING;
- m_doorStatus[3] = DOOR_STATUS_MISSING;
- m_doorStatus[4] = DOOR_STATUS_MISSING;
- m_doorStatus[5] = DOOR_STATUS_MISSING;
+ for(i = 0; i < ARRAY_SIZE(m_doorStatus); i++)
+ m_doorStatus[i] = DOOR_STATUS_MISSING;
for(i = 0; i < 3; i++){
#ifdef FIX_BUGS
diff --git a/src/vehicles/DamageManager.h b/src/vehicles/DamageManager.h
index bf0c59a1..312006e3 100644
--- a/src/vehicles/DamageManager.h
+++ b/src/vehicles/DamageManager.h
@@ -86,7 +86,7 @@ public:
uint8 m_doorStatus[6];
uint32 m_lightStatus;
uint32 m_panelStatus;
- uint32 field_24;
+ uint8 field_18;
CDamageManager(void);
diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp
index 3ac0da38..5beed29e 100644
--- a/src/vehicles/HandlingMgr.cpp
+++ b/src/vehicles/HandlingMgr.cpp
@@ -78,7 +78,7 @@ cHandlingDataMgr::Initialise(void)
{
LoadHandlingData();
field_0 = 0.1f;
- field_4 = 0.9f;
+ fWheelFriction = 0.9f;
field_8 = 1.0f;
field_C = 0.8f;
field_10 = 0.98f;
diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h
index 398a415f..10e25573 100644
--- a/src/vehicles/HandlingMgr.h
+++ b/src/vehicles/HandlingMgr.h
@@ -60,7 +60,9 @@ enum eHandlingId
HANDLING_PANLANT,
HANDLING_FLATBED,
HANDLING_YANKEE,
- HANDLING_BORGNINE
+ HANDLING_BORGNINE,
+
+ NUMHANDLINGS
};
enum
@@ -120,7 +122,7 @@ class cHandlingDataMgr
{
float field_0; // unused it seems
public:
- float field_4; // wheel related
+ float fWheelFriction; // wheel related
private:
float field_8; //
float field_C; // unused it seems
diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp
index 7b62b461..4966a228 100644
--- a/src/vehicles/Heli.cpp
+++ b/src/vehicles/Heli.cpp
@@ -570,7 +570,7 @@ CHeli::PreRender(void)
i = 0;
for(angle = 0.0f; angle < TWOPI; angle += TWOPI/32){
CVector pos(radius*Cos(angle), radius*Sin(angle), 0.0f);
- CVector dir = pos*0.01f;
+ CVector dir = CVector(pos.x, pos.y, 1.0f)*0.01f;
pos += GetPosition();
if(CWorld::ProcessVerticalLine(pos, testLowZ, point, entity, true, false, false, false, true, false, nil))
@@ -590,12 +590,12 @@ CHeli::PreRender(void)
g = 6;
b = 3;
break;
- case SURFACE_DIRT:
+ case SURFACE_GRAVEL:
r = 10;
g = 8;
b = 7;
break;
- case SURFACE_DIRTTRACK:
+ case SURFACE_MUD_DRY:
r = 10;
g = 6;
b = 3;
diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp
index 71189d84..3bf385a0 100644
--- a/src/vehicles/Plane.cpp
+++ b/src/vehicles/Plane.cpp
@@ -84,6 +84,10 @@ CPlane::CPlane(int32 id, uint8 CreatedBy)
SetStatus(STATUS_PLANE);
bIsBIGBuilding = true;
m_level = LEVEL_NONE;
+
+#ifdef FIX_BUGS
+ m_isFarAway = true;
+#endif
}
CPlane::~CPlane()
diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h
index a6f6e1d9..783c53b3 100644
--- a/src/vehicles/Plane.h
+++ b/src/vehicles/Plane.h
@@ -9,13 +9,6 @@ enum ePlaneNodes
NUM_PLANE_NODES
};
-enum ePlanePositions
-{
- PLANE_POS_LIGHT_LEFT,
- PLANE_POS_LIGHT_RIGHT,
- PLANE_POS_LIGHT_TAIL,
-};
-
struct CPlaneNode
{
CVector p; // position
diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp
index 1d47ca3a..26d0dee7 100644
--- a/src/vehicles/Train.cpp
+++ b/src/vehicles/Train.cpp
@@ -13,6 +13,7 @@
#include "DMAudio.h"
#include "HandlingMgr.h"
#include "Train.h"
+#include "AudioScriptObject.h"
static CTrainNode* pTrackNodes;
static int16 NumTrackNodes;
@@ -35,6 +36,8 @@ static float EngineTrackSpeed_S[4];
CVector CTrain::aStationCoors[3];
CVector CTrain::aStationCoors_S[4];
+static bool bTrainArrivalAnnounced[3] = {false, false, false};
+
CTrain::CTrain(int32 id, uint8 CreatedBy)
: CVehicle(CreatedBy)
{
@@ -60,6 +63,10 @@ CTrain::CTrain(int32 id, uint8 CreatedBy)
bUsesCollision = true;
SetStatus(STATUS_TRAIN_MOVING);
+
+#ifdef FIX_BUGS
+ m_isFarAway = true;
+#endif
}
void
@@ -197,7 +204,7 @@ CTrain::ProcessControl(void)
if(m_bTrainStopping){
m_nDoorTimer = CTimer::GetTimeInMilliseconds() + 1000;
m_nDoorState = TRAIN_DOOR_OPENING;
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_18, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_TRAIN_DOOR_CLOSE, 0.0f);
}
break;
@@ -214,7 +221,7 @@ CTrain::ProcessControl(void)
if(!m_bTrainStopping){
m_nDoorTimer = CTimer::GetTimeInMilliseconds() + 1000;
m_nDoorState = TRAIN_DOOR_CLOSING;
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_19, 0.0f);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_TRAIN_DOOR_OPEN, 0.0f);
}
break;
@@ -619,9 +626,47 @@ CTrain::ReadAndInterpretTrackFile(Const char *filename, CTrainNode **nodes, int1
}
void
+PlayAnnouncement(uint8 sound, uint8 station)
+{
+ // this was gone in a PC version but inlined on PS2
+ cAudioScriptObject *obj = new cAudioScriptObject;
+ obj->AudioId = sound;
+ obj->Posn = CTrain::aStationCoors[station];
+ obj->AudioEntity = AEHANDLE_NONE;
+ DMAudio.CreateOneShotScriptObject(obj);
+}
+
+void
ProcessTrainAnnouncements(void)
{
- // TODO but unused
+ for (int i = 0; i < ARRAY_SIZE(StationDist); i++) {
+ for (int j = 0; j < ARRAY_SIZE(EngineTrackPosition); j++) {
+ if (!bTrainArrivalAnnounced[i]) {
+ float preDist = StationDist[i] - 100.0f;
+ if (preDist < 0.0f)
+ preDist += TotalLengthOfTrack;
+ if (EngineTrackPosition[j] > preDist && EngineTrackPosition[j] < StationDist[i]) {
+ bTrainArrivalAnnounced[i] = true;
+ PlayAnnouncement(SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1, i);
+ break;
+ }
+ } else {
+ float postDist = StationDist[i] + 10.0f;
+#ifdef FIX_BUGS
+ if (postDist > TotalLengthOfTrack)
+ postDist -= TotalLengthOfTrack;
+#else
+ if (postDist < 0.0f) // does this even make sense here?
+ postDist += TotalLengthOfTrack;
+#endif
+ if (EngineTrackPosition[j] > StationDist[i] && EngineTrackPosition[j] < postDist) {
+ bTrainArrivalAnnounced[i] = false;
+ PlayAnnouncement(SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2, i);
+ break;
+ }
+ }
+ }
+ }
}
void
diff --git a/src/vehicles/Train.h b/src/vehicles/Train.h
index c645ecaf..3446eeb5 100644
--- a/src/vehicles/Train.h
+++ b/src/vehicles/Train.h
@@ -24,15 +24,6 @@ enum eTrainNodes
NUM_TRAIN_NODES
};
-enum eTrainPositions
-{
- TRAIN_POS_LIGHT_FRONT,
- TRAIN_POS_LIGHT_REAR,
- TRAIN_POS_LEFT_ENTRY,
- TRAIN_POS_MID_ENTRY,
- TRAIN_POS_RIGHT_ENTRY
-};
-
struct CTrainNode
{
CVector p; // position
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 5dc7bc72..e21ad07c 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -50,15 +50,18 @@ CVehicle::CVehicle(uint8 CreatedBy)
{
int i;
- m_nCurrentGear = 0;
- m_fChangeGearTime = 0;
- m_fSteerRatio = 0.0f;
+ m_nCurrentGear = 1;
+ m_fChangeGearTime = 0.0f;
+ m_fSteerInput = 0.0f;
m_type = ENTITY_TYPE_VEHICLE;
VehicleCreatedBy = CreatedBy;
bIsLocked = false;
bIsLawEnforcer = false;
bIsAmbulanceOnDuty = false;
bIsFireTruckOnDuty = false;
+#ifdef FIX_BUGS
+ bIsHandbrakeOn = false;
+#endif
CCarCtrl::UpdateCarCount(this, false);
m_fHealth = 1000.0f;
bEngineOn = true;
@@ -96,7 +99,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
m_numPedsUseItAsCover = 0;
bIsCarParkVehicle = false;
bHasAlreadyBeenRecorded = false;
- m_bSirenOrAlarm = 0;
+ m_bSirenOrAlarm = false;
m_nCarHornTimer = 0;
m_nCarHornPattern = 0;
m_nAlarmState = 0;
@@ -280,90 +283,91 @@ CVehicle::FlyingControl(eFlightModel flightModel)
float turnSpeed = m_vecTurnSpeed.MagnitudeSqr();
if(turnSpeed > SQR(0.2f))
m_vecTurnSpeed *= 0.2f/Sqrt(turnSpeed);
- }
break;
+ }
case FLIGHT_MODEL_RCPLANE:
case FLIGHT_MODEL_SEAPLANE:
{
// thrust
float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward());
- CVector vecWidthForward = GetColModel()->boundingBox.min.y * GetForward();
+ CVector vecTail = GetColModel()->boundingBox.min.y * GetForward();
float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f;
if (fForwSpeed > 0.1f || (flightModel == FLIGHT_MODEL_RCPLANE && fForwSpeed > 0.02f))
fThrust += 1.0f;
else if (fForwSpeed > 0.0f && fThrust < 0.0f)
fThrust = 0.0f;
- float fThrustImpulse;
+ float fThrustAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
- fThrustImpulse = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust;
+ fThrustAccel = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust;
else
- fThrustImpulse = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust;
- ApplyMoveForce(fThrustImpulse * GetForward() * m_fMass * CTimer::GetTimeStep());
+ fThrustAccel = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust;
+ ApplyMoveForce(fThrustAccel * GetForward() * m_fMass * CTimer::GetTimeStep());
// left/right
float fSideSpeed = -DotProduct(GetMoveSpeed(), GetRight());
float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
- float fSideSlipImpulse;
+ float fSideSlipAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
- fSideSlipImpulse = Abs(fSideSpeed) * fSideSpeed * fRCSideSlipMult;
+ fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fRCSideSlipMult;
else
- fSideSlipImpulse = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult;
- ApplyMoveForce(m_fMass * GetRight() * fSideSlipImpulse * CTimer::GetTimeStep());
+ fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult;
+ ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep());
- float fYaw = -DotProduct(CrossProduct(m_vecTurnSpeed + m_vecTurnFriction, vecWidthForward) + m_vecMoveSpeed + m_vecMoveFriction, GetRight());
- float fYawImpulse;
+ float fYaw = -DotProduct(GetSpeed(vecTail), GetRight());
+ float fYawAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
- fYawImpulse = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed;
+ fYawAccel = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed;
else
- fYawImpulse = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed;
- ApplyTurnForce(fYawImpulse * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward);
+ fYawAccel = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed;
+ ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecTail);
- float fRollImpulse;
+ float fRollAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE) {
float fDirectionMultiplier = CPad::GetPad(0)->GetLookRight();
if (CPad::GetPad(0)->GetLookLeft())
fDirectionMultiplier = -1;
- fRollImpulse = (0.5f * fDirectionMultiplier + fSteerLR) * fRCRollMult;
+ fRollAccel = (0.5f * fDirectionMultiplier + fSteerLR) * fRCRollMult;
}
else
- fRollImpulse = fSteerLR * fSeaRollMult;
- ApplyTurnForce(GetRight() * fRollImpulse * fForwSpeed * m_fTurnMass * CTimer::GetTimeStep(), GetUp());
+ fRollAccel = fSteerLR * fSeaRollMult;
+ ApplyTurnForce(GetRight() * fRollAccel * fForwSpeed * m_fTurnMass * CTimer::GetTimeStep(), GetUp());
CVector vecFRight = CrossProduct(GetForward(), CVector(0.0f, 0.0f, 1.0f));
CVector vecStabilise = (GetUp().z > 0.0f) ? vecFRight : -vecFRight;
float fStabiliseDirection = (GetRight().z > 0.0f) ? -1.0f : 1.0f;
- float fStabiliseImpulse;
+ float fStabiliseSpeed;
if (flightModel == FLIGHT_MODEL_RCPLANE)
- fStabiliseImpulse = fRCRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
+ fStabiliseSpeed = fRCRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
else
- fStabiliseImpulse = fSeaRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
- ApplyTurnForce(fStabiliseImpulse * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? VC doesn't have it too
+ fStabiliseSpeed = fSeaRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
+ ApplyTurnForce(fStabiliseSpeed * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? VC doesn't have it too
// up/down
- float fTail = -DotProduct(CrossProduct(m_vecTurnSpeed + m_vecTurnFriction, vecWidthForward) + m_vecMoveSpeed + m_vecMoveFriction, GetUp());
+ float fTail = -DotProduct(GetSpeed(vecTail), GetUp());
float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
- float fPitchImpulse;
+ float fPitchAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
- fPitchImpulse = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed;
+ fPitchAccel = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed;
else
- fPitchImpulse = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
- ApplyTurnForce(fPitchImpulse * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward);
+ fPitchAccel = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
+ ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecTail);
float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
- float fLiftImpluse;
+ float fLiftAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
- fLiftImpluse = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
+ fLiftAccel = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
else
- fLiftImpluse = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed;
- float fLiftForce = fLiftImpluse * m_fMass * CTimer::GetTimeStep();
- if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpluse) {
+ fLiftAccel = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed;
+ float fLiftImpulse = fLiftAccel * m_fMass * CTimer::GetTimeStep();
+ if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpulse) {
if (flightModel == FLIGHT_MODEL_RCPLANE && GetPosition().z > 50.0f)
- fLiftForce = CTimer::GetTimeStep() * 0.0072 * m_fMass;
+ fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass;
else if (flightModel == FLIGHT_MODEL_SEAPLANE && GetPosition().z > 80.0f)
- fLiftForce = CTimer::GetTimeStep() * 0.0072 * m_fMass;
+ fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass;
}
- ApplyMoveForce(fLiftForce * GetUp());
+ ApplyMoveForce(fLiftImpulse * GetUp());
+
CVector vecResistance;
if (flightModel == FLIGHT_MODEL_RCPLANE)
vecResistance = vecRCAeroResistance;
@@ -425,10 +429,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
}
if (CPad::GetPad(0)->GetHorn()) {
fYaw = 0.0f;
- fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetUp()), -200.0f, 1.3f);
+ fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f);
fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f);
}
- debug("fPitch: %f\n", fPitch);
ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward());
ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
@@ -442,11 +445,11 @@ CVehicle::FlyingControl(eFlightModel flightModel)
float rY = Pow(vecResistance.y, CTimer::GetTimeStep());
float rZ = Pow(vecResistance.z, CTimer::GetTimeStep());
CVector vecTurnSpeed = Multiply3x3(m_vecTurnSpeed, GetMatrix());
- float fResistanceMultiplier = Pow(1.0f / (fSpinSpeedRes * SQR(vecTurnSpeed.z) + 1.0f), CTimer::GetTimeStep());
+ float fResistanceMultiplier = Pow(1.0f / (fSpinSpeedRes * SQR(vecTurnSpeed.z) + 1.0f) * rZ, CTimer::GetTimeStep());
float fResistance = vecTurnSpeed.z * fResistanceMultiplier - vecTurnSpeed.z;
vecTurnSpeed.x *= rX;
vecTurnSpeed.y *= rY;
- vecTurnSpeed.z *= rZ;
+ vecTurnSpeed.z *= fResistanceMultiplier;
m_vecTurnSpeed = Multiply3x3(GetMatrix(), vecTurnSpeed);
ApplyTurnForce(-GetRight() * fResistance * m_fTurnMass, GetForward() + Multiply3x3(GetMatrix(), m_vecCentreOfMass));
break;
@@ -454,6 +457,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
}
}
+float fBurstSpeedMax = 0.3f;
+float fBurstTyreMod = 0.1f;
+
void
CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint,
int32 wheelsOnGround, float thrust, float brake, float adhesion, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, uint16 wheelStatus)
@@ -463,6 +469,10 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
static bool bBraking;
static bool bDriving;
+#ifdef FIX_SIGNIFICANT_BUGS
+ bAlreadySkidding = false;
+#endif
+
// how much force we want to apply in these axes
float fwd = 0.0f;
float right = 0.0f;
@@ -487,10 +497,15 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
if(contactSpeedRight != 0.0f){
// exert opposing force
right = -contactSpeedRight/wheelsOnGround;
+#ifdef FIX_BUGS
+ // contactSpeedRight is independent of framerate but right has timestep as a factor
+ // so we probably have to fix this
+ right *= CTimer::GetTimeStepFix();
+#endif
if(wheelStatus == WHEEL_STATUS_BURST){
- float fwdspeed = Min(contactSpeedFwd, 0.3f);
- right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
+ float fwdspeed = Min(contactSpeedFwd, fBurstSpeedMax);
+ right += fwdspeed * CGeneral::GetRandomNumberInRange(-fBurstTyreMod, fBurstTyreMod);
}
}
@@ -507,13 +522,21 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
}
}else if(contactSpeedFwd != 0.0f){
fwd = -contactSpeedFwd/wheelsOnGround;
+#ifdef FIX_BUGS
+ // contactSpeedFwd is independent of framerate but fwd has timestep as a factor
+ // so we probably have to fix this
+ fwd *= CTimer::GetTimeStepFix();
+#endif
if(!bBraking){
if(m_fGasPedal < 0.01f){
if(GetModelIndex() == MI_RCBANDIT)
- brake = 0.2f * mod_HandlingManager.field_4 / m_fMass;
+ brake = 0.2f * mod_HandlingManager.fWheelFriction / m_fMass;
else
- brake = mod_HandlingManager.field_4 / m_fMass;
+ brake = mod_HandlingManager.fWheelFriction / m_fMass;
+#ifdef FIX_BUGS
+ brake *= CTimer::GetTimeStepFix();
+#endif
}
}
@@ -531,7 +554,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
}
}
- if(sq(adhesion) < sq(right) + sq(fwd)){
+ float speedSq = sq(right) + sq(fwd);
+ if(sq(adhesion) < speedSq){
if(*wheelState != WHEEL_STATE_FIXED){
if(bDriving && contactSpeedFwd < 0.2f)
*wheelState = WHEEL_STATE_SPINNING;
@@ -539,7 +563,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
*wheelState = WHEEL_STATE_SKIDDING;
}
- float l = Sqrt(sq(right) + sq(fwd));
+ float l = Sqrt(speedSq);
float tractionLoss = bAlreadySkidding ? 1.0f : pHandling->fTractionLoss;
right *= adhesion * tractionLoss / l;
fwd *= adhesion * tractionLoss / l;
@@ -658,7 +682,7 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
break;
}
}
- if (oldHealth > DAMAGE_HEALTH_TO_CATCH_FIRE && m_fHealth < DAMAGE_HEALTH_TO_CATCH_FIRE) {
+ if (oldHealth >= DAMAGE_HEALTH_TO_CATCH_FIRE && m_fHealth < DAMAGE_HEALTH_TO_CATCH_FIRE) {
if (IsCar()) {
CAutomobile* pThisCar = (CAutomobile*)this;
pThisCar->Damage.SetEngineStatus(ENGINE_STATUS_ON_FIRE);
@@ -759,7 +783,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
return false;
if (pPassengers[1] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_LR) &&
- IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_LEFT, nil)) {
+ IsRoomForPedToLeaveCar(CAR_DOOR_LR, nil)) {
if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) {
pPassengers[2] = pPassengers[1];
pPassengers[1] = nil;
@@ -776,7 +800,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
}
if (pPassengers[2] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_RR) &&
- IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_RIGHT, nil)) {
+ IsRoomForPedToLeaveCar(CAR_DOOR_RR, nil)) {
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[2];
pPassengers[2] = nil;
@@ -793,7 +817,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
}
if (pPassengers[0] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_RF) &&
- IsRoomForPedToLeaveCar(COMPONENT_DOOR_FRONT_RIGHT, nil)) {
+ IsRoomForPedToLeaveCar(CAR_DOOR_RF, nil)) {
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[0];
pPassengers[0] = nil;
@@ -977,9 +1001,8 @@ CVehicle::CanPedOpenLocks(CPed *ped)
bool
CVehicle::CanPedEnterCar(void)
{
- CVector up = GetUp();
// can't enter when car is on side
- if(up.z > 0.1f || up.z < -0.1f){
+ if(GetUp().z > 0.1f || GetUp().z < -0.1f){
// also when car is moving too fast
if(m_vecMoveSpeed.MagnitudeSqr() > sq(0.2f))
return false;
@@ -1172,7 +1195,7 @@ CVehicle::ProcessCarAlarm(void)
{
uint32 step;
- if(m_nAlarmState == 0 || m_nAlarmState == -1)
+ if(!IsAlarmOn())
return;
step = CTimer::GetTimeStepInMilliseconds();
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index f7205c7d..48546e68 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -28,12 +28,6 @@ enum eCarLock {
CARLOCK_SKIP_SHUT_DOORS
};
-
-enum
-{
- BOAT_POS_FRONTSEAT
-};
-
enum eDoors
{
DOOR_BONNET = 0,
@@ -86,8 +80,8 @@ enum
CAR_PIECE_WING_LR,
CAR_PIECE_WING_RR,
CAR_PIECE_WHEEL_LF,
- CAR_PIECE_WHEEL_LR,
CAR_PIECE_WHEEL_RF,
+ CAR_PIECE_WHEEL_LR,
CAR_PIECE_WHEEL_RR,
CAR_PIECE_WINDSCREEN,
};
@@ -109,9 +103,6 @@ enum eFlightModel
FLIGHT_MODEL_SEAPLANE
};
-// Or Weapon.h?
-void FireOneInstantHitRound(CVector *shotSource, CVector *shotTarget, int32 damage);
-
class CVehicle : public CPhysical
{
public:
@@ -197,7 +188,7 @@ public:
bool m_bSirenOrAlarm;
int8 m_comedyControlState;
CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car
- float m_fSteerRatio;
+ float m_fSteerInput;
eVehicleType m_vehType;
static void *operator new(size_t);
@@ -274,8 +265,11 @@ public:
void InflictDamage(CEntity *damagedBy, eWeaponType weaponType, float damage);
void DoFixedMachineGuns(void);
-
+#ifdef FIX_BUGS
+ bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED; }
+#else
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
+#endif
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; }
AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); }
diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp
index 389e7486..26fc459d 100644
--- a/src/weapons/BulletInfo.cpp
+++ b/src/weapons/BulletInfo.cpp
@@ -22,6 +22,7 @@
#include "Weapon.h"
#include "WeaponInfo.h"
#include "World.h"
+#include "SurfaceTable.h"
#define BULLET_LIFETIME (1000)
#define NUM_PED_BLOOD_PARTICLES (8)
@@ -228,7 +229,7 @@ bool CBulletInfo::TestForSniperBullet(float x1, float x2, float y1, float y2, fl
#ifdef FIX_BUGS // original code is not going work anyway...
CColLine line(PlayerSniperBulletStart, PlayerSniperBulletEnd);
CColBox box;
- box.Set(CVector(x1, y1, z1), CVector(x2, y2, z2), 0, 0);
+ box.Set(CVector(x1, y1, z1), CVector(x2, y2, z2), SURFACE_DEFAULT, 0);
return CCollision::TestLineBox(line, box);
#else
float minP = 0.0f;
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 88c4788c..378e621a 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -25,7 +25,8 @@
#include "Stats.h"
#include "TempColModels.h"
#include "Timer.h"
-#include "Vehicle.h"
+#include "Automobile.h"
+#include "Boat.h"
#include "WaterLevel.h"
#include "WeaponInfo.h"
#include "World.h"
@@ -241,51 +242,51 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
}
}
- if ( fired )
+ if (fired)
{
bool isPlayer = false;
- if ( shooter->IsPed() )
+ if (shooter->IsPed())
{
- CPed *shooterPed = (CPed*)shooter;
+ CPed* shooterPed = (CPed*)shooter;
shooterPed->bIsShooting = true;
- if ( shooterPed->IsPlayer() )
+ if (shooterPed->IsPlayer())
isPlayer = true;
DMAudio.PlayOneShot(shooterPed->m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
}
- if ( m_nAmmoInClip > 0 ) m_nAmmoInClip--;
- if ( m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer) ) m_nAmmoTotal--;
+ if (m_nAmmoInClip > 0) m_nAmmoInClip--;
+ if (m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer)) m_nAmmoTotal--;
- if ( m_eWeaponState == WEAPONSTATE_READY && m_eWeaponType == WEAPONTYPE_FLAMETHROWER )
+ if (m_eWeaponState == WEAPONSTATE_READY && m_eWeaponType == WEAPONTYPE_FLAMETHROWER)
DMAudio.PlayOneShot(((CPhysical*)shooter)->m_audioEntityId, SOUND_WEAPON_FLAMETHROWER_FIRE, 0.0f);
m_eWeaponState = WEAPONSTATE_FIRING;
- }
- if ( m_nAmmoInClip == 0 )
- {
- if ( m_nAmmoTotal == 0 )
- return true;
+ if (m_nAmmoInClip == 0)
+ {
+ if (m_nAmmoTotal == 0)
+ return true;
- m_eWeaponState = WEAPONSTATE_RELOADING;
- m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload;
+ m_eWeaponState = WEAPONSTATE_RELOADING;
+ m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload;
- if ( shooter == FindPlayerPed() )
- {
- if ( CWorld::Players[CWorld::PlayerInFocus].m_bFastReload )
- m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4;
+ if (shooter == FindPlayerPed())
+ {
+ if (CWorld::Players[CWorld::PlayerInFocus].m_bFastReload)
+ m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4;
+ }
+
+ return true;
}
- return true;
+ m_nTimer = CTimer::GetTimeInMilliseconds() + 1000;
+ if (shooter == FindPlayerPed())
+ CStats::RoundsFiredByPlayer++;
}
-
- m_nTimer = CTimer::GetTimeInMilliseconds() + 1000;
- if ( shooter == FindPlayerPed() )
- CStats::RoundsFiredByPlayer++;
}
else
{
@@ -1631,31 +1632,29 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left)
CVehicleModelInfo *modelInfo = shooter->GetModelInfo();
- #define FRONTSEATPOS() (&(shooter->IsBoat() ? modelInfo->m_positions[BOAT_POS_FRONTSEAT] : modelInfo->m_positions[CAR_POS_FRONTSEAT]))
-
CVector source, target;
if ( left )
{
source = shooter->GetMatrix() * CVector(-shooter->GetColModel()->boundingBox.max.x + -0.2f,
- float(CGeneral::GetRandomNumber() & 255) * 0.001f + FRONTSEATPOS()->y,
- FRONTSEATPOS()->z + 0.5f);
+ float(CGeneral::GetRandomNumber() & 255) * 0.001f + modelInfo->GetFrontSeatPosn().y,
+ modelInfo->GetFrontSeatPosn().z + 0.5f);
source += CTimer::GetTimeStep() * shooter->m_vecMoveSpeed;
target = shooter->GetMatrix() * CVector(-info->m_fRange,
- FRONTSEATPOS()->y,
- FRONTSEATPOS()->z + 0.5f);
+ modelInfo->GetFrontSeatPosn().y,
+ modelInfo->GetFrontSeatPosn().z + 0.5f);
}
else
{
source = shooter->GetMatrix() * CVector(shooter->GetColModel()->boundingBox.max.x + 0.2f,
- float(CGeneral::GetRandomNumber() & 255) * 0.001f + FRONTSEATPOS()->y,
- FRONTSEATPOS()->z + 0.5f);
+ float(CGeneral::GetRandomNumber() & 255) * 0.001f + modelInfo->GetFrontSeatPosn().y,
+ modelInfo->GetFrontSeatPosn().z + 0.5f);
source += CTimer::GetTimeStep() * shooter->m_vecMoveSpeed;
target = shooter->GetMatrix() * CVector(info->m_fRange,
- FRONTSEATPOS()->y,
- FRONTSEATPOS()->z + 0.5f);
+ modelInfo->GetFrontSeatPosn().y,
+ modelInfo->GetFrontSeatPosn().z + 0.5f);
}
#undef FRONTSEATPOS
diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h
index 1b2c0320..c7685e0d 100644
--- a/src/weapons/Weapon.h
+++ b/src/weapons/Weapon.h
@@ -16,8 +16,8 @@ class CWeapon
public:
eWeaponType m_eWeaponType;
eWeaponState m_eWeaponState;
- uint32 m_nAmmoInClip;
- uint32 m_nAmmoTotal;
+ int32 m_nAmmoInClip;
+ int32 m_nAmmoTotal;
uint32 m_nTimer;
bool m_bAddRotOffset;
diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h
index b5882082..c89dd482 100644
--- a/src/weapons/WeaponInfo.h
+++ b/src/weapons/WeaponInfo.h
@@ -5,13 +5,13 @@
class CWeaponInfo {
// static CWeaponInfo(&ms_apWeaponInfos)[14];
- static CWeaponInfo ms_apWeaponInfos[14];
+ static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_LAST_WEAPONTYPE];
public:
eWeaponFire m_eWeaponFire;
float m_fRange;
uint32 m_nFiringRate;
uint32 m_nReload;
- uint32 m_nAmountofAmmunition;
+ int32 m_nAmountofAmmunition;
uint32 m_nDamage;
float m_fSpeed;
float m_fRadius;