summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.appveyor.yml2
-rw-r--r--README.md13
-rw-r--r--gamefiles/menu.txdbin10244648 -> 10244648 bytes
-rw-r--r--premake5.lua25
-rw-r--r--src/animation/CutsceneMgr.cpp (renamed from src/core/CutsceneMgr.cpp)3
-rw-r--r--src/animation/CutsceneMgr.h (renamed from src/core/CutsceneMgr.h)2
-rw-r--r--src/audio/AudioCollision.cpp24
-rw-r--r--src/audio/AudioCollision.h4
-rw-r--r--src/audio/AudioManager.cpp4749
-rw-r--r--src/audio/AudioManager.h383
-rw-r--r--src/audio/PoliceRadio.cpp19
-rw-r--r--src/control/AutoPilot.cpp16
-rw-r--r--src/control/CarCtrl.cpp146
-rw-r--r--src/control/Garages.cpp12
-rw-r--r--src/control/PathFind.cpp370
-rw-r--r--src/control/PathFind.h45
-rw-r--r--src/control/Pickups.cpp469
-rw-r--r--src/control/Pickups.h25
-rw-r--r--src/control/Record.cpp526
-rw-r--r--src/control/Record.h90
-rw-r--r--src/control/RoadBlocks.cpp200
-rw-r--r--src/control/RoadBlocks.h2
-rw-r--r--src/control/SceneEdit.cpp1101
-rw-r--r--src/control/SceneEdit.h93
-rw-r--r--src/control/Script.cpp17
-rw-r--r--src/control/TrafficLights.cpp334
-rw-r--r--src/control/TrafficLights.h7
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/Collision.cpp5
-rw-r--r--src/core/Collision.h11
-rw-r--r--src/core/Debug.cpp2
-rw-r--r--src/core/FileLoader.cpp165
-rw-r--r--src/core/FileLoader.h3
-rw-r--r--src/core/Frontend.cpp1854
-rw-r--r--src/core/Frontend.h155
-rw-r--r--src/core/Game.cpp2
-rw-r--r--src/core/MenuScreens.h192
-rw-r--r--src/core/Pad.cpp13
-rw-r--r--src/core/Pad.h1
-rw-r--r--src/core/Pools.cpp345
-rw-r--r--src/core/Profile.cpp71
-rw-r--r--src/core/Profile.h28
-rw-r--r--src/core/Radar.cpp8
-rw-r--r--src/core/Streaming.cpp4
-rw-r--r--src/core/Timer.cpp36
-rw-r--r--src/core/Timer.h8
-rw-r--r--src/core/World.cpp4
-rw-r--r--src/core/World.h4
-rw-r--r--src/core/common.h4
-rw-r--r--src/core/config.h6
-rw-r--r--src/core/main.cpp15
-rw-r--r--src/core/re3.cpp28
-rw-r--r--src/entities/Entity.cpp4
-rw-r--r--src/entities/Entity.h5
-rw-r--r--src/entities/Physical.cpp8
-rw-r--r--src/entities/Physical.h2
-rw-r--r--src/math/Vector.h2
-rw-r--r--src/modelinfo/BaseModelInfo.h4
-rw-r--r--src/modelinfo/ModelInfo.cpp17
-rw-r--r--src/modelinfo/ModelInfo.h3
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp7
-rw-r--r--src/objects/Object.cpp285
-rw-r--r--src/objects/Object.h37
-rw-r--r--src/objects/ParticleObject.cpp2
-rw-r--r--src/peds/CivilianPed.cpp12
-rw-r--r--src/peds/Gangs.cpp (renamed from src/control/Gangs.cpp)2
-rw-r--r--src/peds/Gangs.h (renamed from src/control/Gangs.h)0
-rw-r--r--src/peds/Ped.cpp22
-rw-r--r--src/peds/Ped.h10
-rw-r--r--src/peds/Population.cpp82
-rw-r--r--src/peds/Population.h54
-rw-r--r--src/render/Clouds.cpp2
-rw-r--r--src/render/Coronas.cpp4
-rw-r--r--src/render/Hud.cpp279
-rw-r--r--src/render/Hud.h73
-rw-r--r--src/render/PlayerSkin.cpp (renamed from src/core/PlayerSkin.cpp)7
-rw-r--r--src/render/PlayerSkin.h (renamed from src/core/PlayerSkin.h)6
-rw-r--r--src/render/Renderer.cpp17
-rw-r--r--src/render/Renderer.h16
-rw-r--r--src/render/Sprite.cpp28
-rw-r--r--src/render/Timecycle.h2
-rw-r--r--src/render/WeaponEffects.cpp2
-rw-r--r--src/render/Weather.cpp2
-rw-r--r--src/rw/ClumpRead.cpp (renamed from src/core/RwClumpRead.cpp)0
-rw-r--r--src/rw/Lights.cpp (renamed from src/render/Lights.cpp)0
-rw-r--r--src/rw/Lights.h (renamed from src/render/Lights.h)0
-rw-r--r--src/rw/NodeName.cpp (renamed from src/core/NodeName.cpp)0
-rw-r--r--src/rw/NodeName.h (renamed from src/core/NodeName.h)0
-rw-r--r--src/rw/RwHelper.cpp (renamed from src/core/RwHelper.cpp)53
-rw-r--r--src/rw/RwHelper.h (renamed from src/core/RwHelper.h)1
-rw-r--r--src/rw/RwMatFX.cpp (renamed from src/core/RwMatFX.cpp)13
-rw-r--r--src/rw/TexRead.cpp (renamed from src/core/RwTexRead.cpp)14
-rw-r--r--src/rw/TxdStore.cpp (renamed from src/core/TxdStore.cpp)0
-rw-r--r--src/rw/TxdStore.h (renamed from src/core/TxdStore.h)0
-rw-r--r--src/rw/VisibilityPlugins.cpp (renamed from src/render/VisibilityPlugins.cpp)0
-rw-r--r--src/rw/VisibilityPlugins.h (renamed from src/render/VisibilityPlugins.h)0
-rw-r--r--src/rw/rw.cpp (renamed from src/core/rw.cpp)428
-rw-r--r--src/save/GenericGameStorage.cpp184
-rw-r--r--src/vehicles/Automobile.cpp21
-rw-r--r--src/vehicles/Boat.cpp643
-rw-r--r--src/vehicles/Boat.h49
-rw-r--r--src/vehicles/CarGen.cpp (renamed from src/control/CarGen.cpp)88
-rw-r--r--src/vehicles/CarGen.h (renamed from src/control/CarGen.h)12
-rw-r--r--src/vehicles/Cranes.cpp (renamed from src/control/Cranes.cpp)96
-rw-r--r--src/vehicles/Cranes.h (renamed from src/control/Cranes.h)9
-rw-r--r--src/vehicles/Floater.cpp2
-rw-r--r--src/vehicles/Heli.cpp8
-rw-r--r--src/vehicles/Vehicle.cpp61
-rw-r--r--src/vehicles/Vehicle.h16
109 files changed, 10819 insertions, 3518 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index a5b44461..41ada399 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -43,3 +43,5 @@ after_build:
artifacts:
- path: bin/%CONFIGURATION%/re3.dll
name: re3.dll
+- path: bin/%CONFIGURATION%/re3.pdb
+ name: re3.pdb
diff --git a/README.md b/README.md
index 9237e8e3..53f2136a 100644
--- a/README.md
+++ b/README.md
@@ -32,28 +32,15 @@ to reverse at the time, calling the original functions is acceptable.
### Unreversed / incomplete classes (at least the ones we know)
```
-cAudioManager - WIP
-CBoat
CBulletInfo
-CMenuManager - WIP
-CObject
-CPacManPickups
-CPedPath
-CPools - save/loading
-CRecordDataForChase
-CRecordDataForGame
-CRoadBlocks
-CTrafficLights
CWeapon
CWorld
-GenericLoad
```
The following classes have only unused or practically unused code left:
```
CCullZone - only mobile stuff
CCullZones - only mobile stuff
-CFileLoader - almost done
CSceneEdit
```
diff --git a/gamefiles/menu.txd b/gamefiles/menu.txd
index 8ca5de16..f617bcf8 100644
--- a/gamefiles/menu.txd
+++ b/gamefiles/menu.txd
Binary files differ
diff --git a/premake5.lua b/premake5.lua
index 9e3609b6..173fe3e4 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -1,5 +1,5 @@
workspace "re3"
- configurations { "Debug", "Release", "ReleaseFH" }
+ configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW" }
location "build"
files { "src/*.*" }
@@ -13,6 +13,7 @@ workspace "re3"
files { "src/objects/*.*" }
files { "src/peds/*.*" }
files { "src/render/*.*" }
+ files { "src/rw/*.*" }
files { "src/save/*.*" }
files { "src/skel/*.*" }
files { "src/skel/win/*.*" }
@@ -32,6 +33,7 @@ workspace "re3"
includedirs { "src/objects" }
includedirs { "src/peds" }
includedirs { "src/render" }
+ includedirs { "src/rw" }
includedirs { "src/save/" }
includedirs { "src/skel/" }
includedirs { "src/skel/win" }
@@ -47,6 +49,12 @@ workspace "re3"
libdirs { "dxsdk/lib" }
libdirs { "milessdk/lib" }
+
+ filter "configurations:DebugRW or configurations:ReleaseRW"
+ defines { "RWLIBS" }
+ libdirs { "rwsdk/lib/d3d8/release" }
+ links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp" }
+ filter {}
pbcommands = {
"setlocal EnableDelayedExpansion",
@@ -86,13 +94,14 @@ project "re3"
filter "configurations:Debug"
defines { "DEBUG" }
staticruntime "on"
- symbols "On"
+ symbols "Full"
setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
staticruntime "on"
+ symbols "Full"
setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
filter "configurations:ReleaseFH"
@@ -102,3 +111,15 @@ project "re3"
staticruntime "on"
targetextension ".asi"
setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "scripts/")
+
+ filter "configurations:DebugRW"
+ defines { "DEBUG" }
+ staticruntime "on"
+ symbols "On"
+ setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
+
+ filter "configurations:ReleaseRW"
+ defines { "NDEBUG" }
+ optimize "On"
+ staticruntime "on"
+ setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
diff --git a/src/core/CutsceneMgr.cpp b/src/animation/CutsceneMgr.cpp
index 39066958..6f8e9790 100644
--- a/src/core/CutsceneMgr.cpp
+++ b/src/animation/CutsceneMgr.cpp
@@ -352,6 +352,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
CWorld::Remove(ms_pCutsceneObjects[ms_numCutsceneObjs]);
ms_pCutsceneObjects[ms_numCutsceneObjs]->DeleteRwObject();
delete ms_pCutsceneObjects[ms_numCutsceneObjs];
+ ms_pCutsceneObjects[ms_numCutsceneObjs] = nil;
}
ms_numCutsceneObjs = 0;
@@ -409,7 +410,7 @@ CCutsceneMgr::Update(void)
if (!ms_running) return;
- ms_cutsceneTimer += CTimer::GetTimeStepNonClipped() * 0.02f;
+ ms_cutsceneTimer += CTimer::GetTimeStepNonClippedInSeconds();
if (CGeneral::faststricmp(ms_cutsceneName, "end") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
if (CPad::GetPad(0)->GetCrossJustDown()
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
diff --git a/src/core/CutsceneMgr.h b/src/animation/CutsceneMgr.h
index 7b809964..3c915eea 100644
--- a/src/core/CutsceneMgr.h
+++ b/src/animation/CutsceneMgr.h
@@ -26,7 +26,7 @@ public:
static CDirectory *&ms_pCutsceneDir;
static uint32 &ms_cutsceneLoadStatus;
- static void SetRunning(bool running) { ms_running = running; }
+ static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
static bool IsRunning(void) { return ms_running; }
static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp
index 4039bd75..fecd079e 100644
--- a/src/audio/AudioCollision.cpp
+++ b/src/audio/AudioCollision.cpp
@@ -10,6 +10,22 @@
const int CollisionSoundIntensity = 60;
+cAudioCollisionManager::cAudioCollisionManager()
+{
+ m_sQueue.m_pEntity1 = nil;
+ m_sQueue.m_pEntity2 = nil;
+ m_sQueue.m_bSurface1 = SURFACE_DEFAULT;
+ m_sQueue.m_bSurface2 = SURFACE_DEFAULT;
+ m_sQueue.m_fIntensity2 = 0.0f;
+ m_sQueue.m_fIntensity1 = 0.0f;
+ m_sQueue.m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
+
+ for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
+ m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
+
+ m_bCollisionsInQueue = 0;
+}
+
void
cAudioCollisionManager::AddCollisionToRequestedQueue()
{
@@ -151,7 +167,7 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = counter;
+ m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -164,7 +180,7 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -270,7 +286,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
break;
}
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
if(counter >= 255) counter = 28;
m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@@ -282,7 +298,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
diff --git a/src/audio/AudioCollision.h b/src/audio/AudioCollision.h
index 956da3e3..a21bbfdc 100644
--- a/src/audio/AudioCollision.h
+++ b/src/audio/AudioCollision.h
@@ -29,8 +29,8 @@ public:
uint8 m_bCollisionsInQueue;
cAudioCollision m_sQueue;
- // reversed all methods
- void AddCollisionToRequestedQueue(); /// ok
+ cAudioCollisionManager();
+ void AddCollisionToRequestedQueue();
};
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error"); \ No newline at end of file
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index b73cf3ca..1d2835cf 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -1,8 +1,7 @@
-#include "common.h"
+#include "common.h"
#include "patcher.h"
-#include "General.h"
-#include "audio_enums.h"
+#include "audio_enums.h"
#include "AudioManager.h"
#include "Automobile.h"
@@ -13,14 +12,15 @@
#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 "Fire.h"
#include "Physical.h"
#include "Placeable.h"
#include "Plane.h"
@@ -39,20 +39,19 @@
#include "ZoneCull.h"
#include "sampman.h"
-cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
-uint32 &gPornNextTime = *(uint32*)0x6508A0;
-uint32 &gSawMillNextTime = *(uint32*)0x6508A4;
-uint32 &gShopNextTime = *(uint32*)0x6508A8;
-uint32 &gAirportNextTime = *(uint32*)0x6508AC;
-uint32 &gCinemaNextTime = *(uint32*)0x6508B0;
-uint32 &gDocksNextTime = *(uint32*)0x6508B4;
-uint32 &gHomeNextTime = *(uint32*)0x6508B8;
-uint32 &gCellNextTime = *(uint32*)0x6508BC;
-uint32 &gNextCryTime = *(uint32*)0x6508C0;
-uint8 &jumboVolOffset = *(uint8 *)0x6508ED;
-uint8 &gJumboVolOffsetPercentage = *(uint8 *)0x6508ED;
-bool &bPlayerJustEnteredCar = *(bool *)0x6508C4;
-bool &g_bMissionAudioLoadFailed = *(bool *)0x95CD8E;
+cAudioManager AudioManager;
+uint32 gPornNextTime; // = *(uint32*)0x6508A0;
+uint32 gSawMillNextTime; // = *(uint32*)0x6508A4;
+uint32 gShopNextTime; // = *(uint32*)0x6508A8;
+uint32 gAirportNextTime; // = *(uint32*)0x6508AC;
+uint32 gCinemaNextTime; //= *(uint32*)0x6508B0;
+uint32 gDocksNextTime; // = *(uint32*)0x6508B4;
+uint32 gHomeNextTime; // = *(uint32*)0x6508B8;
+uint32 gCellNextTime; // = *(uint32*)0x6508BC;
+uint32 gNextCryTime; // = *(uint32*)0x6508C0;
+uint8 gJumboVolOffsetPercentage; // = *(uint8 *)0x6508ED;
+bool bPlayerJustEnteredCar; // = *(bool *)0x6508C4;
+bool g_bMissionAudioLoadFailed; // = *(bool *)0x95CD8E;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1;
@@ -70,39 +69,46 @@ 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, 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},
+ {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};
+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 {
@@ -179,15 +185,25 @@ enum eVehicleModel {
};
enum PLAY_STATUS : uint8 {
- PLAY_STATUS_STOPPED = 0,
- PLAY_STATUS_PLAYING = 1,
- PLAY_STATUS_FINISHED = 2
+ 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
-};
+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)
@@ -216,7 +232,9 @@ cPedComments::Add(tPedComment *com)
}
}
- if(i < index) memmove(&m_nIndexMap[m_nActiveBank][i + 1], &m_nIndexMap[m_nActiveBank][i], NUM_PED_COMMENTS_SLOTS -1 - i);
+ 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;
@@ -234,19 +252,23 @@ cPedComments::Process()
if(!AudioManager.m_bUserPause) {
if(m_nCommentsInBank[m_nActiveBank]) {
- sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;
- if(!SampleManager.IsPedCommentLoaded(sampleIndex)) SampleManager.LoadPedComment(sampleIndex);
+ 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_counter = 0;
+ 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_bBankIndex = SAMPLEBANK_PED;
AudioManager.m_sQueueSample.m_nReleasingVolumeModificator = 3;
AudioManager.m_sQueueSample.m_bVolume =
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;
+ 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;
@@ -258,9 +280,11 @@ cPedComments::Process()
case SFX_POLICE_HELI_3:
AudioManager.m_sQueueSample.m_fSoundIntensity = policeHeliIntensity;
break;
- default: AudioManager.m_sQueueSample.m_fSoundIntensity = defaultIntensity; break;
+ default:
+ AudioManager.m_sQueueSample.m_fSoundIntensity = defaultIntensity;
+ break;
}
- AudioManager.m_sQueueSample.m_bReleasingSoundFlag = 1;
+ AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true;
AudioManager.m_sQueueSample.m_vecPos =
m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos;
@@ -274,10 +298,13 @@ cPedComments::Process()
AudioManager.m_sQueueSample.m_bIs2D = false;
AudioManager.m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) +
+ 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]].field_25 = -1;
+ if(CTimer::GetIsSlowMotionActive())
+ AudioManager.m_sQueueSample.m_nFrequency /= 2;
+ m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess =
+ -1;
AudioManager.AddSampleToRequestedQueue();
}
@@ -291,42 +318,81 @@ cPedComments::Process()
}
comment = m_asPedComments[actualUsedBank];
for(uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) {
- if(m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].field_25 > 0) {
- --m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].field_25;
+ 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; }
+ for(uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) {
+ m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS;
+ }
m_nCommentsInBank[actualUsedBank] = 0;
}
}
+cAudioManager::cAudioManager()
+{
+ m_bIsInitialised = false;
+ field_1 = 1;
+ m_fSpeedOfSound = 6.86f;
+ m_bTimeSpent = 50;
+ m_bActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
+ m_bActiveSampleQueue = 1;
+ ClearRequestedQueue();
+ m_bActiveSampleQueue = 0;
+ ClearRequestedQueue();
+ ClearActiveSamples();
+ GenerateIntegerRandomNumberTable();
+ field_4 = 0;
+ m_bDynamicAcousticModelingStatus = 1;
+
+ for(int i = 0; i < NUM_AUDIOENTITIES; i++) {
+ m_asAudioEntities[i].m_bIsUsed = false;
+ m_anAudioEntityIndices[i] = NUM_AUDIOENTITIES;
+ }
+ m_nAudioEntitiesTotal = 0;
+ m_FrameCounter = 0;
+ m_bFifthFrameFlag = 0;
+ m_bTimerJustReset = 0;
+ m_nTimer = 0;
+}
+
+cAudioManager::~cAudioManager()
+{
+ if(m_bIsInitialised) Terminate();
+}
+
void
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
{
uint32 i = 0;
if(sample != 0) {
for(; i < sample; i++) {
- if(m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]]
- .calculatedVolume > m_asSamples[m_bActiveSampleQueue][sample].calculatedVolume)
+ if(m_asSamples[m_bActiveSampleQueue]
+ [m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]]
+ .m_nCalculatedVolume >
+ m_asSamples[m_bActiveSampleQueue][sample].m_nCalculatedVolume)
break;
}
if(i < sample) {
memmove(&m_abSampleQueueIndexTable[m_bActiveSampleQueue][i + 1],
- &m_abSampleQueueIndexTable[m_bActiveSampleQueue][i], m_bActiveSamples - i - 1);
+ &m_abSampleQueueIndexTable[m_bActiveSampleQueue][i],
+ m_bActiveSamples - i - 1);
}
}
m_abSampleQueueIndexTable[m_bActiveSampleQueue][i] = sample;
}
void
-cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, uint8 counter,
- bool notLooping)
+cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
+ uint8 counter, bool notLooping)
{
m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = counter;
+ m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_nSampleIndex = sample;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -339,11 +405,13 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl
m_sQueueSample.m_nLoopCount = 1;
}
m_sQueueSample.m_bEmittingVolume = emittingVolume;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -365,12 +433,14 @@ cAudioManager::AddReflectionsToRequestedQueue()
if(m_sQueueSample.m_bLoopsRemaining > 5) {
m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
m_sQueueSample.m_bEmittingVolume = emittingVolume;
- m_sQueueSample.m_bVolume = ComputeVolume(
- emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume > emittingVolume >> 4) {
- m_sQueueSample.m_counter += ((i + 1) << 8);
+ m_sQueueSample.m_nCounter += ((i + 1) << 8);
if(m_sQueueSample.m_nLoopCount) {
- noise = RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ noise = RandomDisplacement(
+ m_sQueueSample.m_nFrequency >> 5);
if(noise <= 0)
m_sQueueSample.m_nFrequency += noise;
else
@@ -394,28 +464,32 @@ cAudioManager::AddReleasingSounds()
for(int32 i = 0; i < m_bSampleRequestQueuesStatus[queue]; i++) {
tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];
- if (sample.m_bLoopEnded) continue;
+ if(sample.m_bLoopEnded) continue;
toProcess[i] = false;
for(int32 j = 0; j < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; j++) {
if(sample.m_nEntityIndex ==
- m_asSamples[m_bActiveSampleQueue]
- [m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]]
- .m_nEntityIndex &&
- sample.m_counter == m_asSamples[m_bActiveSampleQueue]
- [m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]]
- .m_counter) {
+ m_asSamples[m_bActiveSampleQueue]
+ [m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]]
+ .m_nEntityIndex &&
+ sample.m_nCounter ==
+ m_asSamples[m_bActiveSampleQueue]
+ [m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]]
+ .m_nCounter) {
toProcess[i] = true;
break;
}
}
if(!toProcess[i]) {
- if(sample.m_counter <= 255 || !sample.m_bLoopsRemaining) {
+ if(sample.m_nCounter <= 255 || !sample.m_bLoopsRemaining) {
if(!sample.m_nReleasingVolumeDivider) continue;
if(!sample.m_nLoopCount) {
if(sample.m_nVolumeChange == -1) {
- sample.m_nVolumeChange = sample.m_bVolume / sample.m_nReleasingVolumeDivider;
- if(sample.m_nVolumeChange <= 0) sample.m_nVolumeChange = 1;
+ sample.m_nVolumeChange =
+ sample.m_bVolume /
+ sample.m_nReleasingVolumeDivider;
+ if(sample.m_nVolumeChange <= 0)
+ sample.m_nVolumeChange = 1;
}
if(sample.m_bVolume <= sample.m_nVolumeChange) {
sample.m_nReleasingVolumeDivider = 0;
@@ -444,16 +518,20 @@ cAudioManager::AddSampleToRequestedQueue()
bool bReflections;
if(m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
- calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (maxVolume - m_sQueueSample.m_bVolume);
+ calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator *
+ (maxVolume - m_sQueueSample.m_bVolume);
sampleIndex = m_bSampleRequestQueuesStatus[m_bActiveSampleQueue];
if(sampleIndex >= m_bActiveSamples) {
- sampleIndex = m_abSampleQueueIndexTable[m_bActiveSampleQueue][m_bActiveSamples - 1];
- if(m_asSamples[m_bActiveSampleQueue][sampleIndex].calculatedVolume <= calculatedVolume) return;
+ sampleIndex =
+ m_abSampleQueueIndexTable[m_bActiveSampleQueue][m_bActiveSamples - 1];
+ if(m_asSamples[m_bActiveSampleQueue][sampleIndex].m_nCalculatedVolume <=
+ calculatedVolume)
+ return;
} else {
++m_bSampleRequestQueuesStatus[m_bActiveSampleQueue];
}
- m_sQueueSample.calculatedVolume = calculatedVolume;
- m_sQueueSample.m_bLoopEnded = 0;
+ m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
+ m_sQueueSample.m_bLoopEnded = false;
if(m_sQueueSample.m_bIs2D) {
m_sQueueSample.m_bRequireReflection = false;
m_sQueueSample.m_bLoopsRemaining = 0;
@@ -495,7 +573,7 @@ cAudioManager::ClearActiveSamples()
{
for(int32 i = 0; i < m_bActiveSamples; i++) {
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
- m_asActiveSamples[i].m_counter = 0;
+ m_asActiveSamples[i].m_nCounter = 0;
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_bBankIndex = SAMPLEBANK_INVALID;
m_asActiveSamples[i].m_bIs2D = false;
@@ -504,8 +582,8 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_bVolume = 0;
m_asActiveSamples[i].m_bEmittingVolume = 0;
m_asActiveSamples[i].m_fDistance = 0.0f;
- m_asActiveSamples[i].m_bIsProcessed = 0;
- m_asActiveSamples[i].m_bLoopEnded = 0;
+ 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;
@@ -513,7 +591,7 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_fSoundIntensity = 200.0f;
m_asActiveSamples[i].m_bOffset = 63;
m_asActiveSamples[i].m_bReleasingSoundFlag = 0;
- m_asActiveSamples[i].calculatedVolume = 0;
+ 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};
@@ -532,8 +610,8 @@ cAudioManager::ClearMissionAudio()
m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22 = 0;
m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.field_12 = 1;
- m_sMissionAudio.field_24 = 0;
+ m_sMissionAudio.m_bPredefinedProperties = 1;
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
}
}
@@ -554,14 +632,15 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
if(!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) {
float dist = position2 - position1;
if(dist != 0.0f) {
- float speedOfSource = (dist / field_19192) * speedMultiplier;
+ float speedOfSource = (dist / m_bTimeSpent) * 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);
+ newFreq =
+ (oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound);
}
}
}
@@ -585,7 +664,9 @@ cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float d
if((soundIntensity * 0.2f) <= distance) {
newSoundIntensity = soundIntensity * 0.2f;
emittingVolume =
- sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) / (soundIntensity - newSoundIntensity)) * emittingVolume;
+ sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) /
+ (soundIntensity - newSoundIntensity)) *
+ emittingVolume;
}
return emittingVolume;
}
@@ -630,7 +711,8 @@ cAudioManager::DestroyAllGameCreatedEntities()
case AUDIOTYPE_GARAGE:
case AUDIOTYPE_FIREHYDRANT: DestroyEntity(i); break;
case AUDIOTYPE_SCRIPTOBJECT:
- entity = (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity;
+ entity =
+ (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity;
if(entity) {
delete entity;
m_asAudioEntities[i].m_pEntity = nil;
@@ -641,21 +723,25 @@ cAudioManager::DestroyAllGameCreatedEntities()
}
}
}
- m_nScriptObjectEntityTotal = 0;
+ 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 < totalAudioEntitiesSlots &&
+ 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)
- memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1],
- 4 * (m_nAudioEntitiesTotal - (i + 1)));
- m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = totalAudioEntitiesSlots;
+ memmove(&m_anAudioEntityIndices[i],
+ &m_anAudioEntityIndices[i + 1],
+ NUM_AUDIOENTITY_EVENTS *
+ (m_nAudioEntitiesTotal - (i + 1)));
+ m_anAudioEntityIndices[--m_nAudioEntitiesTotal] =
+ totalAudioEntitiesSlots;
return;
}
}
@@ -665,7 +751,8 @@ cAudioManager::DestroyEntity(int32 id)
void
cAudioManager::DoJumboVolOffset() const
{
- if(!(m_FrameCounter % (m_anRandomTable[0] % 6 + 3))) jumboVolOffset = m_anRandomTable[1] % 60;
+ if(!(m_FrameCounter % (m_anRandomTable[0] % 6 + 3)))
+ gJumboVolOffsetPercentage = m_anRandomTable[1] % 60;
}
uint32
@@ -696,11 +783,14 @@ cAudioManager::GetCopTalkSfx(int16 sound)
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;
+ 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;
+ return (SFX_COP_VOICE_2_ARREST_1 - SFX_COP_VOICE_1_ARREST_1) *
+ (m_sQueueSample.m_nEntityIndex % 5) +
+ sfx;
}
uint32
@@ -716,11 +806,14 @@ cAudioManager::GetSwatTalkSfx(int16 sound)
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;
+ 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 % 3) + sfx;
+ return (SFX_SWAT_VOICE_2_CHASE_1 - SFX_SWAT_VOICE_1_CHASE_1) *
+ (m_sQueueSample.m_nEntityIndex % 4) +
+ sfx;
}
uint32
@@ -736,11 +829,14 @@ cAudioManager::GetFBITalkSfx(int16 sound)
if(sound != SOUND_PED_PURSUIT_FBI) { return GetGenericMaleTalkSfx(sound); }
pedState = FindPlayerPed()->m_nPedState;
- if(pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE;
+ 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;
+ return (SFX_FBI_VOICE_2_CHASE_1 - SFX_FBI_VOICE_1_CHASE_1) *
+ (m_sQueueSample.m_nEntityIndex % 3) +
+ sfx;
}
uint32
@@ -753,10 +849,13 @@ cAudioManager::GetArmyTalkSfx(int16 sound)
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;
+ 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;
+ return (SFX_ARMY_VOICE_2_CHASE_1 - SFX_ARMY_VOICE_1_CHASE_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -766,14 +865,24 @@ cAudioManager::GetMedicTalkSfx(int16 sound)
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_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;
+ 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;
+ return (SFX_MEDIC_VOICE_2_GUN_PANIC_1 - SFX_MEDIC_VOICE_1_GUN_PANIC_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -789,10 +898,14 @@ cAudioManager::GetNormalMaleTalkSfx(int16 sound)
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_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_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;
@@ -816,7 +929,10 @@ cAudioManager::GetTaxiDriverTalkSfx(int16 sound)
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;
+ 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
@@ -845,16 +961,26 @@ cAudioManager::GetMafiaTalkSfx(int16 sound)
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_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_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;
+ return (SFX_MAFIA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1) *
+ (m_sQueueSample.m_nEntityIndex % 3) +
+ sfx;
}
uint32
@@ -864,13 +990,23 @@ cAudioManager::GetTriadTalkSfx(int16 sound)
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_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_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);
}
@@ -884,21 +1020,33 @@ cAudioManager::GetDiabloTalkSfx(int16 sound)
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_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_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_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;
+ return (SFX_DIABLO_MALE_VOICE_2_CHAT_1 - SFX_DIABLO_MALE_VOICE_1_CHAT_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -908,15 +1056,23 @@ cAudioManager::GetYakuzaTalkSfx(int16 sound)
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_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_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;
+ return (SFX_YAKUZA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -927,16 +1083,24 @@ cAudioManager::GetYardieTalkSfx(int16 sound)
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_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_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;
+ return (SFX_YARDIE_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -946,16 +1110,31 @@ cAudioManager::GetColumbianTalkSfx(int16 sound)
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_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;
+ return (SFX_COLUMBIAN_MALE_VOICE_2_DRIVER_ABUSE_1 -
+ SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -965,18 +1144,30 @@ cAudioManager::GetHoodTalkSfx(int16 sound)
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_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_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;
+ return (SFX_HOOD_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -986,11 +1177,19 @@ cAudioManager::GetBlackCriminalTalkSfx(int16 sound)
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_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_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;
@@ -1006,11 +1205,19 @@ cAudioManager::GetWhiteCriminalTalkSfx(int16 sound)
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_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_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;
@@ -1026,13 +1233,27 @@ cAudioManager::GetMaleNo2TalkSfx(int16 sound)
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;
+ 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;
@@ -1045,13 +1266,21 @@ cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model)
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_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_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;
@@ -1062,7 +1291,9 @@ cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model)
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);
+ 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;
}
@@ -1073,9 +1304,15 @@ cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound)
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_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;
@@ -1095,9 +1332,15 @@ cAudioManager::GetBlackFatMaleTalkSfx(int16 sound)
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_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;
@@ -1154,7 +1397,9 @@ cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound)
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_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;
@@ -1164,7 +1409,9 @@ cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound)
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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CHAT_1, 4);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1177,15 +1424,23 @@ cAudioManager::GetFemaleNo3TalkSfx(int16 sound)
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_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_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_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);
}
@@ -1205,15 +1460,21 @@ cAudioManager::GetBlackFatFemaleTalkSfx(int16 sound)
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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1229,8 +1490,12 @@ cAudioManager::GetWhiteFatFemaleTalkSfx(int16 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_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;
@@ -1240,7 +1505,9 @@ cAudioManager::GetWhiteFatFemaleTalkSfx(int16 sound)
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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CHAT_1, 8);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1260,17 +1527,23 @@ cAudioManager::GetBlackFemaleProstituteTalkSfx(int16 sound)
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_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;
+ 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;
+ return (SFX_BLACK_PROSTITUTE_VOICE_2_CHAT_1 - SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -1286,17 +1559,23 @@ cAudioManager::GetWhiteFemaleProstituteTalkSfx(int16 sound)
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_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;
+ 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;
+ return (SFX_WHITE_PROSTITUTE_VOICE_2_CHAT_1 - SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -1324,7 +1603,9 @@ cAudioManager::GetBlackProjectFemaleOldTalkSfx(int16 sound)
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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CHAT_1, 10);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1353,7 +1634,9 @@ cAudioManager::GetBlackProjectFemaleYoungTalkSfx(int16 sound)
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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CHAT_1, 7);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1372,13 +1655,21 @@ cAudioManager::GetChinatownMaleOldTalkSfx(int16 sound)
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_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;
+ 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;
@@ -1397,15 +1688,21 @@ cAudioManager::GetChinatownMaleYoungTalkSfx(int16 sound)
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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CHAT_1, 6);
+ break;
default: return GetGenericMaleTalkSfx(sound);
}
return sfx;
@@ -1421,13 +1718,19 @@ cAudioManager::GetChinatownFemaleOldTalkSfx(int16 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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_CHAT_1, 6);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1443,15 +1746,21 @@ cAudioManager::GetChinatownFemaleYoungTalkSfx(int16 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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1470,16 +1779,27 @@ cAudioManager::GetLittleItalyMaleTalkSfx(int16 sound)
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_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;
+ 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;
+ 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
@@ -1492,15 +1812,21 @@ cAudioManager::GetLittleItalyFemaleOldTalkSfx(int16 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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1519,14 +1845,18 @@ cAudioManager::GetLittleItalyFemaleYoungTalkSfx(int16 sound)
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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CHAT_1, 6);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1542,13 +1872,21 @@ cAudioManager::GetWhiteDockerMaleTalkSfx(int16 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_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;
+ 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;
@@ -1564,12 +1902,16 @@ cAudioManager::GetBlackDockerMaleTalkSfx(int16 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_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_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);
}
@@ -1583,15 +1925,21 @@ cAudioManager::GetScumMaleTalkSfx(int16 sound)
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_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, 0xA); 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_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_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);
}
@@ -1605,8 +1953,12 @@ cAudioManager::GetScumFemaleTalkSfx(int16 sound)
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_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:
@@ -1628,13 +1980,21 @@ cAudioManager::GetWhiteWorkerMaleTalkSfx(int16 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_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;
+ 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;
@@ -1650,13 +2010,21 @@ cAudioManager::GetBlackWorkerMaleTalkSfx(int16 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_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;
+ 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;
@@ -1675,20 +2043,30 @@ cAudioManager::GetBusinessMaleYoungTalkSfx(int16 sound, int32 model)
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_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;
+ 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);
+ 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;
}
@@ -1705,14 +2083,24 @@ cAudioManager::GetBusinessMaleOldTalkSfx(int16 sound)
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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CHAT_1, 5);
+ break;
default: return GetGenericMaleTalkSfx(sound);
}
return sfx;
@@ -1728,19 +2116,33 @@ cAudioManager::GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model)
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_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;
+ 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);
+ 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;
}
@@ -1757,8 +2159,12 @@ cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound)
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_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;
@@ -1768,7 +2174,9 @@ cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound)
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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1781,14 +2189,18 @@ cAudioManager::GetSupermodelMaleTalkSfx(int16 sound)
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_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_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);
}
@@ -1805,7 +2217,9 @@ cAudioManager::GetSupermodelFemaleTalkSfx(int16 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_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);
@@ -1826,8 +2240,12 @@ cAudioManager::GetStewardMaleTalkSfx(int16 sound)
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_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);
@@ -1848,14 +2266,19 @@ cAudioManager::GetStewardFemaleTalkSfx(int16 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_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;
+ return (SFX_STEWARD_FEMALE_VOICE_2_DRIVER_ABUSE_1 -
+ SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -1865,15 +2288,25 @@ cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model)
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_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);
+ if(model == MI_FAN_MAN2)
+ sfx += (SFX_FOOTBALL_MALE_VOICE_2_DRIVER_ABUSE_1 -
+ SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1);
return sfx;
}
@@ -1885,15 +2318,24 @@ cAudioManager::GetFanFemaleTalkSfx(int16 sound)
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_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;
+ 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;
+ return (SFX_FOOTBALL_FEMALE_VOICE_2_DRIVER_ABUSE_1 -
+ SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1) *
+ (m_sQueueSample.m_nEntityIndex % 2) +
+ sfx;
}
uint32
@@ -1903,9 +2345,15 @@ cAudioManager::GetHospitalMaleTalkSfx(int16 sound)
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_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;
@@ -1922,11 +2370,15 @@ cAudioManager::GetHospitalFemaleTalkSfx(int16 sound)
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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_CHAT_1, 6);
+ break;
default: return GetGenericFemaleTalkSfx(sound);
}
return sfx;
@@ -1946,14 +2398,18 @@ cAudioManager::GetWhiteConstructionWorkerTalkSfx(int16 sound)
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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CHAT_1, 7);
+ break;
default: return GetGenericMaleTalkSfx(sound);
}
return sfx;
@@ -1975,14 +2431,18 @@ cAudioManager::GetBlackConstructionWorkerTalkSfx(int16 sound)
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_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;
+ case SOUND_PED_CHAT:
+ GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CHAT_1, 4);
+ break;
default: return GetGenericMaleTalkSfx(sound);
}
return sfx;
@@ -1995,13 +2455,17 @@ cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model)
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_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_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);
}
@@ -2021,14 +2485,22 @@ cAudioManager::GetStudentMaleTalkSfx(int16 sound)
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_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_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);
}
@@ -2042,14 +2514,24 @@ cAudioManager::GetStudentFemaleTalkSfx(int16 sound)
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_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_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);
}
@@ -2066,10 +2548,15 @@ 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, "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, "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); }
@@ -2159,12 +2646,24 @@ cAudioManager::GetSecurityGuardTalkSfx(int16 sound)
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_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: GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 12); break;
+ 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;
@@ -2227,8 +2726,8 @@ cAudioManager::GenerateIntegerRandomNumberTable()
char *
cAudioManager::Get3DProviderName(uint8 id) const
{
- if(!m_bIsInitialised) return 0;
- if(id >= SampleManager.GetNum3DProvidersAvailable()) return 0;
+ if(!m_bIsInitialised) return nil;
+ if(id >= SampleManager.GetNum3DProvidersAvailable()) return nil;
return SampleManager.Get3DProviderName(id);
}
@@ -2380,8 +2879,8 @@ cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint
}
float
-cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission,
- float velocityChange)
+cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
+ cTransmission *transmission, float velocityChange)
{
tWheelState wheelState;
float relativeVelChange;
@@ -2419,8 +2918,8 @@ cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobil
}
float
-cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission,
- float velocityChange)
+cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
+ cTransmission *transmission, float velocityChange)
{
float relativeVelChange;
@@ -2436,7 +2935,8 @@ cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automo
bool
cAudioManager::HasAirBrakes(int32 model) const
{
- return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH;
+ return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS ||
+ model == COACH;
}
void
@@ -2516,7 +3016,8 @@ cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const
void
cAudioManager::PlayLoadedMissionAudio()
{
- if(m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && m_sMissionAudio.m_bLoadingStatus == LOADING_STATUS_LOADED &&
+ if(m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE &&
+ m_sMissionAudio.m_bLoadingStatus == LOADING_STATUS_LOADED &&
!m_sMissionAudio.m_bPlayStatus) {
m_sMissionAudio.m_bIsPlayed = true;
}
@@ -2526,11 +3027,12 @@ void
cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
{
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};
+ 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(m_bIsInitialised) {
if(index >= 0 && index < totalAudioEntitiesSlots) {
@@ -2538,37 +3040,48 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
if(entity.m_bIsUsed) {
if(sound < SOUND_TOTAL_SOUNDS) {
if(entity.m_nType == AUDIOTYPE_SCRIPTOBJECT) {
- if(m_nScriptObjectEntityTotal < ARRAY_SIZE(m_anScriptObjectEntityIndices)) {
+ if(m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal <
+ ARRAY_SIZE(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices)) {
entity.m_awAudioEvent[0] = sound;
entity.m_AudioEvents = 1;
- m_anScriptObjectEntityIndices[m_nScriptObjectEntityTotal++] =
- index;
+ 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;
+ 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]] >
+ if(OneShotPriority[entity
+ .m_awAudioEvent[i]] >
OneShotPriority[sound])
break;
++i;
}
- if(i < 3) {
+ if(i < NUM_AUDIOENTITY_EVENTS - 1) {
memmove(&entity.m_awAudioEvent[i + 1],
- &entity.m_awAudioEvent[i], (3 - i) * 2);
- memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i],
- (3 - i) * 4);
+ &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;
+ if(entity.m_AudioEvents <
+ ARRAY_SIZE(entity.m_awAudioEvent))
+ ++entity.m_AudioEvents;
}
}
}
@@ -2594,22 +3107,22 @@ cAudioManager::PostInitialiseGameSpecificSetup()
m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager);
if(m_nFireAudioEntity >= 0) SetEntityStatus(m_nFireAudioEntity, 1);
- m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void*)1);
+ m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1);
if(m_nCollisionEntity >= 0) SetEntityStatus(m_nCollisionEntity, 1);
- m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void*)1);
+ m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1);
if(m_nFrontEndEntity >= 0) SetEntityStatus(m_nFrontEndEntity, 1);
- m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void*)1);
+ m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1);
if(m_nProjectileEntity >= 0) SetEntityStatus(m_nProjectileEntity, 1);
- m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void*)1);
+ m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1);
if(m_nWaterCannonEntity >= 0) SetEntityStatus(m_nWaterCannonEntity, 1);
- m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void*)1);
+ m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1);
if(m_nPoliceChannelEntity >= 0) SetEntityStatus(m_nPoliceChannelEntity, 1);
- m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void*)1);
+ m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void *)1);
if(m_nBridgeEntity >= 0) SetEntityStatus(m_nBridgeEntity, 1);
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
@@ -2617,8 +3130,8 @@ cAudioManager::PostInitialiseGameSpecificSetup()
m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22 = 0;
m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.field_12 = 1;
- m_sMissionAudio.field_24 = 0;
+ m_sMissionAudio.m_bPredefinedProperties = 1;
+ m_sMissionAudio.m_nMissionAudioCounter = 0;
ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds());
}
@@ -2697,7 +3210,8 @@ 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;
+ if(!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name))
+ return MissionAudioNameSfxAssoc[i].m_nId;
}
debug("Can't find mission audio %s", name);
return NO_SAMPLE;
@@ -2713,12 +3227,13 @@ cAudioManager::PreloadMissionAudio(const char *name)
m_sMissionAudio.m_bLoadingStatus = LOADING_STATUS_NOT_LOADED;
m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22 = 0;
- m_sMissionAudio.field_24 =
- field_19192 * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000;
- m_sMissionAudio.field_24 *= 4;
+ m_sMissionAudio.m_nMissionAudioCounter =
+ m_bTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) /
+ 1000;
+ m_sMissionAudio.m_nMissionAudioCounter *= 4;
m_sMissionAudio.m_bIsPlayed = false;
- m_sMissionAudio.field_12 = 1;
- g_bMissionAudioLoadFailed = 0;
+ m_sMissionAudio.m_bPredefinedProperties = 1;
+ g_bMissionAudioLoadFailed = false;
}
}
}
@@ -2774,188 +3289,231 @@ cAudioManager::ProcessActiveQueues()
uint8 emittingVol;
CVector position;
- for (int32 i = 0; i < m_bActiveSamples; i++) {
- m_asSamples[m_bActiveSampleQueue][i].m_bIsProcessed = 0;
- m_asActiveSamples[i].m_bIsProcessed = 0;
- }
-
- for (int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
- tSound& sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]];
- if (sample.m_nSampleIndex != NO_SAMPLE) {
- for (int32 j = 0; j < m_bActiveSamples; ++j) {
- if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex &&
- sample.m_counter == m_asActiveSamples[j].m_counter &&
- sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
- if (sample.m_nLoopCount) {
- if (m_FrameCounter & 1) {
+ for(int32 i = 0; i < m_bActiveSamples; i++) {
+ m_asSamples[m_bActiveSampleQueue][i].m_bIsProcessed = false;
+ m_asActiveSamples[i].m_bIsProcessed = false;
+ }
+
+ for(int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
+ tSound &sample = m_asSamples[m_bActiveSampleQueue]
+ [m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]];
+ if(sample.m_nSampleIndex != NO_SAMPLE) {
+ for(int32 j = 0; j < m_bActiveSamples; ++j) {
+ if(sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex &&
+ sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
+ sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
+ if(sample.m_nLoopCount) {
+ if(m_FrameCounter & 1) {
flag = !!(j & 1);
- }
- else {
+ } else {
flag = !(j & 1);
}
- if (flag && !SampleManager.GetChannelUsedFlag(j)) {
- sample.m_bLoopEnded = 1;
- m_asActiveSamples[j].m_bLoopEnded = 1;
- m_asActiveSamples[j].m_nSampleIndex = NO_SAMPLE;
- m_asActiveSamples[j].m_nEntityIndex = AEHANDLE_NONE;
+ if(flag && !SampleManager.GetChannelUsedFlag(j)) {
+ sample.m_bLoopEnded = true;
+ m_asActiveSamples[j].m_bLoopEnded = true;
+ m_asActiveSamples[j].m_nSampleIndex =
+ NO_SAMPLE;
+ m_asActiveSamples[j].m_nEntityIndex =
+ AEHANDLE_NONE;
continue;
}
}
- sample.m_bIsProcessed = 1;
- m_asActiveSamples[j].m_bIsProcessed = 1;
+ sample.m_bIsProcessed = true;
+ m_asActiveSamples[j].m_bIsProcessed = true;
sample.m_nVolumeChange = -1;
- if (!sample.m_bReleasingSoundFlag) {
- if (sample.m_bIs2D) {
- if (field_4) {
- emittingVol = 2 * min(63, sample.m_bEmittingVolume);
- }
- else {
- emittingVol = sample.m_bEmittingVolume;
+ if(!sample.m_bReleasingSoundFlag) {
+ if(sample.m_bIs2D) {
+ if(field_4) {
+ emittingVol =
+ 2 *
+ min(63,
+ sample.m_bEmittingVolume);
+ } else {
+ emittingVol =
+ sample.m_bEmittingVolume;
}
- SampleManager.SetChannelFrequency(j, sample.m_nFrequency);
- SampleManager.SetChannelEmittingVolume(j, emittingVol);
- }
- else {
- m_asActiveSamples[j].m_fDistance = sample.m_fDistance;
+ SampleManager.SetChannelFrequency(
+ j, sample.m_nFrequency);
+ SampleManager.SetChannelEmittingVolume(
+ j, emittingVol);
+ } else {
+ m_asActiveSamples[j].m_fDistance =
+ sample.m_fDistance;
position2 = sample.m_fDistance;
- position1 = m_asActiveSamples[j].m_fDistance;
- sample.m_nFrequency = ComputeDopplerEffectedFrequency(
- sample.m_nFrequency, position1, position2, sample.m_fSpeedMultiplier);
- if (sample.m_nFrequency != m_asActiveSamples[j].m_nFrequency) {
+ position1 =
+ m_asActiveSamples[j].m_fDistance;
+ sample.m_nFrequency =
+ ComputeDopplerEffectedFrequency(
+ sample.m_nFrequency, position1,
+ position2,
+ sample.m_fSpeedMultiplier);
+ if(sample.m_nFrequency !=
+ m_asActiveSamples[j].m_nFrequency) {
int32 freq;
- if (sample.m_nFrequency <=
- m_asActiveSamples[j].m_nFrequency) {
- freq = max(sample.m_nFrequency,
- m_asActiveSamples[j].m_nFrequency -
- 6000);
- }
- else {
- freq = min(sample.m_nFrequency,
- m_asActiveSamples[j].m_nFrequency +
- 6000);
+ if(sample.m_nFrequency <=
+ m_asActiveSamples[j]
+ .m_nFrequency) {
+ freq = max(
+ sample.m_nFrequency,
+ m_asActiveSamples[j]
+ .m_nFrequency -
+ 6000);
+ } else {
+ freq = min(
+ sample.m_nFrequency,
+ m_asActiveSamples[j]
+ .m_nFrequency +
+ 6000);
}
- m_asActiveSamples[j].m_nFrequency = freq;
- SampleManager.SetChannelFrequency(j, freq);
+ m_asActiveSamples[j].m_nFrequency =
+ freq;
+ SampleManager.SetChannelFrequency(
+ j, freq);
}
- if (sample.m_bEmittingVolume !=
- m_asActiveSamples[j].m_bEmittingVolume) {
- if (sample.m_bEmittingVolume <=
- m_asActiveSamples[j].m_bEmittingVolume) {
+ if(sample.m_bEmittingVolume !=
+ m_asActiveSamples[j].m_bEmittingVolume) {
+ if(sample.m_bEmittingVolume <=
+ m_asActiveSamples[j]
+ .m_bEmittingVolume) {
vol = max(
- m_asActiveSamples[j].m_bEmittingVolume - 10,
- sample.m_bEmittingVolume);
- }
- else {
+ m_asActiveSamples[j]
+ .m_bEmittingVolume -
+ 10,
+ sample
+ .m_bEmittingVolume);
+ } else {
vol = min(
- m_asActiveSamples[j].m_bEmittingVolume + 10,
- sample.m_bEmittingVolume);
+ m_asActiveSamples[j]
+ .m_bEmittingVolume +
+ 10,
+ sample
+ .m_bEmittingVolume);
}
uint8 emittingVol;
- if (field_4) {
- emittingVol = 2 * min(63, vol);
- }
- else {
+ if(field_4) {
+ emittingVol =
+ 2 * min(63, vol);
+ } else {
emittingVol = vol;
}
- SampleManager.SetChannelEmittingVolume(j, emittingVol);
- m_asActiveSamples[j].m_bEmittingVolume = vol;
+ SampleManager
+ .SetChannelEmittingVolume(
+ j, emittingVol);
+ m_asActiveSamples[j]
+ .m_bEmittingVolume = vol;
}
- TranslateEntity(&sample.m_vecPos, &position);
- SampleManager.SetChannel3DPosition(j, position.x, position.y,
- position.z);
+ TranslateEntity(&sample.m_vecPos,
+ &position);
+ SampleManager.SetChannel3DPosition(
+ j, position.x, position.y, position.z);
SampleManager.SetChannel3DDistances(
- j, sample.m_fSoundIntensity,
- 0.25f * sample.m_fSoundIntensity);
+ j, sample.m_fSoundIntensity,
+ 0.25f * sample.m_fSoundIntensity);
}
- SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
+ SampleManager.SetChannelReverbFlag(
+ j, sample.m_bReverbFlag);
continue;
}
- sample.m_bIsProcessed = 0;
- m_asActiveSamples[j].m_bIsProcessed = 0;
+ sample.m_bIsProcessed = false;
+ m_asActiveSamples[j].m_bIsProcessed = false;
break;
}
}
}
}
- for (int32 i = 0; i < m_bActiveSamples; i++) {
- if (m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE && !m_asActiveSamples[i].m_bIsProcessed) {
+ for(int32 i = 0; i < m_bActiveSamples; i++) {
+ if(m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE &&
+ !m_asActiveSamples[i].m_bIsProcessed) {
SampleManager.StopChannel(i);
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
}
}
- for (int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
- tSound& sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]];
- if (!sample.m_bIsProcessed && !sample.m_bLoopEnded &&
- m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
- if (sample.m_counter > 255 && sample.m_nLoopCount && sample.m_bLoopsRemaining) {
+ for(int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
+ tSound &sample = m_asSamples[m_bActiveSampleQueue]
+ [m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]];
+ if(!sample.m_bIsProcessed && !sample.m_bLoopEnded &&
+ m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed &&
+ sample.m_nSampleIndex < NO_SAMPLE) {
+ if(sample.m_nCounter > 255 && sample.m_nLoopCount &&
+ sample.m_bLoopsRemaining) {
--sample.m_bLoopsRemaining;
sample.m_nReleasingVolumeDivider = 1;
- }
- else {
- for (int32 j = 0; j < m_bActiveSamples; ++j) {
- if (!m_asActiveSamples[j].m_bIsProcessed) {
- if (sample.m_nLoopCount) {
- v28 = sample.m_nFrequency / field_19192;
+ } else {
+ for(int32 j = 0; j < m_bActiveSamples; ++j) {
+ if(!m_asActiveSamples[j].m_bIsProcessed) {
+ if(sample.m_nLoopCount) {
+ v28 = sample.m_nFrequency / m_bTimeSpent;
v29 = sample.m_nLoopCount *
- SampleManager.GetSampleLength(sample.m_nSampleIndex);
- if (v28 == 0) continue;
- sample.m_nReleasingVolumeDivider = v29 / v28 + 1;
+ SampleManager.GetSampleLength(
+ sample.m_nSampleIndex);
+ if(v28 == 0) continue;
+ sample.m_nReleasingVolumeDivider =
+ v29 / v28 + 1;
}
- memcpy(&m_asActiveSamples[j], &sample, sizeof(tSound));
- if (!m_asActiveSamples[j].m_bIs2D)
- TranslateEntity(&m_asActiveSamples[j].m_vecPos, &position);
- if (field_4) {
+ memcpy(&m_asActiveSamples[j], &sample,
+ sizeof(tSound));
+ if(!m_asActiveSamples[j].m_bIs2D)
+ TranslateEntity(
+ &m_asActiveSamples[j].m_vecPos,
+ &position);
+ if(field_4) {
emittingVol =
- 2 * min(63, m_asActiveSamples[j].m_bEmittingVolume);
- }
- else {
- emittingVol = m_asActiveSamples[j].m_bEmittingVolume;
+ 2 * min(63, m_asActiveSamples[j]
+ .m_bEmittingVolume);
+ } else {
+ emittingVol =
+ m_asActiveSamples[j].m_bEmittingVolume;
}
- if (SampleManager.InitialiseChannel(j,
- m_asActiveSamples[j].m_nSampleIndex,
- m_asActiveSamples[j].m_bBankIndex)) {
+ if(SampleManager.InitialiseChannel(
+ j, m_asActiveSamples[j].m_nSampleIndex,
+ m_asActiveSamples[j].m_bBankIndex)) {
SampleManager.SetChannelFrequency(
- j, m_asActiveSamples[j].m_nFrequency);
- SampleManager.SetChannelEmittingVolume(j, emittingVol);
+ j, m_asActiveSamples[j].m_nFrequency);
+ SampleManager.SetChannelEmittingVolume(
+ j, emittingVol);
SampleManager.SetChannelLoopPoints(
- j, m_asActiveSamples[j].m_nLoopStart,
- m_asActiveSamples[j].m_nLoopEnd);
+ j, m_asActiveSamples[j].m_nLoopStart,
+ m_asActiveSamples[j].m_nLoopEnd);
SampleManager.SetChannelLoopCount(
- j, m_asActiveSamples[j].m_nLoopCount);
+ j, m_asActiveSamples[j].m_nLoopCount);
SampleManager.SetChannelReverbFlag(
- j, m_asActiveSamples[j].m_bReverbFlag);
- if (m_asActiveSamples[j].m_bIs2D) {
- uint8 offset = m_asActiveSamples[j].m_bOffset;
- if (offset == 63) {
+ j, m_asActiveSamples[j].m_bReverbFlag);
+ if(m_asActiveSamples[j].m_bIs2D) {
+ uint8 offset =
+ m_asActiveSamples[j].m_bOffset;
+ if(offset == 63) {
x = 0.f;
- }
- else if (offset >= 63) {
- x = (offset - 63) * 1000.f / 63;
- }
- else {
- x = -(63 - offset) * 1000.f / 63;
+ } else if(offset >= 63) {
+ x = (offset - 63) * 1000.f /
+ 63;
+ } else {
+ x = -(63 - offset) *
+ 1000.f / 63;
}
usedX = x;
usedY = 0.f;
usedZ = 0.f;
- m_asActiveSamples[j].m_fSoundIntensity = 100000.0f;
- }
- else {
+ m_asActiveSamples[j]
+ .m_fSoundIntensity = 100000.0f;
+ } else {
usedX = position.x;
usedY = position.y;
usedZ = position.z;
}
- SampleManager.SetChannel3DPosition(j, usedX, usedY, usedZ);
+ SampleManager.SetChannel3DPosition(
+ j, usedX, usedY, usedZ);
SampleManager.SetChannel3DDistances(
- j, m_asActiveSamples[j].m_fSoundIntensity,
- 0.25f * m_asActiveSamples[j].m_fSoundIntensity);
+ j,
+ m_asActiveSamples[j].m_fSoundIntensity,
+ 0.25f * m_asActiveSamples[j]
+ .m_fSoundIntensity);
SampleManager.StartChannel(j);
}
- m_asActiveSamples[j].m_bIsProcessed = 1;
- sample.m_bIsProcessed = 1;
+ m_asActiveSamples[j].m_bIsProcessed = true;
+ sample.m_bIsProcessed = true;
sample.m_nVolumeChange = -1;
break;
}
@@ -2975,7 +3533,8 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params)
automobile = (CAutomobile *)params->m_pVehicle;
if(!automobile->bEngineOn) return true;
- if((automobile->m_fVelocityChangeForAudio < 0.025f || params->m_fVelocityChange >= 0.025f) &&
+ if((automobile->m_fVelocityChangeForAudio < 0.025f ||
+ params->m_fVelocityChange >= 0.025f) &&
(automobile->m_fVelocityChangeForAudio > -0.025f || params->m_fVelocityChange <= 0.025f))
return true;
@@ -2983,7 +3542,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params)
rand = m_anRandomTable[0] % 10 + 70;
m_sQueueSample.m_bVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 13;
+ 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 >> 4);
@@ -2996,7 +3555,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -3024,17 +3583,18 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound)
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_bVolume =
- ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ 110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1;
+ m_sQueueSample.m_nSampleIndex =
+ (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_counter = counter++;
+ 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 = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 110;
@@ -3068,24 +3628,27 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
boat = (CBoat *)params->m_pVehicle;
if(params->m_nIndex == REEFER) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_bVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 39;
+ 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 << 16) % 1000;
+ m_sQueueSample.m_nFrequency +=
+ (m_sQueueSample.m_nEntityIndex << 16) % 1000;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = 80;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3100,7 +3663,8 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
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;
+ m_sQueueSample.m_nFrequency =
+ 11 * m_sQueueSample.m_nFrequency / 10;
} else {
gasPedal = Abs(boat->m_fGasPedal);
if(gasPedal > 0.0f) {
@@ -3110,12 +3674,14 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
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_nFrequency =
+ 11 * m_sQueueSample.m_nFrequency / 10;
}
}
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
if(!m_sQueueSample.m_bVolume) return 1;
- m_sQueueSample.m_counter = 40;
+ m_sQueueSample.m_nCounter = 40;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL;
m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex << 16) % 1000;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@@ -3125,10 +3691,11 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3141,18 +3708,21 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
if(padAccelerate <= 20) {
emittingVol = 45 - 45 * padAccelerate / 40;
m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025;
- m_sQueueSample.m_counter = 39;
+ 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);
+ PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_17,
+ oneShotVol);
}
} else {
emittingVol = 105 * padAccelerate / 255 + 15;
- m_sQueueSample.m_nFrequency = 4000 * padAccelerate / 255 + 8000;
+ 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_counter = 40;
+ 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;
@@ -3162,19 +3732,21 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
if(gasPedal > 0.0f) {
m_sQueueSample.m_nFrequency = 11025;
emittingVol = 45;
- m_sQueueSample.m_counter = 39;
+ 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_counter = 40;
+ 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_bVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
if(!m_sQueueSample.m_bVolume) return 1;
m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex << 16) % 1000;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@@ -3184,10 +3756,11 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 7;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3216,7 +3789,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
vol = (30.f * multiplier);
m_sQueueSample.m_bVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 38;
+ m_sQueueSample.m_nCounter = 38;
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3224,11 +3797,13 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = vol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3269,10 +3844,12 @@ void
cAudioManager::ProcessBridgeMotor()
{
if(m_sQueueSample.m_fDistance < bridgeIntensity) {
- m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 1;
- m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name
+ m_sQueueSample.m_nCounter = 1;
+ m_sQueueSample.m_nSampleIndex =
+ SFX_FISHING_BOAT_IDLE; // todo check sfx name
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
@@ -3281,10 +3858,11 @@ cAudioManager::ProcessBridgeMotor()
m_sQueueSample.m_bEmittingVolume = maxVolume;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = false;
AddSampleToRequestedQueue();
@@ -3295,10 +3873,12 @@ cAudioManager::ProcessBridgeMotor()
void
cAudioManager::ProcessBridgeOneShots()
{
- if(CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP) {
+ 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) {
+ 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 &&
@@ -3314,9 +3894,10 @@ cAudioManager::ProcessBridgeOneShots()
}
}
if(m_sQueueSample.m_fDistance < bridgeIntensity) {
- m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
@@ -3328,7 +3909,7 @@ cAudioManager::ProcessBridgeOneShots()
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = bridgeIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -3342,20 +3923,22 @@ cAudioManager::ProcessBridgeWarning()
if(CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) {
m_sQueueSample.m_bVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING;
m_sQueueSample.m_bBankIndex = 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_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = 100;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bRequireReflection = false;
@@ -3375,20 +3958,22 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 35;
+ m_sQueueSample.m_nCounter = 35;
m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN);
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = 60;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3412,9 +3997,10 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
} 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);
+ 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);
@@ -3422,7 +4008,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 52;
+ m_sQueueSample.m_nCounter = 52;
m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3433,18 +4019,20 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
m_sQueueSample.m_bEmittingVolume = 80;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ 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_bVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3454,12 +4042,13 @@ cAudioManager::ProcessCesna(cVehicleParams *params)
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bEmittingVolume = 80;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -3490,18 +4079,19 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound)
if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
rand = m_anRandomTable[0] % 90 + 30;
- m_sQueueSample.m_bVolume =
- ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = counter % 3 + SFX_CINEMA_BASS_1;
m_sQueueSample.m_bBankIndex = 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_counter = counter++;
+ 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 = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = rand;
@@ -3531,9 +4121,10 @@ cAudioManager::ProcessCrane()
distSquared = GetDistanceSquared(&this->m_sQueueSample.m_vecPos);
if(distSquared < SQR(intensity)) {
CalculateDistance(distCalculated, distSquared);
- m_sQueueSample.m_bVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3541,25 +4132,29 @@ cAudioManager::ProcessCrane()
m_sQueueSample.m_nFrequency = 6000;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = 100;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(
- m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = intensity;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ 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_counter = 1;
+ 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);
+ SampleManager.GetSampleBaseFrequency(
+ SFX_COL_CAR_2);
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = true;
AddSampleToRequestedQueue();
@@ -3594,17 +4189,19 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound)
if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
rand = m_anRandomTable[0] % 60 + 40;
- m_sQueueSample.m_bVolume =
- ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_DOCKS_FOGHORN;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 3);
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN);
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 3);
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = rand;
@@ -3640,22 +4237,25 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
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);
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
}
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, engineDamageIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 28;
+ m_sQueueSample.m_nCounter = 28;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3785,7 +4385,8 @@ cAudioManager::ProcessExplosions(int32 explosion)
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_nFrequency =
+ 8 * m_sQueueSample.m_nFrequency / 10;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
break;
@@ -3795,14 +4396,15 @@ cAudioManager::ProcessExplosions(int32 explosion)
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity,
- m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i;
+ 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 = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bEmittingVolume = maxVolume;
m_sQueueSample.m_nLoopStart = 0;
@@ -3823,13 +4425,14 @@ cAudioManager::ProcessFireHydrant()
bool distCalculated = false;
static const int intensity = 35;
- m_sQueueSample.m_vecPos = ((CEntity*)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition();
+ 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_bVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -3839,10 +4442,11 @@ cAudioManager::ProcessFireHydrant()
m_sQueueSample.m_bEmittingVolume = 40;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -3867,8 +4471,11 @@ void cAudioManager::ProcessFires(int32)
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 * ((uint32)m_sQueueSample.m_nFrequency >> 6);
+ 8 *
+ SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE) /
+ 10;
+ m_sQueueSample.m_nFrequency +=
+ i * ((uint32)m_sQueueSample.m_nFrequency >> 6);
m_sQueueSample.m_nReleasingVolumeModificator = 6;
break;
case ENTITY_TYPE_PED:
@@ -3877,7 +4484,8 @@ void cAudioManager::ProcessFires(int32)
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE);
emittingVol = 60;
- m_sQueueSample.m_nFrequency += i * ((uint32)m_sQueueSample.m_nFrequency >> 6);
+ m_sQueueSample.m_nFrequency +=
+ i * ((uint32)m_sQueueSample.m_nFrequency >> 6);
m_sQueueSample.m_nReleasingVolumeModificator = 10;
break;
default:
@@ -3885,15 +4493,18 @@ void cAudioManager::ProcessFires(int32)
m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
- m_sQueueSample.m_nFrequency += i * ((uint32)m_sQueueSample.m_nFrequency >> 6);
+ m_sQueueSample.m_nFrequency +=
+ i * ((uint32)m_sQueueSample.m_nFrequency >> 6);
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 * ((uint32)m_sQueueSample.m_nFrequency >> 6);
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
+ m_sQueueSample.m_nFrequency +=
+ i * ((uint32)m_sQueueSample.m_nFrequency >> 6);
emittingVol = 80;
m_sQueueSample.m_nReleasingVolumeModificator = 8;
}
@@ -3901,21 +4512,24 @@ void cAudioManager::ProcessFires(int32)
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
- m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i;
+ m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_bBankIndex = 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -3942,7 +4556,9 @@ cAudioManager::ProcessFrontEnd()
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_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;
@@ -3995,7 +4611,9 @@ cAudioManager::ProcessFrontEnd()
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_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;
@@ -4033,7 +4651,9 @@ cAudioManager::ProcessFrontEnd()
stereo = true;
break;
case SOUND_FRONTEND_NO_RADIO:
- case SOUND_FRONTEND_RADIO_CHANGE: m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK; break;
+ 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;
}
@@ -4059,9 +4679,9 @@ cAudioManager::ProcessFrontEnd()
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
}
m_sQueueSample.m_bVolume = 110;
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bIs2D = true;
@@ -4077,7 +4697,7 @@ cAudioManager::ProcessFrontEnd()
AddSampleToRequestedQueue();
if(stereo) {
++m_sQueueSample.m_nSampleIndex;
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_bOffset = maxVolume - m_sQueueSample.m_bOffset;
AddSampleToRequestedQueue();
}
@@ -4096,48 +4716,53 @@ cAudioManager::ProcessGarages()
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_bVolume = ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \
- if(m_sQueueSample.m_bVolume) { \
- 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_bBankIndex = SAMPLEBANK_MAIN; \
- m_sQueueSample.m_nReleasingVolumeModificator = 4; \
- m_sQueueSample.m_bEmittingVolume = 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 = 1; \
- m_sQueueSample.m_nLoopCount = 1; \
- m_sQueueSample.m_nLoopStart = 0; \
- m_sQueueSample.m_nLoopEnd = -1; \
- m_sQueueSample.m_counter = iSound++; \
- if(iSound < 32) iSound = 32; \
- m_sQueueSample.m_bRequireReflection = true; \
- AddSampleToRequestedQueue(); \
- } \
- } \
- break; \
- default: continue; \
- } \
+#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_bVolume = \
+ ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \
+ if(m_sQueueSample.m_bVolume) { \
+ 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_bBankIndex = SAMPLEBANK_MAIN; \
+ m_sQueueSample.m_nReleasingVolumeModificator = 4; \
+ m_sQueueSample.m_bEmittingVolume = 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) {
@@ -4151,19 +4776,24 @@ cAudioManager::ProcessGarages()
state = CGarages::aGarages[i].m_eGarageState;
if(state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) {
CalculateDistance(distCalculated, distSquared);
- m_sQueueSample.m_bVolume = ComputeVolume(90, 80.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(90, 80.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
if(CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) {
- if(CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) {
+ 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;
+ sampleIndex =
+ m_anRandomTable[2] % 5 +
+ SFX_COL_CAR_1;
} else {
sampleIndex =
- m_anRandomTable[2] % 6 + SFX_COL_CAR_PANEL_1;
+ m_anRandomTable[2] % 6 +
+ SFX_COL_CAR_PANEL_1;
}
m_sQueueSample.m_nSampleIndex = sampleIndex;
m_sQueueSample.m_nFrequency =
@@ -4171,14 +4801,17 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_nSampleIndex) >>
1;
m_sQueueSample.m_nFrequency +=
- RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
+ RandomDisplacement(
+ m_sQueueSample.m_nFrequency >> 4);
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
+ m_sQueueSample.m_nCounter = iSound++;
if(iSound < 32) iSound = 32;
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
+ m_sQueueSample.m_bBankIndex =
+ SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
- m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample
+ .m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_bEmittingVolume = 90;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(
@@ -4194,24 +4827,28 @@ cAudioManager::ProcessGarages()
LOOP_HELPER
continue;
}
- m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
+ 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_nSampleIndex =
+ SFX_GARAGE_DOOR_LOOP;
m_sQueueSample.m_nFrequency = 13961;
}
- m_sQueueSample.m_counter = i;
+ m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_bEmittingVolume = 90;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_fSoundIntensity = 80.0f;
m_sQueueSample.m_bReverbFlag = true;
@@ -4242,7 +4879,9 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
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;
+ 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;
@@ -4252,28 +4891,31 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
if(dist >= MaxDist) return true;
baseDist = gHeliSfxRanges[i].m_fBaseDistance;
if(dist < baseDist)
- emittingVol = (gHeliSfxRanges[i].m_bBaseVolume * ((MaxDist - dist) / (MaxDist - baseDist)));
+ emittingVol = (gHeliSfxRanges[i].m_bBaseVolume *
+ ((MaxDist - dist) / (MaxDist - baseDist)));
else
emittingVol = gHeliSfxRanges[i].m_bBaseVolume;
- m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i + 65;
+ m_sQueueSample.m_nCounter = i + 65;
m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1;
m_sQueueSample.m_bBankIndex = 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_nFrequency =
+ 1200 * heli->m_nHeliId +
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -4307,18 +4949,19 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound)
if(dist < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(dist);
rand = m_anRandomTable[0] % 30 + 40;
- m_sQueueSample.m_bVolume =
- ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + SFX_HOME_1;
m_sQueueSample.m_bBankIndex = 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_counter = counter++;
+ 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 = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bEmittingVolume = rand;
@@ -4380,7 +5023,8 @@ cAudioManager::ProcessJumboAccel(CPlane *plane)
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(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;
@@ -4419,7 +5063,8 @@ cAudioManager::ProcessJumboLanding(CPlane *plane)
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);
+ SetupJumboWhineSound(18.f * (1.f - modificator),
+ 14600.f * modificator + 29500);
}
}
}
@@ -4429,8 +5074,10 @@ 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);
+ if(SetupJumboFlySound((107.f * modificator) + 20) &&
+ SetupJumboRumbleSound(maxVolume * (1.f - modificator))) {
+ if(SetupJumboEngineSound(maxVolume, 22050))
+ SetupJumboWhineSound(18.f * (1.f - modificator), 44100);
}
}
@@ -4447,9 +5094,7 @@ 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;
+ case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: m_sQueueSample.m_fSoundIntensity = 30.0f; break;
default: return;
}
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
@@ -4460,37 +5105,41 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP);
- m_sQueueSample.m_counter = 0;
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 45;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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_bVolume =
- ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP);
- m_sQueueSample.m_counter = 1;
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 110;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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();
@@ -4770,7 +5419,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1);
+ 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;
@@ -4780,7 +5430,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1);
+ 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;
@@ -4790,7 +5441,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2);
+ 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;
@@ -4800,7 +5452,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2);
+ 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;
@@ -4814,7 +5467,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY);
+ 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;
@@ -4824,7 +5478,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY);
+ 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;
@@ -4836,7 +5491,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN);
+ 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;
@@ -4846,7 +5502,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN);
+ 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;
@@ -4856,7 +5513,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY);
+ 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;
@@ -4866,7 +5524,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY);
+ 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;
@@ -4876,7 +5535,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1);
+ 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;
@@ -4886,7 +5546,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1);
+ 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;
@@ -4896,7 +5557,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2);
+ 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;
@@ -4906,7 +5568,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 110;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2);
+ 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;
@@ -4954,7 +5617,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 90;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1);
+ 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;
@@ -4964,7 +5628,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = 90;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1);
+ 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;
@@ -4974,7 +5639,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1);
+ 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;
@@ -4984,7 +5650,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1);
+ 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;
@@ -4994,7 +5661,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL);
+ 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;
@@ -5004,20 +5672,24 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL);
+ 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_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_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ 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;
@@ -5028,7 +5700,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ 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;
@@ -5038,7 +5711,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN);
+ 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;
@@ -5048,7 +5722,8 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN);
+ 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;
@@ -5069,18 +5744,19 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
@@ -5104,7 +5780,8 @@ cAudioManager::ProcessMissionAudio()
if(m_sMissionAudio.m_nSampleIndex != NO_SAMPLE) {
switch(m_sMissionAudio.m_bLoadingStatus) {
case LOADING_STATUS_NOT_LOADED:
- SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1);
+ SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex,
+ 1);
m_sMissionAudio.m_bLoadingStatus = LOADING_STATUS_LOADED;
nFramesUntilFailedLoad = 0;
return;
@@ -5119,15 +5796,19 @@ cAudioManager::ProcessMissionAudio()
nFramesUntilFailedLoad = 0;
} else if(!m_bUserPause) {
if(++nFramesForPretendPlaying < 120) {
- m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_PLAYING;
+ m_sMissionAudio.m_bPlayStatus =
+ PLAY_STATUS_PLAYING;
} else {
- m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_FINISHED;
+ m_sMissionAudio.m_bPlayStatus =
+ PLAY_STATUS_FINISHED;
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
}
}
} else {
if(m_sMissionAudio.m_bPlayStatus) {
- if(m_sMissionAudio.m_bPlayStatus != PLAY_STATUS_PLAYING) return;
+ if(m_sMissionAudio.m_bPlayStatus !=
+ PLAY_STATUS_PLAYING)
+ return;
if(m_bTimerJustReset) {
ClearMissionAudio();
SampleManager.StopStreamedFile(1);
@@ -5138,33 +5819,49 @@ cAudioManager::ProcessMissionAudio()
if(!m_bUserPause) {
if(nCheckPlayingDelay) {
--nCheckPlayingDelay;
- } else if(GetMissionScriptPoliceAudioPlayingStatus() ==
- PLAY_STATUS_FINISHED ||
- m_sMissionAudio.field_24-- == 0) {
- m_sMissionAudio.m_bPlayStatus =
+ } else if(
+ GetMissionScriptPoliceAudioPlayingStatus() ==
+ PLAY_STATUS_FINISHED ||
+ m_sMissionAudio
+ .m_nMissionAudioCounter-- ==
+ 0) {
+ m_sMissionAudio
+ .m_bPlayStatus =
PLAY_STATUS_FINISHED;
- m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
- SampleManager.StopStreamedFile(1);
- m_sMissionAudio.field_24 = 0;
+ 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_bUserPause ||
- m_bPreviousUserPause) {
+ if(SampleManager.IsStreamPlaying(1) ||
+ m_bUserPause || m_bPreviousUserPause) {
if(m_bUserPause)
- SampleManager.PauseStream(1, 1);
+ SampleManager.PauseStream(
+ 1, 1);
else
- SampleManager.PauseStream(0, 1);
+ SampleManager.PauseStream(
+ 0, 1);
} else {
- m_sMissionAudio.m_bPlayStatus = PLAY_STATUS_FINISHED;
- m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
+ m_sMissionAudio.m_bPlayStatus =
+ PLAY_STATUS_FINISHED;
+ m_sMissionAudio.m_nSampleIndex =
+ NO_SAMPLE;
SampleManager.StopStreamedFile(1);
- m_sMissionAudio.field_24 = 0;
+ m_sMissionAudio
+ .m_nMissionAudioCounter = 0;
}
} else {
if(m_bUserPause) return;
if(nCheckPlayingDelay--) {
- if(!SampleManager.IsStreamPlaying(1)) return;
+ if(!SampleManager.IsStreamPlaying(
+ 1))
+ return;
nCheckPlayingDelay = 0;
}
m_sMissionAudio.field_22 = 1;
@@ -5172,26 +5869,36 @@ cAudioManager::ProcessMissionAudio()
} else {
if(MissionScriptAudioUsesPoliceChannel(
m_sMissionAudio.m_nSampleIndex)) {
- SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex);
+ SetMissionScriptPoliceAudio(
+ m_sMissionAudio.m_nSampleIndex);
} else {
- if(m_bUserPause) SampleManager.PauseStream(1, 1);
- if(m_sMissionAudio.field_12) {
- SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1);
+ if(m_bUserPause)
+ SampleManager.PauseStream(1, 1);
+ if(m_sMissionAudio
+ .m_bPredefinedProperties) {
+ SampleManager
+ .SetStreamedVolumeAndPan(80, 63,
+ 1, 1);
} else {
- distSquared =
- GetDistanceSquared(&m_sMissionAudio.m_vecPos);
+ 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);
+ emittingVol = ComputeVolume(
+ 80, 50.0f, dist);
+ TranslateEntity(
+ &m_sMissionAudio
+ .m_vecPos,
+ &vec);
+ pan =
+ ComputePan(50.f, &vec);
}
- SampleManager.SetStreamedVolumeAndPan(emittingVol, pan,
- 1, 1);
+ SampleManager
+ .SetStreamedVolumeAndPan(
+ emittingVol, pan, 1, 1);
}
SampleManager.StartPreloadedStreamedFile(1);
}
@@ -5203,7 +5910,7 @@ cAudioManager::ProcessMissionAudio()
case 2:
if(++nFramesUntilFailedLoad >= 90) {
nFramesForPretendPlaying = 0;
- g_bMissionAudioLoadFailed = 1;
+ g_bMissionAudioLoadFailed = true;
nFramesUntilFailedLoad = 0;
m_sMissionAudio.m_bLoadingStatus = LOADING_STATUS_LOADED;
}
@@ -5229,8 +5936,10 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
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;
+ 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;
@@ -5239,27 +5948,32 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
else
emittingVol = 90;
if(emittingVol) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
+ CalculateDistance(params->m_bDistanceCalculated,
+ params->m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVol, 30.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
- m_sQueueSample.m_nSampleIndex = SFX_REMOTE_CONTROLLED_CAR;
+ m_sQueueSample.m_nCounter = 2;
+ m_sQueueSample.m_nSampleIndex =
+ SFX_REMOTE_CONTROLLED_CAR;
m_sQueueSample.m_bBankIndex = 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 * velocityChange /
+ params->m_pTransmission->fMaxVelocity +
11025.f);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(
- m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -5319,7 +6033,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_fSoundIntensity = 50.0f;
m_sQueueSample.m_nSampleIndex = m_anRandomTable[iSound % 5] % 3 + SFX_BULLET_WALL_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
m_sQueueSample.m_nReleasingVolumeModificator = 9;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
@@ -5333,7 +6048,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
emittingVolume = maxVolume;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_STATION_ANNOUNCE);
+ 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;
@@ -5416,7 +6132,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_fSoundIntensity = 60.0f;
m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 5 + SFX_COL_CAR_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
@@ -5428,7 +6145,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_fSoundIntensity = 60.0f;
m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
@@ -5459,13 +6177,13 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity,
- m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVolume, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
@@ -5503,12 +6221,12 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
- m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bEmittingVolume = emittingVolume;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
@@ -5529,7 +6247,7 @@ cAudioManager::ProcessPed(CPhysical *ped)
m_sQueueSample.m_vecPos = ped->GetPosition();
- //params.m_bDistanceCalculated = false;
+ // params.m_bDistanceCalculated = false;
params.m_pPed = (CPed *)ped;
params.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(ped->m_modelIndex == MI_FATMALE02) ProcessPedHeadphones(&params);
@@ -5549,10 +6267,11 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
if(ped->bInVehicle && ped->m_nPedState == PED_DRIVING) {
emittingVol = 10;
- veh = (CAutomobile*)ped->m_pMyVehicle;
+ veh = (CAutomobile *)ped->m_pMyVehicle;
if(veh && veh->IsCar()) {
for(int32 i = 2; i < ARRAYSIZE(veh->Doors); i++) {
- if(!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) {
+ if(!veh->IsDoorClosed((eDoors)i) ||
+ veh->IsDoorMissing((eDoors)i)) {
emittingVol = 42;
break;
}
@@ -5562,9 +6281,10 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
emittingVol = 42;
}
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 64;
+ m_sQueueSample.m_nCounter = 64;
m_sQueueSample.m_nSampleIndex = SFX_HEADPHONES;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -5574,12 +6294,13 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -5590,14 +6311,6 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
}
}
-#if 1
-WRAPPER
-void
-cAudioManager::ProcessPedOneShots(cPedParams *params)
-{
- EAXJMP(0x56F650);
-}
-#else
void
cAudioManager::ProcessPedOneShots(cPedParams *params)
{
@@ -5608,15 +6321,15 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
bool stereo;
int16 sound;
- char noReflection;
+ bool noReflection;
CWeapon *weapon;
- float maxDist;
+ float maxDist = 0.f; // uninitialized variable
static uint8 iSound = 21;
- weapon = nil;
+ weapon = params->m_pPed->GetWeapon();
for(uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
- noReflection = 0;
+ noReflection = false;
stereo = 0;
m_sQueueSample.m_bRequireReflection = false;
sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
@@ -5625,7 +6338,8 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
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)
+ if(FindPlayerPed() !=
+ m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
emittingVol >>= 1;
maxDist = 400.f;
switch(params->m_pPed->m_nSurfaceTouched) {
@@ -5634,7 +6348,8 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
break;
case SURFACE_DIRT:
case SURFACE_DIRTTRACK:
- sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
+ sampleIndex =
+ m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
break;
case SURFACE_METAL6:
case SURFACE_METAL_DOOR:
@@ -5650,10 +6365,12 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
break;
case SURFACE_SAND:
- sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
+ sampleIndex =
+ (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
break;
case SURFACE_PUDDLE:
- sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
+ sampleIndex =
+ (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
break;
case SURFACE_WOOD:
case SURFACE_WOOD_BOX:
@@ -5664,37 +6381,46 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
break;
default:
- sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
+ sampleIndex =
+ m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
break;
}
m_sQueueSample.m_nSampleIndex = sampleIndex;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter =
- 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);
+ 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 2:
+ case PEDMOVE_WALK:
emittingVol >>= 2;
- m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
+ m_sQueueSample.m_nFrequency =
+ 9 * m_sQueueSample.m_nFrequency / 10;
break;
- case 3:
+ case PEDMOVE_RUN:
emittingVol >>= 1;
- m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
+ 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;
- case 4: m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10; break;
default: break;
}
- m_sQueueSample.field_16 = 5;
- m_sQueueSample.field_48 = 0.0f;
+ 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_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
m_sQueueSample.m_bRequireReflection = true;
}
break;
@@ -5712,32 +6438,32 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL;
}
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = 1;
- m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
- m_sQueueSample.field_16 = 2;
- m_sQueueSample.field_48 = 0.0f;
+ 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_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
m_sQueueSample.m_bRequireReflection = true;
- break;
}
break;
case SOUND_FIGHT_PUNCH_33:
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
m_sQueueSample.m_nFrequency = 18000;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5745,19 +6471,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5765,19 +6491,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5785,19 +6511,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5805,19 +6531,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5825,19 +6551,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5845,19 +6571,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5865,19 +6591,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5885,19 +6611,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5905,19 +6631,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5925,19 +6651,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5945,19 +6671,19 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound;
+ m_sQueueSample.m_nCounter = iSound;
stereo = 1;
++iSound;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5965,18 +6691,18 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 26 + 100;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
m_sQueueSample.m_bRequireReflection = true;
break;
case SOUND_WEAPON_BAT_ATTACK:
m_sQueueSample.m_nSampleIndex = SFX_BAT_HIT_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 22000;
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -5984,12 +6710,12 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nLoopEnd = -1;
emittingVol = m_anRandomTable[2] % 20 + 100;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
if(m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bRequireReflection = true;
else
- noReflection = 1;
+ noReflection = true;
break;
case SOUND_WEAPON_SHOT_FIRED:
weapon = &ped->m_weapons[ped->m_currentWeapon];
@@ -5997,13 +6723,14 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
case WEAPONTYPE_COLT45:
m_sQueueSample.m_nSampleIndex = SFX_COLT45_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_COLT45_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ 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;
@@ -6011,23 +6738,24 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nLoopEnd = -1;
emittingVol = m_anRandomTable[1] % 10 + 90;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
if(m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bRequireReflection = true;
else
- noReflection = 1;
+ noReflection = true;
break;
case WEAPONTYPE_UZI:
m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ 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;
@@ -6035,19 +6763,20 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[3] % 15 + 70;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
break;
case WEAPONTYPE_SHOTGUN:
m_sQueueSample.m_nSampleIndex = SFX_SHOTGUN_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_SHOTGUN_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ 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;
@@ -6055,23 +6784,24 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nLoopEnd = -1;
emittingVol = m_anRandomTable[2] % 10 + 100;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
if(m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bRequireReflection = true;
else
- noReflection = 1;
+ noReflection = true;
break;
case WEAPONTYPE_AK47:
m_sQueueSample.m_nSampleIndex = SFX_AK47_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_AK47_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ 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;
@@ -6079,19 +6809,20 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[1] % 15 + 70;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
break;
case WEAPONTYPE_M16:
m_sQueueSample.m_nSampleIndex = SFX_M16_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_M16_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ 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;
@@ -6099,19 +6830,20 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[4] % 15 + 70;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
break;
case WEAPONTYPE_SNIPERRIFLE:
m_sQueueSample.m_nSampleIndex = SFX_SNIPER_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_SNIPER_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ 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;
@@ -6119,23 +6851,24 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nLoopEnd = -1;
emittingVol = m_anRandomTable[4] % 10 + 110;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
if(m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bRequireReflection = true;
else
- noReflection = 1;
+ noReflection = true;
break;
case WEAPONTYPE_ROCKETLAUNCHER:
m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_ROCKET_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
- m_sQueueSample.field_16 = 1;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ 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;
@@ -6143,38 +6876,39 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nLoopEnd = -1;
emittingVol = m_anRandomTable[0] % 20 + 80;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
if(m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bRequireReflection = true;
else
- noReflection = 1;
+ noReflection = true;
break;
case WEAPONTYPE_FLAMETHROWER:
m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = 9;
+ m_sQueueSample.m_nCounter = 9;
emittingVol = 90;
m_sQueueSample.m_nFrequency =
(10 * m_sQueueSample.m_nEntityIndex & 2047) +
SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_LEFT);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 4.0f;
+ 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);
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bEmittingVolume = 90;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 0;
- m_sQueueSample.field_76 = 6;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_nReleasingVolumeDivider = 6;
if(m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bRequireReflection = true;
else
- noReflection = 1;
+ noReflection = true;
break;
default: continue;
}
@@ -6185,164 +6919,70 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
switch(weapon->m_eWeaponType) {
case WEAPONTYPE_COLT45:
m_sQueueSample.m_nSampleIndex = SFX_PISTOL_RELOAD;
- emittingVol = 75;
- m_sQueueSample.m_counter = iSound++;
- stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_PISTOL_RELOAD) +
RandomDisplacement(300);
- m_sQueueSample.m_nFrequency += RandomDisplacement(300);
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.field_16 = 5;
- m_sQueueSample.field_48 = 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_bEmittingVolume = 75;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
- m_sQueueSample.m_bRequireReflection = true;
break;
case WEAPONTYPE_UZI:
m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD;
- emittingVol = 75;
- m_sQueueSample.m_counter = iSound++;
- stereo = 1;
m_sQueueSample.m_nFrequency = 39243;
- m_sQueueSample.m_nFrequency += RandomDisplacement(300);
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.field_16 = 5;
- m_sQueueSample.field_48 = 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_bEmittingVolume = 75;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
- m_sQueueSample.m_bRequireReflection = true;
break;
case WEAPONTYPE_SHOTGUN:
m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
- emittingVol = 75;
- m_sQueueSample.m_counter = iSound++;
- stereo = 1;
m_sQueueSample.m_nFrequency = 30290;
- m_sQueueSample.m_nFrequency += RandomDisplacement(300);
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.field_16 = 5;
- m_sQueueSample.field_48 = 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_bEmittingVolume = 75;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
- m_sQueueSample.m_bRequireReflection = true;
break;
case WEAPONTYPE_AK47:
m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
- emittingVol = 75;
- m_sQueueSample.m_counter = iSound++;
- stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_AK47_RELOAD);
- m_sQueueSample.m_nFrequency += RandomDisplacement(300);
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.field_16 = 5;
- m_sQueueSample.field_48 = 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_bEmittingVolume = 75;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
- m_sQueueSample.m_bRequireReflection = true;
break;
case WEAPONTYPE_M16:
m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD;
- emittingVol = 75;
- m_sQueueSample.m_counter = iSound++;
- stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_M16_RELOAD);
- m_sQueueSample.m_nFrequency += RandomDisplacement(300);
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.field_16 = 5;
- m_sQueueSample.field_48 = 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_bEmittingVolume = 75;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
- m_sQueueSample.m_bRequireReflection = true;
break;
case WEAPONTYPE_SNIPERRIFLE:
m_sQueueSample.m_nSampleIndex = SFX_RIFLE_RELOAD;
- emittingVol = 75;
- m_sQueueSample.m_counter = iSound++;
- stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_RIFLE_RELOAD);
- m_sQueueSample.m_nFrequency += RandomDisplacement(300);
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.field_16 = 5;
- m_sQueueSample.field_48 = 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_bEmittingVolume = 75;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
- m_sQueueSample.m_bRequireReflection = true;
break;
case WEAPONTYPE_ROCKETLAUNCHER:
m_sQueueSample.m_nSampleIndex = SFX_ROCKET_RELOAD;
- emittingVol = 75;
- m_sQueueSample.m_counter = iSound++;
- stereo = 1;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_ROCKET_RELOAD);
- m_sQueueSample.m_nFrequency += RandomDisplacement(300);
- m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.field_16 = 5;
- m_sQueueSample.field_48 = 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_bEmittingVolume = 75;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
- m_sQueueSample.m_bRequireReflection = true;
break;
default: continue;
}
+ emittingVol = 75;
+ m_sQueueSample.m_nCounter = iSound++;
+ stereo = 1;
+ m_sQueueSample.m_nFrequency += RandomDisplacement(300);
+ m_sQueueSample.m_bBankIndex = 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_bEmittingVolume = 75;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
+ 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_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_END_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_UZI_END_LEFT);
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
+ 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;
@@ -6350,22 +6990,23 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nLoopEnd = -1;
emittingVol = m_anRandomTable[4] % 10 + 40;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
if(m_bDynamicAcousticModelingStatus)
m_sQueueSample.m_bRequireReflection = true;
else
- noReflection = 1;
+ noReflection = true;
break;
case SOUND_WEAPON_FLAMETHROWER_FIRE:
m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_START_LEFT;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_START_LEFT);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
- m_sQueueSample.field_16 = 3;
- m_sQueueSample.field_48 = 4.0f;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
+ 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;
@@ -6373,18 +7014,20 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nLoopEnd = -1;
emittingVol = 70;
m_sQueueSample.m_bEmittingVolume = 70;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
break;
case SOUND_WEAPON_HIT_PED:
m_sQueueSample.m_nSampleIndex = SFX_BULLET_PED;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BULLET_PED);
- m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency >> 3);
- m_sQueueSample.field_16 = 7;
- m_sQueueSample.field_48 = 0.0f;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_BULLET_PED);
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 3);
+ 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;
@@ -6392,17 +7035,17 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[0] % 20 + 90;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
break;
case SOUND_SPLASH:
m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_counter = iSound++;
+ m_sQueueSample.m_nCounter = iSound++;
stereo = 1;
m_sQueueSample.m_nFrequency = RandomDisplacement(1400) + 20000;
- m_sQueueSample.field_16 = 1;
- m_sQueueSample.field_48 = 0.0f;
+ 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;
@@ -6410,50 +7053,48 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
emittingVol = m_anRandomTable[2] % 30 + 70;
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_bIsDistant = false;
- m_sQueueSample.field_56 = 1;
+ m_sQueueSample.m_bIs2D = false;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
m_sQueueSample.m_bRequireReflection = true;
break;
- default:
- SetupPedComments(params, sound);
- continue;
+ default: SetupPedComments(params, sound); continue;
+ }
- if(stereo && iSound > 60) iSound = 21;
- if(params->m_fDistance < maxDist) {
- CalculateDistance((bool *)params, params->m_fDistance);
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
- m_sQueueSample.m_fDistance);
- if(m_sQueueSample.m_bVolume) {
- if(noReflection) {
- if(0.2f * m_sQueueSample.m_fSoundIntensity >
- m_sQueueSample.m_fDistance) {
- noReflection = 0;
- } else {
- m_sQueueSample.m_bIsDistant = true;
- m_sQueueSample.m_bOffset = 0;
- }
+ if(stereo && iSound > 60) iSound = 21;
+ if(params->m_fDistance < maxDist) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
+ if(m_sQueueSample.m_bVolume) {
+ if(noReflection) {
+ if(0.2f * m_sQueueSample.m_fSoundIntensity <=
+ m_sQueueSample.m_fDistance) {
+ noReflection = 0;
+ } else {
+ m_sQueueSample.m_bIs2D = true;
+ m_sQueueSample.m_bOffset = 0;
}
- m_sQueueSample.m_bReverbFlag = true;
- AddSampleToRequestedQueue();
- if(noReflection) {
- m_sQueueSample.m_bOffset = 127;
- ++m_sQueueSample.m_nSampleIndex;
- if(m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] !=
- 47 ||
- weapon->m_eWeaponType != WEAPONTYPE_FLAMETHROWER) {
- m_sQueueSample.m_counter = iSound++;
- if(iSound > 60) iSound = 21;
- } else {
- ++m_sQueueSample.m_counter;
- }
- AddSampleToRequestedQueue();
+ }
+ m_sQueueSample.m_bReverbFlag = true;
+ AddSampleToRequestedQueue();
+ if(noReflection) {
+ m_sQueueSample.m_bOffset = 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();
}
}
}
}
}
-#endif
void
cAudioManager::ProcessPhysical(int32 id)
@@ -6461,8 +7102,12 @@ cAudioManager::ProcessPhysical(int32 id)
CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity;
if(entity) {
switch(entity->m_type) {
- case ENTITY_TYPE_VEHICLE: ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity); break;
- case ENTITY_TYPE_PED: ProcessPed((CPhysical *)m_asAudioEntities[id].m_pEntity); break;
+ 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;
}
}
@@ -6480,18 +7125,93 @@ cAudioManager::ProcessPlane(cVehicleParams *params)
struct tVehicleSampleData {
eSfxSample m_nAccelerationSampleIndex;
- char m_bEngineSoundType;
+ uint8 m_bEngineSoundType;
char gap_5[3];
eSfxSample m_nHornSample;
int32 m_nHornFrequency;
- char m_nSirenOrAlarmSample;
- int m_nSirenOrAlarmFrequency;
- char m_bDoorType;
+ uint8 m_nSirenOrAlarmSample;
+ int32 m_nSirenOrAlarmFrequency;
+ uint8 m_bDoorType;
char gap_25[3];
};
-int32 *CSWTCH_554 = (int32 *)0x606A50;
-tVehicleSampleData *CarSounds = (tVehicleSampleData *)0x606204;
+// int32 *GearFreqAdj = (int32 *)0x606A50;
+int32 GearFreqAdj[] = {112, 23, 0, 0, 112, 23, 0, 0, 72, 13, 0, 0,
+ 176, 4, 0, 0, 0, 0, 0, 0, 24, 252, 255, 255};
+
+// tVehicleSampleData *CarSounds = (tVehicleSampleData *)0x606204;
+
+const tVehicleSampleData CarSounds[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)
@@ -6530,7 +7250,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
processedAccelSampleStopped = 0;
if(bPlayerJustEnteredCar) {
bAccelSampleStopped = 1;
- bPlayerJustEnteredCar = 0;
+ bPlayerJustEnteredCar = false;
nCruising = 0;
LastAccel = 0;
bLostTractionLastFrame = 0;
@@ -6554,7 +7274,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if(transmission->nDriveType == '4') {
wheelInUseCounter = 0;
- for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++){
+ for(uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
if(automobile->m_aWheelState[i]) ++wheelInUseCounter;
}
if(wheelInUseCounter > 2) lostTraction = 1;
@@ -6563,7 +7283,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
(automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) {
lostTraction = 1;
}
- } else if(transmission->nDriveType == 'R' && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) {
+ } else if(transmission->nDriveType == 'R' &&
+ (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) {
lostTraction = 1;
}
if(0.0f != velocityChange) {
@@ -6585,11 +7306,13 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
SampleManager.StopChannel(m_bActiveSamples);
bAccelSampleStopped = 1;
}
- if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) {
+ if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn ||
+ lostTraction) {
gasPedalAudio = automobile->m_fGasPedalAudio;
} else {
gasPedalAudio =
- min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity);
+ min(1.0f, params->m_fVelocityChange /
+ params->m_pTransmission->fMaxReverseVelocity);
}
gasPedalAudio = max(0.0f, gasPedalAudio);
automobile->m_fGasPedalAudio = gasPedalAudio;
@@ -6599,16 +7322,19 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
bAccelSampleStopped = 1;
}
nCruising = 0;
- if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction ||
- params->m_fVelocityChange >= 0.01f && automobile->m_fGasPedalAudio > 0.2f) {
+ 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 >>= 1;
- AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq,
- (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1),
+ AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) +
+ 40,
+ freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1),
engineSoundType, 63, 0);
}
}
@@ -6625,16 +7351,19 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
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 ||
+ 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;
+ automobile->m_fGasPedalAudio =
+ automobile->m_fGasPedalAudio * 0.6f;
}
freqModifier = 0;
baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000;
@@ -6672,13 +7401,14 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
SampleManager.SetChannel3DPosition(m_bActiveSamples, pos.x, pos.y, pos.z);
SampleManager.SetChannel3DDistances(m_bActiveSamples, 50.f, 12.5f);
if(engineSoundType == 6)
- freq = (CSWTCH_554[CurrentPretendGear] + freqModifier + 22050) >> 1;
+ freq =
+ (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) >> 1;
else
- freq = CSWTCH_554[CurrentPretendGear] + freqModifier + 22050;
+ freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
SampleManager.SetChannelFrequency(m_bActiveSamples, freq);
if(!channelUsed) {
- SampleManager.SetChannelReverbFlag(m_bActiveSamples,
- m_bDynamicAcousticModelingStatus != 0);
+ SampleManager.SetChannelReverbFlag(
+ m_bActiveSamples, m_bDynamicAcousticModelingStatus != 0);
SampleManager.StartChannel(m_bActiveSamples);
}
LastAccel = accelerateState;
@@ -6688,20 +7418,22 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
return;
}
if(processedAccelSampleStopped) {
- if(!SampleManager.InitialiseChannel(m_bActiveSamples, soundOffset + 345, 0)) return;
+ if(!SampleManager.InitialiseChannel(m_bActiveSamples, soundOffset + 345, 0))
+ return;
SampleManager.SetChannelLoopCount(m_bActiveSamples, 1);
SampleManager.SetChannelLoopPoints(m_bActiveSamples, 0, -1);
SampleManager.SetChannelEmittingVolume(m_bActiveSamples, 85);
SampleManager.SetChannel3DPosition(m_bActiveSamples, pos.x, pos.y, pos.z);
SampleManager.SetChannel3DDistances(m_bActiveSamples, 50.f, 12.5f);
if(engineSoundType == 6)
- freq = (CSWTCH_554[CurrentPretendGear] + freqModifier + 22050) >> 1;
+ freq =
+ (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) >> 1;
else
- freq = CSWTCH_554[CurrentPretendGear] + freqModifier + 22050;
+ freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
SampleManager.SetChannelFrequency(m_bActiveSamples, freq);
if(!channelUsed) {
- SampleManager.SetChannelReverbFlag(m_bActiveSamples,
- m_bDynamicAcousticModelingStatus != 0);
+ SampleManager.SetChannelReverbFlag(
+ m_bActiveSamples, m_bDynamicAcousticModelingStatus != 0);
SampleManager.StartChannel(m_bActiveSamples);
}
LastAccel = accelerateState;
@@ -6712,20 +7444,21 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
}
if(CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) {
++CurrentPretendGear;
- if(!SampleManager.InitialiseChannel(m_bActiveSamples, soundOffset + 345, 0)) return;
+ if(!SampleManager.InitialiseChannel(m_bActiveSamples, soundOffset + 345, 0))
+ return;
SampleManager.SetChannelLoopCount(m_bActiveSamples, 1);
SampleManager.SetChannelLoopPoints(m_bActiveSamples, 0, -1);
SampleManager.SetChannelEmittingVolume(m_bActiveSamples, 85);
SampleManager.SetChannel3DPosition(m_bActiveSamples, pos.x, pos.y, pos.z);
SampleManager.SetChannel3DDistances(m_bActiveSamples, 50.f, 12.5f);
- freq = CSWTCH_554[CurrentPretendGear] + freqModifier + 22050;
+ freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
if(engineSoundType == 6) freq >>= 1;
SampleManager.SetChannelFrequency(m_bActiveSamples, freq);
if(!channelUsed) {
- SampleManager.SetChannelReverbFlag(m_bActiveSamples,
- m_bDynamicAcousticModelingStatus != 0);
+ SampleManager.SetChannelReverbFlag(
+ m_bActiveSamples, m_bDynamicAcousticModelingStatus != 0);
SampleManager.StartChannel(m_bActiveSamples);
}
LastAccel = accelerateState;
@@ -6737,8 +7470,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
nCruising = 1;
}
bAccelSampleStopped = 1;
- if(accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction ||
- currentGear < params->m_pTransmission->nNumberOfGears - 1) {
+ if(accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn ||
+ lostTraction || currentGear < params->m_pTransmission->nNumberOfGears - 1) {
nCruising = 0;
} else {
if(accelerateState >= 220 &&
@@ -6749,8 +7482,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
}
freq = 27 * nCruising + freqModifier + 22050;
if(engineSoundType == 6) freq >>= 1;
- AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1),
- engineSoundType, 64, 1);
+ AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType,
+ 64, 1);
}
LastAccel = accelerateState;
@@ -6789,16 +7522,18 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound)
m_sQueueSample.m_nSampleIndex = sampleIndex;
emittingVol = m_anRandomTable[0] % 50 + 55;
m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_bBankIndex = 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_counter = counter++;
+ 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 = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bEmittingVolume = emittingVol;
@@ -6872,21 +7607,23 @@ cAudioManager::ProcessPornCinema(uint8 sound)
m_sQueueSample.m_fDistance = Sqrt(distSquared);
if(sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) {
m_sQueueSample.m_bVolume =
- ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_counter = 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = maxVolume;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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();
@@ -6895,18 +7632,19 @@ cAudioManager::ProcessPornCinema(uint8 sound)
time = CTimer::GetTimeInMilliseconds();
if(time > gPornNextTime) {
- m_sQueueSample.m_bVolume =
- ComputeVolume(90, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ 90, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
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 >> 4);
- m_sQueueSample.m_counter = rand + 1;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
+ m_sQueueSample.m_nCounter = rand + 1;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 6;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_nLoopStart = 0;
@@ -6950,22 +7688,26 @@ cAudioManager::ProcessProjectiles()
}
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
- m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition();
+ 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_bVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
- m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i;
+ m_sQueueSample.m_nCounter = i;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -6978,24 +7720,21 @@ cAudioManager::ProcessProjectiles()
void
cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
{
- float emittingVol;
- CVehicle *veh;
-
if(params->m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f &&
(!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
- ++params->m_pVehicle->m_bRainAudioCounter;
- veh = params->m_pVehicle;
+ CVehicle *veh = params->m_pVehicle;
+ ++veh->m_bRainAudioCounter;
if(veh->m_bRainAudioCounter >= 2) {
veh->m_bRainAudioCounter = 0;
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- emittingVol = 30.f * CWeather::Rain;
- m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance);
+ float emittingVol = 30.f * CWeather::Rain;
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = veh->m_bRainSamplesCounter++;
- veh = params->m_pVehicle;
+ 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_nSampleIndex =
+ (m_anRandomTable[1] & 3) + SFX_CAR_RAIN_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 9;
@@ -7006,7 +7745,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_fSoundIntensity = rainOnVehicleIntensity;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -7019,8 +7758,16 @@ void
cAudioManager::ProcessReverb() const
{
if(SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
- for(uint32 i = 0; i < channels; i++) { // bug?
- if(m_asActiveSamples[i].m_bReverbFlag) SampleManager.SetChannelReverbFlag(i, 1);
+ for(uint32 i = 0; i <
+#ifdef FIX_BUGS
+ channels
+#else
+ 28
+#endif
+ ;
+ i++) {
+ if(m_asActiveSamples[i].m_bReverbFlag)
+ SampleManager.SetChannelReverbFlag(i, 1);
}
}
}
@@ -7039,7 +7786,8 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
automobile = (CAutomobile *)params->m_pVehicle;
if(automobile->m_nWheelsOnGround) {
- modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity;
+ modificator = params->m_fVelocityChange /
+ params->m_pTransmission->fMaxReverseVelocity;
} else {
if(automobile->m_nDriveWheelsOnGround)
automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f;
@@ -7047,13 +7795,14 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
}
modificator = Abs(modificator);
emittingVol = (24.f * modificator);
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
if(params->m_pVehicle->m_fGasPedal >= 0.0f) {
- m_sQueueSample.m_counter = 62;
+ m_sQueueSample.m_nCounter = 62;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2;
} else {
- m_sQueueSample.m_counter = 61;
+ m_sQueueSample.m_nCounter = 61;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR;
}
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@@ -7064,10 +7813,11 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params)
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7098,34 +7848,36 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound)
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP);
- m_sQueueSample.m_counter = 0;
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 30;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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_bVolume =
- ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ 70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_CUT_WOOD;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_counter = 1;
+ 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 = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_nLoopStart = 0;
@@ -7161,9 +7913,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound)
switch(sound) {
case SCRIPT_SOUND_SHOP_LOOP_S:
- case SCRIPT_SOUND_SHOP_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 30.0f;
- break;
+ case SCRIPT_SOUND_SHOP_LOOP_L: m_sQueueSample.m_fSoundIntensity = 30.0f; break;
default: return;
}
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
@@ -7174,35 +7924,37 @@ cAudioManager::ProcessShopScriptObject(uint8 sound)
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP);
- m_sQueueSample.m_counter = 0;
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 30;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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_bVolume =
- ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ 70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
rand = m_anRandomTable[1] & 1;
m_sQueueSample.m_nSampleIndex = rand + SFX_SHOP_TILL_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_counter = rand + 1;
+ 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 = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 70;
@@ -7234,7 +7986,8 @@ cAudioManager::ProcessSpecial()
CPlayerPed *playerPed = FindPlayerPed();
if(playerPed) {
const PedState &state = playerPed->m_nPedState;
- if(state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle)
+ if(state != PED_ENTER_CAR && state != PED_STEAL_CAR &&
+ !playerPed->bInVehicle)
SampleManager.StopChannel(m_bActiveSamples);
}
}
@@ -7255,9 +8008,10 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
speedMultipler = min(1.0f, train->m_fSpeed * 250.f / 51.f);
emittingVol = (75.f * speedMultipler);
if(train->m_fWagonPosition == 0.0f) {
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 300.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, 300.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 32;
+ m_sQueueSample.m_nCounter = 32;
m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -7267,12 +8021,13 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 300.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7280,9 +8035,10 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
}
}
if(params->m_fDistance < 4900.f) {
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 70.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, 70.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 33;
+ m_sQueueSample.m_nCounter = 33;
m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -7292,11 +8048,14 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
100 * m_sQueueSample.m_nEntityIndex % 987;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 70.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7328,7 +8087,8 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
if(params.m_pVehicle->m_status == STATUS_SIMPLE)
velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f;
else
- velChange = DotProduct(params.m_pVehicle->m_vecMoveSpeed, params.m_pVehicle->GetForward());
+ 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:
@@ -7343,7 +8103,8 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
if(params.m_nIndex == DODO) {
if(!ProcessVehicleRoadNoise(&params)) {
ProcessVehicleOneShots(&params);
- ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
+ ((CAutomobile *)veh)->m_fVelocityChangeForAudio =
+ params.m_fVelocityChange;
ProcessRainOnVehicle(&params);
break;
}
@@ -7352,7 +8113,8 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
} else {
if(!ProcessVehicleRoadNoise(&params)) {
ProcessVehicleOneShots(&params);
- ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange;
+ ((CAutomobile *)veh)->m_fVelocityChangeForAudio =
+ params.m_fVelocityChange;
ProcessRainOnVehicle(&params);
break;
}
@@ -7361,7 +8123,8 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
ProcessVehicleSkidding(&params);
ProcessVehicleHorn(&params);
ProcessVehicleSirenOrAlarm(&params);
- if(UsesReverseWarning(params.m_nIndex)) ProcessVehicleReverseWarning(&params);
+ if(UsesReverseWarning(params.m_nIndex))
+ ProcessVehicleReverseWarning(&params);
if(HasAirBrakes(params.m_nIndex)) ProcessAirBrakes(&params);
}
ProcessCarBombTick(&params);
@@ -7416,15 +8179,16 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
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_bVolume =
- ComputeVolume(emittingVol, 40.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVol, 40.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = i + 6;
+ 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_nFrequency =
+ SampleManager.GetSampleBaseFrequency(
+ m_sQueueSample.m_nSampleIndex) +
+ RandomDisplacement(1000);
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 10;
@@ -7434,7 +8198,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 1.0f;
m_sQueueSample.m_fSoundIntensity = 40.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = true;
AddSampleToRequestedQueue();
@@ -7447,215 +8211,241 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
}
void
-cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
+cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
{
- CVehicle* playerVeh;
- CVehicle* veh;
- CAutomobile* automobile;
+ CVehicle *playerVeh;
+ CVehicle *veh;
+ CAutomobile *automobile;
float relativeGearChange;
float relativeChange;
float reverseRelativechange;
uint8 volume;
eSfxSample accelerationSample;
- int32 freq;
+ int32 freq = 0; // uinitialized variable
uint8 emittingVol;
- cTransmission* transmission;
+ cTransmission *transmission;
uint8 currentGear;
float modificator;
float traction = 0.f;
- if (params->m_fDistance < SQR(50.f)) {
+ if(params->m_fDistance < SQR(50.f)) {
playerVeh = FindPlayerVehicle();
veh = params->m_pVehicle;
- if (playerVeh == veh && veh->m_status == STATUS_WRECKED) {
+ if(playerVeh == veh && veh->m_status == STATUS_WRECKED) {
SampleManager.StopChannel(m_bActiveSamples);
return;
}
- if (veh->bEngineOn) {
+ if(veh->bEngineOn) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- automobile = (CAutomobile*)params->m_pVehicle;
- if (params->m_nIndex == DODO) {
+ automobile = (CAutomobile *)params->m_pVehicle;
+ if(params->m_nIndex == DODO) {
ProcessCesna(params);
return;
}
- if (FindPlayerVehicle() == veh) {
+ if(FindPlayerVehicle() == veh) {
ProcessPlayersVehicleEngine(params, automobile);
return;
}
transmission = params->m_pTransmission;
- if (transmission) {
+ if(transmission) {
currentGear = params->m_pVehicle->m_nCurrentGear;
- if (automobile->m_nWheelsOnGround) {
- if (automobile->bIsHandbrakeOn) {
- if (0.f == params->m_fVelocityChange) traction = 0.9f;
- }
- else if (params->m_pVehicle->m_status == STATUS_SIMPLE) {
+ if(automobile->m_nWheelsOnGround) {
+ if(automobile->bIsHandbrakeOn) {
+ if(0.f == params->m_fVelocityChange)
+ traction = 0.9f;
+ } else if(params->m_pVehicle->m_status == STATUS_SIMPLE) {
traction = 0.f;
- }
- else {
- switch (transmission->nDriveType) {
+ } 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)
+ 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)
+ if(automobile->m_aWheelState[0] ==
+ WHEEL_STATE_SPINNING)
traction += 0.1f;
- if (automobile->m_aWheelState[2] == WHEEL_STATE_SPINNING)
+ if(automobile->m_aWheelState[2] ==
+ WHEEL_STATE_SPINNING)
traction += 0.1f;
break;
case 'R':
- if (automobile->m_aWheelState[1] == WHEEL_STATE_SPINNING)
+ if(automobile->m_aWheelState[1] ==
+ WHEEL_STATE_SPINNING)
traction += 0.1f;
- if (automobile->m_aWheelState[3] == WHEEL_STATE_SPINNING)
+ if(automobile->m_aWheelState[3] ==
+ WHEEL_STATE_SPINNING)
traction += 0.1f;
break;
}
}
- if (transmission->fMaxVelocity <= 0.f) {
+ if(transmission->fMaxVelocity <= 0.f) {
relativeChange = 0.f;
- }
- else if (currentGear) {
- if ((params->m_fVelocityChange -
- transmission->Gears[currentGear].fShiftDownVelocity) /
- transmission->fMaxVelocity * 2.5f <=
- 1.f)
+ } else if(currentGear) {
+ if((params->m_fVelocityChange -
+ transmission->Gears[currentGear]
+ .fShiftDownVelocity) /
+ transmission->fMaxVelocity * 2.5f <=
+ 1.f)
relativeGearChange =
- (params->m_fVelocityChange -
- transmission->Gears[currentGear].fShiftDownVelocity) /
- transmission->fMaxVelocity * 2.5f;
+ (params->m_fVelocityChange -
+ transmission->Gears[currentGear]
+ .fShiftDownVelocity) /
+ transmission->fMaxVelocity * 2.5f;
else
relativeGearChange = 1.f;
- if (0.f == traction && automobile->m_status != STATUS_SIMPLE &&
- params->m_fVelocityChange >=
- transmission->Gears[1].fShiftUpVelocity) {
+ if(0.f == traction &&
+ automobile->m_status != STATUS_SIMPLE &&
+ params->m_fVelocityChange >=
+ transmission->Gears[1].fShiftUpVelocity) {
traction = 0.7f;
}
- relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f +
- (1.f - traction) * relativeGearChange;
- }
- else {
- reverseRelativechange =
- Abs((params->m_fVelocityChange -
- transmission->Gears[0].fShiftDownVelocity) /
- transmission->fMaxReverseVelocity);
- if (1.f - reverseRelativechange <= 1.f) {
- relativeChange = 1.f - reverseRelativechange;
- }
- else {
+ relativeChange =
+ traction * automobile->m_fGasPedalAudio *
+ 0.95f +
+ (1.f - traction) * relativeGearChange;
+ } else {
+ reverseRelativechange = Abs(
+ (params->m_fVelocityChange -
+ transmission->Gears[0].fShiftDownVelocity) /
+ transmission->fMaxReverseVelocity);
+ if(1.f - reverseRelativechange <= 1.f) {
+ relativeChange =
+ 1.f - reverseRelativechange;
+ } else {
relativeChange = 1.f;
}
}
- }
- else {
- if (automobile->m_nDriveWheelsOnGround)
- automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f;
+ } else {
+ if(automobile->m_nDriveWheelsOnGround)
+ automobile->m_fGasPedalAudio =
+ automobile->m_fGasPedalAudio * 0.4f;
relativeChange = automobile->m_fGasPedalAudio;
}
modificator = relativeChange;
- if (currentGear || !automobile->m_nWheelsOnGround)
+ if(currentGear || !automobile->m_nWheelsOnGround)
freq = 1200 * currentGear + 18000.f * modificator + 14000;
else
freq = 13000.f * modificator + 14000;
- if (modificator >= 0.75f) {
+ if(modificator >= 0.75f) {
emittingVol = 120;
- volume = ComputeVolume(120, 50.f, m_sQueueSample.m_fDistance);
- }
- else {
+ volume =
+ ComputeVolume(120, 50.f, m_sQueueSample.m_fDistance);
+ } else {
emittingVol = modificator * 4 / 3 * 40.f + 80.f;
- volume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
+ volume = ComputeVolume(emittingVol, 50.f,
+ m_sQueueSample.m_fDistance);
}
- }
- else {
+ } else {
modificator = 0.f;
emittingVol = 80;
volume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
}
m_sQueueSample.m_bVolume = volume;
- if (m_sQueueSample.m_bVolume) {
- if (automobile->m_status == STATUS_SIMPLE) {
- if (modificator < 0.02f) {
+ if(m_sQueueSample.m_bVolume) {
+ if(automobile->m_status == STATUS_SIMPLE) {
+ if(modificator < 0.02f) {
m_sQueueSample.m_nSampleIndex =
- CarSounds[params->m_nIndex].m_bEngineSoundType + SFX_CAR_REV_10;
+ CarSounds[params->m_nIndex].m_bEngineSoundType +
+ SFX_CAR_REV_10;
freq = 10000.f * modificator + 22050;
- m_sQueueSample.m_counter = 52;
+ m_sQueueSample.m_nCounter = 52;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIs2D = 0;
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 = m_sQueueSample.m_nFrequency >> 1;
+ 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 =
+ m_sQueueSample.m_nFrequency >> 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(
- m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
return;
}
- accelerationSample = CarSounds[params->m_nIndex].m_nAccelerationSampleIndex;
- }
- else {
- if (automobile->m_fGasPedal < 0.05f) {
+ accelerationSample =
+ CarSounds[params->m_nIndex].m_nAccelerationSampleIndex;
+ } else {
+ if(automobile->m_fGasPedal < 0.05f) {
m_sQueueSample.m_nSampleIndex =
- CarSounds[params->m_nIndex].m_bEngineSoundType +
- SFX_CAR_REV_10; // to recheck idle sounds start 1 postion later
+ CarSounds[params->m_nIndex].m_bEngineSoundType +
+ SFX_CAR_REV_10; // to recheck idle sounds start
+ // 1 postion later
freq = 10000.f * modificator + 22050;
- m_sQueueSample.m_counter = 52;
+ m_sQueueSample.m_nCounter = 52;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIs2D = 0;
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 = m_sQueueSample.m_nFrequency >> 1;
+ 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 =
+ m_sQueueSample.m_nFrequency >> 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(
- m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
return;
}
- accelerationSample = CarSounds[params->m_nIndex].m_nAccelerationSampleIndex;
+ accelerationSample =
+ CarSounds[params->m_nIndex].m_nAccelerationSampleIndex;
}
m_sQueueSample.m_nSampleIndex = accelerationSample;
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIs2D = 0;
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 = m_sQueueSample.m_nFrequency >> 1;
+ 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 =
+ m_sQueueSample.m_nFrequency >> 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 8;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7677,31 +8467,42 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
automobile->m_modelIndex != MI_MRWHOOP) {
if(automobile->m_nCarHornTimer) {
if(params->m_pVehicle->m_status) {
- if(automobile->m_nCarHornTimer > 44) automobile->m_nCarHornTimer = 44;
+ if(automobile->m_nCarHornTimer > 44)
+ automobile->m_nCarHornTimer = 44;
if(automobile->m_nCarHornTimer == 44)
automobile->field_22D =
- (uint8(m_FrameCounter) + uint8(m_sQueueSample.m_nEntityIndex)) & 7;
- if (!hornPatternsArray[automobile->field_22D][44 - automobile->m_nCarHornTimer]) return;
+ (uint8(m_FrameCounter) +
+ uint8(m_sQueueSample.m_nEntityIndex)) &
+ 7;
+ if(!hornPatternsArray[automobile->field_22D]
+ [44 - automobile->m_nCarHornTimer])
+ return;
}
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- m_sQueueSample.m_bVolume = ComputeVolume(80, 40.f, m_sQueueSample.m_fDistance);
+ CalculateDistance(params->m_bDistanceCalculated,
+ params->m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(80, 40.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 4;
- m_sQueueSample.m_nSampleIndex = CarSounds[params->m_nIndex].m_nHornSample;
+ m_sQueueSample.m_nCounter = 4;
+ m_sQueueSample.m_nSampleIndex =
+ CarSounds[params->m_nIndex].m_nHornSample;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 2;
- m_sQueueSample.m_nFrequency = CarSounds[params->m_nIndex].m_nHornFrequency;
+ m_sQueueSample.m_nFrequency =
+ CarSounds[params->m_nIndex].m_nHornFrequency;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = 80;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 5.0f;
m_sQueueSample.m_fSoundIntensity = 40.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7712,11 +8513,517 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
}
}
-WRAPPER
void
-cAudioManager::ProcessVehicleOneShots(void *)
+cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
{
- EAXJMP(0x56CD40);
+ 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:
+ maxDist = 2500.f;
+ emittingVol = m_anRandomTable[2] % 5 + 122;
+ switch(CarSounds[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_bBankIndex = 0;
+ 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 >> 5);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ 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:
+ maxDist = 2500.f;
+ emittingVol = m_anRandomTable[1] % 10 + 117;
+ switch(CarSounds[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_bBankIndex = 0;
+ 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 >> 5);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 50.0f;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ case SOUND_CAR_WINDSHIELD_CRACK:
+ maxDist = 900.f;
+ m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 30.0f;
+ break;
+ case SOUND_CAR_JUMP:
+ emittingVol = max(
+ 80.f,
+ 2 * (100.f *
+ m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]));
+ maxDist = 1225.f;
+ m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 >> 4);
+ if(params->m_nIndex == 41) {
+ m_sQueueSample.m_nFrequency *= 2;
+ emittingVol = emittingVol >> 1;
+ }
+ m_sQueueSample.m_nReleasingVolumeModificator = 6;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_fSoundIntensity = 35.0f;
+ break;
+ case SOUND_E:
+ case SOUND_F:
+ case SOUND_STEP_START:
+ case SOUND_STEP_END:
+ case SOUND_FALL_LAND:
+ case SOUND_FALL_COLLAPSE:
+ case SOUND_FIGHT_PUNCH_33:
+ case SOUND_FIGHT_KICK_34:
+ case SOUND_FIGHT_HEADBUTT_35:
+ case SOUND_FIGHT_PUNCH_36:
+ case SOUND_FIGHT_PUNCH_37:
+ case SOUND_FIGHT_CLOSE_PUNCH_38:
+ case SOUND_FIGHT_PUNCH_39:
+ case SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40:
+ case SOUND_FIGHT_PUNCH_41:
+ case SOUND_FIGHT_PUNCH_FROM_BEHIND_42:
+ case SOUND_FIGHT_KNEE_OR_KICK_43:
+ case SOUND_FIGHT_KICK_44:
+ case SOUND_WEAPON_BAT_ATTACK:
+ case SOUND_WEAPON_RELOAD:
+ case SOUND_WEAPON_AK47_BULLET_ECHO:
+ case SOUND_WEAPON_UZI_BULLET_ECHO:
+ case SOUND_WEAPON_M16_BULLET_ECHO:
+ case SOUND_WEAPON_FLAMETHROWER_FIRE:
+ case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM:
+ case SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM:
+ case SOUND_WEAPON_HIT_PED:
+ case SOUND_GARAGE_NO_MONEY:
+ case SOUND_GARAGE_BAD_VEHICLE:
+ case SOUND_GARAGE_OPENING:
+ case SOUND_GARAGE_BOMB_ALREADY_SET:
+ case SOUND_GARAGE_BOMB1_SET:
+ case SOUND_GARAGE_BOMB2_SET:
+ case SOUND_GARAGE_BOMB3_SET:
+ case SOUND_40:
+ case SOUND_41:
+ case SOUND_GARAGE_VEHICLE_DECLINED:
+ case SOUND_GARAGE_VEHICLE_ACCEPTED:
+ case SOUND_GARAGE_DOOR_CLOSED:
+ case SOUND_GARAGE_DOOR_OPENED:
+ case SOUND_CRANE_PICKUP:
+ case SOUND_PICKUP_WEAPON_BOUGHT:
+ case SOUND_PICKUP_WEAPON:
+ case SOUND_PICKUP_HEALTH:
+ case SOUND_4A:
+ case SOUND_4B:
+ case SOUND_PICKUP_ADRENALINE:
+ case SOUND_PICKUP_ARMOUR:
+ 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:
+ case SOUND_RAMPAGE_START:
+ case SOUND_RAMPAGE_ONGOING:
+ case SOUND_RAMPAGE_PASSED:
+ case SOUND_RAMPAGE_FAILED:
+ case SOUND_RAMPAGE_KILL:
+ case SOUND_RAMPAGE_CAR_BLOWN:
+ case SOUND_EVIDENCE_PICKUP:
+ case SOUND_UNLOAD_GOLD:
+ case SOUND_PAGER:
+ case SOUND_PED_DEATH:
+ case SOUND_PED_DAMAGE:
+ case SOUND_PED_HIT:
+ case SOUND_PED_LAND:
+ case SOUND_PED_BULLET_HIT:
+ case SOUND_PED_BOMBER:
+ case SOUND_PED_BURNING:
+ case SOUND_PED_ARREST_FBI:
+ case SOUND_PED_ARREST_SWAT:
+ case SOUND_PED_ARREST_COP:
+ case SOUND_PED_HANDS_UP:
+ case SOUND_PED_HANDS_COWER:
+ case SOUND_PED_FLEE_SPRINT:
+ case SOUND_PED_CAR_JACKING:
+ case SOUND_PED_MUGGING:
+ case SOUND_PED_CAR_JACKED:
+ case SOUND_PED_ROBBED:
+ case SOUND_PED_TAXI_WAIT:
+ case SOUND_PED_ATTACK:
+ case SOUND_PED_DEFEND:
+ case SOUND_PED_PURSUIT_ARMY:
+ case SOUND_PED_PURSUIT_FBI:
+ case SOUND_PED_PURSUIT_SWAT:
+ case SOUND_PED_PURSUIT_COP:
+ case SOUND_PED_HEALING:
+ case SOUND_PED_7B:
+ case SOUND_PED_LEAVE_VEHICLE:
+ case SOUND_PED_EVADE:
+ case SOUND_PED_FLEE_RUN:
+ case SOUND_PED_CAR_COLLISION:
+ case SOUND_PED_SOLICIT:
+ case SOUND_PED_EXTINGUISHING_FIRE:
+ case SOUND_PED_WAIT_DOUBLEBACK:
+ case SOUND_PED_CHAT_SEXY:
+ case SOUND_PED_CHAT_EVENT:
+ case SOUND_PED_CHAT:
+ case SOUND_PED_TAXI_CALL:
+ case SOUND_INJURED_PED_MALE_OUCH:
+ case SOUND_INJURED_PED_FEMALE:
+ case SOUND_8A:
+ case SOUND_RACE_START_3:
+ case SOUND_RACE_START_2:
+ case SOUND_RACE_START_1:
+ case SOUND_RACE_START_GO:
+ case SOUND_SPLASH: continue;
+ case SOUND_CAR_ENGINE_START:
+ emittingVol = 60;
+ maxDist = 1600.f;
+ m_sQueueSample.m_nSampleIndex = SFX_CAR_STARTER;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 40.0f;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ case SOUND_CAR_LIGHT_BREAK:
+ m_sQueueSample.m_nSampleIndex = SFX_GLASS_SHARD_1;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 >> 3);
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 30.0f;
+ maxDist = 900.f;
+ emittingVol = m_anRandomTable[4] % 10 + 30;
+ break;
+ case SOUND_CAR_HYDRAULIC_1:
+ case SOUND_CAR_HYDRAULIC_2:
+ 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_bBankIndex = 0;
+ m_sQueueSample.m_nCounter = 51;
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 3);
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 35.0f;
+ maxDist = 1225.f;
+ emittingVol = m_anRandomTable[0] % 15 + 55;
+ break;
+ case SOUND_CAR_HYDRAULIC_3:
+ m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_SLOW_MOVE_LOOP;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 35.0f;
+ m_sQueueSample.m_nReleasingVolumeDivider = 7;
+ noReflections = true;
+ maxDist = 1225.f;
+ emittingVol = m_anRandomTable[0] % 15 + 55;
+ break;
+ case SOUND_CAR_JERK:
+ m_sQueueSample.m_nSampleIndex = SFX_SHAG_SUSPENSION;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_nCounter = 87;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_SHAG_SUSPENSION);
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 3);
+ m_sQueueSample.m_nReleasingVolumeModificator = 5;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 35.0f;
+ maxDist = 1225.f;
+ emittingVol = m_anRandomTable[1] % 15 + 55;
+ break;
+ case SOUND_CAR_SPLASH:
+ 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_bBankIndex = 0;
+ 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 = 40.0f;
+ emittingVol = (55.f * relVol);
+ maxDist = 1600.f;
+ break;
+ case SOUND_17:
+ m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_THUMB_OFF;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 50.0f;
+ emittingVol =
+ m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
+ maxDist = 2500.f;
+ break;
+ case SOUND_18:
+ case SOUND_19:
+ m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 35.0f;
+ maxDist = 1225.f;
+ emittingVol = m_anRandomTable[1] % 20 + 70;
+ break;
+ case SOUND_CAR_TANK_TURRET_ROTATE:
+ vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
+ if(vol > 0.038400002f) vol = 0.038400002f;
+ m_sQueueSample.m_nSampleIndex = SFX_TANK_TURRET;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_nCounter = 79;
+ m_sQueueSample.m_nFrequency = (3000.f * vol * 26.041666f) + 9000;
+ m_sQueueSample.m_nReleasingVolumeModificator = 2;
+ m_sQueueSample.m_fSpeedMultiplier = 2.0f;
+ m_sQueueSample.m_nReleasingVolumeDivider = 3;
+ m_sQueueSample.m_fSoundIntensity = 40.0f;
+ emittingVol = (37.f * vol * 26.041666f) + 90;
+ maxDist = 1600.f;
+ noReflections = true;
+ break;
+ case SOUND_CAR_BOMB_TICK:
+ m_sQueueSample.m_nSampleIndex = SFX_BOMB_BEEP;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 30.0f;
+ maxDist = 900.f;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVol = 60;
+ break;
+ case SOUND_PLANE_ON_GROUND:
+ m_sQueueSample.m_nSampleIndex = SFX_JUMBO_LAND_WHEELS;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 180.0f;
+ maxDist = 32400.f;
+ emittingVol = m_anRandomTable[4] % 25 + 75;
+ break;
+ case SOUND_WEAPON_SHOT_FIRED:
+ emittingVol = m_anRandomTable[2];
+ maxDist = 14400.f;
+ m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 >> 4);
+ m_sQueueSample.m_nReleasingVolumeModificator = 3;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 120.0f;
+ break;
+ case SOUND_WEAPON_HIT_VEHICLE:
+ m_sQueueSample.m_nSampleIndex =
+ m_anRandomTable[m_sQueueSample.m_nEntityIndex %
+ ARRAY_SIZE(m_anRandomTable)] %
+ 6 +
+ SFX_BULLET_CAR_1;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_nCounter = 34;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nFrequency +=
+ RandomDisplacement(m_sQueueSample.m_nFrequency >> 5);
+ m_sQueueSample.m_nReleasingVolumeModificator = 7;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 40.0f;
+ maxDist = 1600.f;
+ emittingVol = m_anRandomTable[3] % 20 + 90;
+ break;
+ case SOUND_BOMB_TIMED_ACTIVATED:
+ case SOUND_55:
+ case SOUND_BOMB_ONIGNITION_ACTIVATED:
+ case SOUND_BOMB_TICK:
+ m_sQueueSample.m_nSampleIndex = SFX_ARM_BOMB;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 50.0f;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVol = 50;
+ maxDist = 2500.f;
+ break;
+ case SOUND_PED_HELI_PLAYER_FOUND:
+ pedParams.m_pPed = 0;
+ pedParams.m_bDistanceCalculated = 0;
+ 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 = 0;
+ pedParams.m_bDistanceCalculated = 0;
+ 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:
+ m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 40.0f;
+ maxDist = 1600.f;
+ m_sQueueSample.m_bRequireReflection = true;
+ emittingVol = m_anRandomTable[4] % 20 + 90;
+ break;
+ case SOUND_SPLATTER:
+ m_sQueueSample.m_nSampleIndex = CrunchOffset + SFX_PED_CRUNCH_1;
+ m_sQueueSample.m_bBankIndex = 0;
+ 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 = 1600.f;
+ emittingVol = m_anRandomTable[4] % 20 + 55;
+ CrunchOffset &= 1u;
+ m_sQueueSample.m_bRequireReflection = true;
+ break;
+ case SOUND_CAR_PED_COLLISION:
+ vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
+ if(20.f < vol) vol = 20.f;
+ emittingVol = (vol * 0.05f * 127.f);
+ if(!emittingVol) continue;
+
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[2] & 3) + SFX_FIGHT_1;
+ m_sQueueSample.m_bBankIndex = 0;
+ m_sQueueSample.m_nCounter = 50;
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) >>
+ 1;
+ m_sQueueSample.m_nReleasingVolumeModificator = 1;
+ m_sQueueSample.m_fSpeedMultiplier = 0.0f;
+ m_sQueueSample.m_fSoundIntensity = 40.0f;
+ maxDist = 1600.f;
+ break;
+ }
+ if(params->m_fDistance < maxDist) {
+ CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
+ if(m_sQueueSample.m_bVolume) {
+ if(noReflections) {
+ m_sQueueSample.m_nLoopCount = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = 0;
+ } else {
+ m_sQueueSample.m_nLoopCount = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = 1;
+ }
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_bEmittingVolume = emittingVol;
+ m_sQueueSample.m_bReverbFlag = 1;
+ m_sQueueSample.m_bIs2D = false;
+ AddSampleToRequestedQueue();
+ }
+ }
+ }
}
bool
@@ -7730,7 +9037,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(60, 50.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 12;
+ m_sQueueSample.m_nCounter = 12;
m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -7742,10 +9049,11 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params)
m_sQueueSample.m_bEmittingVolume = 60;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7769,16 +9077,21 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
if(params->m_pVehicle->m_vecMoveSpeed.z) {
velocity = Abs(params->m_fVelocityChange);
if(velocity > 0.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params->m_bDistanceCalculated,
+ params->m_fDistance);
emittingVol =
- 30.f * min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 95.f, m_sQueueSample.m_fDistance);
+ 30.f *
+ min(1.f,
+ velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, 95.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
- if(params->m_pVehicle->m_nSurfaceTouched == SURFACE_PUDDLE) {
+ if(params->m_pVehicle->m_nSurfaceTouched ==
+ SURFACE_PUDDLE) {
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
freq = 6050 * emittingVol / 30 + 16000;
} else {
@@ -7786,18 +9099,21 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
modificator = m_sQueueSample.m_fDistance / 190.f;
sampleFreq = SampleManager.GetSampleBaseFrequency(
SFX_ROAD_NOISE);
- freq = (sampleFreq * modificator) + ((3 * sampleFreq) >> 2);
+ freq = (sampleFreq * modificator) +
+ ((3 * sampleFreq) >> 2);
}
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 95.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7819,7 +9135,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(80, 110.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 5;
+ m_sQueueSample.m_nCounter = 5;
if(UsesSiren(params->m_nIndex)) {
if(params->m_pVehicle->m_status == STATUS_ABANDONED) return;
if(veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) {
@@ -7828,8 +9144,9 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
m_sQueueSample.m_nFrequency = 16113;
else
m_sQueueSample.m_nFrequency =
- SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST);
- m_sQueueSample.m_counter = 60;
+ SampleManager.GetSampleBaseFrequency(
+ SFX_SIREN_FAST);
+ m_sQueueSample.m_nCounter = 60;
} else {
m_sQueueSample.m_nSampleIndex =
CarSounds[params->m_nIndex].m_nSirenOrAlarmSample;
@@ -7837,8 +9154,10 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
CarSounds[params->m_nIndex].m_nSirenOrAlarmFrequency;
}
} else {
- m_sQueueSample.m_nSampleIndex = CarSounds[params->m_nIndex].m_nSirenOrAlarmSample;
- m_sQueueSample.m_nFrequency = CarSounds[params->m_nIndex].m_nSirenOrAlarmFrequency;
+ m_sQueueSample.m_nSampleIndex =
+ CarSounds[params->m_nIndex].m_nSirenOrAlarmSample;
+ m_sQueueSample.m_nFrequency =
+ CarSounds[params->m_nIndex].m_nSirenOrAlarmFrequency;
}
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -7847,10 +9166,11 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
m_sQueueSample.m_bEmittingVolume = 80;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 7.0f;
m_sQueueSample.m_fSoundIntensity = 110.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7874,12 +9194,13 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
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] || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING)
+ if(!automobile->m_aWheelState[i] ||
+ automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING)
continue;
transmission = params->m_pTransmission;
if(transmission->nDriveType == '4') {
- newSkidVal =
- GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission,
+ params->m_fVelocityChange);
if(newSkidVal > skidVal) skidVal = newSkidVal;
continue;
}
@@ -7889,31 +9210,33 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
continue;
}
if(i != 1 && i != 3) {
- newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission,
- params->m_fVelocityChange);
+ newSkidVal = GetVehicleNonDriveWheelSkidValue(
+ i, automobile, transmission, params->m_fVelocityChange);
if(newSkidVal > skidVal) skidVal = newSkidVal;
continue;
}
- newSkidVal =
- GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission,
+ params->m_fVelocityChange);
if(newSkidVal > skidVal) skidVal = newSkidVal;
continue;
}
if(i == 0 || i == 2) {
- newSkidVal =
- GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission,
+ params->m_fVelocityChange);
if(newSkidVal > skidVal) skidVal = newSkidVal;
continue;
}
- newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange);
+ newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission,
+ params->m_fVelocityChange);
if(newSkidVal > skidVal) skidVal = newSkidVal;
}
if(skidVal > 0.0f) {
emittingVol = 50.f * skidVal;
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 40.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, 40.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 3;
+ m_sQueueSample.m_nCounter = 3;
switch(params->m_pVehicle->m_nSurfaceTouched) {
case SURFACE_GRASS:
case SURFACE_HEDGE:
@@ -7943,10 +9266,11 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 3.0f;
m_sQueueSample.m_fSoundIntensity = 40.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -7959,29 +9283,33 @@ void cAudioManager::ProcessWaterCannon(int32)
{
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];
+ m_sQueueSample.m_vecPos =
+ CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(distSquared < 900.f) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_bVolume =
- ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+ ComputeVolume(50, m_sQueueSample.m_fSoundIntensity,
+ m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_fSoundIntensity = 900.0f;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nFrequency = 15591;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
- m_sQueueSample.m_counter = i;
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bEmittingVolume = 50;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
@@ -7997,7 +9325,8 @@ 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_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_bBankIndex = SAMPLEBANK_MAIN;
@@ -8012,12 +9341,12 @@ cAudioManager::ProcessWeather(int32 id)
m_sQueueSample.m_bVolume = vol;
if(TheCamera.SoundDistUp < 20.f) m_sQueueSample.m_bVolume >>= 1;
if(counter == 4) counter = 0;
- m_sQueueSample.m_counter = counter++;
+ m_sQueueSample.m_nCounter = counter++;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bOffset = (m_anRandomTable[2] & 15) + 55;
m_sQueueSample.m_bIs2D = true;
m_sQueueSample.m_nLoopCount = 1;
- m_sQueueSample.m_bReleasingSoundFlag = 1;
+ m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
@@ -8027,21 +9356,22 @@ cAudioManager::ProcessWeather(int32 id)
}
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_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAIN);
m_sQueueSample.m_bVolume = (int32)(25.f * CWeather::Rain);
- m_sQueueSample.m_counter = 4;
+ m_sQueueSample.m_nCounter = 4;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bOffset = 63;
m_sQueueSample.m_bIs2D = true;
m_sQueueSample.m_nLoopCount = 0;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 30;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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();
}
@@ -8061,13 +9391,16 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
if(params->m_pVehicle->m_vecMoveSpeed.z) {
velChange = Abs(params->m_fVelocityChange);
if(velChange > 0.f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
+ CalculateDistance(params->m_bDistanceCalculated,
+ params->m_fDistance);
relativeVelocity =
- min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity));
+ min(1.0f,
+ velChange / (0.5f * params->m_pTransmission->fMaxVelocity));
emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
- m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
+ m_sQueueSample.m_bVolume =
+ ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -8078,12 +9411,14 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
- SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopStartOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
- SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ SampleManager.GetSampleLoopEndOffset(
+ m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 6.0f;
m_sQueueSample.m_fSoundIntensity = 30.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -8102,9 +9437,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
switch(sound) {
case SCRIPT_SOUND_WORK_SHOP_LOOP_S:
- case SCRIPT_SOUND_WORK_SHOP_LOOP_L:
- m_sQueueSample.m_fSoundIntensity = 20.0f;
- break;
+ case SCRIPT_SOUND_WORK_SHOP_LOOP_L: m_sQueueSample.m_fSoundIntensity = 20.0f; break;
default: return;
}
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
@@ -8115,17 +9448,19 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1);
- m_sQueueSample.m_counter = 0;
+ 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 = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeModificator = 5;
m_sQueueSample.m_fSpeedMultiplier = 2.0f;
m_sQueueSample.m_bEmittingVolume = 30;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(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();
@@ -8265,14 +9600,15 @@ cAudioManager::ServiceSoundEffects()
ProcessMissionAudio();
AdjustSamplesVolume();
ProcessActiveQueues();
- for(int32 i = 0; i < m_nScriptObjectEntityTotal; ++i) {
+ for(int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) {
cAudioScriptObject *object =
- (cAudioScriptObject *)m_asAudioEntities[m_anScriptObjectEntityIndices[i]].m_pEntity;
+ (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]]
+ .m_pEntity;
delete object;
- m_asAudioEntities[m_anScriptObjectEntityIndices[i]].m_pEntity = nil;
- DestroyEntity(m_anScriptObjectEntityIndices[i]);
+ m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil;
+ DestroyEntity(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]);
}
- m_nScriptObjectEntityTotal = 0;
+ m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
}
int8
@@ -8316,7 +9652,8 @@ cAudioManager::SetEffectsMasterVolume(uint8 volume) const
void
cAudioManager::SetEntityStatus(int32 id, uint8 status)
{
- if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed) {
+ if(m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots &&
+ m_asAudioEntities[id].m_bIsUsed) {
m_asAudioEntities[id].m_bStatus = status;
}
}
@@ -8325,7 +9662,7 @@ void
cAudioManager::SetMissionAudioLocation(float x, float y, float z)
{
if(m_bIsInitialised) {
- m_sMissionAudio.field_12 = 0;
+ m_sMissionAudio.m_bPredefinedProperties = 0;
m_sMissionAudio.m_vecPos = {x, y, z};
}
}
@@ -8356,7 +9693,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq)
uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100;
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 3;
+ m_sQueueSample.m_nCounter = 3;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -8364,11 +9701,13 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq)
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 180.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -8386,20 +9725,23 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
m_sQueueSample.m_bVolume = vol;
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY;
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
m_sQueueSample.m_bEmittingVolume = 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_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY);
+ m_sQueueSample.m_nLoopStart =
+ SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSoundIntensity = 440.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ 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);
+ m_sQueueSample.m_nLoopEnd =
+ SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
AddSampleToRequestedQueue();
}
return true;
@@ -8413,25 +9755,28 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol)
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 240.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 5;
+ m_sQueueSample.m_nCounter = 5;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = true;
m_sQueueSample.m_nReleasingVolumeModificator = 1;
- m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE);
+ m_sQueueSample.m_nFrequency =
+ SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE);
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 240.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 12;
m_sQueueSample.m_bOffset = 0;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
- m_sQueueSample.m_counter = 6;
+ m_sQueueSample.m_nCounter = 6;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE;
m_sQueueSample.m_nFrequency += 200;
m_sQueueSample.m_bOffset = maxVolume;
@@ -8447,11 +9792,12 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
uint8 emittingVol = (vol >> 1) + ((vol >> 1) * m_sQueueSample.m_fDistance / 180);
- if(m_sQueueSample.m_fDistance / 180 < 0.7f) emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
+ if(m_sQueueSample.m_fDistance / 180 < 0.7f)
+ emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100;
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 180.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 1;
+ m_sQueueSample.m_nCounter = 1;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -8459,11 +9805,13 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol)
m_sQueueSample.m_nFrequency = GetJumboTaxiFreq();
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 180.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -8480,7 +9828,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
m_sQueueSample.m_bVolume = ComputeVolume(emittingVol, 170.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
- m_sQueueSample.m_counter = 2;
+ m_sQueueSample.m_nCounter = 2;
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@@ -8488,11 +9836,13 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq)
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
- m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
- m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
+ 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 = 170.0f;
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 4;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@@ -8531,17 +9881,17 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
case SOUND_AMMUNATION_WELCOME_3: emittingVol = maxVolume; break;
default:
if(CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(),
- m_sQueueSample.m_vecPos, 1, 0, 0, 0, 0, 0,
- 0)) {
+ m_sQueueSample.m_vecPos, 1,
+ 0, 0, 0, 0, 0, 0)) {
emittingVol = maxVolume;
} else {
emittingVol = 31;
}
break;
}
- m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
- pedComment.field_25 = 10;
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
+ pedComment.m_nProcess = 10;
if(m_sQueueSample.m_bVolume) {
pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
pedComment.m_vecPos = m_sQueueSample.m_vecPos;
@@ -8555,26 +9905,30 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
switch(sound) {
case SOUND_PED_HELI_PLAYER_FOUND:
soundIntensity = 400.f;
- pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 29 +
- SFX_POLICE_HELI_1;
+ pedComment.m_nSampleIndex =
+ m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 29 +
+ SFX_POLICE_HELI_1;
break;
case SOUND_PED_BODYCAST_HIT:
if(CTimer::GetTimeInMilliseconds() <= gNextCryTime) return;
soundIntensity = 50.f;
gNextCryTime = CTimer::GetTimeInMilliseconds() + 500;
pedComment.m_nSampleIndex =
- (m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] & 3) + SFX_PLASTER_BLOKE_1;
+ (m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] & 3) +
+ SFX_PLASTER_BLOKE_1;
break;
case SOUND_INJURED_PED_MALE_OUCH:
case SOUND_8A:
soundIntensity = 50.f;
- pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 15 +
- SFX_GENERIC_MALE_GRUNT_1;
+ pedComment.m_nSampleIndex =
+ m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 15 +
+ SFX_GENERIC_MALE_GRUNT_1;
break;
case SOUND_INJURED_PED_FEMALE:
soundIntensity = 50.f;
- pedComment.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 11 +
- SFX_GENERIC_FEMALE_GRUNT_1;
+ pedComment.m_nSampleIndex =
+ m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % 11 +
+ SFX_GENERIC_FEMALE_GRUNT_1;
break;
default: return;
}
@@ -8588,17 +9942,17 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound)
case SOUND_AMMUNATION_WELCOME_3: emittingVol = maxVolume; break;
default:
if(CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(),
- m_sQueueSample.m_vecPos, 1, 0, 0, 0, 0, 0,
- 0)) {
+ m_sQueueSample.m_vecPos, 1,
+ 0, 0, 0, 0, 0, 0)) {
emittingVol = maxVolume;
} else {
emittingVol = 31;
}
break;
}
- m_sQueueSample.m_bVolume =
- ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
- pedComment.field_25 = 10;
+ m_sQueueSample.m_bVolume = ComputeVolume(
+ emittingVol, soundIntensity, m_sQueueSample.m_fDistance);
+ pedComment.m_nProcess = 10;
if(m_sQueueSample.m_bVolume) {
pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
pedComment.m_vecPos = m_sQueueSample.m_vecPos;
@@ -8623,7 +9977,7 @@ cAudioManager::Terminate()
}
m_nAudioEntitiesTotal = 0;
- m_nScriptObjectEntityTotal = 0;
+ m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
PreTerminateGameSpecificShutdown();
for(uint32 i = 0; i < DIGITALCHANNELS; i++) {
@@ -8632,7 +9986,7 @@ cAudioManager::Terminate()
SampleManager.Terminate();
- m_bIsInitialised = 0;
+ m_bIsInitialised = false;
PostTerminateGameSpecificShutdown();
}
}
@@ -8735,7 +10089,8 @@ cAudioManager::UpdateReflections()
bool
cAudioManager::UsesReverseWarning(int32 model) const
{
- return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH;
+ return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS ||
+ model == COACH;
}
bool
@@ -8768,11 +10123,14 @@ void
cAudioManager::AdjustSamplesVolume()
{
for(int i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; i++) {
- tSound* pSample = &m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i] + 1];
+ tSound *pSample =
+ &m_asSamples[m_bActiveSampleQueue]
+ [m_abSampleQueueIndexTable[m_bActiveSampleQueue][i] + 1];
if(!pSample->m_bIs2D)
- pSample->m_bEmittingVolume = ComputeEmittingVolume(
- pSample->m_bEmittingVolume, pSample->m_fSoundIntensity, pSample->m_fDistance);
+ pSample->m_bEmittingVolume =
+ ComputeEmittingVolume(pSample->m_bEmittingVolume,
+ pSample->m_fSoundIntensity, pSample->m_fDistance);
}
}
@@ -8782,220 +10140,221 @@ cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, floa
float quatIntensity = intensity / 4.0f;
float diffIntensity = intensity - quatIntensity;
if(dist > diffIntensity)
- return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity;
+ return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume /
+ quatIntensity;
return emittingVolume;
}
-STARTPATCHES
-InjectHook(0x57B210, &cAudioManager::AddDetailsToRequestedOrderList, PATCH_JUMP);
-InjectHook(0x56AD30, &cAudioManager::AddPlayerCarSample, PATCH_JUMP);
-InjectHook(0x57B300, &cAudioManager::AddReflectionsToRequestedQueue, PATCH_JUMP);
-InjectHook(0x57B8D0, &cAudioManager::AddReleasingSounds, PATCH_JUMP);
-InjectHook(0x57B070, &cAudioManager::AddSampleToRequestedQueue, PATCH_JUMP);
-InjectHook(0x5697A0, &cAudioManager::CalculateDistance, PATCH_JUMP);
-InjectHook(0x57AA10, &cAudioManager::CheckForAnAudioFileOnCD, PATCH_JUMP);
-InjectHook(0x57C160, &cAudioManager::ClearActiveSamples, PATCH_JUMP);
-InjectHook(0x5796A0, &cAudioManager::ClearMissionAudio, PATCH_JUMP);
-InjectHook(0x57C120, &cAudioManager::ClearRequestedQueue, PATCH_JUMP);
-InjectHook(0x57AE00, &cAudioManager::ComputeDopplerEffectedFrequency, PATCH_JUMP);
-InjectHook(0x57AD20, &cAudioManager::ComputePan, PATCH_JUMP);
-InjectHook(0x57ABB0, &cAudioManager::ComputeVolume, PATCH_JUMP);
-InjectHook(0x57A310, &cAudioManager::CreateEntity, PATCH_JUMP);
-InjectHook(0x57A830, &cAudioManager::DestroyAllGameCreatedEntities, PATCH_JUMP);
-InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP);
-InjectHook(0x57C290, &cAudioManager::GenerateIntegerRandomNumberTable, PATCH_JUMP);
-InjectHook(0x57A8C0, &cAudioManager::Get3DProviderName, PATCH_JUMP);
-InjectHook(0x571110, &cAudioManager::GetArmyTalkSfx, PATCH_JUMP);
-InjectHook(0x573AB0, &cAudioManager::GetBlackBusinessFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x572050, &cAudioManager::GetBlackCasualFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574380, &cAudioManager::GetBlackConstructionWorkerTalkSfx, PATCH_JUMP);
-InjectHook(0x571D80, &cAudioManager::GetBlackCriminalTalkSfx, PATCH_JUMP);
-InjectHook(0x5735E0, &cAudioManager::GetBlackDockerMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5724D0, &cAudioManager::GetBlackFatFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5726C0, &cAudioManager::GetBlackFatMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5728B0, &cAudioManager::GetBlackFemaleProstituteTalkSfx, PATCH_JUMP);
-InjectHook(0x572C20, &cAudioManager::GetBlackProjectFemaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x572D20, &cAudioManager::GetBlackProjectFemaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x572AF0, &cAudioManager::GetBlackProjectMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5739C0, &cAudioManager::GetBlackWorkerMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574FF0, &cAudioManager::GetBomberTalkSfx, PATCH_JUMP);
-InjectHook(0x5712C0, &cAudioManager::GetBusinessMaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x5713E0, &cAudioManager::GetBusinessMaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x572040, &cAudioManager::GetCasualMaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x574FE0, &cAudioManager::GetCatatalinaTalkSfx, PATCH_JUMP);
-InjectHook(0x57AA30, &cAudioManager::GetCDAudioDriveLetter, PATCH_JUMP);
-InjectHook(0x573010, &cAudioManager::GetChinatownFemaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x5730F0, &cAudioManager::GetChinatownFemaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x572E10, &cAudioManager::GetChinatownMaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x572F10, &cAudioManager::GetChinatownMaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x575120, &cAudioManager::GetChunkyTalkSfx, PATCH_JUMP);
-InjectHook(0x571B00, &cAudioManager::GetColumbianTalkSfx, PATCH_JUMP);
-InjectHook(0x570EA0, &cAudioManager::GetCopTalkSfx, PATCH_JUMP);
-InjectHook(0x57A8F0, &cAudioManager::GetCurrent3DProviderIndex, PATCH_JUMP);
-InjectHook(0x571770, &cAudioManager::GetDiabloTalkSfx, PATCH_JUMP);
-InjectHook(0x569750, &cAudioManager::GetDistanceSquared, PATCH_JUMP);
-InjectHook(0x574DA0, &cAudioManager::GetEightTalkSfx, PATCH_JUMP);
-InjectHook(0x574040, &cAudioManager::GetFanFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573F60, &cAudioManager::GetFanMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x571040, &cAudioManager::GetFBITalkSfx, PATCH_JUMP);
-InjectHook(0x572280, &cAudioManager::GetFemaleNo3TalkSfx, PATCH_JUMP);
-InjectHook(0x5712B0, &cAudioManager::GetFiremanTalkSfx, PATCH_JUMP);
-InjectHook(0x574E50, &cAudioManager::GetFrankieTalkSfx, PATCH_JUMP);
-InjectHook(0x575510, &cAudioManager::GetGenericFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x575460, &cAudioManager::GetGenericMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x571C30, &cAudioManager::GetHoodTalkSfx, PATCH_JUMP);
-InjectHook(0x5741F0, &cAudioManager::GetHospitalFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574120, &cAudioManager::GetHospitalMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x56F410, &cAudioManager::GetJumboTaxiFreq, PATCH_JUMP);
-InjectHook(0x573310, &cAudioManager::GetLittleItalyFemaleOldTalkSfx, PATCH_JUMP);
-InjectHook(0x573400, &cAudioManager::GetLittleItalyFemaleYoungTalkSfx, PATCH_JUMP);
-InjectHook(0x5731E0, &cAudioManager::GetLittleItalyMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x571510, &cAudioManager::GetMafiaTalkSfx, PATCH_JUMP);
-InjectHook(0x571F40, &cAudioManager::GetMaleNo2TalkSfx, PATCH_JUMP);
-InjectHook(0x5711C0, &cAudioManager::GetMedicTalkSfx, PATCH_JUMP);
-InjectHook(0x5795D0, &cAudioManager::GetMissionAudioLoadingStatus, PATCH_JUMP);
-InjectHook(0x574F00, &cAudioManager::GetMistyTalkSfx, PATCH_JUMP);
-InjectHook(0x575340, &cAudioManager::GetNormalMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x57A8A0, &cAudioManager::GetNum3DProvidersAvailable, PATCH_JUMP);
-InjectHook(0x574FD0, &cAudioManager::GetOJGTalkSfx, PATCH_JUMP);
-InjectHook(0x570960, &cAudioManager::GetPedCommentSfx, PATCH_JUMP);
-InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP);
-InjectHook(0x56BF80, &cAudioManager::GetVehicleDriveWheelSkidValue, PATCH_JUMP);
-InjectHook(0x56C120, &cAudioManager::GetVehicleNonDriveWheelSkidValue, PATCH_JUMP);
-InjectHook(0x575240, &cAudioManager::GetPimpTalkSfx, PATCH_JUMP);
-InjectHook(0x570E00, &cAudioManager::GetPlayerTalkSfx, PATCH_JUMP);
-InjectHook(0x5737E0, &cAudioManager::GetScumFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5736D0, &cAudioManager::GetScumMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x575060, &cAudioManager::GetSecurityGuardTalkSfx, PATCH_JUMP);
-InjectHook(0x574480, &cAudioManager::GetShopperFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574790, &cAudioManager::GetSpecialCharacterTalkSfx, PATCH_JUMP);
-InjectHook(0x573E90, &cAudioManager::GetStewardFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573DC0, &cAudioManager::GetStewardMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574690, &cAudioManager::GetStudentFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574590, &cAudioManager::GetStudentMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573CD0, &cAudioManager::GetSupermodelFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x573BD0, &cAudioManager::GetSupermodelMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x570F80, &cAudioManager::GetSwatTalkSfx, PATCH_JUMP);
-InjectHook(0x575190, &cAudioManager::GetTaxiDriverTalkSfx, PATCH_JUMP);
-InjectHook(0x571650, &cAudioManager::GetTriadTalkSfx, PATCH_JUMP);
-InjectHook(0x5723A0, &cAudioManager::GetWhiteBusinessFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x572170, &cAudioManager::GetWhiteCasualFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x574290, &cAudioManager::GetWhiteConstructionWorkerTalkSfx, PATCH_JUMP);
-InjectHook(0x571E60, &cAudioManager::GetWhiteCriminalTalkSfx, PATCH_JUMP);
-InjectHook(0x5734F0, &cAudioManager::GetWhiteDockerMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5727B0, &cAudioManager::GetWhiteFatFemaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5725D0, &cAudioManager::GetWhiteFatMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5729D0, &cAudioManager::GetWhiteFemaleProstituteTalkSfx, PATCH_JUMP);
-InjectHook(0x5738D0, &cAudioManager::GetWhiteWorkerMaleTalkSfx, PATCH_JUMP);
-InjectHook(0x5718D0, &cAudioManager::GetYakuzaTalkSfx, PATCH_JUMP);
-InjectHook(0x5719E0, &cAudioManager::GetYardieTalkSfx, PATCH_JUMP);
-InjectHook(0x56CAB0, &cAudioManager::HasAirBrakes, PATCH_JUMP);
-InjectHook(0x57A0E0, &cAudioManager::Initialise, PATCH_JUMP);
-InjectHook(0x57B030, &cAudioManager::InterrogateAudioEntities, PATCH_JUMP);
-InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP);
-InjectHook(0x579650, &cAudioManager::IsMissionAudioSampleFinished, PATCH_JUMP);
-InjectHook(0x57A9C0, &cAudioManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
-InjectHook(0x579520, &cAudioManager::MissionScriptAudioUsesPoliceChannel, PATCH_JUMP);
-InjectHook(0x56AD10, &cAudioManager::PlayerJustGotInCar, PATCH_JUMP);
-InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
-InjectHook(0x579620, &cAudioManager::PlayLoadedMissionAudio, PATCH_JUMP);
-InjectHook(0x57A500, &cAudioManager::PlayOneShot, PATCH_JUMP);
-InjectHook(0x569420, &cAudioManager::PostInitialiseGameSpecificSetup, PATCH_JUMP);
-InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP);
-InjectHook(0x569400, &cAudioManager::PreInitialiseGameSpecificSetup, PATCH_JUMP);
-InjectHook(0x579550, &cAudioManager::PreloadMissionAudio, PATCH_JUMP);
-InjectHook(0x569570, &cAudioManager::PreTerminateGameSpecificShutdown, PATCH_JUMP);
+// STARTPATCHES
+// InjectHook(0x57B210, &cAudioManager::AddDetailsToRequestedOrderList, PATCH_JUMP);
+// InjectHook(0x56AD30, &cAudioManager::AddPlayerCarSample, PATCH_JUMP);
+// InjectHook(0x57B300, &cAudioManager::AddReflectionsToRequestedQueue, PATCH_JUMP);
+// InjectHook(0x57B8D0, &cAudioManager::AddReleasingSounds, PATCH_JUMP);
+// InjectHook(0x57B070, &cAudioManager::AddSampleToRequestedQueue, PATCH_JUMP);
+// InjectHook(0x5697A0, &cAudioManager::CalculateDistance, PATCH_JUMP);
+// InjectHook(0x57AA10, &cAudioManager::CheckForAnAudioFileOnCD, PATCH_JUMP);
+// InjectHook(0x57C160, &cAudioManager::ClearActiveSamples, PATCH_JUMP);
+// InjectHook(0x5796A0, &cAudioManager::ClearMissionAudio, PATCH_JUMP);
+// InjectHook(0x57C120, &cAudioManager::ClearRequestedQueue, PATCH_JUMP);
+// InjectHook(0x57AE00, &cAudioManager::ComputeDopplerEffectedFrequency, PATCH_JUMP);
+// InjectHook(0x57AD20, &cAudioManager::ComputePan, PATCH_JUMP);
+// InjectHook(0x57ABB0, &cAudioManager::ComputeVolume, PATCH_JUMP);
+// InjectHook(0x57A310, &cAudioManager::CreateEntity, PATCH_JUMP);
+// InjectHook(0x57A830, &cAudioManager::DestroyAllGameCreatedEntities, PATCH_JUMP);
+// InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP);
+// InjectHook(0x57C290, &cAudioManager::GenerateIntegerRandomNumberTable, PATCH_JUMP);
+// InjectHook(0x57A8C0, &cAudioManager::Get3DProviderName, PATCH_JUMP);
+// InjectHook(0x571110, &cAudioManager::GetArmyTalkSfx, PATCH_JUMP);
+// InjectHook(0x573AB0, &cAudioManager::GetBlackBusinessFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x572050, &cAudioManager::GetBlackCasualFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x574380, &cAudioManager::GetBlackConstructionWorkerTalkSfx, PATCH_JUMP);
+// InjectHook(0x571D80, &cAudioManager::GetBlackCriminalTalkSfx, PATCH_JUMP);
+// InjectHook(0x5735E0, &cAudioManager::GetBlackDockerMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5724D0, &cAudioManager::GetBlackFatFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5726C0, &cAudioManager::GetBlackFatMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5728B0, &cAudioManager::GetBlackFemaleProstituteTalkSfx, PATCH_JUMP);
+// InjectHook(0x572C20, &cAudioManager::GetBlackProjectFemaleOldTalkSfx, PATCH_JUMP);
+// InjectHook(0x572D20, &cAudioManager::GetBlackProjectFemaleYoungTalkSfx, PATCH_JUMP);
+// InjectHook(0x572AF0, &cAudioManager::GetBlackProjectMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5739C0, &cAudioManager::GetBlackWorkerMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x574FF0, &cAudioManager::GetBomberTalkSfx, PATCH_JUMP);
+// InjectHook(0x5712C0, &cAudioManager::GetBusinessMaleOldTalkSfx, PATCH_JUMP);
+// InjectHook(0x5713E0, &cAudioManager::GetBusinessMaleYoungTalkSfx, PATCH_JUMP);
+// InjectHook(0x572040, &cAudioManager::GetCasualMaleOldTalkSfx, PATCH_JUMP);
+// InjectHook(0x574FE0, &cAudioManager::GetCatatalinaTalkSfx, PATCH_JUMP);
+// InjectHook(0x57AA30, &cAudioManager::GetCDAudioDriveLetter, PATCH_JUMP);
+// InjectHook(0x573010, &cAudioManager::GetChinatownFemaleOldTalkSfx, PATCH_JUMP);
+// InjectHook(0x5730F0, &cAudioManager::GetChinatownFemaleYoungTalkSfx, PATCH_JUMP);
+// InjectHook(0x572E10, &cAudioManager::GetChinatownMaleOldTalkSfx, PATCH_JUMP);
+// InjectHook(0x572F10, &cAudioManager::GetChinatownMaleYoungTalkSfx, PATCH_JUMP);
+// InjectHook(0x575120, &cAudioManager::GetChunkyTalkSfx, PATCH_JUMP);
+// InjectHook(0x571B00, &cAudioManager::GetColumbianTalkSfx, PATCH_JUMP);
+// InjectHook(0x570EA0, &cAudioManager::GetCopTalkSfx, PATCH_JUMP);
+// InjectHook(0x57A8F0, &cAudioManager::GetCurrent3DProviderIndex, PATCH_JUMP);
+// InjectHook(0x571770, &cAudioManager::GetDiabloTalkSfx, PATCH_JUMP);
+// InjectHook(0x569750, &cAudioManager::GetDistanceSquared, PATCH_JUMP);
+// InjectHook(0x574DA0, &cAudioManager::GetEightTalkSfx, PATCH_JUMP);
+// InjectHook(0x574040, &cAudioManager::GetFanFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x573F60, &cAudioManager::GetFanMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x571040, &cAudioManager::GetFBITalkSfx, PATCH_JUMP);
+// InjectHook(0x572280, &cAudioManager::GetFemaleNo3TalkSfx, PATCH_JUMP);
+// InjectHook(0x5712B0, &cAudioManager::GetFiremanTalkSfx, PATCH_JUMP);
+// InjectHook(0x574E50, &cAudioManager::GetFrankieTalkSfx, PATCH_JUMP);
+// InjectHook(0x575510, &cAudioManager::GetGenericFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x575460, &cAudioManager::GetGenericMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x571C30, &cAudioManager::GetHoodTalkSfx, PATCH_JUMP);
+// InjectHook(0x5741F0, &cAudioManager::GetHospitalFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x574120, &cAudioManager::GetHospitalMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x56F410, &cAudioManager::GetJumboTaxiFreq, PATCH_JUMP);
+// InjectHook(0x573310, &cAudioManager::GetLittleItalyFemaleOldTalkSfx, PATCH_JUMP);
+// InjectHook(0x573400, &cAudioManager::GetLittleItalyFemaleYoungTalkSfx, PATCH_JUMP);
+// InjectHook(0x5731E0, &cAudioManager::GetLittleItalyMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x571510, &cAudioManager::GetMafiaTalkSfx, PATCH_JUMP);
+// InjectHook(0x571F40, &cAudioManager::GetMaleNo2TalkSfx, PATCH_JUMP);
+// InjectHook(0x5711C0, &cAudioManager::GetMedicTalkSfx, PATCH_JUMP);
+// InjectHook(0x5795D0, &cAudioManager::GetMissionAudioLoadingStatus, PATCH_JUMP);
+// InjectHook(0x574F00, &cAudioManager::GetMistyTalkSfx, PATCH_JUMP);
+// InjectHook(0x575340, &cAudioManager::GetNormalMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x57A8A0, &cAudioManager::GetNum3DProvidersAvailable, PATCH_JUMP);
+// InjectHook(0x574FD0, &cAudioManager::GetOJGTalkSfx, PATCH_JUMP);
+// InjectHook(0x570960, &cAudioManager::GetPedCommentSfx, PATCH_JUMP);
+// InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP);
+// InjectHook(0x56BF80, &cAudioManager::GetVehicleDriveWheelSkidValue, PATCH_JUMP);
+// InjectHook(0x56C120, &cAudioManager::GetVehicleNonDriveWheelSkidValue, PATCH_JUMP);
+// InjectHook(0x575240, &cAudioManager::GetPimpTalkSfx, PATCH_JUMP);
+// InjectHook(0x570E00, &cAudioManager::GetPlayerTalkSfx, PATCH_JUMP);
+// InjectHook(0x5737E0, &cAudioManager::GetScumFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5736D0, &cAudioManager::GetScumMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x575060, &cAudioManager::GetSecurityGuardTalkSfx, PATCH_JUMP);
+// InjectHook(0x574480, &cAudioManager::GetShopperFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x574790, &cAudioManager::GetSpecialCharacterTalkSfx, PATCH_JUMP);
+// InjectHook(0x573E90, &cAudioManager::GetStewardFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x573DC0, &cAudioManager::GetStewardMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x574690, &cAudioManager::GetStudentFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x574590, &cAudioManager::GetStudentMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x573CD0, &cAudioManager::GetSupermodelFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x573BD0, &cAudioManager::GetSupermodelMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x570F80, &cAudioManager::GetSwatTalkSfx, PATCH_JUMP);
+// InjectHook(0x575190, &cAudioManager::GetTaxiDriverTalkSfx, PATCH_JUMP);
+// InjectHook(0x571650, &cAudioManager::GetTriadTalkSfx, PATCH_JUMP);
+// InjectHook(0x5723A0, &cAudioManager::GetWhiteBusinessFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x572170, &cAudioManager::GetWhiteCasualFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x574290, &cAudioManager::GetWhiteConstructionWorkerTalkSfx, PATCH_JUMP);
+// InjectHook(0x571E60, &cAudioManager::GetWhiteCriminalTalkSfx, PATCH_JUMP);
+// InjectHook(0x5734F0, &cAudioManager::GetWhiteDockerMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5727B0, &cAudioManager::GetWhiteFatFemaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5725D0, &cAudioManager::GetWhiteFatMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5729D0, &cAudioManager::GetWhiteFemaleProstituteTalkSfx, PATCH_JUMP);
+// InjectHook(0x5738D0, &cAudioManager::GetWhiteWorkerMaleTalkSfx, PATCH_JUMP);
+// InjectHook(0x5718D0, &cAudioManager::GetYakuzaTalkSfx, PATCH_JUMP);
+// InjectHook(0x5719E0, &cAudioManager::GetYardieTalkSfx, PATCH_JUMP);
+// InjectHook(0x56CAB0, &cAudioManager::HasAirBrakes, PATCH_JUMP);
+// InjectHook(0x57A0E0, &cAudioManager::Initialise, PATCH_JUMP);
+// InjectHook(0x57B030, &cAudioManager::InterrogateAudioEntities, PATCH_JUMP);
+// InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP);
+// InjectHook(0x579650, &cAudioManager::IsMissionAudioSampleFinished, PATCH_JUMP);
+// InjectHook(0x57A9C0, &cAudioManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
+// InjectHook(0x579520, &cAudioManager::MissionScriptAudioUsesPoliceChannel, PATCH_JUMP);
+// InjectHook(0x56AD10, &cAudioManager::PlayerJustGotInCar, PATCH_JUMP);
+// InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
+// InjectHook(0x579620, &cAudioManager::PlayLoadedMissionAudio, PATCH_JUMP);
+// InjectHook(0x57A500, &cAudioManager::PlayOneShot, PATCH_JUMP);
+// InjectHook(0x569420, &cAudioManager::PostInitialiseGameSpecificSetup, PATCH_JUMP);
+// InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP);
+// InjectHook(0x569400, &cAudioManager::PreInitialiseGameSpecificSetup, PATCH_JUMP);
+// InjectHook(0x579550, &cAudioManager::PreloadMissionAudio, PATCH_JUMP);
+// InjectHook(0x569570, &cAudioManager::PreTerminateGameSpecificShutdown, PATCH_JUMP);
// InjectHook(0x57BA60, &cAudioManager::ProcessActiveQueues, PATCH_JUMP);
-InjectHook(0x56C940, &cAudioManager::ProcessAirBrakes, PATCH_JUMP);
-InjectHook(0x577B30, &cAudioManager::ProcessAirportScriptObject, PATCH_JUMP);
-InjectHook(0x56DE80, &cAudioManager::ProcessBoatEngine, PATCH_JUMP);
-InjectHook(0x56E500, &cAudioManager::ProcessBoatMovingOverWater, PATCH_JUMP);
-InjectHook(0x5790D0, &cAudioManager::ProcessBridge, PATCH_JUMP);
-InjectHook(0x579250, &cAudioManager::ProcessBridgeMotor, PATCH_JUMP);
-InjectHook(0x579310, &cAudioManager::ProcessBridgeOneShots, PATCH_JUMP);
-InjectHook(0x579170, &cAudioManager::ProcessBridgeWarning, PATCH_JUMP);
-InjectHook(0x56CC20, &cAudioManager::ProcessCarBombTick, PATCH_JUMP);
-InjectHook(0x577CA0, &cAudioManager::ProcessCinemaScriptObject, PATCH_JUMP);
-InjectHook(0x577E50, &cAudioManager::ProcessDocksScriptObject, PATCH_JUMP);
-InjectHook(0x56CAF0, &cAudioManager::ProcessEngineDamage, PATCH_JUMP);
-InjectHook(0x569870, &cAudioManager::ProcessEntity, PATCH_JUMP);
-InjectHook(0x575AC0, &cAudioManager::ProcessExplosions, PATCH_JUMP);
-InjectHook(0x578FD0, &cAudioManager::ProcessFireHydrant, PATCH_JUMP);
-InjectHook(0x5785E0, &cAudioManager::ProcessFrontEnd, PATCH_JUMP);
-InjectHook(0x56E6A0, &cAudioManager::ProcessHelicopter, PATCH_JUMP);
-InjectHook(0x577FE0, &cAudioManager::ProcessHomeScriptObject, PATCH_JUMP);
-InjectHook(0x56E8F0, &cAudioManager::ProcessJumbo, PATCH_JUMP);
-InjectHook(0x56EA40, &cAudioManager::ProcessJumboAccel, PATCH_JUMP);
-InjectHook(0x56EE40, &cAudioManager::ProcessJumboDecel, PATCH_JUMP);
-InjectHook(0x56ECF0, &cAudioManager::ProcessJumboFlying, PATCH_JUMP);
-InjectHook(0x56ED10, &cAudioManager::ProcessJumboLanding, PATCH_JUMP);
-InjectHook(0x56EC00, &cAudioManager::ProcessJumboTakeOff, PATCH_JUMP);
-InjectHook(0x56EA10, &cAudioManager::ProcessJumboTaxi, PATCH_JUMP);
-InjectHook(0x5777E0, &cAudioManager::ProcessLaunderetteScriptObject, PATCH_JUMP);
-InjectHook(0x576770, &cAudioManager::ProcessLoopingScriptObject, PATCH_JUMP);
-InjectHook(0x5796E0, &cAudioManager::ProcessMissionAudio, PATCH_JUMP);
-InjectHook(0x56A050, &cAudioManager::ProcessModelCarEngine, PATCH_JUMP);
-InjectHook(0x5760C0, &cAudioManager::ProcessOneShotScriptObject, PATCH_JUMP);
-InjectHook(0x56F450, &cAudioManager::ProcessPed, PATCH_JUMP);
-InjectHook(0x56F4D0, &cAudioManager::ProcessPedHeadphones, PATCH_JUMP);
+// InjectHook(0x56C940, &cAudioManager::ProcessAirBrakes, PATCH_JUMP);
+// InjectHook(0x577B30, &cAudioManager::ProcessAirportScriptObject, PATCH_JUMP);
+// InjectHook(0x56DE80, &cAudioManager::ProcessBoatEngine, PATCH_JUMP);
+// InjectHook(0x56E500, &cAudioManager::ProcessBoatMovingOverWater, PATCH_JUMP);
+// InjectHook(0x5790D0, &cAudioManager::ProcessBridge, PATCH_JUMP);
+// InjectHook(0x579250, &cAudioManager::ProcessBridgeMotor, PATCH_JUMP);
+// InjectHook(0x579310, &cAudioManager::ProcessBridgeOneShots, PATCH_JUMP);
+// InjectHook(0x579170, &cAudioManager::ProcessBridgeWarning, PATCH_JUMP);
+// InjectHook(0x56CC20, &cAudioManager::ProcessCarBombTick, PATCH_JUMP);
+// InjectHook(0x577CA0, &cAudioManager::ProcessCinemaScriptObject, PATCH_JUMP);
+// InjectHook(0x577E50, &cAudioManager::ProcessDocksScriptObject, PATCH_JUMP);
+// InjectHook(0x56CAF0, &cAudioManager::ProcessEngineDamage, PATCH_JUMP);
+// InjectHook(0x569870, &cAudioManager::ProcessEntity, PATCH_JUMP);
+// InjectHook(0x575AC0, &cAudioManager::ProcessExplosions, PATCH_JUMP);
+// InjectHook(0x578FD0, &cAudioManager::ProcessFireHydrant, PATCH_JUMP);
+// InjectHook(0x5785E0, &cAudioManager::ProcessFrontEnd, PATCH_JUMP);
+// InjectHook(0x56E6A0, &cAudioManager::ProcessHelicopter, PATCH_JUMP);
+// InjectHook(0x577FE0, &cAudioManager::ProcessHomeScriptObject, PATCH_JUMP);
+// InjectHook(0x56E8F0, &cAudioManager::ProcessJumbo, PATCH_JUMP);
+// InjectHook(0x56EA40, &cAudioManager::ProcessJumboAccel, PATCH_JUMP);
+// InjectHook(0x56EE40, &cAudioManager::ProcessJumboDecel, PATCH_JUMP);
+// InjectHook(0x56ECF0, &cAudioManager::ProcessJumboFlying, PATCH_JUMP);
+// InjectHook(0x56ED10, &cAudioManager::ProcessJumboLanding, PATCH_JUMP);
+// InjectHook(0x56EC00, &cAudioManager::ProcessJumboTakeOff, PATCH_JUMP);
+// InjectHook(0x56EA10, &cAudioManager::ProcessJumboTaxi, PATCH_JUMP);
+// InjectHook(0x5777E0, &cAudioManager::ProcessLaunderetteScriptObject, PATCH_JUMP);
+// InjectHook(0x576770, &cAudioManager::ProcessLoopingScriptObject, PATCH_JUMP);
+// InjectHook(0x5796E0, &cAudioManager::ProcessMissionAudio, PATCH_JUMP);
+// InjectHook(0x56A050, &cAudioManager::ProcessModelCarEngine, PATCH_JUMP);
+// InjectHook(0x5760C0, &cAudioManager::ProcessOneShotScriptObject, PATCH_JUMP);
+// InjectHook(0x56F450, &cAudioManager::ProcessPed, PATCH_JUMP);
+// InjectHook(0x56F4D0, &cAudioManager::ProcessPedHeadphones, PATCH_JUMP);
// InjectHook(0x56F650, &cAudioManager::ProcessPedOneShots, PATCH_JUMP);
-InjectHook(0x5699C0, &cAudioManager::ProcessPhysical, PATCH_JUMP);
-InjectHook(0x56E860, &cAudioManager::ProcessPlane, PATCH_JUMP);
-InjectHook(0x56B0D0, &cAudioManager::ProcessPlayersVehicleEngine, PATCH_JUMP);
-InjectHook(0x578190, &cAudioManager::ProcessPoliceCellBeatingScriptObject, PATCH_JUMP);
-InjectHook(0x577280, &cAudioManager::ProcessPornCinema, PATCH_JUMP);
-InjectHook(0x578A80, &cAudioManager::ProcessProjectiles, PATCH_JUMP);
-InjectHook(0x569CC0, &cAudioManager::ProcessRainOnVehicle, PATCH_JUMP);
-InjectHook(0x569700, &cAudioManager::ProcessReverb, PATCH_JUMP);
-InjectHook(0x569E50, &cAudioManager::ProcessReverseGear, PATCH_JUMP);
-InjectHook(0x577630, &cAudioManager::ProcessSawMillScriptObject, PATCH_JUMP);
-InjectHook(0x576070, &cAudioManager::ProcessScriptObject, PATCH_JUMP);
-InjectHook(0x577970, &cAudioManager::ProcessShopScriptObject, PATCH_JUMP);
-InjectHook(0x5697D0, &cAudioManager::ProcessSpecial, PATCH_JUMP);
-InjectHook(0x56DBF0, &cAudioManager::ProcessTrainNoise, PATCH_JUMP);
-InjectHook(0x569A00, &cAudioManager::ProcessVehicle, PATCH_JUMP);
-InjectHook(0x56C770, &cAudioManager::ProcessVehicleDoors, PATCH_JUMP);
-InjectHook(0x56C200, &cAudioManager::ProcessVehicleHorn, PATCH_JUMP);
-InjectHook(0x56C640, &cAudioManager::ProcessVehicleReverseWarning, PATCH_JUMP);
-InjectHook(0x56A230, &cAudioManager::ProcessVehicleRoadNoise, PATCH_JUMP);
-InjectHook(0x56C420, &cAudioManager::ProcessVehicleSirenOrAlarm, PATCH_JUMP);
-InjectHook(0x56BCB0, &cAudioManager::ProcessVehicleSkidding, PATCH_JUMP);
-InjectHook(0x575F30, &cAudioManager::ProcessWaterCannon, PATCH_JUMP);
-InjectHook(0x578370, &cAudioManager::ProcessWeather, PATCH_JUMP);
-InjectHook(0x56A440, &cAudioManager::ProcessWetRoadNoise, PATCH_JUMP);
-InjectHook(0x577530, &cAudioManager::ProcessWorkShopScriptObject, PATCH_JUMP);
-InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP);
-InjectHook(0x57A9F0, &cAudioManager::ReacquireDigitalHandle, PATCH_JUMP);
-InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP);
-InjectHook(0x569650, &cAudioManager::ResetAudioLogicTimers, PATCH_JUMP);
-InjectHook(0x57A7B0, &cAudioManager::ResetTimers, PATCH_JUMP);
-InjectHook(0x57A2A0, &cAudioManager::Service, PATCH_JUMP);
-InjectHook(0x57AA60, &cAudioManager::ServiceSoundEffects, PATCH_JUMP);
-InjectHook(0x57A910, &cAudioManager::SetCurrent3DProvider, PATCH_JUMP);
-InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP);
-InjectHook(0x57A770, &cAudioManager::SetEffectsFadeVolume, PATCH_JUMP);
-InjectHook(0x57A730, &cAudioManager::SetEffectsMasterVolume, PATCH_JUMP);
-InjectHook(0x57A4C0, &cAudioManager::SetEntityStatus, PATCH_JUMP);
-InjectHook(0x5795F0, &cAudioManager::SetMissionAudioLocation, PATCH_JUMP);
-InjectHook(0x57A790, &cAudioManager::SetMusicFadeVolume, PATCH_JUMP);
-InjectHook(0x57A750, &cAudioManager::SetMusicMasterVolume, PATCH_JUMP);
-InjectHook(0x57A9A0, &cAudioManager::SetSpeakerConfig, PATCH_JUMP);
-InjectHook(0x56F230, &cAudioManager::SetupJumboFlySound, PATCH_JUMP);
-InjectHook(0x56F310, &cAudioManager::SetupJumboRumbleSound, PATCH_JUMP);
-InjectHook(0x56EF20, &cAudioManager::SetupJumboTaxiSound, PATCH_JUMP);
-InjectHook(0x56F070, &cAudioManager::SetupJumboWhineSound, PATCH_JUMP);
-InjectHook(0x570690, &cAudioManager::SetupPedComments, PATCH_JUMP);
-InjectHook(0x57A150, &cAudioManager::Terminate, PATCH_JUMP);
-InjectHook(0x57AC60, &cAudioManager::TranslateEntity, PATCH_JUMP);
-InjectHook(0x56AC80, &cAudioManager::UpdateGasPedalAudio, PATCH_JUMP);
-InjectHook(0x57B470, &cAudioManager::UpdateReflections, PATCH_JUMP);
-InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP);
-InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP);
-InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP);
-
-InjectHook(0x57C2B0, &cAudioManager::AdjustSamplesVolume, PATCH_JUMP);
-InjectHook(0x57C320, &cAudioManager::ComputeEmittingVolume, PATCH_JUMP);
-
-InjectHook(0x5755C0, &cPedComments::Add, PATCH_JUMP);
-InjectHook(0x575730, &cPedComments::Process, PATCH_JUMP);
-ENDPATCHES
+// InjectHook(0x5699C0, &cAudioManager::ProcessPhysical, PATCH_JUMP);
+// InjectHook(0x56E860, &cAudioManager::ProcessPlane, PATCH_JUMP);
+// InjectHook(0x56B0D0, &cAudioManager::ProcessPlayersVehicleEngine, PATCH_JUMP);
+// InjectHook(0x578190, &cAudioManager::ProcessPoliceCellBeatingScriptObject, PATCH_JUMP);
+// InjectHook(0x577280, &cAudioManager::ProcessPornCinema, PATCH_JUMP);
+// InjectHook(0x578A80, &cAudioManager::ProcessProjectiles, PATCH_JUMP);
+// InjectHook(0x569CC0, &cAudioManager::ProcessRainOnVehicle, PATCH_JUMP);
+// InjectHook(0x569700, &cAudioManager::ProcessReverb, PATCH_JUMP);
+// InjectHook(0x569E50, &cAudioManager::ProcessReverseGear, PATCH_JUMP);
+// InjectHook(0x577630, &cAudioManager::ProcessSawMillScriptObject, PATCH_JUMP);
+// InjectHook(0x576070, &cAudioManager::ProcessScriptObject, PATCH_JUMP);
+// InjectHook(0x577970, &cAudioManager::ProcessShopScriptObject, PATCH_JUMP);
+// InjectHook(0x5697D0, &cAudioManager::ProcessSpecial, PATCH_JUMP);
+// InjectHook(0x56DBF0, &cAudioManager::ProcessTrainNoise, PATCH_JUMP);
+// InjectHook(0x569A00, &cAudioManager::ProcessVehicle, PATCH_JUMP);
+// InjectHook(0x56C770, &cAudioManager::ProcessVehicleDoors, PATCH_JUMP);
+// InjectHook(0x56C200, &cAudioManager::ProcessVehicleHorn, PATCH_JUMP);
+// InjectHook(0x56C640, &cAudioManager::ProcessVehicleReverseWarning, PATCH_JUMP);
+// InjectHook(0x56A230, &cAudioManager::ProcessVehicleRoadNoise, PATCH_JUMP);
+// InjectHook(0x56C420, &cAudioManager::ProcessVehicleSirenOrAlarm, PATCH_JUMP);
+// InjectHook(0x56BCB0, &cAudioManager::ProcessVehicleSkidding, PATCH_JUMP);
+// InjectHook(0x575F30, &cAudioManager::ProcessWaterCannon, PATCH_JUMP);
+// InjectHook(0x578370, &cAudioManager::ProcessWeather, PATCH_JUMP);
+// InjectHook(0x56A440, &cAudioManager::ProcessWetRoadNoise, PATCH_JUMP);
+// InjectHook(0x577530, &cAudioManager::ProcessWorkShopScriptObject, PATCH_JUMP);
+// InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP);
+// InjectHook(0x57A9F0, &cAudioManager::ReacquireDigitalHandle, PATCH_JUMP);
+// InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP);
+// InjectHook(0x569650, &cAudioManager::ResetAudioLogicTimers, PATCH_JUMP);
+// InjectHook(0x57A7B0, &cAudioManager::ResetTimers, PATCH_JUMP);
+// InjectHook(0x57A2A0, &cAudioManager::Service, PATCH_JUMP);
+// InjectHook(0x57AA60, &cAudioManager::ServiceSoundEffects, PATCH_JUMP);
+// InjectHook(0x57A910, &cAudioManager::SetCurrent3DProvider, PATCH_JUMP);
+// InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP);
+// InjectHook(0x57A770, &cAudioManager::SetEffectsFadeVolume, PATCH_JUMP);
+// InjectHook(0x57A730, &cAudioManager::SetEffectsMasterVolume, PATCH_JUMP);
+// InjectHook(0x57A4C0, &cAudioManager::SetEntityStatus, PATCH_JUMP);
+// InjectHook(0x5795F0, &cAudioManager::SetMissionAudioLocation, PATCH_JUMP);
+// InjectHook(0x57A790, &cAudioManager::SetMusicFadeVolume, PATCH_JUMP);
+// InjectHook(0x57A750, &cAudioManager::SetMusicMasterVolume, PATCH_JUMP);
+// InjectHook(0x57A9A0, &cAudioManager::SetSpeakerConfig, PATCH_JUMP);
+// InjectHook(0x56F230, &cAudioManager::SetupJumboFlySound, PATCH_JUMP);
+// InjectHook(0x56F310, &cAudioManager::SetupJumboRumbleSound, PATCH_JUMP);
+// InjectHook(0x56EF20, &cAudioManager::SetupJumboTaxiSound, PATCH_JUMP);
+// InjectHook(0x56F070, &cAudioManager::SetupJumboWhineSound, PATCH_JUMP);
+// InjectHook(0x570690, &cAudioManager::SetupPedComments, PATCH_JUMP);
+// InjectHook(0x57A150, &cAudioManager::Terminate, PATCH_JUMP);
+// InjectHook(0x57AC60, &cAudioManager::TranslateEntity, PATCH_JUMP);
+// InjectHook(0x56AC80, &cAudioManager::UpdateGasPedalAudio, PATCH_JUMP);
+// InjectHook(0x57B470, &cAudioManager::UpdateReflections, PATCH_JUMP);
+// InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP);
+// InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP);
+// InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP);
+
+// InjectHook(0x57C2B0, &cAudioManager::AdjustSamplesVolume, PATCH_JUMP);
+// InjectHook(0x57C320, &cAudioManager::ComputeEmittingVolume, PATCH_JUMP);
+
+// InjectHook(0x5755C0, &cPedComments::Add, PATCH_JUMP);
+// InjectHook(0x575730, &cPedComments::Process, PATCH_JUMP);
+// ENDPATCHES
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 40aabcfc..ad558061 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -1,13 +1,14 @@
#pragma once
-#include "DMAudio.h"
#include "common.h"
#include "config.h"
+
+#include "DMAudio.h"
+
#include "AudioCollision.h"
#include "PoliceRadio.h"
-enum eScriptSounds : int16
-{
+enum eScriptSounds : int16 {
SCRIPT_SOUND_0 = 0,
SCRIPT_SOUND_1 = 1,
SCRIPT_SOUND_2 = 2,
@@ -138,47 +139,47 @@ class tSound
{
public:
int32 m_nEntityIndex;
- int32 m_counter;
+ int32 m_nCounter;
int32 m_nSampleIndex;
uint8 m_bBankIndex;
bool m_bIs2D;
- uint8 field_14;
- uint8 field_15;
+ uint8 field_14; // unused
+ uint8 field_15; // unused
int32 m_nReleasingVolumeModificator;
int32 m_nFrequency;
uint8 m_bVolume;
- uint8 field_25;
- uint8 field_26;
- uint8 field_27;
+ uint8 field_25; // unused
+ uint8 field_26; // unused
+ uint8 field_27; // unused
float m_fDistance;
int32 m_nLoopCount;
int32 m_nLoopStart;
int32 m_nLoopEnd;
uint8 m_bEmittingVolume;
- uint8 field_45;
- uint8 field_46;
- uint8 field_47;
+ uint8 field_45; // unused
+ uint8 field_46; // unused
+ uint8 field_47; // unused
float m_fSpeedMultiplier;
float m_fSoundIntensity;
bool m_bReleasingSoundFlag;
- uint8 field_57;
- uint8 field_58;
- uint8 field_59;
+ uint8 field_57; // unused
+ uint8 field_58; // unused
+ uint8 field_59; // unused
CVector m_vecPos;
bool m_bReverbFlag;
uint8 m_bLoopsRemaining;
bool m_bRequireReflection; // Used for oneshots
uint8 m_bOffset;
int32 m_nReleasingVolumeDivider;
- uint8 m_bIsProcessed;
- uint8 m_bLoopEnded;
- uint8 field_82;
- uint8 field_83;
- int32 calculatedVolume;
+ bool m_bIsProcessed;
+ bool m_bLoopEnded;
+ uint8 field_82; // unused
+ uint8 field_83; // unused
+ int32 m_nCalculatedVolume;
int8 m_nVolumeChange;
- uint8 field_89;
- uint8 field_90;
- uint8 field_91;
+ uint8 field_89; // unused
+ uint8 field_90; // unused
+ uint8 field_91; // unused
// no methods
};
@@ -196,7 +197,7 @@ public:
bool m_bIsUsed;
uint8 m_bStatus;
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
- uint8 gap_18[2];
+ //uint8 gap_18[2];
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
uint8 m_AudioEvents;
uint8 field_25[3];
@@ -214,8 +215,7 @@ public:
CVector m_vecPos;
float m_fDistance;
uint8 m_bVolume;
- int8 field_25; // allocated time?
- uint8 gap_26[2];
+ int8 m_nProcess;
// no methods
};
@@ -229,11 +229,10 @@ public:
uint8 m_nIndexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
uint8 m_nActiveBank;
- uint8 gap_1163[1];
- // reversed all methods
- void Add(tPedComment *com); /// ok
- void Process(); /// ok
+ cPedComments();
+ void Add(tPedComment *com);
+ void Process();
};
static_assert(sizeof(cPedComments) == 1164, "cPedComments: error");
@@ -244,23 +243,35 @@ class cMissionAudio
{
public:
CVector m_vecPos;
- uint8 field_12;
- uint8 gap_13[3];
+ bool m_bPredefinedProperties;
+ //uint8 gap_13[3];
int m_nSampleIndex;
uint8 m_bLoadingStatus;
uint8 m_bPlayStatus;
- uint8 field_22;
- uint8 field_23;
- int field_24;
+ uint8 field_22; // todo find a name
+ uint8 field_23; // unused
+ int32 m_nMissionAudioCounter;
bool m_bIsPlayed;
- uint8 field_29;
- uint8 field_30;
- uint8 field_31;
- // no methods
+ uint8 field_29; // unused
+ uint8 field_30; // unused
+ uint8 field_31; // unused
+ // no methods
};
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
+// name made up
+class cAudioScriptObjectManager
+{
+public:
+ int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
+ int32 m_nScriptObjectEntityTotal;
+
+ cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
+ ~cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
+};
+
+
class cVehicleParams;
class CPlane;
class CVehicle;
@@ -314,8 +325,7 @@ public:
int32 m_nAudioEntitiesTotal;
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
- int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
- int32 m_nScriptObjectEntityTotal;
+ cAudioScriptObjectManager m_sAudioScriptObjectManager;
cPedComments m_sPedComments;
int32 m_nFireAudioEntity;
int32 m_nWaterCannonEntity;
@@ -328,12 +338,15 @@ public:
int32 m_nBridgeEntity;
cMissionAudio m_sMissionAudio;
int32 m_anRandomTable[5];
- uint8 field_19192; // time?
+ uint8 m_bTimeSpent;
uint8 m_bUserPause;
uint8 m_bPreviousUserPause;
uint8 field_19195; // unused
uint32 m_FrameCounter;
+ cAudioManager();
+ ~cAudioManager();
+
// getters
uint32 GetFrameCounter() const { return m_FrameCounter; }
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
@@ -341,29 +354,29 @@ public:
bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_bPlayStatus == 1; }
// "Should" be in alphabetic order, except "getXTalkSfx"
- void AddDetailsToRequestedOrderList(uint8 sample); /// ok (check once more)
+ void AddDetailsToRequestedOrderList(uint8 sample);
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
- uint8 counter, bool notLooping); /// ok
- void AddReflectionsToRequestedQueue(); /// ok (check value)
- void AddReleasingSounds(); /// ok (check)
- void AddSampleToRequestedQueue(); /// ok
- void AgeCrimes(); /// ok
-
- void CalculateDistance(bool &condition, float dist); /// ok
- bool CheckForAnAudioFileOnCD() const; /// ok
- void ClearActiveSamples(); /// ok
- void ClearMissionAudio(); /// ok
- void ClearRequestedQueue(); /// ok
+ uint8 counter, bool notLooping);
+ void AddReflectionsToRequestedQueue();
+ void AddReleasingSounds();
+ void AddSampleToRequestedQueue();
+ void AgeCrimes();
+
+ void CalculateDistance(bool &condition, float dist);
+ bool CheckForAnAudioFileOnCD() const;
+ void ClearActiveSamples();
+ void ClearMissionAudio();
+ void ClearRequestedQueue();
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
- float speedMultiplier) const; /// ok
- int32 ComputePan(float, CVector *); /// ok
- uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; /// ok
- int32 CreateEntity(int32 type, void *entity); /// ok
+ float speedMultiplier) const;
+ int32 ComputePan(float, CVector *);
+ uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
+ int32 CreateEntity(int32 type, void *entity);
- void DestroyAllGameCreatedEntities(); /// ok
- void DestroyEntity(int32 id); /// ok
- void DoJumboVolOffset() const; /// ok
- void DoPoliceRadioCrackle(); /// ok
+ void DestroyAllGameCreatedEntities();
+ void DestroyEntity(int32 id);
+ void DoJumboVolOffset() const;
+ void DoPoliceRadioCrackle();
// functions returning talk sfx,
// order from GetPedCommentSfx
@@ -445,154 +458,151 @@ public:
uint32 GetGenericFemaleTalkSfx(int16 sound);
// end of functions returning talk sfx
- void GenerateIntegerRandomNumberTable(); /// ok
+ void GenerateIntegerRandomNumberTable();
char *Get3DProviderName(uint8 id) const;
uint8 GetCDAudioDriveLetter() const;
- int8 GetCurrent3DProviderIndex() const; /// ok
+ int8 GetCurrent3DProviderIndex() const;
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
- float GetCollisionOneShotRatio(int32 a, float b) const; /// ok
- float GetCollisionRatio(float a, float b, float c, float d) const; /// ok
- float GetDistanceSquared(CVector *v) const; /// ok
- int32 GetJumboTaxiFreq() const; /// ok
- bool GetMissionAudioLoadingStatus() const; /// ok
- int8 GetMissionScriptPoliceAudioPlayingStatus() const; /// ok
+ float GetCollisionOneShotRatio(int32 a, float b) const;
+ float GetCollisionRatio(float a, float b, float c, float d) const;
+ float GetDistanceSquared(CVector *v) const;
+ int32 GetJumboTaxiFreq() const;
+ bool GetMissionAudioLoadingStatus() const;
+ int8 GetMissionScriptPoliceAudioPlayingStatus() const;
uint8 GetNum3DProvidersAvailable() const;
int32 GetPedCommentSfx(CPed *ped, int32 sound);
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
- cTransmission *transmission,
- float velocityChange); /// ok
+ cTransmission *transmission, float velocityChange);
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
- cTransmission *transmission,
- float velocityChange); /// ok
+ cTransmission *transmission, float velocityChange);
- bool HasAirBrakes(int32 model) const; /// ok
+ bool HasAirBrakes(int32 model) const;
- void Initialise(); /// ok
- void InitialisePoliceRadio(); /// ok
- void InitialisePoliceRadioZones(); /// ok
- void InterrogateAudioEntities(); /// ok
- bool IsAudioInitialised() const; /// ok
- bool IsMissionAudioSampleFinished(); /// ok
+ void Initialise();
+ void InitialisePoliceRadio();
+ void InitialisePoliceRadioZones();
+ void InterrogateAudioEntities();
+ bool IsAudioInitialised() const;
+ bool IsMissionAudioSampleFinished();
bool IsMP3RadioChannelAvailable() const;
- bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; /// ok
-
- void PlayLoadedMissionAudio(); /// ok
- void PlayOneShot(int32 index, int16 sound, float vol); /// ok
- void PlaySuspectLastSeen(float x, float y, float z); /// ok
- void PlayerJustGotInCar() const; /// ok
- void PlayerJustLeftCar() const; /// ok
- void PostInitialiseGameSpecificSetup(); /// ok
- void PostTerminateGameSpecificShutdown(); /// ok
- void PreInitialiseGameSpecificSetup() const; /// ok
- void PreloadMissionAudio(const char *name); /// ok
- void PreTerminateGameSpecificShutdown(); /// ok
+ bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
+
+ void PlayLoadedMissionAudio();
+ void PlayOneShot(int32 index, int16 sound, float vol);
+ void PlaySuspectLastSeen(float x, float y, float z);
+ void PlayerJustGotInCar() const;
+ void PlayerJustLeftCar() const;
+ void PostInitialiseGameSpecificSetup();
+ void PostTerminateGameSpecificShutdown();
+ void PreInitialiseGameSpecificSetup() const;
+ void PreloadMissionAudio(const char *name);
+ void PreTerminateGameSpecificShutdown();
/// processX - main logic of adding new sounds
- void ProcessActiveQueues(); /// ok
- bool ProcessAirBrakes(cVehicleParams *params); /// ok
- void ProcessAirportScriptObject(uint8 sound); /// ok
- bool ProcessBoatEngine(cVehicleParams *params); /// ok
- bool ProcessBoatMovingOverWater(cVehicleParams *params); /// ok
- void ProcessBridge(); /// ok
- void ProcessBridgeMotor(); /// ok
- void ProcessBridgeOneShots(); /// ok
- void ProcessBridgeWarning(); /// ok
- bool ProcessCarBombTick(cVehicleParams *params); /// ok
- void ProcessCesna(cVehicleParams *params); /// ok
- void ProcessCinemaScriptObject(uint8 sound); /// ok
- void ProcessCrane(); /// ok
- void ProcessDocksScriptObject(uint8 sound); /// ok
- bool ProcessEngineDamage(cVehicleParams *params); /// ok
- void ProcessEntity(int32 sound); /// ok
- void ProcessExplosions(int32 explosion); /// ok
- void ProcessFireHydrant(); /// ok
- void ProcessFires(int32 entity); /// ok
- void ProcessFrontEnd(); /// ok
- void ProcessGarages(); /// ok
- bool ProcessHelicopter(cVehicleParams *params); /// ok
- void ProcessHomeScriptObject(uint8 sound); /// ok
- void ProcessJumbo(cVehicleParams *); /// ok
- void ProcessJumboAccel(CPlane *plane); /// ok
- void ProcessJumboDecel(CPlane *plane); /// ok
- void ProcessJumboFlying(); /// ok
- void ProcessJumboLanding(CPlane *plane); /// ok
- void ProcessJumboTakeOff(CPlane *plane); /// ok
- void ProcessJumboTaxi(); /// ok
- void ProcessLaunderetteScriptObject(uint8 sound); /// ok
- void ProcessLoopingScriptObject(uint8 sound); /// ok
- void ProcessMissionAudio(); /// ok
- void ProcessModelCarEngine(cVehicleParams *params); /// ok
- void ProcessOneShotScriptObject(uint8 sound); /// ok
- void ProcessPed(CPhysical *ped); /// ok
- void ProcessPedHeadphones(cPedParams *params); /// ok
- void ProcessPedOneShots(cPedParams *params); // todo later (weird)
- void ProcessPhysical(int32 id); /// ok
- void ProcessPlane(cVehicleParams *params); /// ok
- void ProcessPlayersVehicleEngine(cVehicleParams *params,
- CAutomobile *automobile); /// ok
- void ProcessPoliceCellBeatingScriptObject(uint8 sound); /// ok
- void ProcessPornCinema(uint8 sound); /// ok
- void ProcessProjectiles(); /// ok
- void ProcessRainOnVehicle(cVehicleParams *params); /// ok
- void ProcessReverb() const; /// ok
- bool ProcessReverseGear(cVehicleParams *params); /// ok
- void ProcessSawMillScriptObject(uint8 sound); /// ok
- void ProcessScriptObject(int32 id); /// ok
- void ProcessShopScriptObject(uint8 sound); /// ok
- void ProcessSpecial(); /// ok
- bool ProcessTrainNoise(cVehicleParams *params); /// ok
- void ProcessVehicle(CVehicle *vehicle); /// ok
- bool ProcessVehicleDoors(cVehicleParams *params); /// ok
- void ProcessVehicleEngine(cVehicleParams *params); /// ok
- void ProcessVehicleHorn(cVehicleParams *params); /// ok
- void ProcessVehicleOneShots(void *); // todo
- bool ProcessVehicleReverseWarning(cVehicleParams *params); /// ok
- bool ProcessVehicleRoadNoise(cVehicleParams *params); /// ok
- void ProcessVehicleSirenOrAlarm(cVehicleParams *params); /// ok
- void ProcessVehicleSkidding(cVehicleParams *params); /// ok
- void ProcessWaterCannon(int32); /// ok
- void ProcessWeather(int32 id); /// ok
- bool ProcessWetRoadNoise(cVehicleParams *params); /// ok
- void ProcessWorkShopScriptObject(uint8 sound); /// ok
+ void ProcessActiveQueues();
+ bool ProcessAirBrakes(cVehicleParams *params);
+ void ProcessAirportScriptObject(uint8 sound);
+ bool ProcessBoatEngine(cVehicleParams *params);
+ bool ProcessBoatMovingOverWater(cVehicleParams *params);
+ void ProcessBridge();
+ void ProcessBridgeMotor();
+ void ProcessBridgeOneShots();
+ void ProcessBridgeWarning();
+ bool ProcessCarBombTick(cVehicleParams *params);
+ void ProcessCesna(cVehicleParams *params);
+ void ProcessCinemaScriptObject(uint8 sound);
+ void ProcessCrane();
+ void ProcessDocksScriptObject(uint8 sound);
+ bool ProcessEngineDamage(cVehicleParams *params);
+ void ProcessEntity(int32 sound);
+ void ProcessExplosions(int32 explosion);
+ void ProcessFireHydrant();
+ void ProcessFires(int32 entity);
+ void ProcessFrontEnd();
+ void ProcessGarages();
+ bool ProcessHelicopter(cVehicleParams *params);
+ void ProcessHomeScriptObject(uint8 sound);
+ void ProcessJumbo(cVehicleParams *);
+ void ProcessJumboAccel(CPlane *plane);
+ void ProcessJumboDecel(CPlane *plane);
+ void ProcessJumboFlying();
+ void ProcessJumboLanding(CPlane *plane);
+ void ProcessJumboTakeOff(CPlane *plane);
+ void ProcessJumboTaxi();
+ void ProcessLaunderetteScriptObject(uint8 sound);
+ void ProcessLoopingScriptObject(uint8 sound);
+ void ProcessMissionAudio();
+ void ProcessModelCarEngine(cVehicleParams *params);
+ void ProcessOneShotScriptObject(uint8 sound);
+ void ProcessPed(CPhysical *ped);
+ void ProcessPedHeadphones(cPedParams *params);
+ void ProcessPedOneShots(cPedParams *params);
+ void ProcessPhysical(int32 id);
+ void ProcessPlane(cVehicleParams *params);
+ void ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile);
+ void ProcessPoliceCellBeatingScriptObject(uint8 sound);
+ void ProcessPornCinema(uint8 sound);
+ void ProcessProjectiles();
+ void ProcessRainOnVehicle(cVehicleParams *params);
+ void ProcessReverb() const;
+ bool ProcessReverseGear(cVehicleParams *params);
+ void ProcessSawMillScriptObject(uint8 sound);
+ void ProcessScriptObject(int32 id);
+ void ProcessShopScriptObject(uint8 sound);
+ void ProcessSpecial();
+ bool ProcessTrainNoise(cVehicleParams *params);
+ void ProcessVehicle(CVehicle *vehicle);
+ bool ProcessVehicleDoors(cVehicleParams *params);
+ void ProcessVehicleEngine(cVehicleParams *params);
+ void ProcessVehicleHorn(cVehicleParams *params);
+ void ProcessVehicleOneShots(cVehicleParams *params);
+ bool ProcessVehicleReverseWarning(cVehicleParams *params);
+ bool ProcessVehicleRoadNoise(cVehicleParams *params);
+ void ProcessVehicleSirenOrAlarm(cVehicleParams *params);
+ void ProcessVehicleSkidding(cVehicleParams *params);
+ void ProcessWaterCannon(int32);
+ void ProcessWeather(int32 id);
+ bool ProcessWetRoadNoise(cVehicleParams *params);
+ void ProcessWorkShopScriptObject(uint8 sound);
int32 RandomDisplacement(uint32 seed) const;
void ReacquireDigitalHandle() const;
void ReleaseDigitalHandle() const;
- void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
- float intensity2); /// ok
- void ReportCrime(int32 crime, const CVector *pos); /// ok
- void ResetAudioLogicTimers(uint32 timer); /// ok
- void ResetPoliceRadio(); /// ok
- void ResetTimers(uint32 time); /// ok
-
- void Service(); /// ok
- void ServiceCollisions(); /// ok
- void ServicePoliceRadio(); /// ok
- void ServicePoliceRadioChannel(int32 wantedLevel); /// ok
- void ServiceSoundEffects(); /// ok
- int8 SetCurrent3DProvider(uint8 which); /// ok
+ void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2,
+ float collisionPower, float intensity2);
+ void ReportCrime(int32 crime, const CVector *pos);
+ void ResetAudioLogicTimers(uint32 timer);
+ void ResetPoliceRadio();
+ void ResetTimers(uint32 time);
+
+ void Service();
+ void ServiceCollisions();
+ void ServicePoliceRadio();
+ void ServicePoliceRadioChannel(int32 wantedLevel);
+ void ServiceSoundEffects();
+ int8 SetCurrent3DProvider(uint8 which);
void SetDynamicAcousticModelingStatus(bool status);
void SetEffectsFadeVolume(uint8 volume) const;
void SetEffectsMasterVolume(uint8 volume) const;
void SetEntityStatus(int32 id, uint8 status);
- uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision); /// ok
+ uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision);
void SetMissionAudioLocation(float x, float y, float z);
void SetMissionScriptPoliceAudio(int32 sfx) const;
void SetMonoMode(uint8); // todo (mobile)
void SetMusicFadeVolume(uint8 volume) const;
void SetMusicMasterVolume(uint8 volume) const;
void SetSpeakerConfig(int32 conf) const;
- void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter); /// ok
- void SetUpOneShotCollisionSound(cAudioCollision *col); /// ok
- bool SetupCrimeReport(); /// ok
- bool SetupJumboEngineSound(uint8 vol, int32 freq); /// ok
- bool SetupJumboFlySound(uint8 emittingVol); /// ok
- bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
- bool SetupJumboTaxiSound(uint8 vol); /// ok
- bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
- void SetupPedComments(cPedParams *params, uint32 sound); /// ok
- void SetupSuspectLastSeenReport(); /// ok
+ void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter);
+ void SetUpOneShotCollisionSound(cAudioCollision *col);
+ bool SetupCrimeReport();
+ bool SetupJumboEngineSound(uint8 vol, int32 freq);
+ bool SetupJumboFlySound(uint8 emittingVol);
+ bool SetupJumboRumbleSound(uint8 emittingVol);
+ bool SetupJumboTaxiSound(uint8 vol);
+ bool SetupJumboWhineSound(uint8 emittingVol, int32 freq);
+ void SetupPedComments(cPedParams *params, uint32 sound);
+ void SetupSuspectLastSeenReport();
void Terminate();
void TranslateEntity(CVector *v1, CVector *v2) const;
@@ -604,11 +614,10 @@ public:
bool UsesSirenSwitching(int32 model) const;
// only used in pc
- void AdjustSamplesVolume(); /// ok
- uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity,
- float dist); /// ok
+ void AdjustSamplesVolume();
+ uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
};
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
-extern cAudioManager &AudioManager;
+extern cAudioManager AudioManager;
diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp
index 3ba16ef3..255d7026 100644
--- a/src/audio/PoliceRadio.cpp
+++ b/src/audio/PoliceRadio.cpp
@@ -125,7 +125,7 @@ void
cAudioManager::DoPoliceRadioCrackle()
{
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
- m_sQueueSample.m_counter = 0;
+ m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = true;
@@ -136,7 +136,7 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE);
- m_sQueueSample.m_bReleasingSoundFlag = 0;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bOffset = 63;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
@@ -147,17 +147,20 @@ cAudioManager::DoPoliceRadioCrackle()
void
cAudioManager::ServicePoliceRadio()
{
- int32 wantedLevel = 0; // bug?;
+ int32 wantedLevel = 0; // uninitialized variable
static uint32 nLastSeen = 300;
- if (!m_bIsInitialised) return;
+ if(!m_bIsInitialised) return;
- if (!m_bUserPause) {
+ if(!m_bUserPause) {
bool crimeReport = SetupCrimeReport();
+#ifdef FIX_BUGS // Crash at 0x5fe6ef
+ if(!FindPlayerPed() || !FindPlayerPed()->m_pWanted) return;
+#endif
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
- if (!crimeReport) {
- if (wantedLevel) {
- if (nLastSeen) {
+ if(!crimeReport) {
+ if(wantedLevel) {
+ if(nLastSeen) {
--nLastSeen;
} else {
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
diff --git a/src/control/AutoPilot.cpp b/src/control/AutoPilot.cpp
index 319cebab..65e73e5d 100644
--- a/src/control/AutoPilot.cpp
+++ b/src/control/AutoPilot.cpp
@@ -12,17 +12,17 @@ void CAutoPilot::ModifySpeed(float speed)
float positionBetweenNodes = (float)(CTimer::GetTimeInMilliseconds() - m_nTimeEnteredCurve) / m_nTimeToSpendOnCurrentCurve;
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[m_nNextPathNodeInfo];
- float currentPathLinkForwardX = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dirX;
- float currentPathLinkForwardY = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dirY;
- float nextPathLinkForwardX = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dirX;
- float nextPathLinkForwardY = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dirY;
+ float currentPathLinkForwardX = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dir.x;
+ float currentPathLinkForwardY = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dir.y;
+ float nextPathLinkForwardX = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dir.x;
+ float nextPathLinkForwardY = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dir.y;
CVector positionOnCurrentLinkIncludingLane(
- pCurrentLink->posX + ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurrentLink->posY - ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurrentLink->pos.x + ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurrentLink->pos.y - ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index ef89965a..197fca63 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -90,7 +90,7 @@ uint32 (&aCarsToKeepTime)[MAX_CARS_TO_KEEP] = *(uint32(*)[MAX_CARS_TO_KEEP])*(ui
void
CCarCtrl::GenerateRandomCars()
{
- if (CCutsceneMgr::IsCutsceneProcessing())
+ if (CCutsceneMgr::IsRunning())
return;
if (NumRandomCars < 30){
if (CountDownToCarsAtStart == 0){
@@ -393,25 +393,25 @@ CCarCtrl::GenerateOneRandomCar()
pCar->GetRight() = CVector(forwardY, -forwardX, 0.0f);
pCar->GetUp() = CVector(0.0f, 0.0f, 1.0f);
- float currentPathLinkForwardX = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dirX;
- float currentPathLinkForwardY = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dirY;
- float nextPathLinkForwardX = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dirX;
- float nextPathLinkForwardY = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dirY;
+ float currentPathLinkForwardX = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dir.x;
+ float currentPathLinkForwardY = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dir.y;
+ float nextPathLinkForwardX = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dir.x;
+ float nextPathLinkForwardY = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dir.y;
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo];
CVector positionOnCurrentLinkIncludingLane(
- pCurrentLink->posX + ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurrentLink->posY - ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurrentLink->pos.x + ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurrentLink->pos.y - ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
- float directionCurrentLinkX = pCurrentLink->dirX * pCar->AutoPilot.m_nCurrentDirection;
- float directionCurrentLinkY = pCurrentLink->dirY * pCar->AutoPilot.m_nCurrentDirection;
- float directionNextLinkX = pNextLink->dirX * pCar->AutoPilot.m_nNextDirection;
- float directionNextLinkY = pNextLink->dirY * pCar->AutoPilot.m_nNextDirection;
+ float directionCurrentLinkX = pCurrentLink->dir.x * pCar->AutoPilot.m_nCurrentDirection;
+ float directionCurrentLinkY = pCurrentLink->dir.y * pCar->AutoPilot.m_nCurrentDirection;
+ float directionNextLinkX = pNextLink->dir.x * pCar->AutoPilot.m_nNextDirection;
+ float directionNextLinkY = pNextLink->dir.y * pCar->AutoPilot.m_nNextDirection;
/* We want to make a path between two links that may not have the same forward directions a curve. */
pCar->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
@@ -763,17 +763,17 @@ CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle)
return;
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
- float currentPathLinkForwardX = pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- float currentPathLinkForwardY = pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- float nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ float currentPathLinkForwardX = pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ float currentPathLinkForwardY = pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ float nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
CVector positionOnCurrentLinkIncludingLane(
- pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
CVector directionCurrentLink(currentPathLinkForwardX, currentPathLinkForwardY, 0.0f);
CVector directionNextLink(nextPathLinkForwardX, nextPathLinkForwardY, 0.0f);
@@ -1553,8 +1553,8 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nNextDirection = -1;
lanesOnNextNode = pNextLink->numRightLanes;
}
- float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
- float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
+ float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
+ float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
if (lanesOnNextNode >= 0){
if ((CGeneral::GetRandomNumber() & 0x600) == 0){
/* 25% chance vehicle will try to switch lane */
@@ -1574,17 +1574,17 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
if (pVehicle->AutoPilot.m_bStayInFastLane)
pVehicle->AutoPilot.m_nNextLane = 0;
CVector positionOnCurrentLinkIncludingLane(
- pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH), /* ...what about Y? */
- pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH), /* ...what about Y? */
+ pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH),
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH),
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
- float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
/* We want to make a path between two links that may not have the same forward directions a curve. */
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
@@ -1725,10 +1725,10 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
pVehicle->AutoPilot.m_nNextDirection = -1;
lanesOnNextNode = pNextLink->numRightLanes;
}
- float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
- float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirY;
- float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
- float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirY;
+ float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
+ float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.y;
+ float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
+ float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.y;
if (lanesOnNextNode >= 0) {
CVector2D dist = pNextPathNode->pos - pCurNode->pos;
if (dist.MagnitudeSqr() >= SQR(7.0f)){
@@ -1755,17 +1755,17 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
if (pVehicle->AutoPilot.m_bStayInFastLane)
pVehicle->AutoPilot.m_nNextLane = 0;
CVector positionOnCurrentLinkIncludingLane(
- pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
- float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
/* We want to make a path between two links that may not have the same forward directions a curve. */
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
@@ -1814,10 +1814,10 @@ bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nNextDirection = -1;
lanesOnNextNode = pNextLink->numRightLanes;
}
- float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
- float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirY;
- float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
- float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirY;
+ float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
+ float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.y;
+ float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
+ float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.y;
if (lanesOnNextNode >= 0) {
CVector2D dist = pNextPathNode->pos - pCurNode->pos;
if (dist.MagnitudeSqr() >= SQR(7.0f) && (CGeneral::GetRandomNumber() & 0x600) == 0) {
@@ -1835,17 +1835,17 @@ bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
if (pVehicle->AutoPilot.m_bStayInFastLane)
pVehicle->AutoPilot.m_nNextLane = 0;
CVector positionOnCurrentLinkIncludingLane(
- pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
- pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
+ pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
+ pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f);
CVector positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f);
- float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
/* We want to make a path between two links that may not have the same forward directions a curve. */
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
&positionOnCurrentLinkIncludingLane,
@@ -2192,16 +2192,16 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
forward.Normalise();
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
- CVector2D currentPathLinkForward(pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection,
- pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection);
- float nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- float nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ CVector2D currentPathLinkForward(pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection,
+ pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection);
+ float nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ float nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
CVector2D positionOnCurrentLinkIncludingLane(
- pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
- pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
+ pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
+ pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
CVector2D positionOnNextLinkIncludingLane(
- pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
- pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX);
+ pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
+ pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX);
CVector2D distanceToNextNode = (CVector2D)pVehicle->GetPosition() - positionOnCurrentLinkIncludingLane;
float scalarDistanceToNextNode = distanceToNextNode.Magnitude();
CVector2D distanceBetweenNodes = positionOnNextLinkIncludingLane - positionOnCurrentLinkIncludingLane;
@@ -2230,16 +2230,16 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
}
pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
scalarDistanceToNextNode = CVector2D(
- pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y - pVehicle->GetPosition().x,
- pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x - pVehicle->GetPosition().y).Magnitude();
+ pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y - pVehicle->GetPosition().x,
+ pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x - pVehicle->GetPosition().y).Magnitude();
pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
- currentPathLinkForward.x = pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
- currentPathLinkForward.y = pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
- nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
- nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
+ currentPathLinkForward.x = pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
+ currentPathLinkForward.y = pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
+ nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
+ nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
}
- positionOnCurrentLinkIncludingLane.x = pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y;
- positionOnCurrentLinkIncludingLane.y = pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x;
+ positionOnCurrentLinkIncludingLane.x = pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y;
+ positionOnCurrentLinkIncludingLane.y = pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x;
CVector2D projectedPosition = positionOnCurrentLinkIncludingLane - currentPathLinkForward * scalarDistanceToNextNode * 0.4f;
if (scalarDistanceToNextNode > DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN){
projectedPosition.x = positionOnCurrentLinkIncludingLane.x;
@@ -2281,8 +2281,8 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
CCarAI::CarHasReasonToStop(pVehicle);
speedStyleMultiplier = 0.0f;
}
- CVector2D trajectory(pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
- pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
+ CVector2D trajectory(pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
+ pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
trajectory -= pVehicle->GetPosition();
float speedAngleMultiplier = FindSpeedMultiplier(
CGeneral::GetATanOfXY(trajectory.x, trajectory.y) - angleForward,
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 48a99170..d187f666 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -307,13 +307,13 @@ void CGarage::Update()
CGarages::bCamShouldBeOutisde = true;
}
if (pVehicle) {
- if (IsEntityEntirelyOutside(pVehicle, 0.0f))
+ if (!IsEntityEntirelyOutside(pVehicle, 0.0f))
TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = this;
if (pVehicle->GetModelIndex() == MI_MRWHOOP) {
if (pVehicle->IsWithinArea(
m_fX1 - DISTANCE_FOR_MRWHOOP_HACK,
- m_fX2 + DISTANCE_FOR_MRWHOOP_HACK,
- m_fY1 - DISTANCE_FOR_MRWHOOP_HACK,
+ m_fY1 + DISTANCE_FOR_MRWHOOP_HACK,
+ m_fX2 - DISTANCE_FOR_MRWHOOP_HACK,
m_fY2 + DISTANCE_FOR_MRWHOOP_HACK)) {
TheCamera.pToGarageWeAreIn = this;
CGarages::bCamShouldBeOutisde = true;
@@ -2108,7 +2108,7 @@ void CGarages::CloseHideOutGaragesBeforeSave()
aGarages[i].m_eGarageType != GARAGE_HIDEOUT_THREE)
continue;
if (aGarages[i].m_eGarageState != GS_FULLYCLOSED &&
- aGarages[i].m_eGarageType != GARAGE_HIDEOUT_ONE || !aGarages[i].IsAnyCarBlockingDoor()) {
+ (aGarages[i].m_eGarageType != GARAGE_HIDEOUT_ONE || !aGarages[i].IsAnyCarBlockingDoor())) {
aGarages[i].m_eGarageState = GS_FULLYCLOSED;
switch (aGarages[i].m_eGarageType) {
case GARAGE_HIDEOUT_ONE:
@@ -2313,6 +2313,10 @@ void CGarages::Load(uint8* buf, uint32 size)
#ifdef FIX_GARAGE_SIZE
VALIDATESAVEBUF(size);
#endif
+
+ MessageEndTime = 0;
+ bCamShouldBeOutisde = false;
+ MessageStartTime = 0;
}
bool
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index 608a209a..9f45c454 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -5,13 +5,17 @@
#include "Camera.h"
#include "Vehicle.h"
#include "World.h"
+#include "Lines.h" // for debug
#include "PathFind.h"
-CPathFind &ThePaths = *(CPathFind*)0x8F6754;
+bool gbShowPedPaths;
+bool gbShowCarPaths;
+bool gbShowCarPathsLinks;
-WRAPPER bool CPedPath::CalcPedRoute(uint8, CVector, CVector, CVector*, int16*, int16) { EAXJMP(0x42E680); }
+CPathFind &ThePaths = *(CPathFind*)0x8F6754;
#define MAX_DIST INT16_MAX-1
+#define MIN_PED_ROUTE_DISTANCE 23.8f
// object flags:
// 1 UseInRoadBlock
@@ -23,6 +27,199 @@ CPathInfoForObject *&InfoForTilePeds = *(CPathInfoForObject**)0x8F1AE4;
CTempDetachedNode *&DetachedNodesCars = *(CTempDetachedNode**)0x8E2824;
CTempDetachedNode *&DetachedNodesPeds = *(CTempDetachedNode**)0x8E28A0;
+bool
+CPedPath::CalcPedRoute(int8 pathType, CVector position, CVector destination, CVector *pointPoses, int16 *pointsFound, int16 maxPoints)
+{
+ *pointsFound = 0;
+ CVector vecDistance = destination - position;
+ if (Abs(vecDistance.x) > MIN_PED_ROUTE_DISTANCE || Abs(vecDistance.y) > MIN_PED_ROUTE_DISTANCE || Abs(vecDistance.z) > MIN_PED_ROUTE_DISTANCE)
+ return false;
+ CVector vecPos = (position + destination) * 0.5f;
+ CVector vecSectorStartPos (vecPos.x - 14.0f, vecPos.y - 14.0f, vecPos.z);
+ CVector2D vecSectorEndPos (vecPos.x + 28.0f, vecPos.x + 28.0f);
+ const int16 nodeStartX = (position.x - vecSectorStartPos.x) / 0.7f;
+ const int16 nodeStartY = (position.y - vecSectorStartPos.y) / 0.7f;
+ const int16 nodeEndX = (destination.x - vecSectorStartPos.x) / 0.7f;
+ const int16 nodeEndY = (destination.y - vecSectorStartPos.y) / 0.7f;
+ if (nodeStartX == nodeEndX && nodeStartY == nodeEndY)
+ return false;
+ CPedPathNode pathNodes[40][40];
+ CPedPathNode pathNodesList[416];
+ for (int32 x = 0; x < 40; x++) {
+ for (int32 y = 0; y < 40; y++) {
+ pathNodes[x][y].bBlockade = false;
+ pathNodes[x][y].id = INT16_MAX;
+ pathNodes[x][y].nodeIdX = x;
+ pathNodes[x][y].nodeIdY = y;
+ }
+ }
+ CWorld::AdvanceCurrentScanCode();
+ if (pathType != ROUTE_NO_BLOCKADE) {
+ const int32 nStartX = max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
+ const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
+ const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
+ const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
+ for (int32 y = nStartY; y <= nEndY; y++) {
+ for (int32 x = nStartX; x <= nEndX; x++) {
+ CSector *pSector = CWorld::GetSector(x, y);
+ AddBlockadeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], pathNodes, &vecSectorStartPos);
+ AddBlockadeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], pathNodes, &vecSectorStartPos);
+ AddBlockadeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], pathNodes, &vecSectorStartPos);
+ AddBlockadeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], pathNodes, &vecSectorStartPos);
+ }
+ }
+ }
+ for (int32 i = 0; i < 416; i++) {
+ pathNodesList[i].prev = nil;
+ pathNodesList[i].next = nil;
+ }
+ CPedPathNode *pStartPathNode = &pathNodes[nodeStartX][nodeStartY];
+ CPedPathNode *pEndPathNode = &pathNodes[nodeEndX][nodeEndY];
+ pEndPathNode->bBlockade = false;
+ pEndPathNode->id = 0;
+ pEndPathNode->prev = nil;
+ pEndPathNode->next = pathNodesList;
+ pathNodesList[0].prev = pEndPathNode;
+ int32 pathNodeIndex = 0;
+ CPedPathNode *pPreviousNode = nil;
+ for (; pathNodeIndex < 414; pathNodeIndex++)
+ {
+ pPreviousNode = pathNodesList[pathNodeIndex].prev;
+ while (pPreviousNode && pPreviousNode != pStartPathNode) {
+ const uint8 nodeIdX = pPreviousNode->nodeIdX;
+ const uint8 nodeIdY = pPreviousNode->nodeIdY;
+ if (nodeIdX > 0) {
+ AddNodeToPathList(&pathNodes[nodeIdX - 1][nodeIdY], pathNodeIndex + 5, pathNodesList);
+ if (nodeIdY > 0)
+ AddNodeToPathList(&pathNodes[nodeIdX - 1][nodeIdY - 1], pathNodeIndex + 7, pathNodesList);
+ if (nodeIdY < 39)
+ AddNodeToPathList(&pathNodes[nodeIdX - 1][nodeIdY + 1], pathNodeIndex + 7, pathNodesList);
+ }
+ if (nodeIdX < 39) {
+ AddNodeToPathList(&pathNodes[nodeIdX + 1][nodeIdY], pathNodeIndex + 5, pathNodesList);
+ if (nodeIdY > 0)
+ AddNodeToPathList(&pathNodes[nodeIdX + 1][nodeIdY - 1], pathNodeIndex + 7, pathNodesList);
+ if (nodeIdY < 39)
+ AddNodeToPathList(&pathNodes[nodeIdX + 1][nodeIdY + 1], pathNodeIndex + 7, pathNodesList);
+ }
+ if (nodeIdY > 0)
+ AddNodeToPathList(&pathNodes[nodeIdX][nodeIdY - 1], pathNodeIndex + 5, pathNodesList);
+ if (nodeIdY < 39)
+ AddNodeToPathList(&pathNodes[nodeIdX][nodeIdY + 1], pathNodeIndex + 5, pathNodesList);
+ pPreviousNode = pPreviousNode->prev;
+ if (!pPreviousNode)
+ break;
+ }
+
+ if (pPreviousNode && pPreviousNode == pStartPathNode)
+ break;
+ }
+ if (pathNodeIndex == 414)
+ return false;
+ CPedPathNode *pPathNode = pStartPathNode;
+ for (*pointsFound = 0; pPathNode != pEndPathNode && *pointsFound < maxPoints; ++ *pointsFound) {
+ const uint8 nodeIdX = pPathNode->nodeIdX;
+ const uint8 nodeIdY = pPathNode->nodeIdY;
+ if (nodeIdX > 0 && pathNodes[nodeIdX - 1][nodeIdY].id + 5 == pPathNode->id)
+ pPathNode = &pathNodes[nodeIdX - 1][nodeIdY];
+ else if (nodeIdX > 39 && pathNodes[nodeIdX + 1][nodeIdY].id + 5 == pPathNode->id)
+ pPathNode = &pathNodes[nodeIdX + 1][nodeIdY];
+ else if (nodeIdY > 0 && pathNodes[nodeIdX][nodeIdY - 1].id + 5 == pPathNode->id)
+ pPathNode = &pathNodes[nodeIdX][nodeIdY - 1];
+ else if (nodeIdY > 39 && pathNodes[nodeIdX][nodeIdY + 1].id + 5 == pPathNode->id)
+ pPathNode = &pathNodes[nodeIdX][nodeIdY + 1];
+ else if (nodeIdX > 0 && nodeIdY > 0 && pathNodes[nodeIdX - 1][nodeIdY - 1].id + 7 == pPathNode->id)
+ pPathNode = &pathNodes[nodeIdX - 1][nodeIdY - 1];
+ else if (nodeIdX > 0 && nodeIdY < 39 && pathNodes[nodeIdX - 1][nodeIdY + 1].id + 7 == pPathNode->id)
+ pPathNode = &pathNodes[nodeIdX - 1][nodeIdY + 1];
+ else if (nodeIdX < 39 && nodeIdY > 0 && pathNodes[nodeIdX + 1][nodeIdY - 1].id + 7 == pPathNode->id)
+ pPathNode = &pathNodes[nodeIdX + 1][nodeIdY - 1];
+ else if (nodeIdX < 39 && nodeIdY < 39 && pathNodes[nodeIdX + 1][nodeIdY + 1].id + 7 == pPathNode->id)
+ pPathNode = &pathNodes[nodeIdX + 1][nodeIdY + 1];
+ pointPoses[*pointsFound] = vecSectorStartPos;
+ pointPoses[*pointsFound].x += pPathNode->nodeIdX * 0.7f;
+ pointPoses[*pointsFound].y += pPathNode->nodeIdY * 0.7f;
+ }
+ return true;
+}
+
+
+void
+CPedPath::AddNodeToPathList(CPedPathNode *pNodeToAdd, int16 id, CPedPathNode *pNodeList)
+{
+ if (!pNodeToAdd->bBlockade && id < pNodeToAdd->id) {
+ if (pNodeToAdd->id != INT16_MAX)
+ RemoveNodeFromList(pNodeToAdd);
+ AddNodeToList(pNodeToAdd, id, pNodeList);
+ }
+}
+
+void
+CPedPath::RemoveNodeFromList(CPedPathNode *pNode)
+{
+ pNode->next->prev = pNode->prev;
+ if (pNode->prev)
+ pNode->prev->next = pNode->next;
+}
+
+void
+CPedPath::AddNodeToList(CPedPathNode *pNode, int16 index, CPedPathNode *pList)
+{
+ pNode->prev = pList[index].prev;
+ pNode->next = &pList[index];
+ if (pList[index].prev)
+ pList[index].prev->next = pNode;
+ pList[index].prev = pNode;
+ pNode->id = index;
+}
+
+void
+CPedPath::AddBlockadeSectorList(CPtrList& list, CPedPathNode(*pathNodes)[40], CVector *pPosition)
+{
+ CPtrNode* listNode = list.first;
+ while (listNode) {
+ CEntity* pEntity = (CEntity*)listNode->item;
+ if (pEntity->m_scanCode != CWorld::GetCurrentScanCode() && pEntity->bUsesCollision) {
+ pEntity->m_scanCode = CWorld::GetCurrentScanCode();
+ AddBlockade(pEntity, pathNodes, pPosition);
+ }
+ listNode = listNode->next;
+ }
+}
+
+void
+CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition)
+{
+ const CColBox& boundingBox = pEntity->GetColModel()->boundingBox;
+ const float fBoundMaxY = boundingBox.max.y + 0.3f;
+ const float fBoundMinY = boundingBox.min.y - 0.3f;
+ const float fBoundMaxX = boundingBox.max.x + 0.3f;
+ const float fDistanceX = pPosition->x - pEntity->m_matrix.GetPosition().x;
+ const float fDistanceY = pPosition->y - pEntity->m_matrix.GetPosition().y;
+ const float fBoundRadius = pEntity->GetBoundRadius();
+ CVector vecBoundCentre;
+ pEntity->GetBoundCentre(vecBoundCentre);
+ if (vecBoundCentre.x + fBoundRadius >= pPosition->x &&
+ vecBoundCentre.y + fBoundRadius >= pPosition->y &&
+ vecBoundCentre.x - fBoundRadius <= pPosition->x + 28.0f &&
+ vecBoundCentre.y - fBoundRadius <= pPosition->y + 28.0f) {
+ for (int16 x = 0; x < 40; x++) {
+ const float pointX = x * 0.7f + fDistanceX;
+ for (int16 y = 0; y < 40; y++) {
+ if (!pathNodes[x][y].bBlockade) {
+ const float pointY = y * 0.7f + fDistanceY;
+ CVector2D point(pointX, pointY);
+ if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->m_matrix.GetRight()))) {
+ float fDotProduct = DotProduct2D(point, pEntity->m_matrix.GetForward());
+ if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
+ pathNodes[x][y].bBlockade = true;
+ }
+ }
+ }
+ }
+ }
+}
+
void
CPathFind::Init(void)
{
@@ -466,20 +663,20 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
// IMPROVE: use a goto here
// Find existing car path link
for(k = 0; k < m_numCarPathLinks; k++){
- if(m_carPathLinks[k].dirX == tempnodes[j].dirX &&
- m_carPathLinks[k].dirY == tempnodes[j].dirY &&
- m_carPathLinks[k].posX == tempnodes[j].pos.x &&
- m_carPathLinks[k].posY == tempnodes[j].pos.y){
+ if(m_carPathLinks[k].dir.x == tempnodes[j].dirX &&
+ m_carPathLinks[k].dir.y == tempnodes[j].dirY &&
+ m_carPathLinks[k].pos.x == tempnodes[j].pos.x &&
+ m_carPathLinks[k].pos.y == tempnodes[j].pos.y){
m_carPathConnections[m_numConnections] = k;
k = m_numCarPathLinks;
}
}
// k is m_numCarPathLinks+1 if we found one
if(k == m_numCarPathLinks){
- m_carPathLinks[m_numCarPathLinks].dirX = tempnodes[j].dirX;
- m_carPathLinks[m_numCarPathLinks].dirY = tempnodes[j].dirY;
- m_carPathLinks[m_numCarPathLinks].posX = tempnodes[j].pos.x;
- m_carPathLinks[m_numCarPathLinks].posY = tempnodes[j].pos.y;
+ m_carPathLinks[m_numCarPathLinks].dir.x = tempnodes[j].dirX;
+ m_carPathLinks[m_numCarPathLinks].dir.y = tempnodes[j].dirY;
+ m_carPathLinks[m_numCarPathLinks].pos.x = tempnodes[j].pos.x;
+ m_carPathLinks[m_numCarPathLinks].pos.y = tempnodes[j].pos.y;
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
m_carPathLinks[m_numCarPathLinks].numLeftLanes = tempnodes[j].numLeftLanes;
m_carPathLinks[m_numCarPathLinks].numRightLanes = tempnodes[j].numRightLanes;
@@ -529,20 +726,20 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
// IMPROVE: use a goto here
// Find existing car path link
for(k = 0; k < m_numCarPathLinks; k++){
- if(m_carPathLinks[k].dirX == dx &&
- m_carPathLinks[k].dirY == dy &&
- m_carPathLinks[k].posX == posx &&
- m_carPathLinks[k].posY == posy){
+ if(m_carPathLinks[k].dir.x == dx &&
+ m_carPathLinks[k].dir.y == dy &&
+ m_carPathLinks[k].pos.x == posx &&
+ m_carPathLinks[k].pos.y == posy){
m_carPathConnections[m_numConnections] = k;
k = m_numCarPathLinks;
}
}
// k is m_numCarPathLinks+1 if we found one
if(k == m_numCarPathLinks){
- m_carPathLinks[m_numCarPathLinks].dirX = dx;
- m_carPathLinks[m_numCarPathLinks].dirY = dy;
- m_carPathLinks[m_numCarPathLinks].posX = posx;
- m_carPathLinks[m_numCarPathLinks].posY = posy;
+ m_carPathLinks[m_numCarPathLinks].dir.x = dx;
+ m_carPathLinks[m_numCarPathLinks].dir.y = dy;
+ m_carPathLinks[m_numCarPathLinks].pos.x = posx;
+ m_carPathLinks[m_numCarPathLinks].pos.y = posy;
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1;
m_carPathLinks[m_numCarPathLinks].numRightLanes = -1;
@@ -760,8 +957,8 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena
{
int i;
for(i = 0; i < m_numCarPathLinks; i++)
- if(x1 < m_carPathLinks[i].posX && m_carPathLinks[i].posX < x2 &&
- y1 < m_carPathLinks[i].posY && m_carPathLinks[i].posY < y2)
+ if(x1 < m_carPathLinks[i].pos.x && m_carPathLinks[i].pos.x < x2 &&
+ y1 < m_carPathLinks[i].pos.y && m_carPathLinks[i].pos.y < y2)
m_carPathLinks[i].bBridgeLights = enable;
}
@@ -1444,7 +1641,140 @@ CPathFind::Load(uint8 *buf, uint32 size)
m_pathNodes[i].bBetweenLevels = false;
}
+void
+CPathFind::DisplayPathData(void)
+{
+ // Not the function from mobm_carPathLinksile but my own!
+
+ int i, j, k;
+ // Draw 50 units around camera
+ CVector pos = TheCamera.GetPosition();
+ const float maxDist = 50.0f;
+
+ // Render car path nodes
+ if(gbShowCarPaths)
+ for(i = 0; i < m_numCarPathNodes; i++){
+ if((m_pathNodes[i].pos - pos).MagnitudeSqr() > SQR(maxDist))
+ continue;
+
+ CVector n1 = m_pathNodes[i].pos;
+ n1.z += 0.3f;
+
+ // Draw node itself
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n1.x, n1.y, n1.z + 1.0f,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ for(j = 0; j < m_pathNodes[i].numLinks; j++){
+ k = m_connections[m_pathNodes[i].firstLink + j];
+ CVector n2 = m_pathNodes[k].pos;
+ n2.z += 0.3f;
+ // Draw links to neighbours
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n2.x, n2.y, n2.z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ }
+ }
+
+ // Render car path nodes
+ if(gbShowCarPathsLinks)
+ for(i = 0; i < m_numCarPathLinks; i++){
+ CVector2D n1_2d = m_carPathLinks[i].pos;
+ if((n1_2d - pos).MagnitudeSqr() > SQR(maxDist))
+ continue;
+
+ int ni = m_carPathLinks[i].pathNodeIndex;
+ CVector pn1 = m_pathNodes[ni].pos;
+ pn1.z += 0.3f;
+ CVector n1(n1_2d.x, n1_2d.y, pn1.z);
+ n1.z += 0.3f;
+
+ // Draw car node itself
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n1.x, n1.y, n1.z + 1.0f,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z + 0.5f,
+ n1.x+m_carPathLinks[i].dir.x, n1.y+m_carPathLinks[i].dir.y, n1.z + 0.5f,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ // Draw connection to car path node
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ pn1.x, pn1.y, pn1.z,
+ 0xFF0000FF, 0xFFFFFFFF);
+
+ // traffic light type
+ uint32 col = 0xFF;
+ if((m_carPathLinks[i].trafficLightType&0x7F) == 1)
+ col += 0xFF000000;
+ if((m_carPathLinks[i].trafficLightType&0x7F) == 2)
+ col += 0x00FF0000;
+ if(m_carPathLinks[i].trafficLightType & 0x80)
+ col += 0x0000FF00;
+ CLines::RenderLineWithClipping(n1.x+0.2f, n1.y, n1.z,
+ n1.x+0.2f, n1.y, n1.z + 1.0f,
+ col, col);
+
+ for(j = 0; j < m_pathNodes[ni].numLinks; j++){
+ k = m_carPathConnections[m_pathNodes[ni].firstLink + j];
+ CVector2D n2_2d = m_carPathLinks[k].pos;
+ int nk = m_carPathLinks[k].pathNodeIndex;
+ CVector pn2 = m_pathNodes[nk].pos;
+ pn2.z += 0.3f;
+ CVector n2(n2_2d.x, n2_2d.y, pn2.z);
+ n2.z += 0.3f;
+
+ // Draw links to neighbours
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n2.x, n2.y, n2.z,
+ 0xFF00FFFF, 0xFF00FFFF);
+ }
+ }
+
+ // Render ped path nodes
+ if(gbShowPedPaths)
+ for(i = m_numCarPathNodes; i < m_numPathNodes; i++){
+ if((m_pathNodes[i].pos - pos).MagnitudeSqr() > SQR(maxDist))
+ continue;
+
+ CVector n1 = m_pathNodes[i].pos;
+ n1.z += 0.3f;
+
+ // Draw node itself
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n1.x, n1.y, n1.z + 1.0f,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ for(j = 0; j < m_pathNodes[i].numLinks; j++){
+ k = m_connections[m_pathNodes[i].firstLink + j];
+ CVector n2 = m_pathNodes[k].pos;
+ n2.z += 0.3f;
+ // Draw links to neighbours
+ CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
+ n2.x, n2.y, n2.z,
+ 0xFFFFFFFF, 0xFFFFFFFF);
+
+ // Draw connection flags
+ CVector mid = (n1+n2)/2.0f;
+ uint32 col = 0xFF;
+ if(m_connectionFlags[m_pathNodes[i].firstLink + j].bCrossesRoad)
+ col += 0x00FF0000;
+ if(m_connectionFlags[m_pathNodes[i].firstLink + j].bTrafficLight)
+ col += 0xFF000000;
+ CLines::RenderLineWithClipping(mid.x, mid.y, mid.z,
+ mid.x, mid.y, mid.z + 1.0f,
+ col, col);
+ }
+ }
+}
+
STARTPATCHES
+ InjectHook(0x42E680, &CPedPath::CalcPedRoute, PATCH_JUMP);
+ InjectHook(0x42F100, &CPedPath::AddNodeToPathList, PATCH_JUMP);
+ InjectHook(0x42F140, &CPedPath::RemoveNodeFromList, PATCH_JUMP);
+ InjectHook(0x42F160, &CPedPath::AddNodeToList, PATCH_JUMP);
+ InjectHook(0x42F1A0, &CPedPath::AddBlockade, PATCH_JUMP);
+ InjectHook(0x42F420, &CPedPath::AddBlockadeSectorList, PATCH_JUMP);
+
InjectHook(0x4294A0, &CPathFind::Init, PATCH_JUMP);
InjectHook(0x42D580, &CPathFind::AllocatePathFindInfoMem, PATCH_JUMP);
InjectHook(0x429540, &CPathFind::RegisterMapObject, PATCH_JUMP);
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index c51cb7c7..ea88ade6 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -3,11 +3,7 @@
#include "Treadable.h"
class CVehicle;
-
-class CPedPath {
-public:
- static bool CalcPedRoute(uint8, CVector, CVector, CVector*, int16*, int16);
-};
+class CPtrList;
enum
{
@@ -30,6 +26,33 @@ enum
SWITCH_ON = 1,
};
+enum
+{
+ ROUTE_ADD_BLOCKADE = 0,
+ ROUTE_NO_BLOCKADE = 1
+};
+
+struct CPedPathNode
+{
+ bool bBlockade;
+ uint8 nodeIdX;
+ uint8 nodeIdY;
+ int16 id;
+ CPedPathNode* prev;
+ CPedPathNode* next;
+};
+static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error");
+
+class CPedPath {
+public:
+ static bool CalcPedRoute(int8 pathType, CVector position, CVector destination, CVector *pointPoses, int16 *pointsFound, int16 maxPoints);
+ static void AddNodeToPathList(CPedPathNode *pNodeToAdd, int16 id, CPedPathNode *pNodeList);
+ static void RemoveNodeFromList(CPedPathNode *pNode);
+ static void AddNodeToList(CPedPathNode *pNode, int16 index, CPedPathNode *pList);
+ static void AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition);
+ static void AddBlockadeSectorList(CPtrList& list, CPedPathNode(*pathNodes)[40], CVector *pPosition);
+};
+
struct CPathNode
{
CVector pos;
@@ -84,10 +107,8 @@ union CConnectionFlags
struct CCarPathLink
{
- float posX;
- float posY;
- float dirX;
- float dirY;
+ CVector2D pos;
+ CVector2D dir;
int16 pathNodeIndex;
int8 numLeftLanes;
int8 numRightLanes;
@@ -208,7 +229,13 @@ public:
bool TestCoorsCloseness(CVector target, uint8 type, CVector start);
void Save(uint8 *buf, uint32 *size);
void Load(uint8 *buf, uint32 size);
+
+ void DisplayPathData(void);
};
static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
extern CPathFind &ThePaths;
+
+extern bool gbShowPedPaths;
+extern bool gbShowCarPaths;
+extern bool gbShowCarPathsLinks;
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 774abd8c..eb561670 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -54,23 +54,6 @@ uint8 aWeaponGreens[] = { 0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255, 0, 25
uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 };
float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
-WRAPPER void CPacManPickups::Init(void) { EAXJMP(0x432760); }
-WRAPPER void CPacManPickups::Update(void) { EAXJMP(0x432800); }
-WRAPPER void CPacManPickups::GeneratePMPickUps(CVector, float, int16, uint8) { EAXJMP(0x432AE0); }
-WRAPPER void CPacManPickups::GeneratePMPickUpsForRace(int32) { EAXJMP(0x432D50); }
-WRAPPER void CPacManPickups::GenerateOnePMPickUp(CVector) { EAXJMP(0x432F20); }
-WRAPPER void CPacManPickups::Render(void) { EAXJMP(0x432F60); }
-WRAPPER void CPacManPickups::DoCleanUpPacManStuff(void) { EAXJMP(0x433150); }
-WRAPPER void CPacManPickups::StartPacManRace(int32) { EAXJMP(0x433340); }
-WRAPPER void CPacManPickups::StartPacManRecord(void) { EAXJMP(0x433360); }
-WRAPPER uint32 CPacManPickups::QueryPowerPillsEatenInRace(void) { EAXJMP(0x4333A0); }
-WRAPPER void CPacManPickups::ResetPowerPillsEatenInRace(void) { EAXJMP(0x4333B0); }
-WRAPPER void CPacManPickups::CleanUpPacManStuff(void) { EAXJMP(0x4333C0); }
-WRAPPER void CPacManPickups::StartPacManScramble(CVector, float, int16) { EAXJMP(0x4333D0); }
-WRAPPER uint32 CPacManPickups::QueryPowerPillsCarriedByPlayer(void) { EAXJMP(0x4333F0); }
-WRAPPER void CPacManPickups::ResetPowerPillsCarriedByPlayer(void) { EAXJMP(0x433410); }
-
-
void
CPickup::RemoveKeepType()
{
@@ -111,7 +94,7 @@ CPickup::GiveUsAPickUpObject(int32 handle)
object->bUsesCollision = false;
object->bIsPickup = true;
- object->field_172 = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0;
+ object->m_nBonusValue = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0;
switch (m_eType)
{
@@ -289,13 +272,6 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
Remove();
DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0);
return true;
- //case PICKUP_IN_SHOP_OUT_OF_STOCK:
- //case PICKUP_MINE_INACTIVE:
- //case PICKUP_MINE_ARMED:
- //case PICKUP_NAUTICAL_MINE_INACTIVE:
- //case PICKUP_NAUTICAL_MINE_ARMED:
- //case PICKUP_FLOATINGPACKAGE:
- //case PICKUP_FLOATINGPACKAGE_FLOATING:
default:
break;
}
@@ -530,14 +506,12 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan
}
}
- if (!bFreeFound)
- {
+ if (!bFreeFound) {
for (slot = 0; slot < NUMGENERALPICKUPS; slot++) {
if (aPickUps[slot].m_eType == PICKUP_MONEY) break;
}
- if (slot >= NUMGENERALPICKUPS)
- {
+ if (slot >= NUMGENERALPICKUPS) {
for (slot = 0; slot < NUMGENERALPICKUPS; slot++) {
if (aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT) break;
}
@@ -671,9 +645,9 @@ void
CPickups::DoPickUpEffects(CEntity *entity)
{
if (entity->GetModelIndex() == MI_PICKUP_KILLFRENZY)
- entity->m_flagD80 = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
+ entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
- if (!entity->m_flagD80) {
+ if (!entity->bDoNotRender) {
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
float modifiedSin = 0.3f * (s + 1.0f);
@@ -716,7 +690,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
size, 65.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
CObject *object = (CObject*)entity;
- if (object->m_obj_flag2 || object->bOutOfStock || object->field_172) {
+ if (object->m_obj_flag2 || object->bOutOfStock || object->m_nBonusValue) {
float dist = (TheCamera.GetPosition() - pos).Magnitude();
const float MAXDIST = 12.0f;
@@ -734,7 +708,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
aMessages[NumMessages].m_color.blue = aWeaponBlues[colorId];
aMessages[NumMessages].m_color.alpha = (1.0f - dist / MAXDIST) * 128.0f;
aMessages[NumMessages].m_bOutOfStock = object->bOutOfStock;
- aMessages[NumMessages].m_quantity = object->field_172;
+ aMessages[NumMessages].m_quantity = object->m_nBonusValue;
NumMessages++;
}
}
@@ -1021,6 +995,418 @@ INITSAVEBUF
VALIDATESAVEBUF(*size)
}
+void
+CPacManPickup::Update()
+{
+ if (FindPlayerVehicle() == nil) return;
+
+ CVehicle *veh = FindPlayerVehicle();
+
+ if (DistanceSqr2D(FindPlayerVehicle()->GetPosition(), m_vecPosn.x, m_vecPosn.y) < 100.0f && veh->IsSphereTouchingVehicle(m_vecPosn.x, m_vecPosn.y, m_vecPosn.z, 1.5f)) {
+ switch (m_eType)
+ {
+ case PACMAN_SCRAMBLE:
+ {
+ veh->m_nPacManPickupsCarried++;
+ veh->m_vecMoveSpeed *= 0.65f;
+ float massMult = (veh->m_fMass + 250.0f) / veh->m_fMass;
+ veh->m_fMass *= massMult;
+ veh->m_fTurnMass *= massMult;
+ veh->m_fForceMultiplier *= massMult;
+ FindPlayerPed()->m_pWanted->m_nChaos += 10;
+ FindPlayerPed()->m_pWanted->UpdateWantedLevel();
+ DMAudio.PlayFrontEndSound(SOUND_PICKUP_PACMAN_PACKAGE, 0);
+ break;
+ }
+ case PACMAN_RACE:
+ CPacManPickups::PillsEatenInRace++;
+ DMAudio.PlayFrontEndSound(SOUND_PICKUP_PACMAN_PILL, 0);
+ break;
+ default:
+ break;
+ }
+ m_eType = PACMAN_NONE;
+ if (m_pObject != nil) {
+ CWorld::Remove(m_pObject);
+ delete m_pObject;
+ m_pObject = nil;
+ }
+ }
+}
+
+int32 CollectGameState;
+int16 ThingsToCollect;
+
+CPacManPickup CPacManPickups::aPMPickUps[NUMPACMANPICKUPS];
+CVector CPacManPickups::LastPickUpCoors;
+int32 CPacManPickups::PillsEatenInRace;
+bool CPacManPickups::bPMActive;
+
+void
+CPacManPickups::Init()
+{
+ for (int i = 0; i < NUMPACMANPICKUPS; i++)
+ aPMPickUps[i].m_eType = PACMAN_NONE;
+ bPMActive = false;
+}
+
+void
+CPacManPickups::Update()
+{
+ if (FindPlayerVehicle()) {
+ float dist = Distance(FindPlayerCoors(), CVector(1072.0f, -948.0f, 14.5f));
+ switch (CollectGameState) {
+ case 1:
+ if (dist < 10.0f) {
+ ThingsToCollect -= FindPlayerVehicle()->m_nPacManPickupsCarried;
+ FindPlayerVehicle()->m_nPacManPickupsCarried = 0;
+ FindPlayerVehicle()->m_fMass /= FindPlayerVehicle()->m_fForceMultiplier;
+ FindPlayerVehicle()->m_fTurnMass /= FindPlayerVehicle()->m_fForceMultiplier;
+ FindPlayerVehicle()->m_fForceMultiplier = 1.0f;
+ }
+ if (ThingsToCollect <= 0) {
+ CollectGameState = 2;
+ ClearPMPickUps();
+ }
+ break;
+ case 2:
+ if (dist > 11.0f)
+ CollectGameState = 0;
+ break;
+ case 20:
+ if (Distance(FindPlayerCoors(), LastPickUpCoors) > 30.0f) {
+ LastPickUpCoors = FindPlayerCoors();
+ printf("%f, %f, %f,\n", LastPickUpCoors.x, LastPickUpCoors.y, LastPickUpCoors.z);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if (bPMActive) {
+#define PACMANPICKUPS_FRAME_SPAN (4)
+ for (uint32 i = (CTimer::GetFrameCounter() % PACMANPICKUPS_FRAME_SPAN) * (NUMPACMANPICKUPS / PACMANPICKUPS_FRAME_SPAN); i < ((CTimer::GetFrameCounter() % PACMANPICKUPS_FRAME_SPAN) + 1) * (NUMPACMANPICKUPS / PACMANPICKUPS_FRAME_SPAN); i++) {
+ if (aPMPickUps[i].m_eType != PACMAN_NONE)
+ aPMPickUps[i].Update();
+ }
+#undef PACMANPICKUPS_FRAME_SPAN
+ }
+}
+
+void
+CPacManPickups::GeneratePMPickUps(CVector pos, float scrambleMult, int16 count, uint8 type)
+{
+ int i = 0;
+ while (count > 0) {
+ while (aPMPickUps[i].m_eType != PACMAN_NONE)
+ i++;
+
+ bool bPickupCreated = false;
+ while (!bPickupCreated) {
+ CVector newPos = pos;
+ CColPoint colPoint;
+ CEntity *pRoad;
+ uint16 nRand = CGeneral::GetRandomNumber();
+ newPos.x += ((nRand & 0xFF) - 128) * scrambleMult / 128.0f;
+ newPos.y += (((nRand >> 8) & 0xFF) - 128) * scrambleMult / 128.0f;
+ newPos.z = 1000.0f;
+ if (CWorld::ProcessVerticalLine(newPos, -1000.0f, colPoint, pRoad, true, false, false, false, true, false, nil) && pRoad->IsBuilding() && ((CBuilding*)pRoad)->GetIsATreadable()) {
+ newPos.z = 0.7f + colPoint.point.z;
+ aPMPickUps[i].m_eType = type;
+ aPMPickUps[i].m_vecPosn = newPos;
+ CObject *obj = new CObject(MI_BULLION, true);
+ if (obj != nil) {
+ obj->ObjectCreatedBy = MISSION_OBJECT;
+ obj->GetPosition() = aPMPickUps[i].m_vecPosn;
+ obj->SetOrientation(0.0f, 0.0f, -HALFPI);
+ obj->GetMatrix().UpdateRW();
+ obj->UpdateRwFrame();
+
+ obj->bAffectedByGravity = false;
+ obj->bExplosionProof = true;
+ obj->bUsesCollision = false;
+ obj->bIsPickup = false;
+ CWorld::Add(obj);
+ }
+ aPMPickUps[i].m_pObject = obj;
+ bPickupCreated = true;
+ }
+ }
+ count--;
+ }
+ bPMActive = true;
+}
+
+// diablo porn mission pickups
+static const CVector aRacePoints1[] = {
+ CVector(913.62219f, -155.13692f, 4.9699469f),
+ CVector(913.92401f, -124.12943f, 4.9692569f),
+ CVector(913.27899f, -93.524231f, 7.4325991f),
+ CVector(912.60852f, -63.15905f, 7.4533591f),
+ CVector(934.22144f, -42.049122f, 7.4511471f),
+ CVector(958.88092f, -23.863735f, 7.4652338f),
+ CVector(978.50812f, -0.78458798f, 5.13515f),
+ CVector(1009.4175f, -2.1041219f, 2.4461579f),
+ CVector(1040.6313f, -2.0793829f, 2.293175f),
+ CVector(1070.7863f, -2.084095f, 2.2789791f),
+ CVector(1100.5773f, -8.468729f, 5.3248072f),
+ CVector(1119.9341f, -31.738031f, 7.1913071f),
+ CVector(1122.1664f, -62.762737f, 7.4703908f),
+ CVector(1122.814f, -93.650566f, 8.5577497f),
+ CVector(1125.8253f, -124.26616f, 9.9803305f),
+ CVector(1153.8727f, -135.47169f, 14.150617f),
+ CVector(1184.0831f, -135.82845f, 14.973998f),
+ CVector(1192.0432f, -164.57816f, 19.18627f),
+ CVector(1192.7761f, -194.28871f, 24.799675f),
+ CVector(1215.1527f, -215.0714f, 25.74975f),
+ CVector(1245.79f, -215.39304f, 28.70726f),
+ CVector(1276.2477f, -216.39485f, 33.71236f),
+ CVector(1306.5535f, -216.71007f, 39.711472f),
+ CVector(1335.0244f, -224.59329f, 46.474979f),
+ CVector(1355.4879f, -246.27664f, 49.934841f),
+ CVector(1362.6003f, -276.47064f, 49.96265f),
+ CVector(1363.027f, -307.30847f, 49.969173f),
+ CVector(1365.343f, -338.08609f, 49.967789f),
+ CVector(1367.5957f, -368.01105f, 50.092304f),
+ CVector(1368.2749f, -398.38049f, 50.061268f),
+ CVector(1366.9034f, -429.98483f, 50.057545f),
+ CVector(1356.8534f, -459.09259f, 50.035545f),
+ CVector(1335.5819f, -481.13544f, 47.217903f),
+ CVector(1306.7552f, -491.07443f, 40.202629f),
+ CVector(1275.5978f, -491.33194f, 33.969223f),
+ CVector(1244.702f, -491.46451f, 29.111021f),
+ CVector(1213.2222f, -491.8754f, 25.771168f),
+ CVector(1182.7729f, -492.19995f, 24.749964f),
+ CVector(1152.6874f, -491.42221f, 21.70038f),
+ CVector(1121.5352f, -491.94604f, 20.075182f),
+ CVector(1090.7056f, -492.63751f, 17.585758f),
+ CVector(1059.6008f, -491.65762f, 14.848632f),
+ CVector(1029.113f, -489.66031f, 14.918498f),
+ CVector(998.20679f, -486.78107f, 14.945688f),
+ CVector(968.00555f, -484.91266f, 15.001229f),
+ CVector(937.74939f, -492.09015f, 14.958629f),
+ CVector(927.17352f, -520.97736f, 14.972308f),
+ CVector(929.29749f, -552.08643f, 14.978855f),
+ CVector(950.69525f, -574.47778f, 14.972788f),
+ CVector(974.02826f, -593.56024f, 14.966445f),
+ CVector(989.04779f, -620.12854f, 14.951016f),
+ CVector(1014.1639f, -637.3905f, 14.966736f),
+ CVector(1017.5961f, -667.3736f, 14.956415f),
+ CVector(1041.9735f, -685.94391f, 15.003841f),
+ CVector(1043.3064f, -716.11298f, 14.974236f),
+ CVector(1043.5337f, -746.63855f, 14.96919f),
+ CVector(1044.142f, -776.93823f, 14.965424f),
+ CVector(1044.2657f, -807.29395f, 14.97171f),
+ CVector(1017.0797f, -820.1076f, 14.975431f),
+ CVector(986.23865f, -820.37103f, 14.972883f),
+ CVector(956.10065f, -820.23291f, 14.981133f),
+ CVector(925.86914f, -820.19049f, 14.976553f),
+ CVector(897.69702f, -831.08734f, 14.962709f),
+ CVector(868.06586f, -835.99237f, 14.970685f),
+ CVector(836.93054f, -836.84387f, 14.965049f),
+ CVector(811.63586f, -853.7915f, 15.067576f),
+ CVector(811.46344f, -884.27368f, 12.247812f),
+ CVector(811.60651f, -914.70959f, 9.2393751f),
+ CVector(811.10425f, -945.16272f, 5.817255f),
+ CVector(816.54584f, -975.64587f, 4.998558f),
+ CVector(828.2951f, -1003.3685f, 5.0471172f),
+ CVector(852.28839f, -1021.5963f, 4.9371028f),
+ CVector(882.50067f, -1025.4459f, 5.14077f),
+ CVector(912.84821f, -1026.7874f, 8.3415451f),
+ CVector(943.68274f, -1026.6914f, 11.341879f),
+ CVector(974.4129f, -1027.3682f, 14.410345f),
+ CVector(1004.1079f, -1036.0778f, 14.92961f),
+ CVector(1030.1144f, -1051.1224f, 14.850387f),
+ CVector(1058.7585f, -1060.342f, 14.821624f),
+ CVector(1087.7797f, -1068.3263f, 14.800561f),
+ CVector(1099.8807f, -1095.656f, 11.877907f),
+ CVector(1130.0005f, -1101.994f, 11.853914f),
+ CVector(1160.3809f, -1101.6355f, 11.854824f),
+ CVector(1191.8524f, -1102.1577f, 11.853843f),
+ CVector(1223.3307f, -1102.7448f, 11.852233f),
+ CVector(1253.564f, -1098.1045f, 11.853944f),
+ CVector(1262.0203f, -1069.1785f, 14.8147f),
+ CVector(1290.9998f, -1059.1882f, 14.816016f),
+ CVector(1316.246f, -1041.0635f, 14.81109f),
+ CVector(1331.7539f, -1013.835f, 14.81207f),
+ CVector(1334.0579f, -983.55402f, 14.827253f),
+ CVector(1323.2429f, -954.23083f, 14.954678f),
+ CVector(1302.7495f, -932.21216f, 14.962917f),
+ CVector(1317.418f, -905.89325f, 14.967506f),
+ CVector(1337.9503f, -883.5025f, 14.969675f),
+ CVector(1352.6929f, -855.96954f, 14.967854f),
+ CVector(1357.2388f, -826.26971f, 14.97295f),
+ CVector(1384.8668f, -812.47693f, 12.907736f),
+ CVector(1410.8983f, -795.39056f, 12.052228f),
+ CVector(1433.901f, -775.55811f, 11.96265f),
+ CVector(1443.8615f, -746.92511f, 11.976114f),
+ CVector(1457.7015f, -720.00903f, 11.971177f),
+ CVector(1481.5685f, -701.30237f, 11.977908f),
+ CVector(1511.4004f, -696.83295f, 11.972709f),
+ CVector(1542.1796f, -695.61676f, 11.970441f),
+ CVector(1570.3301f, -684.6239f, 11.969202f),
+ CVector(0.0f, 0.0f, 0.0f),
+};
+
+void
+CPacManPickups::GeneratePMPickUpsForRace(int32 race)
+{
+ const CVector *pPos = nil;
+ int i = 0;
+
+ if (race == 0) pPos = aRacePoints1; // there's only one available
+ assert(pPos != nil);
+
+ while (!pPos->IsZero()) {
+ while (aPMPickUps[i].m_eType != PACMAN_NONE)
+ i++;
+
+ aPMPickUps[i].m_eType = PACMAN_RACE;
+ aPMPickUps[i].m_vecPosn = *(pPos++);
+ if (race == 0) {
+ CObject* obj = new CObject(MI_DONKEYMAG, true);
+ if (obj != nil) {
+ obj->ObjectCreatedBy = MISSION_OBJECT;
+
+ obj->GetPosition() = aPMPickUps[i].m_vecPosn;
+ obj->SetOrientation(0.0f, 0.0f, -HALFPI);
+ obj->GetMatrix().UpdateRW();
+ obj->UpdateRwFrame();
+
+ obj->bAffectedByGravity = false;
+ obj->bExplosionProof = true;
+ obj->bUsesCollision = false;
+ obj->bIsPickup = false;
+
+ CWorld::Add(obj);
+ }
+ aPMPickUps[i].m_pObject = obj;
+ } else
+ aPMPickUps[i].m_pObject = nil;
+ }
+ bPMActive = true;
+}
+
+void
+CPacManPickups::GenerateOnePMPickUp(CVector pos)
+{
+ bPMActive = true;
+ aPMPickUps[0].m_eType = PACMAN_RACE;
+ aPMPickUps[0].m_vecPosn = pos;
+}
+
+void
+CPacManPickups::Render()
+{
+ if (!bPMActive) return;
+
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[6]));
+
+ RwV3d pos;
+ float w, h;
+
+ for (int i = 0; i < NUMPACMANPICKUPS; i++) {
+ switch (aPMPickUps[i].m_eType)
+ {
+ case PACMAN_SCRAMBLE:
+ case PACMAN_RACE:
+ if (CSprite::CalcScreenCoors(aPMPickUps[i].m_vecPosn, &pos, &w, &h, true) && pos.z < 100.0f) {
+ if (aPMPickUps[i].m_pObject != nil) {
+ aPMPickUps[i].m_pObject->GetMatrix().SetRotateZOnly((CTimer::GetTimeInMilliseconds() % 1024) * TWOPI / 1024.0f);
+ aPMPickUps[i].m_pObject->GetMatrix().UpdateRW();
+ aPMPickUps[i].m_pObject->UpdateRwFrame();
+ }
+ float fsin = Sin((CTimer::GetTimeInMilliseconds() % 1024) * 6.28f / 1024.0f); // yes, it is 6.28f when it was TWOPI just now...
+ CSprite::RenderOneXLUSprite(pos.x, pos.y, pos.z, 0.8f * w * fsin, 0.8f * h, 100, 50, 5, 255, 1.0f / pos.z, 255);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE);
+}
+
+void
+CPacManPickups::ClearPMPickUps()
+{
+ bPMActive = false;
+
+ for (int i = 0; i < NUMPACMANPICKUPS; i++) {
+ if (aPMPickUps[i].m_pObject != nil) {
+ CWorld::Remove(aPMPickUps[i].m_pObject);
+ delete aPMPickUps[i].m_pObject;
+ aPMPickUps[i].m_pObject = nil;
+ }
+ aPMPickUps[i].m_eType = PACMAN_NONE;
+ }
+}
+
+void
+CPacManPickups::StartPacManRace(int32 race)
+{
+ GeneratePMPickUpsForRace(race);
+ PillsEatenInRace = 0;
+}
+
+void
+CPacManPickups::StartPacManRecord()
+{
+ CollectGameState = 20;
+ LastPickUpCoors = FindPlayerCoors();
+}
+
+uint32
+CPacManPickups::QueryPowerPillsEatenInRace()
+{
+ return PillsEatenInRace;
+}
+
+void
+CPacManPickups::ResetPowerPillsEatenInRace()
+{
+ PillsEatenInRace = 0;
+}
+
+void
+CPacManPickups::CleanUpPacManStuff()
+{
+ ClearPMPickUps();
+}
+
+void
+CPacManPickups::StartPacManScramble(CVector pos, float scrambleMult, int16 count)
+{
+ GeneratePMPickUps(pos, scrambleMult, count, PACMAN_SCRAMBLE);
+}
+
+uint32
+CPacManPickups::QueryPowerPillsCarriedByPlayer()
+{
+ if (FindPlayerVehicle())
+ return FindPlayerVehicle()->m_nPacManPickupsCarried;
+ return 0;
+}
+
+void
+CPacManPickups::ResetPowerPillsCarriedByPlayer()
+{
+ if (FindPlayerVehicle() != nil) {
+ FindPlayerVehicle()->m_nPacManPickupsCarried = 0;
+ FindPlayerVehicle()->m_fMass /= FindPlayerVehicle()->m_fForceMultiplier;
+ FindPlayerVehicle()->m_fTurnMass /= FindPlayerVehicle()->m_fForceMultiplier;
+ FindPlayerVehicle()->m_fForceMultiplier = 1.0f;
+ }
+}
+
STARTPATCHES
InjectHook(0x430220, CPickups::Init, PATCH_JUMP);
InjectHook(0x4303D0, CPickups::Update, PATCH_JUMP);
@@ -1046,4 +1432,21 @@ STARTPATCHES
InjectHook(0x433E40, CPickups::Save, PATCH_JUMP);
InjectHook(0x433BA0, &CPickup::GiveUsAPickUpObject, PATCH_JUMP);
InjectHook(0x430860, &CPickup::Update, PATCH_JUMP);
+ InjectHook(0x4331B0, &CPacManPickup::Update, PATCH_JUMP);
+ InjectHook(0x432760, CPacManPickups::Init, PATCH_JUMP);
+ InjectHook(0x432800, CPacManPickups::Update, PATCH_JUMP);
+ InjectHook(0x432AE0, CPacManPickups::GeneratePMPickUps, PATCH_JUMP);
+ InjectHook(0x432D50, CPacManPickups::GeneratePMPickUpsForRace, PATCH_JUMP);
+ InjectHook(0x432F20, CPacManPickups::GenerateOnePMPickUp, PATCH_JUMP);
+ InjectHook(0x432F60, CPacManPickups::Render, PATCH_JUMP);
+ InjectHook(0x433150, CPacManPickups::ClearPMPickUps, PATCH_JUMP);
+ InjectHook(0x433340, CPacManPickups::StartPacManRace, PATCH_JUMP);
+ InjectHook(0x433360, CPacManPickups::StartPacManRecord, PATCH_JUMP);
+ InjectHook(0x4333A0, CPacManPickups::QueryPowerPillsEatenInRace, PATCH_JUMP);
+ InjectHook(0x4333B0, CPacManPickups::ResetPowerPillsEatenInRace, PATCH_JUMP);
+ InjectHook(0x4333C0, CPacManPickups::CleanUpPacManStuff, PATCH_JUMP);
+ InjectHook(0x4333D0, CPacManPickups::StartPacManScramble, PATCH_JUMP);
+ InjectHook(0x4333F0, CPacManPickups::QueryPowerPillsCarriedByPlayer, PATCH_JUMP);
+ InjectHook(0x433410, CPacManPickups::ResetPowerPillsCarriedByPlayer, PATCH_JUMP);
+
ENDPATCHES
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index 3e075b24..b5b4f396 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -102,8 +102,31 @@ extern uint16 AmmoForWeapon[20];
extern uint16 AmmoForWeapon_OnStreet[20];
extern uint16 CostOfWeapon[20];
+enum ePacmanPickupType
+{
+ PACMAN_NONE,
+ PACMAN_SCRAMBLE,
+ PACMAN_RACE,
+};
+
+class CPacManPickup
+{
+public:
+ CVector m_vecPosn;
+ CObject *m_pObject;
+ uint8 m_eType;
+
+ void Update();
+};
+
class CPacManPickups
{
+ friend CPacManPickup;
+
+ static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
+ static CVector LastPickUpCoors;
+ static int PillsEatenInRace;
+ static bool bPMActive;
public:
static void Init(void);
static void Update(void);
@@ -111,11 +134,11 @@ public:
static void GeneratePMPickUpsForRace(int32);
static void GenerateOnePMPickUp(CVector);
static void Render(void);
- static void DoCleanUpPacManStuff(void);
static void StartPacManRace(int32);
static void StartPacManRecord(void);
static uint32 QueryPowerPillsEatenInRace(void);
static void ResetPowerPillsEatenInRace(void);
+ static void ClearPMPickUps(void);
static void CleanUpPacManStuff(void);
static void StartPacManScramble(CVector, float, int16);
static uint32 QueryPowerPillsCarriedByPlayer(void);
diff --git a/src/control/Record.cpp b/src/control/Record.cpp
index 7c330311..ca4128e3 100644
--- a/src/control/Record.cpp
+++ b/src/control/Record.cpp
@@ -2,18 +2,522 @@
#include "patcher.h"
#include "Record.h"
+#include "FileMgr.h"
+#include "Pad.h"
+#include "Pools.h"
+#include "Streaming.h"
+#include "Timer.h"
+#include "VehicleModelInfo.h"
+#include "World.h"
+
uint16 &CRecordDataForGame::RecordingState = *(uint16*)0x95CC24;
+uint8*& CRecordDataForGame::pDataBuffer = *(uint8**)0x8F1B70;
+uint8*& CRecordDataForGame::pDataBufferPointer = *(uint8**)0x8F1AB0;
+int& CRecordDataForGame::FId = *(int*)0x885BA4;
+tGameBuffer& CRecordDataForGame::pDataBufferForFrame = *(tGameBuffer*)0x72CED0;
+
+#define MEMORY_FOR_GAME_RECORD (150000)
+
+void CRecordDataForGame::Init(void)
+{
+ RecordingState = STATE_NONE;
+ delete[] pDataBuffer;
+ pDataBufferPointer = nil;
+ pDataBuffer = nil;
+#ifndef GTA_PS2 // this stuff is not present on PS2
+ FId = CFileMgr::OpenFile("playback.dat", "r");
+ if (FId <= 0) {
+ if ((FId = CFileMgr::OpenFile("record.dat", "r")) <= 0)
+ RecordingState = STATE_NONE;
+ else {
+ CFileMgr::CloseFile(FId);
+ FId = CFileMgr::OpenFileForWriting("record.dat");
+ RecordingState = STATE_RECORD;
+ }
+ }
+ else {
+ RecordingState = STATE_PLAYBACK;
+ }
+ if (RecordingState == STATE_PLAYBACK) {
+ pDataBufferPointer = new uint8[MEMORY_FOR_GAME_RECORD];
+ pDataBuffer = pDataBufferPointer;
+ pDataBuffer[CFileMgr::Read(FId, (char*)pDataBufferPointer, MEMORY_FOR_GAME_RECORD) + 8] = (uint8)-1;
+ CFileMgr::CloseFile(FId);
+ }
+#else
+ RecordingState = STATE_NONE; // second time to make sure
+#endif
+}
+
+void CRecordDataForGame::SaveOrRetrieveDataForThisFrame(void)
+{
+ switch (RecordingState) {
+ case STATE_RECORD:
+ {
+ pDataBufferForFrame.m_fTimeStep = CTimer::GetTimeStep();
+ pDataBufferForFrame.m_nTimeInMilliseconds = CTimer::GetTimeInMilliseconds();
+ pDataBufferForFrame.m_nSizeOfPads[0] = 0;
+ pDataBufferForFrame.m_nSizeOfPads[1] = 0;
+ pDataBufferForFrame.m_nChecksum = CalcGameChecksum();
+ uint8* pController1 = PackCurrentPadValues(pDataBufferForFrame.m_ControllerBuffer, &CPad::GetPad(0)->OldState, &CPad::GetPad(0)->NewState);
+ pDataBufferForFrame.m_nSizeOfPads[0] = (pController1 - pDataBufferForFrame.m_ControllerBuffer) / 2;
+ uint8* pController2 = PackCurrentPadValues(pController1, &CPad::GetPad(1)->OldState, &CPad::GetPad(1)->NewState);
+ pDataBufferForFrame.m_nSizeOfPads[1] = (pController2 - pController1) / 2;
+ uint8* pEndPtr = pController2;
+ if ((pDataBufferForFrame.m_nSizeOfPads[0] + pDataBufferForFrame.m_nSizeOfPads[1]) & 1)
+ pEndPtr += 2;
+ CFileMgr::Write(FId, (char*)&pDataBufferForFrame, pEndPtr - (uint8*)&pDataBufferForFrame);
+ break;
+ }
+ case STATE_PLAYBACK:
+ if (pDataBufferPointer[8] == (uint8)-1)
+ CPad::GetPad(0)->NewState.Clear();
+ else {
+ tGameBuffer* pData = (tGameBuffer*)pDataBufferPointer;
+ CTimer::SetTimeInMilliseconds(pData->m_nTimeInMilliseconds);
+ CTimer::SetTimeStep(pData->m_fTimeStep);
+ uint8 size1 = pData->m_nSizeOfPads[0];
+ uint8 size2 = pData->m_nSizeOfPads[1];
+ pDataBufferPointer = (uint8*)&pData->m_ControllerBuffer;
+ pDataBufferPointer = UnPackCurrentPadValues(pDataBufferPointer, size1, &CPad::GetPad(0)->NewState);
+ pDataBufferPointer = UnPackCurrentPadValues(pDataBufferPointer, size2, &CPad::GetPad(1)->NewState);
+ if ((size1 + size2) & 1)
+ pDataBufferPointer += 2;
+ if (pData->m_nChecksum != CalcGameChecksum())
+ printf("Playback out of sync\n");
+ }
+ }
+}
+
+#define PROCESS_BUTTON_STATE_STORE(buf, os, ns, field, id) \
+ do { \
+ if (os->field != ns->field){ \
+ *buf++ = id; \
+ *buf++ = ns->field; \
+ } \
+ } while (0);
+
+uint8* CRecordDataForGame::PackCurrentPadValues(uint8* buf, CControllerState* os, CControllerState* ns)
+{
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftStickX, 0);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftStickY, 1);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightStickX, 2);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightStickY, 3);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShoulder1, 4);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShoulder2, 5);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShoulder1, 6);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShoulder2, 7);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadUp, 8);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadDown, 9);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadLeft, 10);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadRight, 11);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Start, 12);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Select, 13);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Square, 14);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Triangle, 15);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Cross, 16);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, Circle, 17);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShock, 18);
+ PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShock, 19);
+ return buf;
+}
+#undef PROCESS_BUTTON_STATE_STORE
+
+#define PROCESS_BUTTON_STATE_RESTORE(buf, state, field, id) case id: state->field = *buf++; break;
+
+uint8* CRecordDataForGame::UnPackCurrentPadValues(uint8* buf, uint8 total, CControllerState* state)
+{
+ for (uint8 i = 0; i < total; i++) {
+ switch (*buf++) {
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftStickX, 0);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftStickY, 1);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightStickX, 2);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightStickY, 3);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShoulder1, 4);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShoulder2, 5);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShoulder1, 6);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShoulder2, 7);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadUp, 8);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadDown, 9);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadLeft, 10);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadRight, 11);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Start, 12);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Select, 13);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Square, 14);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Triangle, 15);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Cross, 16);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, Circle, 17);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShock, 18);
+ PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShock, 19);
+ }
+ }
+ return buf;
+}
+
+#undef PROCESS_BUTTON_STATE_RESTORE
+
+uint16 CRecordDataForGame::CalcGameChecksum(void)
+{
+ uint32 checksum = 0;
+ int i = CPools::GetPedPool()->GetSize();
+ while (i--) {
+ CPed* pPed = CPools::GetPedPool()->GetSlot(i);
+ if (!pPed)
+ continue;
+ checksum ^= pPed->GetModelIndex() ^ *(uint32*)&pPed->GetPosition().z ^ *(uint32*)&pPed->GetPosition().y ^ *(uint32*)&pPed->GetPosition().x;
+ }
+ i = CPools::GetVehiclePool()->GetSize();
+ while (i--) {
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
+ if (!pVehicle)
+ continue;
+ checksum ^= pVehicle->GetModelIndex() ^ *(uint32*)&pVehicle->GetPosition().z ^ *(uint32*)&pVehicle->GetPosition().y ^ *(uint32*)&pVehicle->GetPosition().x;
+ }
+ return checksum ^ checksum >> 16;
+}
+
+uint8& CRecordDataForChase::Status = *(uint8*)0x95CDCE;
+int& CRecordDataForChase::PositionChanges = *(int*)0x8F59C8;
+uint8& CRecordDataForChase::CurrentCar = *(uint8*)0x95CDC9;
+CAutomobile* (&CRecordDataForChase::pChaseCars)[NUM_CHASE_CARS] = *(CAutomobile * (*)[NUM_CHASE_CARS])*(uintptr*)0x6F46A8;
+uint32& CRecordDataForChase::AnimStartTime = *(uint32*)0x8F1AEC;
+float& CRecordDataForChase::AnimTime = *(float*)0x880F88;
+CCarStateEachFrame* (&CRecordDataForChase::pBaseMemForCar)[NUM_CHASE_CARS] = *(CCarStateEachFrame * (*)[NUM_CHASE_CARS])*(uintptr*)0x70EA18;
+float& CRecordDataForChase::TimeMultiplier = *(float*)0x8E2A94;
+int& CRecordDataForChase::FId2 = *(int*)0x8E2C18;
+
+#define CHASE_SCENE_LENGTH_IN_SECONDS (80)
+#define CHASE_SCENE_FRAMES_PER_SECOND (15) // skipping every second frame
+#define CHASE_SCENE_FRAMES_IN_RECORDING (CHASE_SCENE_LENGTH_IN_SECONDS * CHASE_SCENE_FRAMES_PER_SECOND)
+#define CHASE_SCENE_LENGTH_IN_FRAMES (CHASE_SCENE_FRAMES_IN_RECORDING * 2)
+
+void CRecordDataForChase::Init(void)
+{
+ Status = STATE_NONE;
+ PositionChanges = 0;
+ CurrentCar = 0;
+ for (int i = 0; i < NUM_CHASE_CARS; i++)
+ pChaseCars[i] = nil;
+ AnimStartTime = 0;
+}
+
+void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void)
+{
+ switch (Status) {
+ case STATE_NONE:
+ return;
+ case STATE_RECORD:
+ {
+ if ((CTimer::GetFrameCounter() & 1) == 0)
+ StoreInfoForCar(pChaseCars[CurrentCar], &pBaseMemForCar[CurrentCar][CTimer::GetFrameCounter() / 2]);
+ if (CTimer::GetFrameCounter() < CHASE_SCENE_LENGTH_IN_FRAMES * 2)
+ return;
+ CFileMgr::SetDir("data\\paths");
+ sprintf(gString, "chase%d.dat", CurrentCar);
+ int fid = CFileMgr::OpenFileForWriting(gString);
+ uint32 fs = CHASE_SCENE_LENGTH_IN_FRAMES * sizeof(CCarStateEachFrame);
+ printf("FileSize:%d\n", fs);
+ CFileMgr::Write(fid, (char*)pBaseMemForCar[CurrentCar], fs);
+ CFileMgr::CloseFile(fid);
+ CFileMgr::SetDir("");
+ sprintf(gString, "car%d.max", CurrentCar);
+ int fid2 = CFileMgr::OpenFileForWriting(gString);
+ for (int i = 0; i < CHASE_SCENE_FRAMES_IN_RECORDING; i++) {
+ // WTF? Was it ever used?
+#ifdef FIX_BUGS
+ CCarStateEachFrame* pState = pBaseMemForCar[CurrentCar];
+#else
+ CCarStateEachFrame* pState = (CCarStateEachFrame*)pChaseCars[CurrentCar];
+#endif
+ CVector right = CVector(pState->rightX, pState->rightY, pState->rightZ) / INT8_MAX;
+ CVector forward = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / INT8_MAX;
+ CVector up = CrossProduct(right, forward);
+ sprintf(gString, "%f %f %f\n", pState->pos.x, pState->pos.y, pState->pos.z);
+ CFileMgr::Write(fid2, gString, strlen(gString) - 1);
+ sprintf(gString, "%f %f %f\n", right.x, right.y, right.z);
+ CFileMgr::Write(fid2, gString, strlen(gString) - 1);
+ sprintf(gString, "%f %f %f\n", forward.x, forward.y, forward.z);
+ CFileMgr::Write(fid2, gString, strlen(gString) - 1);
+ sprintf(gString, "%f %f %f\n", up.x, up.y, up.z);
+ CFileMgr::Write(fid2, gString, strlen(gString) - 1);
+ }
+ CFileMgr::CloseFile(fid2);
+ }
+ case STATE_PLAYBACK:
+ case STATE_PLAYBACK_BEFORE_RECORDING:
+ case STATE_PLAYBACK_INIT:
+ break;
+ }
+}
+
+struct tCoors {
+ CVector pos;
+ float angle;
+};
+
+// I guess developer was filling this with actual data before running the game
+tCoors NewCoorsForRecordedCars[7];
+
+void CRecordDataForChase::SaveOrRetrieveCarPositions(void)
+{
+ switch (Status) {
+ case STATE_NONE:
+ return;
+ case STATE_RECORD:
+ case STATE_PLAYBACK_BEFORE_RECORDING:
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (i != CurrentCar && CTimer::GetFrameCounter()) {
+ RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][CTimer::GetFrameCounter() / 2], false);
+ pChaseCars[i]->GetMatrix().UpdateRW();
+ pChaseCars[i]->UpdateRwFrame();
+ }
+ }
+ if (Status == STATE_PLAYBACK_BEFORE_RECORDING && CTimer::GetFrameCounter()) {
+ RestoreInfoForCar(pChaseCars[CurrentCar], &pBaseMemForCar[CurrentCar][CTimer::GetFrameCounter() / 2], false);
+ pChaseCars[CurrentCar]->GetMatrix().UpdateRW();
+ pChaseCars[CurrentCar]->UpdateRwFrame();
+ }
+ if (CPad::GetPad(0)->GetLeftShockJustDown() && CPad::GetPad(0)->GetRightShockJustDown()) {
+ if (!CPad::GetPad(0)->GetRightShockJustDown()) {
+ pChaseCars[CurrentCar]->GetPosition() = NewCoorsForRecordedCars[PositionChanges].pos;
+ pChaseCars[CurrentCar]->SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ pChaseCars[CurrentCar]->GetMatrix().SetRotateZOnly(DEGTORAD(NewCoorsForRecordedCars[PositionChanges].angle));
+ ++PositionChanges;
+ }
+ if (Status == STATE_PLAYBACK_BEFORE_RECORDING) {
+ Status = STATE_RECORD;
+ pChaseCars[CurrentCar]->m_status = STATUS_PLAYER;
+ }
+ }
+ break;
+ case STATE_PLAYBACK_INIT:
+ Status = STATE_PLAYBACK;
+ break;
+ case STATE_PLAYBACK:
+ {
+ TimeMultiplier += CTimer::GetTimeStepNonClippedInSeconds();
+ float EndOfFrameTime = CHASE_SCENE_FRAMES_PER_SECOND * min(CHASE_SCENE_LENGTH_IN_SECONDS, TimeMultiplier);
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (!pBaseMemForCar[i])
+ continue;
+ if (!pChaseCars[i])
+ continue;
+ if (EndOfFrameTime < CHASE_SCENE_FRAMES_IN_RECORDING - 1) {
+ int FlooredEOFTime = EndOfFrameTime;
+ RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][FlooredEOFTime], false);
+ CMatrix tmp;
+ float dp = EndOfFrameTime - FlooredEOFTime;
+ RestoreInfoForMatrix(tmp, &pBaseMemForCar[i][FlooredEOFTime + 1]);
+ pChaseCars[i]->GetRight() += (tmp.GetRight() - pChaseCars[i]->GetRight()) * dp;
+ pChaseCars[i]->GetForward() += (tmp.GetForward() - pChaseCars[i]->GetForward()) * dp;
+ pChaseCars[i]->GetUp() += (tmp.GetUp() - pChaseCars[i]->GetUp()) * dp;
+ pChaseCars[i]->GetPosition() += (tmp.GetPosition() - pChaseCars[i]->GetPosition()) * dp;
+ }
+ else{
+ RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][CHASE_SCENE_FRAMES_IN_RECORDING - 1], true);
+ if (i == 0)
+ pChaseCars[i]->GetPosition().z += 0.2f;
+ }
+ pChaseCars[i]->GetMatrix().UpdateRW();
+ pChaseCars[i]->UpdateRwFrame();
+ pChaseCars[i]->RemoveAndAdd();
+ }
+ break;
+ }
+ }
+}
+
+void CRecordDataForChase::StoreInfoForCar(CAutomobile* pCar, CCarStateEachFrame* pState)
+{
+ pState->rightX = INT8_MAX * pCar->GetRight().x;
+ pState->rightY = INT8_MAX * pCar->GetRight().y;
+ pState->rightZ = INT8_MAX * pCar->GetRight().z;
+ pState->forwardX = INT8_MAX * pCar->GetForward().x;
+ pState->forwardY = INT8_MAX * pCar->GetForward().y;
+ pState->forwardZ = INT8_MAX * pCar->GetForward().z;
+ pState->pos = pCar->GetPosition();
+ pState->velX = 0.5f * INT16_MAX * pCar->GetMoveSpeed().x;
+ pState->velY = 0.5f * INT16_MAX * pCar->GetMoveSpeed().y;
+ pState->velZ = 0.5f * INT16_MAX * pCar->GetMoveSpeed().z;
+ pState->wheel = 20 * pCar->m_fSteerAngle;
+ pState->gas = 100 * pCar->m_fGasPedal;
+ pState->brake = 100 * pCar->m_fBrakePedal;
+ pState->handbrake = pCar->bIsHandbrakeOn;
+}
+
+void CRecordDataForChase::RestoreInfoForMatrix(CMatrix& matrix, CCarStateEachFrame* pState)
+{
+ matrix.GetRight() = CVector(pState->rightX, pState->rightY, pState->rightZ) / INT8_MAX;
+ matrix.GetForward() = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / INT8_MAX;
+ matrix.GetUp() = CrossProduct(matrix.GetRight(), matrix.GetForward());
+ matrix.GetPosition() = pState->pos;
+}
+
+void CRecordDataForChase::RestoreInfoForCar(CAutomobile* pCar, CCarStateEachFrame* pState, bool stop)
+{
+ CVector oldPos = pCar->GetPosition();
+ RestoreInfoForMatrix(pCar->GetMatrix(), pState);
+ pCar->SetMoveSpeed(CVector(pState->velX, pState->velY, pState->velZ) / INT16_MAX / 0.5f);
+ pCar->SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ pCar->m_fSteerAngle = pState->wheel / 20.0f;
+ pCar->m_fGasPedal = pState->gas / 100.0f;
+ pCar->m_fBrakePedal = pState->brake / 100.0f;
+ pCar->bIsHandbrakeOn = pState->handbrake;
+ if ((oldPos - pCar->GetPosition()).Magnitude() > 15.0f) {
+ if (pCar == pChaseCars[14]) {
+ pCar->m_currentColour1 = 58;
+ pCar->m_currentColour2 = 1;
+ }
+ else
+ pCar->GetModelInfo()->ChooseVehicleColour(pCar->m_currentColour1, pCar->m_currentColour2);
+ }
+ pCar->m_fHealth = min(pCar->m_fHealth, 500.0f);
+ if (stop) {
+ pCar->m_fGasPedal = 0.0f;
+ pCar->m_fBrakePedal = 0.0f;
+ pCar->SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ pCar->bIsHandbrakeOn = false;
+ }
+}
+
+void CRecordDataForChase::ProcessControlCars(void)
+{
+ if (Status != STATE_PLAYBACK)
+ return;
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (pChaseCars[i])
+ pChaseCars[i]->ProcessControl();
+ }
+}
+
+#if (defined(GTA_PS2) || defined(FIX_BUGS))
+bool CRecordDataForChase::ShouldThisPadBeLeftAlone(uint8 pad)
+{
+ // may be wrong
+ if (Status == STATE_NONE || Status == STATE_PLAYBACK)
+ return false;
+ return pad != 0;
+}
+#endif
+
+void CRecordDataForChase::GiveUsACar(int32 mi, CVector pos, float angle, CAutomobile** ppCar, uint8 colour1, uint8 colour2)
+{
+ CStreaming::RequestModel(mi, STREAMFLAGS_DEPENDENCY);
+ CStreaming::LoadAllRequestedModels(false);
+ if (!CStreaming::HasModelLoaded(mi))
+ return;
+ CAutomobile* pCar = new CAutomobile(mi, MISSION_VEHICLE);
+ pCar->GetPosition() = pos;
+ pCar->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER;
+ pCar->GetMatrix().SetRotateZOnly(DEGTORAD(angle));
+ pCar->pDriver = nil;
+ pCar->m_currentColour1 = colour1;
+ pCar->m_currentColour2 = colour2;
+ CWorld::Add(pCar);
+ *ppCar = pCar;
+}
+
+void RemoveUnusedCollision(void)
+{
+ static const char* dontDeleteArray[] = {
+ "rd_SrRoad2A50", "rd_SrRoad2A20", "rd_CrossRda1w22", "rd_CrossRda1rw22",
+ "road_broadway02", "road_broadway01", "com_21way5", "com_21way50",
+ "cm1waycrosscom", "com_21way20", "com_21way10", "road_broadway04",
+ "com_rvroads52", "com_roadsrv", "com_roadkb23", "com_roadkb22"
+ };
+ for (int i = 0; i < ARRAY_SIZE(dontDeleteArray); i++)
+ CModelInfo::GetModelInfo(dontDeleteArray[i], nil)->GetColModel()->level = LEVEL_NONE;
+ CModelInfo::RemoveColModelsFromOtherLevels(LEVEL_NONE);
+ for (int i = 0; i < ARRAY_SIZE(dontDeleteArray); i++)
+ CModelInfo::GetModelInfo(dontDeleteArray[i], nil)->GetColModel()->level = LEVEL_COMMERCIAL;
+}
+
+void CRecordDataForChase::StartChaseScene(float startTime)
+{
+ char filename[28];
+ SetUpCarsForChaseScene();
+ Status = STATE_PLAYBACK;
+ AnimTime = startTime;
+ AnimStartTime = CTimer::GetTimeInMilliseconds();
+ RemoveUnusedCollision();
+ CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN);
+ CGame::TidyUpMemory(true, true);
+ CStreaming::ImGonnaUseStreamingMemory();
+ CFileMgr::SetDir("data\\paths");
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (!pChaseCars[i]) {
+ pBaseMemForCar[i] = nil;
+ continue;
+ }
+ sprintf(filename, "chase%d.dat", i);
+ FId2 = CFileMgr::OpenFile(filename, "rb");
+ if (FId2 <= 0) {
+ pBaseMemForCar[i] = nil;
+ continue;
+ }
+ pBaseMemForCar[i] = new CCarStateEachFrame[CHASE_SCENE_FRAMES_IN_RECORDING];
+ for (int j = 0; j < CHASE_SCENE_FRAMES_IN_RECORDING; j++) {
+ CFileMgr::Read(FId2, (char*)&pBaseMemForCar[i][j], sizeof(CCarStateEachFrame));
+ CFileMgr::Seek(FId2, sizeof(CCarStateEachFrame), 1);
+ }
+ CFileMgr::CloseFile(FId2);
+ }
+ CFileMgr::SetDir("");
+ CStreaming::IHaveUsedStreamingMemory();
+ TimeMultiplier = 0.0f;
+}
+
+void CRecordDataForChase::CleanUpChaseScene(void)
+{
+ if (Status != STATE_PLAYBACK_INIT && Status != STATE_PLAYBACK)
+ return;
+ Status = STATE_NONE;
+ CleanUpCarsForChaseScene();
+ for (int i = 0; i < NUM_CHASE_CARS; i++) {
+ if (pBaseMemForCar[i]) {
+ delete[] pBaseMemForCar[i];
+ pBaseMemForCar[i] = nil;
+ }
+ }
+}
+
+void CRecordDataForChase::SetUpCarsForChaseScene(void)
+{
+ GiveUsACar(MI_POLICE, CVector(273.54221f, -1167.1907f, 24.880601f), 63.0f, &pChaseCars[0], 2, 1);
+ GiveUsACar(MI_ENFORCER, CVector(231.1783f, -1388.8322f, 25.978201f), 90.0f, &pChaseCars[1], 2, 1);
+ GiveUsACar(MI_TAXI, CVector(184.3156f, -1473.251f, 25.978201f), 0.0f, &pChaseCars[4], 6, 6);
+ GiveUsACar(MI_CHEETAH, CVector(173.8868f, -1377.6514f, 25.978201f), 0.0f, &pChaseCars[6], 4, 5);
+ GiveUsACar(MI_STINGER, CVector(102.5946f, -943.93628f, 25.9781f), 270.0f, &pChaseCars[7], 53, 53);
+ GiveUsACar(MI_CHEETAH, CVector(-177.7157f, -862.18652f, 25.978201f), 155.0f, &pChaseCars[10], 41, 1);
+ GiveUsACar(MI_STINGER, CVector(-170.56979f, -889.02362f, 25.978201f), 154.0f, &pChaseCars[11], 10, 10);
+ GiveUsACar(MI_KURUMA, CVector(402.60809f, -917.49628f, 37.381001f), 90.0f, &pChaseCars[14], 34, 1);
+ GiveUsACar(MI_TAXI, CVector(-33.496201f, -938.4563f, 25.9781f), 266.0f, &pChaseCars[16], 6, 6);
+ GiveUsACar(MI_KURUMA, CVector(49.363098f, -987.60498f, 25.9781f), 0.0f, &pChaseCars[18], 51, 1);
+ GiveUsACar(MI_TAXI, CVector(179.0049f, -1154.6686f, 25.9781f), 0.0f, &pChaseCars[19], 6, 76);
+ GiveUsACar(MI_RUMPO, CVector(-28.9762f, -1031.3367f, 25.990601f), 242.0f, &pChaseCars[2], 1, 75);
+ GiveUsACar(MI_PATRIOT, CVector(114.1564f, -796.69379f, 24.978201f), 180.0f, &pChaseCars[3], 0, 0);
+}
+
+void CRecordDataForChase::CleanUpCarsForChaseScene(void)
+{
+ for (int i = 0; i < NUM_CHASE_CARS; i++)
+ RemoveCarFromChase(i);
+}
-uint8 &CRecordDataForChase::Status = *(uint8*)0x95CDCE;
+void CRecordDataForChase::RemoveCarFromChase(int32 i)
+{
+ if (!pChaseCars[i])
+ return;
+ CWorld::Remove(pChaseCars[i]);
+ delete pChaseCars[i];
+ pChaseCars[i] = nil;
+}
-WRAPPER void CRecordDataForGame::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4341F0); }
-WRAPPER void CRecordDataForGame::Init(void) { EAXJMP(0x4340F0); }
+CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32 i)
+{
+ CVehicle* pVehicle = pChaseCars[i];
+ pChaseCars[i] = nil;
+ pVehicle->m_status = STATUS_PHYSICS;
+ return pVehicle;
+}
-WRAPPER void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4347F0); }
-WRAPPER void CRecordDataForChase::ProcessControlCars(void) { EAXJMP(0x435540); }
-WRAPPER void CRecordDataForChase::SaveOrRetrieveCarPositions(void) { EAXJMP(0x434B20); }
-WRAPPER void CRecordDataForChase::StartChaseScene(float) { EAXJMP(0x435690); }
-WRAPPER void CRecordDataForChase::CleanUpChaseScene() { EAXJMP(0x4357C0); }
-WRAPPER void CRecordDataForChase::RemoveCarFromChase(int32) { EAXJMP(0x435BC0); }
-WRAPPER CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32) { EAXJMP(0x435C00); }
-WRAPPER void CRecordDataForChase::Init(void) { EAXJMP(0x434780); }
diff --git a/src/control/Record.h b/src/control/Record.h
index e52a623e..4abeb68a 100644
--- a/src/control/Record.h
+++ b/src/control/Record.h
@@ -1,34 +1,106 @@
#pragma once
+class CAutomobile;
class CVehicle;
+class CControllerState;
-enum {
- RECORDSTATE_0,
- RECORDSTATE_1,
- RECORDSTATE_2,
+class CCarStateEachFrame
+{
+public:
+ int16 velX;
+ int16 velY;
+ int16 velZ;
+ int8 rightX;
+ int8 rightY;
+ int8 rightZ;
+ int8 forwardX;
+ int8 forwardY;
+ int8 forwardZ;
+ int8 wheel;
+ uint8 gas;
+ uint8 brake;
+ bool handbrake;
+ CVector pos;
};
+extern char* gString;
+
class CRecordDataForChase
{
-public:
+ enum {
+ NUM_CHASE_CARS = 20
+ };
+ enum {
+ STATE_NONE = 0,
+ STATE_RECORD = 1,
+ STATE_PLAYBACK_INIT = 2,
+ STATE_PLAYBACK = 3,
+ STATE_PLAYBACK_BEFORE_RECORDING = 4
+ };
static uint8 &Status;
+ static int &PositionChanges;
+ static uint8 &CurrentCar;
+ static CAutomobile*(&pChaseCars)[NUM_CHASE_CARS];
+ static float &AnimTime;
+ static uint32 &AnimStartTime;
+ static CCarStateEachFrame* (&pBaseMemForCar)[NUM_CHASE_CARS];
+ static float &TimeMultiplier;
+ static int &FId2;
+public:
+
+ static bool IsRecording(void) { return Status == STATE_RECORD; }
+ static void Init(void);
static void SaveOrRetrieveDataForThisFrame(void);
- static void ProcessControlCars(void);
static void SaveOrRetrieveCarPositions(void);
+ static void StoreInfoForCar(CAutomobile*, CCarStateEachFrame*);
+ static void RestoreInfoForMatrix(CMatrix&, CCarStateEachFrame*);
+ static void RestoreInfoForCar(CAutomobile*, CCarStateEachFrame*, bool);
+ static void ProcessControlCars(void);
+#if (defined(GTA_PS2) || defined(FIX_BUGS))
+ static bool ShouldThisPadBeLeftAlone(uint8 pad);
+#endif
+ static void GiveUsACar(int32, CVector, float, CAutomobile**, uint8, uint8);
static void StartChaseScene(float);
- static void CleanUpChaseScene();
+ static void CleanUpChaseScene(void);
+ static void SetUpCarsForChaseScene(void);
+ static void CleanUpCarsForChaseScene(void);
static void RemoveCarFromChase(int32);
static CVehicle* TurnChaseCarIntoScriptCar(int32);
- static void Init(void);
+
};
+struct tGameBuffer
+{
+ float m_fTimeStep;
+ uint32 m_nTimeInMilliseconds;
+ uint8 m_nSizeOfPads[2];
+ uint16 m_nChecksum;
+ uint8 m_ControllerBuffer[116];
+};
class CRecordDataForGame
{
+ enum {
+ STATE_NONE = 0,
+ STATE_RECORD = 1,
+ STATE_PLAYBACK = 2,
+ };
+ static uint16& RecordingState;
+ static uint8* &pDataBuffer;
+ static uint8* &pDataBufferPointer;
+ static int &FId;
+ static tGameBuffer &pDataBufferForFrame;
+
public:
- static uint16 &RecordingState;
+ static bool IsRecording() { return RecordingState == STATE_RECORD; }
+ static bool IsPlayingBack() { return RecordingState == STATE_PLAYBACK; }
static void SaveOrRetrieveDataForThisFrame(void);
static void Init(void);
+
+private:
+ static uint16 CalcGameChecksum(void);
+ static uint8* PackCurrentPadValues(uint8*, CControllerState*, CControllerState*);
+ static uint8* UnPackCurrentPadValues(uint8*, uint8, CControllerState*);
};
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index e39fe481..9548bc0a 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -2,36 +2,202 @@
#include "patcher.h"
#include "RoadBlocks.h"
#include "PathFind.h"
+#include "ModelIndices.h"
+#include "Streaming.h"
+#include "World.h"
+#include "PedPlacement.h"
+#include "Automobile.h"
+#include "CopPed.h"
+#include "VisibilityPlugins.h"
+#include "PlayerPed.h"
+#include "Wanted.h"
+#include "Camera.h"
+#include "CarCtrl.h"
+#include "General.h"
int16 &CRoadBlocks::NumRoadBlocks = *(int16*)0x95CC34;
int16 (&CRoadBlocks::RoadBlockObjects)[NUMROADBLOCKS] = *(int16(*)[NUMROADBLOCKS]) * (uintptr*)0x72B3A8;
bool (&CRoadBlocks::InOrOut)[NUMROADBLOCKS] = *(bool(*)[NUMROADBLOCKS]) * (uintptr*)0x733810;
-WRAPPER void CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle*, int32, int16) { EAXJMP(0x4376A0); }
-WRAPPER void CRoadBlocks::GenerateRoadBlocks(void) { EAXJMP(0x436FA0); }
-
void
CRoadBlocks::Init(void)
{
- NumRoadBlocks = 0;
- for (int objId = 0; objId < ThePaths.m_numMapObjects; objId++) {
- if (ThePaths.m_objectFlags[objId] & UseInRoadBlock) {
- if (NumRoadBlocks < 600) {
- InOrOut[NumRoadBlocks] = true;
- RoadBlockObjects[NumRoadBlocks] = objId;
- NumRoadBlocks++;
- } else {
+ NumRoadBlocks = 0;
+ for (int objId = 0; objId < ThePaths.m_numMapObjects; objId++) {
+ if (ThePaths.m_objectFlags[objId] & UseInRoadBlock) {
+ if (NumRoadBlocks < NUMROADBLOCKS) {
+ InOrOut[NumRoadBlocks] = true;
+ RoadBlockObjects[NumRoadBlocks] = objId;
+ NumRoadBlocks++;
+ } else {
#ifndef MASTER
- printf("Not enough room for the potential roadblocks\n");
+ printf("Not enough room for the potential roadblocks\n");
#endif
- // FIX: Don't iterate loop after NUMROADBLOCKS
- return;
- }
- }
- }
+ // FIX: Don't iterate loop after NUMROADBLOCKS
+ return;
+ }
+ }
+ }
+
+}
+
+void
+CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode)
+{
+ static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f},
+ {1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} };
+ CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
+ if (!pEntityToAttack)
+ pEntityToAttack = (CEntity*)FindPlayerPed();
+ CColModel* pPoliceColModel = CModelInfo::GetModelInfo(MI_POLICE)->GetColModel();
+ float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
+ for (int32 i = 0; i < 2; i++) {
+ const int32 roadBlockIndex = i + 2 * roadBlockType;
+ CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
+ int32 modelInfoId = MI_COP;
+ eCopType copType = COP_STREET;
+ switch (pVehicle->GetModelIndex())
+ {
+ case MI_FBICAR:
+ modelInfoId = MI_FBI;
+ copType = COP_FBI;
+ break;
+ case MI_ENFORCER:
+ modelInfoId = MI_SWAT;
+ copType = COP_SWAT;
+ break;
+ case MI_BARRACKS:
+ modelInfoId = MI_ARMY;
+ copType = COP_ARMY;
+ break;
+ }
+ if (!CStreaming::HasModelLoaded(modelInfoId))
+ copType = COP_STREET;
+ CCopPed* pCopPed = new CCopPed(copType);
+ if (copType == COP_STREET)
+ pCopPed->SetCurrentWeapon(WEAPONTYPE_COLT45);
+ CPedPlacement::FindZCoorForPed(&posForZ);
+ pCopPed->m_matrix.GetPosition() = posForZ;
+ CVector vecSavedPos = pCopPed->m_matrix.GetPosition();
+ pCopPed->m_matrix.SetRotate(0.0f, 0.0f, -HALFPI);
+ pCopPed->m_matrix.GetPosition() += vecSavedPos;
+ pCopPed->m_bIsDisabledCop = true;
+ pCopPed->SetIdle();
+ pCopPed->bKindaStayInSamePlace = true;
+ pCopPed->bNotAllowedToDuck = false;
+ pCopPed->m_wRoadblockNode = roadBlockNode;
+ pCopPed->bCrouchWhenShooting = roadBlockType != 2;
+ if (pEntityToAttack) {
+ pCopPed->m_pPointGunAt = pEntityToAttack;
+ pEntityToAttack->RegisterReference(&pCopPed->m_pPointGunAt);
+ pCopPed->SetAttack(pEntityToAttack);
+ }
+ pCopPed->m_pMyVehicle = pVehicle;
+ pVehicle->RegisterReference((CEntity**)&pCopPed->m_pMyVehicle);
+ pCopPed->bCullExtraFarAway = true;
+ CVisibilityPlugins::SetClumpAlpha(pCopPed->GetClump(), 0);
+ CWorld::Add(pCopPed);
+ }
+}
+void
+CRoadBlocks::GenerateRoadBlocks(void)
+{
+ CMatrix offsetMatrix;
+ uint32 frame = CTimer::GetFrameCounter() & 0xF;
+ int16 nRoadblockNode = (int16)(NUMROADBLOCKS * frame) / 16;
+ const int16 maxRoadBlocks = (int16)(NUMROADBLOCKS * (frame + 1)) / 16;
+ int16 numRoadBlocks = CRoadBlocks::NumRoadBlocks;
+ if (CRoadBlocks::NumRoadBlocks >= maxRoadBlocks)
+ numRoadBlocks = maxRoadBlocks;
+ for (; nRoadblockNode < numRoadBlocks; nRoadblockNode++) {
+ CTreadable *mapObject = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[nRoadblockNode]];
+ CVector2D vecDistance = FindPlayerCoors() - mapObject->GetPosition();
+ if (vecDistance.x > -80.0f && vecDistance.x < 80.0f &&
+ vecDistance.y > -80.0f && vecDistance.y < 80.0f &&
+ vecDistance.Magnitude() < 80.0f) {
+ if (!CRoadBlocks::InOrOut[nRoadblockNode]) {
+ CRoadBlocks::InOrOut[nRoadblockNode] = true;
+ if (FindPlayerVehicle() && (CGeneral::GetRandomNumber() & 0x7F) < FindPlayerPed()->m_pWanted->m_RoadblockDensity) {
+ CWanted *pPlayerWanted = FindPlayerPed()->m_pWanted;
+ float fMapObjectRadius = 2.0f * mapObject->GetColModel()->boundingBox.max.x;
+ int32 vehicleId = MI_POLICE;
+ if (pPlayerWanted->AreArmyRequired())
+ vehicleId = MI_BARRACKS;
+ else if (pPlayerWanted->AreFbiRequired())
+ vehicleId = MI_FBICAR;
+ else if (pPlayerWanted->AreSwatRequired())
+ vehicleId = MI_ENFORCER;
+ if (!CStreaming::HasModelLoaded(vehicleId))
+ vehicleId = MI_POLICE;
+ 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->m_matrix.GetPosition();
+ float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->m_matrix.GetUp());
+ 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[CRoadBlocks::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->m_status = 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->m_matrix.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;
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ CRoadBlocks::InOrOut[nRoadblockNode] = false;
+ }
+ }
}
STARTPATCHES
InjectHook(0x436F50, &CRoadBlocks::Init, PATCH_JUMP);
+ InjectHook(0x4376A0, &CRoadBlocks::GenerateRoadBlockCopsForCar, PATCH_JUMP);
+ InjectHook(0x436FA0, &CRoadBlocks::GenerateRoadBlocks, PATCH_JUMP);
ENDPATCHES \ No newline at end of file
diff --git a/src/control/RoadBlocks.h b/src/control/RoadBlocks.h
index 3f5868e7..16e3a362 100644
--- a/src/control/RoadBlocks.h
+++ b/src/control/RoadBlocks.h
@@ -11,6 +11,6 @@ public:
static bool (&InOrOut)[NUMROADBLOCKS];
static void Init(void);
- static void GenerateRoadBlockCopsForCar(CVehicle*, int32, int16);
+ static void GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode);
static void GenerateRoadBlocks(void);
};
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp
index 3e55d431..8d804e4d 100644
--- a/src/control/SceneEdit.cpp
+++ b/src/control/SceneEdit.cpp
@@ -2,11 +2,1096 @@
#include "patcher.h"
#include "SceneEdit.h"
-bool &CSceneEdit::m_bEditOn = *(bool*)0x95CD77;
-int32 &CSceneEdit::m_bCameraFollowActor = *(int*)0x940590;
-bool &CSceneEdit::m_bRecording = *(bool*)0x95CD1F;
-CVector &CSceneEdit::m_vecCurrentPosition = *(CVector*)0x943064;
-CVector &CSceneEdit::m_vecCamHeading = *(CVector*)0x942F8C;
-
-WRAPPER void CSceneEdit::Update(void) { EAXJMP(0x585570); }
-WRAPPER void CSceneEdit::Init(void) { EAXJMP(0x585170); }
+#include "Automobile.h"
+#include "Camera.h"
+#include "CarCtrl.h"
+#include "CivilianPed.h"
+#include "FileMgr.h"
+#include "Font.h"
+#include "ModelIndices.h"
+#include "ModelInfo.h"
+#include "Pad.h"
+#include "Ped.h"
+#include "Population.h"
+#include "Text.h"
+#include "Timecycle.h"
+#include "Streaming.h"
+#include "Vehicle.h"
+#include "WeaponInfo.h"
+#include "World.h"
+
+bool CSceneEdit::m_bEditOn;
+int32 CSceneEdit::m_bCameraFollowActor;
+bool CSceneEdit::m_bRecording;
+CVector CSceneEdit::m_vecCurrentPosition;
+CVector CSceneEdit::m_vecCamHeading;
+CVector CSceneEdit::m_vecGotoPosition;
+int32 CSceneEdit::m_nVehicle;
+int32 CSceneEdit::m_nVehicle2;
+int32 CSceneEdit::m_nActor;
+int32 CSceneEdit::m_nActor2;
+int32 CSceneEdit::m_nVehiclemodelId;
+int32 CSceneEdit::m_nPedmodelId;
+int16 CSceneEdit::m_nCurrentMovieCommand;
+int16 CSceneEdit::m_nNumActors;
+int16 CSceneEdit::m_nNumMovieCommands;
+int16 CSceneEdit::m_nCurrentCommand;
+int16 CSceneEdit::m_nCurrentVehicle;
+int16 CSceneEdit::m_nCurrentActor;
+int16 CSceneEdit::m_nWeaponType;
+bool CSceneEdit::m_bCommandActive;
+bool CSceneEdit::m_bActorSelected;
+bool CSceneEdit::m_bActor2Selected;
+bool CSceneEdit::m_bVehicleSelected;
+int16 CSceneEdit::m_nNumVehicles;
+CPed* CSceneEdit::pActors[NUM_ACTORS_IN_MOVIE];
+CVehicle* CSceneEdit::pVehicles[NUM_VEHICLES_IN_MOVIE];
+bool CSceneEdit::m_bDrawGotoArrow;
+CMovieCommand CSceneEdit::Movie[NUM_COMMANDS_IN_MOVIE];
+
+#define SHADOW_OFFSET (2.0f)
+#define ACTION_MESSAGE_X_RIGHT (60.0f)
+#define ACTION_MESSAGE_Y (8.0f)
+#define SELECTED_MESSAGE_X_RIGHT (60.0f)
+#define SELECTED_MESSAGE_Y (248.0f)
+#define COMMAND_NAME_X_RIGHT (60.0f)
+#define COMMAND_NAME_Y (38.0f)
+#define COMMAND_NAME_HEIGHT (16.0f)
+
+#define NUM_COMMANDS_TO_DRAW (9)
+
+static const char* pCommandStrings[] = {
+ "do-nothing", "New Actor", "Move Actor", "Select Actor", "Delete Actor",
+ "New Vehicle", "Move Vehicle", "Select Vehicle", "Delete Vehicle", "Give Weapon",
+ "Goto", "Goto (wait)", "Get In Car", "Get Out Car", "Kill",
+ "Flee", "Wait", "Position Camera", "Set Camera Target", "Select Camera Mode",
+ "Save Movie", "Load Movie", "Play Movie", "END"
+};
+
+static_assert(ARRAY_SIZE(pCommandStrings) == CSceneEdit::MOVIE_TOTAL_COMMANDS, "Scene edit: not all commands have names");
+
+static int32 NextValidModelId(int32 mi, int32 step)
+{
+ int32 result = -1;
+ int32 i = mi;
+ while (result == -1) {
+ i += step;
+ if (i < 0 || i > 5500) {
+ step = -step;
+ continue;
+ }
+ CBaseModelInfo* pInfo = CModelInfo::GetModelInfo(i);
+ CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo;
+ if (!pInfo)
+ continue;
+ if (pInfo->m_type == MITYPE_PED
+#ifdef FIX_BUGS
+ && !(i >= MI_SPECIAL01 && i <= MI_SPECIAL04)
+#endif
+ ||
+ pInfo->m_type == MITYPE_VEHICLE &&
+#ifdef FIX_BUGS
+ (pVehicleInfo->m_vehicleType == VEHICLE_TYPE_CAR || pVehicleInfo->m_vehicleType == VEHICLE_TYPE_BOAT))
+#else // && and || priority failure it seems, also crashes on special models
+ pVehicleInfo->m_vehicleType == VEHICLE_TYPE_CAR || pVehicleInfo->m_vehicleType == VEHICLE_TYPE_BOAT)
+#endif
+ result = i;
+ }
+ return result;
+}
+
+void CSceneEdit::LoadMovie(void)
+{
+ ReInitialise();
+ CFileMgr::SetDir("DATA");
+ int fid = CFileMgr::OpenFile("movie.dat", "r");
+#ifdef FIX_BUGS
+ if (fid >= 0)
+#endif
+ {
+ CFileMgr::Read(fid, (char*)&Movie, sizeof(Movie));
+ CFileMgr::Read(fid, (char*)&m_nNumMovieCommands, sizeof(m_nNumMovieCommands));
+ CFileMgr::CloseFile(fid);
+ }
+ CFileMgr::SetDir("");
+ m_bCommandActive = false;
+}
+
+void CSceneEdit::SaveMovie(void)
+{
+ CFileMgr::SetDir("DATA");
+ int fid = CFileMgr::OpenFileForWriting("movie.dat");
+ if (fid >= 0) {
+ CFileMgr::Write(fid, (char*)&Movie, sizeof(Movie));
+ CFileMgr::Write(fid, (char*)&m_nNumMovieCommands, sizeof(m_nNumMovieCommands));
+ CFileMgr::CloseFile(fid);
+ }
+ CFileMgr::SetDir("");
+ m_bCommandActive = false;
+}
+
+void CSceneEdit::Initialise(void)
+{
+ m_nActor = -1;
+ m_nActor2 = -1;
+ m_nVehicle = -1;
+ m_nVehicle2 = -1;
+ m_nCurrentCommand = MOVIE_NEW_ACTOR;
+ m_nVehiclemodelId = MI_INFERNUS;
+ m_nPedmodelId = MI_MALE01;
+ m_nNumVehicles = 0;
+ m_nNumActors = 0;
+ m_nNumMovieCommands = 0;
+ m_bCommandActive = false;
+ m_bRecording = true;
+ m_bEditOn = false;
+ for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++)
+ pActors[i] = nil;
+ for (int i = 0; i < NUM_VEHICLES_IN_MOVIE; i++)
+ pVehicles[i] = nil;
+ m_vecCamHeading = TheCamera.Cams[TheCamera.ActiveCam].Front;
+ m_vecGotoPosition = CVector(0.0f, 0.0f, 0.0f);
+ m_bCameraFollowActor = false;
+ TheCamera.Cams[TheCamera.ActiveCam].ResetStatics = true;
+ m_bDrawGotoArrow = false;
+}
+
+void CSceneEdit::InitPlayback(void)
+{
+ m_nVehiclemodelId = MI_INFERNUS;
+ m_nPedmodelId = MI_MALE01;
+ m_bCommandActive = false;
+ m_nNumActors = 0;
+ m_nNumVehicles = 0;
+ m_nActor = -1;
+ m_nActor2 = -1;
+ m_nVehicle = -1;
+ m_nVehicle2 = -1;
+ TheCamera.Cams[TheCamera.ActiveCam].ResetStatics = true;
+ m_vecCamHeading = TheCamera.Cams[TheCamera.ActiveCam].Front;
+ for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++) {
+ if (pActors[i]) {
+ CPopulation::RemovePed(pActors[i]);
+ pActors[i] = nil;
+ }
+ }
+ m_nCurrentActor = 0;
+ for (int i = 0; i < NUM_VEHICLES_IN_MOVIE; i++) {
+ if (pVehicles[i]) {
+ CWorld::Remove(pVehicles[i]);
+ delete pVehicles[i];
+ pVehicles[i] = nil;
+ }
+ }
+ m_nCurrentVehicle = 0;
+ m_vecGotoPosition = CVector(0.0f, 0.0f, 0.0f);
+ m_nCurrentMovieCommand = MOVIE_DO_NOTHING;
+ m_bDrawGotoArrow = false;
+}
+
+void CSceneEdit::ReInitialise(void)
+{
+ m_nVehiclemodelId = MI_INFERNUS;
+ m_nPedmodelId = MI_MALE01;
+ m_nCurrentCommand = MOVIE_NEW_ACTOR;
+ m_bEditOn = true;
+ m_bRecording = true;
+ m_bCommandActive = false;
+#ifdef FIX_BUGS
+ m_bCameraFollowActor = false;
+ TheCamera.Cams[TheCamera.ActiveCam].ResetStatics = true; // not enough...
+#endif
+ m_nActor = -1;
+ m_nActor2 = -1;
+ m_nVehicle = -1;
+ m_nVehicle2 = -1;
+ m_nNumMovieCommands = 0;
+ m_nCurrentMovieCommand = MOVIE_DO_NOTHING;
+ m_nNumActors = 0;
+ m_nNumVehicles = 0;
+ for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++) {
+ if (pActors[i]) {
+ CPopulation::RemovePed(pActors[i]);
+ pActors[i] = nil;
+ }
+ }
+ for (int i = 0; i < NUM_VEHICLES_IN_MOVIE; i++) {
+ if (pVehicles[i]) {
+ CWorld::Remove(pVehicles[i]);
+ delete pVehicles[i];
+ pVehicles[i] = nil;
+ }
+ }
+ for (int i = 0; i < NUM_COMMANDS_IN_MOVIE; i++) {
+ Movie[i].m_nCommandId = MOVIE_DO_NOTHING;
+ Movie[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
+ Movie[i].m_vecCamera = CVector(0.0f, 0.0f, 0.0f);
+ Movie[i].m_nActorId = -1;
+ Movie[i].m_nActor2Id = -1;
+ Movie[i].m_nVehicleId = -1;
+ Movie[i].m_nModelIndex = 0;
+ }
+ m_vecGotoPosition = CVector(0.0f, 0.0f, 0.0f);
+ m_bDrawGotoArrow = false;
+}
+
+void CSceneEdit::Update(void)
+{
+ if (!m_bEditOn)
+ return;
+ if (m_bRecording)
+ ProcessCommand();
+ else {
+ if (m_bCameraFollowActor && m_nActor != -1) {
+ if (pActors[m_nActor]->bInVehicle)
+ TheCamera.TakeControl(pActors[m_nActor]->m_pMyVehicle, CCam::MODE_BEHINDCAR, JUMP_CUT, CAMCONTROL_SCRIPT);
+ else
+ TheCamera.TakeControl(pActors[m_nActor], CCam::MODE_FOLLOWPED, JUMP_CUT, CAMCONTROL_SCRIPT);
+ }
+ PlayBack();
+ }
+}
+
+void CSceneEdit::Draw(void)
+{
+ char str[200];
+ wchar wstr[200];
+ if (TheCamera.m_WideScreenOn)
+ return;
+#ifndef FIX_BUGS
+ CFont::SetPropOff();
+#endif
+ CFont::SetBackgroundOff();
+ CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
+ CFont::SetCentreOn();
+ CFont::SetRightJustifyOn();
+ CFont::SetRightJustifyWrap(0.0f);
+ CFont::SetBackGroundOnlyTextOff();
+#ifdef FIX_BUGS
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetPropOn();
+ CFont::SetDropColor(CRGBA(0, 0, 0, 255));
+ CFont::SetDropShadowPosition(1);
+#else
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetPropOff();
+#endif
+ sprintf(str, "Action");
+ AsciiToUnicode(str, wstr);
+ CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(ACTION_MESSAGE_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(ACTION_MESSAGE_Y + SHADOW_OFFSET), wstr);
+ CFont::SetColor(CRGBA(193, 164, 120, 255));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(ACTION_MESSAGE_X_RIGHT), SCREEN_SCALE_Y(ACTION_MESSAGE_Y), wstr);
+ sprintf(str, "Selected");
+ AsciiToUnicode(str, wstr);
+ CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(SELECTED_MESSAGE_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(SELECTED_MESSAGE_Y + SHADOW_OFFSET), wstr);
+ CFont::SetColor(CRGBA(193, 164, 120, 255));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(SELECTED_MESSAGE_X_RIGHT), SCREEN_SCALE_Y(SELECTED_MESSAGE_Y), wstr);
+ CFont::SetCentreOff();
+ CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.7f));
+#ifdef FIX_BUGS
+ CFont::SetFontStyle(FONT_BANK);
+#else
+ CFont::SetFontStyle(FONT_HEADING);
+#endif
+ CFont::SetColor(CRGBA(0, 0, 0, 0));
+ for (int i = 0; i < NUM_COMMANDS_TO_DRAW; i++) {
+ int16 nCommandDrawn = m_nCurrentCommand + i - NUM_COMMANDS_TO_DRAW / 2;
+ if (nCommandDrawn >= MOVIE_TOTAL_COMMANDS)
+ nCommandDrawn -= (MOVIE_TOTAL_COMMANDS - 1);
+ if (nCommandDrawn <= MOVIE_DO_NOTHING)
+ nCommandDrawn += (MOVIE_TOTAL_COMMANDS - 1);
+ sprintf(str, pCommandStrings[nCommandDrawn]);
+ AsciiToUnicode(str, wstr);
+ CFont::SetColor(CRGBA(0, 0, 0, 0));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
+ if (nCommandDrawn == m_nCurrentCommand)
+ CFont::SetColor(CRGBA(156, 91, 40, 255));
+ else
+ CFont::SetColor(CRGBA(193, 164, 120, 255));
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
+ }
+}
+
+void CSceneEdit::ProcessCommand(void)
+{
+ if (!m_bCommandActive) {
+ ClearForNewCommand();
+ if (CPad::GetPad(1)->GetDPadUpJustDown()) {
+ if (--m_nCurrentCommand == MOVIE_DO_NOTHING)
+ m_nCurrentCommand = MOVIE_END;
+ }
+ if (CPad::GetPad(1)->GetDPadDownJustDown()) {
+ if (++m_nCurrentCommand == MOVIE_TOTAL_COMMANDS)
+ m_nCurrentCommand = MOVIE_NEW_ACTOR;
+ }
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ if (m_nCurrentCommand != MOVIE_DO_NOTHING)
+ m_bCommandActive = true;
+ }
+ return;
+ }
+ switch (m_nCurrentCommand) {
+ case MOVIE_DO_NOTHING:
+ m_bCommandActive = false;
+ break;
+ case MOVIE_NEW_ACTOR:
+ if (m_nActor == -1) {
+ if (m_nNumActors == NUM_ACTORS_IN_MOVIE)
+ break;
+ if (!CStreaming::HasModelLoaded(m_nPedmodelId)) {
+ CStreaming::RequestModel(m_nPedmodelId, 0);
+#ifdef FIX_BUGS
+ CStreaming::LoadAllRequestedModels(false); // otherwise gets stuck :(
+#endif
+ break;
+ }
+ CPed* pPed = new CCivilianPed(PEDTYPE_SPECIAL, m_nPedmodelId);
+ pPed->CharCreatedBy = MISSION_CHAR;
+ pPed->GetPosition() = m_vecCurrentPosition;
+ pPed->SetOrientation(0.0f, 0.0f, 0.0f);
+ CWorld::Add(pPed);
+ pPed->bUsesCollision = false;
+ pPed->bAffectedByGravity = false;
+ for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++) {
+ if (pActors[i] == nil) {
+ m_nActor = i;
+ pActors[i] = pPed;
+ break;
+ }
+ }
+ }
+ else {
+ pActors[m_nActor]->GetPosition() = m_vecCurrentPosition;
+ pActors[m_nActor]->SetOrientation(0.0f, 0.0f, 0.0f);
+ int32 mi = m_nPedmodelId;
+ if (CPad::GetPad(1)->GetLeftShoulder1JustDown())
+ mi = NextValidModelId(m_nPedmodelId, -1);
+ else if (CPad::GetPad(1)->GetRightShoulder1JustDown())
+ mi = NextValidModelId(m_nPedmodelId, 1);
+ if (mi == m_nPedmodelId) {
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ pActors[m_nActor]->bUsesCollision = true;
+ pActors[m_nActor]->bAffectedByGravity = true;
+ ++m_nNumActors;
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_NEW_ACTOR;
+ Movie[m_nNumMovieCommands].m_vecPosition = m_vecCurrentPosition;
+ Movie[m_nNumMovieCommands].m_nModelIndex = m_nPedmodelId;
+ Movie[m_nNumMovieCommands++].m_nActorId = m_nActor;
+ m_nActor = -1;
+ m_bCommandActive = false;
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ CWorld::Remove(pActors[m_nActor]);
+ delete pActors[m_nActor];
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+ m_bCommandActive = false;
+ }
+ }
+ else {
+ m_nPedmodelId = mi;
+ if (pActors[m_nActor]) {
+ CWorld::Remove(pActors[m_nActor]);
+ delete pActors[m_nActor];
+ }
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+ }
+ }
+ break;
+ case MOVIE_MOVE_ACTOR:
+ SelectActor();
+ if (m_bCommandActive)
+ break;
+ pActors[m_nActor]->GetPosition() = m_vecCurrentPosition;
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ m_bCommandActive = false;
+#ifndef FIX_BUGS // why? it crashes, also makes no sense
+ pActors[m_nActor] = nil;
+#endif
+ SelectActor();
+ }
+ break;
+ case MOVIE_SELECT_ACTOR:
+ SelectActor();
+ break;
+ case MOVIE_DELETE_ACTOR:
+ SelectActor();
+ if (m_bActorSelected) {
+ CPopulation::RemovePed(pActors[m_nActor]);
+ m_nCurrentActor = 0;
+ --m_nNumActors;
+#ifdef FIX_BUGS
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+#else
+ m_nActor = -1;
+ pActors[m_nActor] = nil;
+#endif
+ SelectActor();
+ m_bCommandActive = false;
+ }
+ else if (CPad::GetPad(1)->GetCircleJustDown()) {
+ m_nActor = -1;
+ m_bCommandActive = false;
+ }
+ break;
+ case MOVIE_NEW_VEHICLE:
+ if (m_nVehicle == -1) {
+ if (m_nNumVehicles == NUM_VEHICLES_IN_MOVIE)
+ break;
+ if (!CStreaming::HasModelLoaded(m_nVehiclemodelId)) {
+ CStreaming::RequestModel(m_nVehiclemodelId, 0);
+#ifdef FIX_BUGS
+ CStreaming::LoadAllRequestedModels(false); // otherwise gets stuck :(
+#endif
+ break;
+ }
+ CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE);
+ pVehicle->m_status = STATUS_PHYSICS;
+ pVehicle->GetPosition() = m_vecCurrentPosition;
+ pVehicle->SetOrientation(0.0f, 0.0f, 0.0f);
+ CWorld::Add(pVehicle);
+ pVehicle->bUsesCollision = false;
+ pVehicle->bAffectedByGravity = false;
+ for (int i = 0; i < NUM_VEHICLES_IN_MOVIE; i++) {
+ if (pVehicles[i] == nil) {
+ m_nVehicle = i;
+ pVehicles[i] = pVehicle;
+ break;
+ }
+ }
+ }
+ else {
+ pVehicles[m_nVehicle]->GetPosition() = m_vecCurrentPosition;
+ pVehicles[m_nVehicle]->SetOrientation(0.0f, 0.0f, 0.0f);
+ int32 mi = m_nVehiclemodelId;
+ if (CPad::GetPad(1)->GetLeftShoulder1JustDown())
+ mi = NextValidModelId(m_nVehiclemodelId, -1);
+ else if (CPad::GetPad(1)->GetRightShoulder1JustDown())
+ mi = NextValidModelId(m_nVehiclemodelId, 1);
+ if (mi == m_nVehiclemodelId) {
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ pVehicles[m_nVehicle]->bUsesCollision = true;
+ pVehicles[m_nVehicle]->bAffectedByGravity = true;
+ ++m_nNumVehicles;
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_NEW_VEHICLE;
+ Movie[m_nNumMovieCommands].m_vecPosition = m_vecCurrentPosition;
+ Movie[m_nNumMovieCommands].m_nModelIndex = m_nVehiclemodelId;
+ Movie[m_nNumMovieCommands++].m_nVehicleId = m_nVehicle;
+ m_nVehicle = -1;
+ m_bCommandActive = false;
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ CWorld::Remove(pVehicles[m_nVehicle]);
+ delete pVehicles[m_nVehicle];
+ pVehicles[m_nVehicle] = nil;
+ m_nVehicle = -1;
+ m_bCommandActive = false;
+ }
+ }
+ else {
+ m_nVehiclemodelId = mi;
+ if (pVehicles[m_nVehicle]) {
+ CWorld::Remove(pVehicles[m_nVehicle]);
+ delete pVehicles[m_nVehicle];
+ }
+ pVehicles[m_nVehicle] = nil;
+ m_nVehicle = -1;
+ }
+ }
+ break;
+ case MOVIE_MOVE_VEHICLE:
+ SelectVehicle();
+ if (m_bCommandActive)
+ break;
+ pVehicles[m_nVehicle]->GetPosition() = m_vecCurrentPosition;
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ m_bCommandActive = false;
+#ifndef FIX_BUGS // again, why? works wrong
+ pVehicles[m_nVehicle] = nil;
+#endif
+ m_nVehicle = -1;
+ }
+ break;
+ case MOVIE_SELECT_VEHICLE:
+ SelectVehicle();
+ break;
+ case MOVIE_DELETE_VEHICLE:
+ SelectVehicle();
+ if (m_bVehicleSelected) {
+ CWorld::Remove(pVehicles[m_nVehicle]);
+ delete pVehicles[m_nVehicle];
+ m_nCurrentVehicle = 0;
+ --m_nNumVehicles;
+ pVehicles[m_nVehicle] = nil;
+ m_nVehicle = -1;
+ SelectVehicle();
+ m_bCommandActive = false;
+ }
+ else if (CPad::GetPad(1)->GetCircleJustDown()) {
+ pVehicles[m_nVehicle] = nil;
+ m_nVehicle = -1;
+ m_bCommandActive = false;
+ }
+ break;
+ case MOVIE_GIVE_WEAPON:
+ if (m_bActorSelected) {
+ if (SelectWeapon()) {
+ m_bCommandActive = false;
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_GIVE_WEAPON;
+ Movie[m_nNumMovieCommands].m_nActorId = m_nActor;
+ Movie[m_nNumMovieCommands++].m_nModelIndex = m_nWeaponType;
+ }
+ }
+ else {
+ SelectActor();
+ m_bCommandActive = true;
+ }
+ break;
+ case MOVIE_GOTO:
+ case MOVIE_GOTO_WAIT:
+ if (!m_bActorSelected) {
+ m_bDrawGotoArrow = true;
+ SelectActor();
+ if (m_nActor == -1)
+ m_bCommandActive = true;
+ }
+ else {
+ m_vecGotoPosition = m_vecCurrentPosition;
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ if (pActors[m_nActor]->bInVehicle) {
+ if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(pActors[m_nActor]->m_pMyVehicle, m_vecGotoPosition, false))
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
+ else
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
+ pActors[m_nActor]->m_pMyVehicle->m_status = STATUS_PHYSICS;
+ pActors[m_nActor]->m_pMyVehicle->bEngineOn = true;
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed);
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
+ TheCamera.TakeControl(pActors[m_nActor]->m_pMyVehicle, CCam::MODE_BEHINDCAR, JUMP_CUT, CAMCONTROL_SCRIPT);
+ }
+ else {
+ pActors[m_nActor]->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, m_vecGotoPosition);
+ TheCamera.TakeControl(pActors[m_nActor], CCam::MODE_FOLLOWPED, JUMP_CUT, CAMCONTROL_SCRIPT);
+ }
+ m_bDrawGotoArrow = false;
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_GOTO;
+ Movie[m_nNumMovieCommands].m_nActorId = m_nActor;
+ Movie[m_nNumMovieCommands++].m_vecPosition = m_vecGotoPosition;
+ }
+ if (!m_bDrawGotoArrow) {
+ if (pActors[m_nActor]->bInVehicle && pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_NONE ||
+ !pActors[m_nActor]->bInVehicle && pActors[m_nActor]->m_objective == OBJECTIVE_NONE) {
+ if (pActors[m_nActor]) // if there is something that requires this check the least, it's this one
+ m_vecCamHeading = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].Source;
+ m_bCommandActive = false;
+ TheCamera.Cams[TheCamera.ActiveCam].Mode = CCam::MODE_FIGHT_CAM_RUNABOUT;
+ m_vecCurrentPosition = pActors[m_nActor]->GetPosition();
+ pActors[m_nActor]->SetObjective(OBJECTIVE_NONE);
+ if (pActors[m_nActor]->bInVehicle)
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
+ }
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+ m_bCommandActive = false;
+ }
+ }
+ break;
+ case MOVIE_GET_IN_CAR:
+ if (m_bActorSelected)
+ SelectVehicle();
+ else {
+ SelectActor();
+ if (m_nActor != -1)
+ m_bCommandActive = true;
+ }
+ if (m_bVehicleSelected) {
+ pActors[m_nActor]->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicles[m_nVehicle]);
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_GET_IN_CAR;
+ Movie[m_nNumMovieCommands].m_nActorId = m_nActor;
+ Movie[m_nNumMovieCommands++].m_nVehicleId = m_nVehicle;
+ m_nVehicle = -1;
+ m_bCommandActive = false;
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ pVehicles[m_nVehicle] = nil;
+ m_nVehicle = -1;
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+ m_bCommandActive = false;
+ }
+ break;
+ case MOVIE_GET_OUT_CAR:
+ SelectActor();
+ if (m_bActorSelected) {
+ if (pActors[m_nActor]->bInVehicle) {
+ pActors[m_nActor]->SetObjective(OBJECTIVE_LEAVE_VEHICLE);
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_GET_OUT_CAR;
+ Movie[m_nNumMovieCommands++].m_nActorId = m_nActor;
+ }
+ m_nActor = -1;
+ m_bCommandActive = false;
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ pVehicles[m_nVehicle] = nil;
+ m_nVehicle = -1;
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+ m_bCommandActive = false;
+ }
+ break;
+ case MOVIE_KILL:
+ if (!m_bActorSelected) {
+ SelectActor();
+ m_bCommandActive = true;
+ }
+ else if (!m_bActor2Selected) {
+ SelectActor2();
+ if (m_bActorSelected && m_bActor2Selected && m_nActor != -1 && m_nActor2 != -1 && m_nActor != m_nActor2) {
+ pActors[m_nActor]->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pActors[m_nActor2]);
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_KILL;
+ Movie[m_nNumMovieCommands].m_nActorId = m_nActor;
+ Movie[m_nNumMovieCommands++].m_nActor2Id = m_nActor2;
+ m_bCommandActive = false;
+ }
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+ pActors[m_nActor2] = nil;
+ m_nActor2 = -1;
+ m_bCommandActive = false;
+ }
+ break;
+ case MOVIE_FLEE:
+ if (!m_bActorSelected) {
+ SelectActor();
+ m_bCommandActive = true;
+ }
+ else if (!m_bActor2Selected) {
+ SelectActor2();
+ if (m_bActorSelected && m_bActor2Selected && m_nActor != -1 && m_nActor2 != -1 && m_nActor != m_nActor2) {
+ pActors[m_nActor]->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pActors[m_nActor2]);
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_FLEE;
+ Movie[m_nNumMovieCommands].m_nActorId = m_nActor;
+ Movie[m_nNumMovieCommands++].m_nActor2Id = m_nActor2;
+ m_bCommandActive = false;
+ }
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+ pActors[m_nActor2] = nil;
+ m_nActor2 = -1;
+ m_bCommandActive = false;
+ }
+ break;
+ case MOVIE_WAIT:
+ SelectActor();
+ if (m_bActorSelected) {
+ pActors[m_nActor]->SetObjective(OBJECTIVE_IDLE);
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_WAIT;
+ Movie[m_nNumMovieCommands++].m_nActorId = m_nActor;
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ pActors[m_nActor] = nil;
+ m_nActor = -1;
+ m_bCommandActive = false;
+ }
+ break;
+ case MOVIE_POSITION_CAMERA:
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_POSITION_CAMERA;
+ Movie[m_nNumMovieCommands].m_vecPosition = TheCamera.Cams[TheCamera.ActiveCam].Source;
+ Movie[m_nNumMovieCommands++].m_vecCamera = m_vecCamHeading;
+ m_bCommandActive = false;
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ m_bCommandActive = false;
+ }
+ break;
+ case MOVIE_SET_CAMERA_TARGET:
+ if (!m_bActorSelected) {
+ SelectActor();
+ m_bCommandActive = true;
+ }
+ else {
+ TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity = pActors[m_nActor];
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_SET_CAMERA_TARGET;
+ Movie[m_nNumMovieCommands++].m_nActorId = m_nActor;
+ m_bCommandActive = false;
+ }
+ }
+ break;
+ case MOVIE_SELECT_CAMERA_MODE:
+ m_bCommandActive = false;
+ break;
+ case MOVIE_SAVE_MOVIE:
+ SaveMovie();
+ break;
+ case MOVIE_LOAD_MOVIE:
+ LoadMovie();
+ break;
+ case MOVIE_PLAY_MOVIE:
+ InitPlayback();
+ LoadMovie();
+ m_bRecording = false;
+ break;
+ case MOVIE_END:
+ m_bRecording = false;
+ break;
+ default:
+ assert(0);
+ }
+}
+
+void CSceneEdit::PlayBack(void)
+{
+ m_nCurrentCommand = Movie[m_nCurrentMovieCommand].m_nCommandId;
+ if (m_nCurrentMovieCommand >= m_nNumMovieCommands) {
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ m_nCurrentCommand = MOVIE_DO_NOTHING;
+ m_bRecording = true;
+ ReInitialise();
+ }
+ return;
+ }
+ switch (m_nCurrentCommand) {
+ case MOVIE_DO_NOTHING:
+ case MOVIE_MOVE_ACTOR:
+ case MOVIE_SELECT_ACTOR:
+ case MOVIE_DELETE_ACTOR:
+ case MOVIE_MOVE_VEHICLE:
+ case MOVIE_SELECT_VEHICLE:
+ case MOVIE_DELETE_VEHICLE:
+ break;
+ case MOVIE_NEW_ACTOR:
+ {
+ m_nPedmodelId = Movie[m_nCurrentMovieCommand].m_nModelIndex;
+ m_vecCurrentPosition = Movie[m_nCurrentMovieCommand].m_vecPosition;
+ if (!CStreaming::HasModelLoaded(m_nPedmodelId)) {
+ CStreaming::RequestModel(m_nPedmodelId, 0);
+#ifdef FIX_BUGS
+ CStreaming::LoadAllRequestedModels(false); // otherwise gets stuck :(
+#endif
+ break;
+ }
+ CPed* pPed = new CCivilianPed(PEDTYPE_SPECIAL, m_nPedmodelId);
+ pPed->CharCreatedBy = MISSION_CHAR;
+ CWorld::Add(pPed);
+ pPed->GetPosition() = m_vecCurrentPosition;
+ pPed->SetOrientation(0.0f, 0.0f, 0.0f);
+ for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++) {
+ if (pActors[i] == nil) {
+ m_nActor = i;
+ pActors[i] = pPed;
+ break;
+ }
+ }
+ m_nNumActors++;
+ m_nCurrentMovieCommand++;
+ break;
+ }
+ case MOVIE_NEW_VEHICLE:
+ {
+ m_nVehiclemodelId = Movie[m_nCurrentMovieCommand].m_nModelIndex;
+ m_vecCurrentPosition = Movie[m_nCurrentMovieCommand].m_vecPosition;
+ if (!CStreaming::HasModelLoaded(m_nVehiclemodelId)) {
+ CStreaming::RequestModel(m_nVehiclemodelId, 0);
+#ifdef FIX_BUGS
+ CStreaming::LoadAllRequestedModels(false); // otherwise gets stuck :(
+#endif
+ break;
+ }
+ CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE);
+ pVehicle->m_status = STATUS_PHYSICS;
+ pVehicle->GetPosition() = m_vecCurrentPosition;
+ pVehicle->SetOrientation(0.0f, 0.0f, 0.0f);
+ CWorld::Add(pVehicle);
+ for (int i = 0; i < NUM_VEHICLES_IN_MOVIE; i++) {
+ if (pVehicles[i] == nil) {
+ m_nVehicle = i;
+ pVehicles[i] = pVehicle;
+ break;
+ }
+ }
+ m_nNumVehicles++;
+ m_nCurrentMovieCommand++;
+ break;
+ }
+ case MOVIE_GIVE_WEAPON:
+ m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
+ m_nWeaponType = Movie[m_nCurrentMovieCommand].m_nModelIndex;
+ pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
+ pActors[m_nActor]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId);
+ pActors[m_nActor]->SetCurrentWeapon(m_nWeaponType);
+ m_nCurrentMovieCommand++;
+ break;
+ case MOVIE_GOTO:
+ case MOVIE_GOTO_WAIT:
+ m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
+ m_vecGotoPosition = Movie[m_nCurrentMovieCommand].m_vecPosition;
+ if (pActors[m_nActor]->bInVehicle) {
+ if (pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission != MISSION_GOTOCOORDS &&
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission != MISSION_GOTOCOORDS_STRAIGHT) {
+ if ((pActors[m_nActor]->m_pMyVehicle->GetPosition() - m_vecGotoPosition).Magnitude() < 5.0f) {
+ if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(pActors[m_nActor]->m_pMyVehicle, m_vecGotoPosition, false))
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
+ else
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
+ pActors[m_nActor]->m_pMyVehicle->m_status = STATUS_PHYSICS;
+ pActors[m_nActor]->m_pMyVehicle->bEngineOn = true;
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed);
+ pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
+ if (m_nCurrentCommand != MOVIE_GOTO_WAIT)
+ ++m_nCurrentMovieCommand;
+ }
+ else
+ ++m_nCurrentMovieCommand;
+ }
+ }
+ else {
+ if (pActors[m_nActor]->m_objective != OBJECTIVE_GOTO_AREA_ON_FOOT) {
+ pActors[m_nActor]->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, m_vecGotoPosition);
+ ++m_nCurrentMovieCommand;
+ }
+ }
+ break;
+ case MOVIE_GET_IN_CAR:
+ m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
+ if (!pActors[m_nActor]->bInVehicle){
+ m_nVehicle = Movie[m_nCurrentMovieCommand].m_nVehicleId;
+ pActors[m_nActor]->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicles[m_nVehicle]);
+ }
+ else
+ ++m_nCurrentMovieCommand;
+ break;
+ case MOVIE_GET_OUT_CAR:
+ m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
+ if (pActors[m_nActor]->bInVehicle)
+ pActors[m_nActor]->SetObjective(OBJECTIVE_LEAVE_VEHICLE);
+ else
+ ++m_nCurrentMovieCommand;
+ break;
+ case MOVIE_KILL:
+ m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
+ m_nActor2 = Movie[m_nCurrentMovieCommand].m_nActor2Id;
+ pActors[m_nActor]->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pActors[m_nActor2]);
+ if (pActors[m_nActor2]->GetPedState() == PED_DEAD)
+ ++m_nCurrentMovieCommand;
+ break;
+ case MOVIE_FLEE:
+ m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
+ m_nActor2 = Movie[m_nCurrentMovieCommand].m_nActor2Id;
+ pActors[m_nActor]->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pActors[m_nActor2]);
+ ++m_nCurrentMovieCommand;
+ break;
+ case MOVIE_WAIT:
+ m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
+ pActors[m_nActor]->SetObjective(OBJECTIVE_IDLE);
+ ++m_nCurrentMovieCommand;
+ break;
+ case MOVIE_POSITION_CAMERA:
+ TheCamera.Cams[TheCamera.ActiveCam].Source = Movie[m_nCurrentMovieCommand].m_vecPosition;
+ m_vecCamHeading = Movie[m_nCurrentMovieCommand].m_vecCamera;
+ TheCamera.Cams[TheCamera.ActiveCam].Front = m_vecCamHeading;
+ ++m_nCurrentMovieCommand;
+ break;
+ case MOVIE_SET_CAMERA_TARGET:
+ m_bCameraFollowActor = true;
+ TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity = pActors[Movie[m_nNumMovieCommands].m_nActorId];
+ TheCamera.pTargetEntity = pActors[Movie[m_nNumMovieCommands].m_nActorId];
+ TheCamera.m_bLookingAtPlayer = false;
+ ++m_nCurrentMovieCommand;
+ break;
+ case MOVIE_SELECT_CAMERA_MODE:
+ m_bCommandActive = false; // this is wrong
+ break;
+ }
+}
+
+void CSceneEdit::ClearForNewCommand(void)
+{
+ m_nActor = -1;
+ m_nActor2 = -1;
+ m_nVehicle = -1;
+ m_bActorSelected = false;
+ m_bActor2Selected = false;
+ m_bVehicleSelected = false;
+ m_bDrawGotoArrow = false;
+}
+void CSceneEdit::SelectActor(void)
+{
+ m_bActorSelected = false;
+ if (m_nActor != -1) {
+ if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) {
+ CPed* pPed;
+ do {
+ if (--m_nActor < 0)
+ m_nActor = NUM_ACTORS_IN_MOVIE - 1;
+ pPed = pActors[m_nActor];
+ } while (pPed == nil);
+ TheCamera.Cams[TheCamera.ActiveCam].Source = pPed->GetPosition() - m_vecCamHeading;
+ }
+ else if (CPad::GetPad(1)->GetRightShoulder1JustDown()) {
+ CPed* pPed;
+ do {
+ if (++m_nActor == NUM_ACTORS_IN_MOVIE)
+ m_nActor = 0;
+ pPed = pActors[m_nActor];
+ } while (pPed == nil);
+ TheCamera.Cams[TheCamera.ActiveCam].Source = pPed->GetPosition() - m_vecCamHeading;
+ }
+ m_vecCurrentPosition = pActors[m_nActor]->GetPosition();
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ m_bActorSelected = true;
+ m_bCommandActive = false;
+ }
+ else if (CPad::GetPad(1)->GetCircleJustDown()) {
+ m_nActor = -1;
+ }
+ }
+ else if (m_nNumActors != 0) {
+ for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++) {
+ if (pActors[i] != nil) {
+ m_nActor = i;
+ break;
+ }
+ }
+ TheCamera.Cams[TheCamera.ActiveCam].Source = pActors[m_nActor]->GetPosition() - m_vecCamHeading;
+ if (m_nNumActors == 1) {
+ m_bActorSelected = true;
+ m_bCommandActive = false;
+ }
+ }
+ else {
+ m_bCommandActive = false;
+ }
+}
+
+void CSceneEdit::SelectActor2(void)
+{
+ m_bActor2Selected = false;
+ if (m_nNumActors <= 1) {
+ m_bCommandActive = false;
+ return;
+ }
+ if (m_nActor2 != -1) {
+ if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) {
+ CPed* pPed;
+ do {
+ if (--m_nActor2 < 0)
+ m_nActor2 = NUM_ACTORS_IN_MOVIE - 1;
+ pPed = pActors[m_nActor2];
+ } while (pPed == nil || pPed == pActors[m_nActor]);
+ TheCamera.Cams[TheCamera.ActiveCam].Source = pPed->GetPosition() - m_vecCamHeading;
+ }
+ else if (CPad::GetPad(1)->GetRightShoulder1JustDown()) {
+ CPed* pPed;
+ do {
+ if (++m_nActor2 == NUM_ACTORS_IN_MOVIE)
+ m_nActor2 = 0;
+ pPed = pActors[m_nActor2];
+ } while (pPed == nil || pPed == pActors[m_nActor]);
+ TheCamera.Cams[TheCamera.ActiveCam].Source = pPed->GetPosition() - m_vecCamHeading;
+ }
+ m_vecCurrentPosition = pActors[m_nActor2]->GetPosition();
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ m_bActor2Selected = true;
+ m_bCommandActive = false;
+ }
+ else if (CPad::GetPad(1)->GetCircleJustDown()) {
+ m_nActor2 = -1;
+ }
+ }
+ else {
+ for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++) {
+ if (pActors[i] != nil && pActors[m_nActor] != pActors[i] ) {
+ m_nActor2 = i;
+ break;
+ }
+ }
+ TheCamera.Cams[TheCamera.ActiveCam].Source = pActors[m_nActor2]->GetPosition() - m_vecCamHeading;
+ }
+}
+
+void CSceneEdit::SelectVehicle(void)
+{
+ m_bVehicleSelected = false;
+ if (m_nVehicle != -1) {
+ if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) {
+ CVehicle* pVehicle;
+ do {
+ if (--m_nVehicle < 0)
+ m_nVehicle = NUM_VEHICLES_IN_MOVIE - 1;
+ pVehicle = pVehicles[m_nVehicle];
+ } while (pVehicle == nil);
+ }
+ else if (CPad::GetPad(1)->GetRightShoulder1JustDown()) {
+ CVehicle* pVehicle;
+ do {
+ if (++m_nVehicle == NUM_VEHICLES_IN_MOVIE)
+ m_nVehicle = 0;
+ pVehicle = pVehicles[m_nVehicle];
+ } while (pVehicle == nil);
+ }
+ m_vecCurrentPosition = pVehicles[m_nVehicle]->GetPosition();
+ TheCamera.Cams[TheCamera.ActiveCam].Source = pVehicles[m_nVehicle]->GetPosition() - m_vecCamHeading;
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ m_bVehicleSelected = true;
+ m_bCommandActive = false;
+ }
+ else if (CPad::GetPad(1)->GetCircleJustDown()) {
+ m_nVehicle = -1;
+ }
+ }
+ else if (m_nNumVehicles != 0) {
+ for (int i = 0; i < NUM_ACTORS_IN_MOVIE; i++) {
+ if (pVehicles[i] != nil) {
+ m_nVehicle = i;
+ break;
+ }
+ }
+ }
+}
+
+bool CSceneEdit::SelectWeapon(void)
+{
+ if (m_nWeaponType == WEAPONTYPE_UNARMED) {
+ m_nWeaponType = WEAPONTYPE_COLT45;
+ return false;
+ }
+ if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) {
+ if (++m_nWeaponType >= WEAPONTYPE_DETONATOR)
+ m_nWeaponType = WEAPONTYPE_BASEBALLBAT;
+ pActors[m_nActor]->ClearWeapons();
+ pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
+ pActors[m_nActor]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId);
+ pActors[m_nActor]->SetCurrentWeapon(m_nWeaponType);
+ }
+ else if (CPad::GetPad(1)->GetRightShoulder1JustDown()){
+ if (--m_nWeaponType <= WEAPONTYPE_UNARMED)
+ m_nWeaponType = WEAPONTYPE_GRENADE;
+ pActors[m_nActor]->ClearWeapons();
+ pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
+ pActors[m_nActor]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId);
+ pActors[m_nActor]->SetCurrentWeapon(m_nWeaponType);
+ }
+ if (CPad::GetPad(1)->GetTriangleJustDown()) {
+ m_bCommandActive = false;
+ return true;
+ }
+ if (CPad::GetPad(1)->GetCircleJustDown()) {
+ pActors[m_nActor]->ClearWeapons();
+ m_nWeaponType = WEAPONTYPE_UNARMED;
+ m_bCommandActive = false;
+ return false;
+ }
+ return false;
+} \ No newline at end of file
diff --git a/src/control/SceneEdit.h b/src/control/SceneEdit.h
index 0de72c19..6dcefa31 100644
--- a/src/control/SceneEdit.h
+++ b/src/control/SceneEdit.h
@@ -1,14 +1,95 @@
#pragma once
+class CPed;
+class CVehicle;
+
+struct CMovieCommand
+{
+ int32 m_nCommandId;
+ CVector m_vecPosition;
+ CVector m_vecCamera;
+ int16 m_nActorId;
+ int16 m_nActor2Id;
+ int16 m_nVehicleId;
+ int16 m_nModelIndex;
+};
+
class CSceneEdit
{
public:
- static bool &m_bEditOn;
- static int32 &m_bCameraFollowActor;
- static bool &m_bRecording;
- static CVector &m_vecCurrentPosition;
- static CVector &m_vecCamHeading;
+ enum {
+ MOVIE_DO_NOTHING = 0,
+ MOVIE_NEW_ACTOR,
+ MOVIE_MOVE_ACTOR,
+ MOVIE_SELECT_ACTOR,
+ MOVIE_DELETE_ACTOR,
+ MOVIE_NEW_VEHICLE,
+ MOVIE_MOVE_VEHICLE,
+ MOVIE_SELECT_VEHICLE,
+ MOVIE_DELETE_VEHICLE,
+ MOVIE_GIVE_WEAPON,
+ MOVIE_GOTO,
+ MOVIE_GOTO_WAIT,
+ MOVIE_GET_IN_CAR,
+ MOVIE_GET_OUT_CAR,
+ MOVIE_KILL,
+ MOVIE_FLEE,
+ MOVIE_WAIT,
+ MOVIE_POSITION_CAMERA,
+ MOVIE_SET_CAMERA_TARGET,
+ MOVIE_SELECT_CAMERA_MODE,
+ MOVIE_SAVE_MOVIE,
+ MOVIE_LOAD_MOVIE,
+ MOVIE_PLAY_MOVIE,
+ MOVIE_END,
+ MOVIE_TOTAL_COMMANDS
+ };
+ enum {
+ NUM_ACTORS_IN_MOVIE = 5,
+ NUM_VEHICLES_IN_MOVIE = 5,
+ NUM_COMMANDS_IN_MOVIE = 20
+ };
+ static int32 m_bCameraFollowActor;
+ static CVector m_vecCurrentPosition;
+ static CVector m_vecCamHeading;
+ static CVector m_vecGotoPosition;
+ static int32 m_nVehicle;
+ static int32 m_nVehicle2;
+ static int32 m_nActor;
+ static int32 m_nActor2;
+ static int32 m_nVehiclemodelId;
+ static int32 m_nPedmodelId;
+ static int16 m_nCurrentMovieCommand;
+ static int16 m_nCurrentCommand;
+ static int16 m_nCurrentVehicle;
+ static int16 m_nCurrentActor;
+ static bool m_bEditOn;
+ static bool m_bRecording;
+ static bool m_bCommandActive;
+ static bool m_bActorSelected;
+ static bool m_bActor2Selected;
+ static bool m_bVehicleSelected;
+ static int16 m_nNumActors;
+ static int16 m_nNumVehicles;
+ static int16 m_nNumMovieCommands;
+ static int16 m_nWeaponType;
+ static CPed* pActors[NUM_ACTORS_IN_MOVIE];
+ static CVehicle* pVehicles[NUM_VEHICLES_IN_MOVIE];
+ static bool m_bDrawGotoArrow;
+ static CMovieCommand Movie[NUM_COMMANDS_IN_MOVIE];
+ static void LoadMovie(void);
+ static void SaveMovie(void);
+ static void Initialise(void);
+ static void InitPlayback(void);
+ static void ReInitialise(void);
static void Update(void);
- static void Init(void);
+ static void Draw(void);
+ static void ProcessCommand(void);
+ static void PlayBack(void);
+ static void ClearForNewCommand(void);
+ static void SelectActor(void);
+ static void SelectActor2(void);
+ static void SelectVehicle(void);
+ static bool SelectWeapon(void);
};
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index ddea0e3c..83d072f3 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -8442,7 +8442,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
CPad::GetPad(ScriptParams[0])->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80;
pPlayerInfo->MakePlayerSafe(true);
- CCutsceneMgr::SetRunning(true);
+ CCutsceneMgr::StartCutsceneProcessing();
return 0;
}
case COMMAND_USE_TEXT_COMMANDS:
@@ -8921,6 +8921,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
UpdateCompareFlag(CCredits::AreCreditsDone());
return 0;
case COMMAND_CREATE_SINGLE_PARTICLE:
+ CollectParameters(&m_nIp, 8);
CParticle::AddParticle((tParticleType)ScriptParams[0], *(CVector*)&ScriptParams[1],
*(CVector*)&ScriptParams[4], nil, *(float*)&ScriptParams[7], 0, 0, 0, 0);
return 0;
@@ -11358,7 +11359,7 @@ VALIDATESAVEBUF(size)
void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntity)
{
- static CColPoint aTempColPoints[32];
+ static CColPoint aTempColPoints[MAX_COLLISION_POINTS];
int16 entities = 0;
CEntity* aEntities[16];
CWorld::FindObjectsKindaColliding(pos, pEntity->GetBoundRadius(), false, &entities, 16, aEntities, false, true, true, false, false);
@@ -11373,15 +11374,15 @@ void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntit
continue;
CEntity* pFound = aEntities[i];
int cols;
- if (CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel()->numLines <= 0)
- cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel(),
- pFound->GetMatrix(), *CModelInfo::GetModelInfo(pFound->GetModelIndex())->GetColModel(), aTempColPoints, nil, nil);
+ if (pEntity->GetColModel()->numLines <= 0)
+ cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *pEntity->GetColModel(),
+ pFound->GetMatrix(), *pFound->GetColModel(), aTempColPoints, nil, nil);
else {
float lines[4];
lines[0] = lines[1] = lines[2] = lines[3] = 1.0f;
- CColPoint tmp;
- cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel(),
- pFound->GetMatrix(), *CModelInfo::GetModelInfo(pFound->GetModelIndex())->GetColModel(), aTempColPoints, &tmp, lines);
+ CColPoint tmp[4];
+ cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *pEntity->GetColModel(),
+ pFound->GetMatrix(), *pFound->GetColModel(), aTempColPoints,tmp, lines);
}
if (cols <= 0)
continue;
diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp
index 2cd09a03..ab9cd92d 100644
--- a/src/control/TrafficLights.cpp
+++ b/src/control/TrafficLights.cpp
@@ -1,23 +1,335 @@
#include "common.h"
#include "patcher.h"
-#include "TrafficLights.h"
+#include "General.h"
+#include "Camera.h"
+#include "World.h"
+#include "PathFind.h"
#include "Timer.h"
+#include "Clock.h"
+#include "Weather.h"
+#include "Timecycle.h"
+#include "Pointlights.h"
+#include "Shadows.h"
+#include "Coronas.h"
+#include "SpecialFX.h"
#include "Vehicle.h"
+#include "TrafficLights.h"
+
+// TODO: figure out the meaning of this
+enum { SOME_FLAG = 0x80 };
+
+void
+CTrafficLights::DisplayActualLight(CEntity *ent)
+{
+ if(ent->GetUp().z < 0.96f || ent->bRenderDamaged)
+ return;
+
+ int phase;
+ if(FindTrafficLightType(ent) == 1)
+ phase = LightForCars1();
+ else
+ phase = LightForCars2();
+
+ int i;
+ CBaseModelInfo *mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
+ float x = mi->Get2dEffect(0)->pos.x;
+ float yMin = mi->Get2dEffect(0)->pos.y;
+ float yMax = mi->Get2dEffect(0)->pos.y;
+ float zMin = mi->Get2dEffect(0)->pos.z;
+ float zMax = mi->Get2dEffect(0)->pos.z;
+ for(i = 1; i < 6; i++){
+ assert(mi->Get2dEffect(i));
+ yMin = min(yMin, mi->Get2dEffect(i)->pos.y);
+ yMax = max(yMax, mi->Get2dEffect(i)->pos.y);
+ zMin = min(zMin, mi->Get2dEffect(i)->pos.z);
+ zMax = max(zMax, mi->Get2dEffect(i)->pos.z);
+ }
+
+ CVector pos1, pos2;
+ uint8 r, g;
+ int id;
+ switch(phase){
+ case CAR_LIGHTS_GREEN:
+ r = 0;
+ g = 255;
+ pos1 = ent->GetMatrix() * CVector(x, yMax, zMin);
+ pos2 = ent->GetMatrix() * CVector(x, yMin, zMin);
+ id = 0;
+ break;
+ case CAR_LIGHTS_YELLOW:
+ r = 255;
+ g = 128;
+ pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin+zMax)/2.0f);
+ pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin+zMax)/2.0f);
+ id = 1;
+ break;
+ case CAR_LIGHTS_RED:
+ default:
+ r = 255;
+ g = 0;
+ pos1 = ent->GetMatrix() * CVector(x, yMax, zMax);
+ pos2 = ent->GetMatrix() * CVector(x, yMin, zMax);
+ id = 2;
+ break;
+ }
+
+ if(CClock::GetHours() > 19 || CClock::GetHours() < 6 || CWeather::Foggyness > 0.05f)
+ CPointLights::AddLight(CPointLights::LIGHT_POINT,
+ pos1, CVector(0.0f, 0.0f, 0.0f), 8.0f,
+ r/255.0f, g/255.0f, 0/255.0f, CPointLights::FOG_NORMAL, true);
+
+ CShadows::StoreStaticShadow((uintptr)ent,
+ SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1,
+ 8.0f, 0.0f, 0.0f, -8.0f, 128,
+ r*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
+ g*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
+ 0*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
+ 12.0f, 1.0f, 40.0f, false, 0.0f);
+
+ if(DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f)
+ CCoronas::RegisterCorona((uintptr)ent + id,
+ r*CTimeCycle::GetSpriteBrightness()*0.7f,
+ g*CTimeCycle::GetSpriteBrightness()*0.7f,
+ 0*CTimeCycle::GetSpriteBrightness()*0.7f,
+ 255,
+ pos1, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f,
+ CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
+ CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
+ else
+ CCoronas::RegisterCorona((uintptr)ent + id + 3,
+ r*CTimeCycle::GetSpriteBrightness()*0.7f,
+ g*CTimeCycle::GetSpriteBrightness()*0.7f,
+ 0*CTimeCycle::GetSpriteBrightness()*0.7f,
+ 255,
+ pos2, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f,
+ CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
+ CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
+
+ CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
+ CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
+
+ static const float top = -0.127f;
+ static const float bot = -0.539f;
+ static const float mid = bot + (top-bot)/3.0f;
+ static const float left = 1.256f;
+ static const float right = 0.706f;
+ phase = CTrafficLights::LightForPeds();
+ if(phase == PED_LIGHTS_DONT_WALK){
+ CVector p0(2.7f, right, top);
+ CVector p1(2.7f, left, top);
+ CVector p2(2.7f, right, mid);
+ CVector p3(2.7f, left, mid);
+ CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3,
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
+ SHINYTEXT_WALK, 255, 0, 0, 60.0f);
+ }else if(phase == PED_LIGHTS_WALK || CTimer::GetTimeInMilliseconds() & 0x100){
+ CVector p0(2.7f, right, mid);
+ CVector p1(2.7f, left, mid);
+ CVector p2(2.7f, right, bot);
+ CVector p3(2.7f, left, bot);
+ CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3,
+ 1.0f, 0.5f, 0.0f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f,
+ SHINYTEXT_WALK, 255, 255, 255, 60.0f);
+ }
+}
+
+void
+CTrafficLights::ScanForLightsOnMap(void)
+{
+ int x, y;
+ int i, j, l;
+ CPtrNode *node;
+
+ for(x = 0; x < NUMSECTORS_X; x++)
+ for(y = 0; y < NUMSECTORS_Y; y++){
+ CPtrList &list = CWorld::GetSector(x, y)->m_lists[ENTITYLIST_DUMMIES];
+ for(node = list.first; node; node = node->next){
+ CEntity *light = (CEntity*)node->item;
+ if(light->GetModelIndex() != MI_TRAFFICLIGHTS)
+ continue;
+
+ // Check cars
+ for(i = 0; i < ThePaths.m_numCarPathLinks; i++){
+ CVector2D dist = ThePaths.m_carPathLinks[i].pos - light->GetPosition();
+ float dotY = Abs(DotProduct2D(dist, light->GetForward())); // forward is direction of car light
+ float dotX = DotProduct2D(dist, light->GetRight()); // towards base of light
+ // it has to be on the correct side of the node and also not very far away
+ if(dotX < 0.0f && dotX > -15.0f && dotY < 3.0f){
+ float dz = ThePaths.m_pathNodes[ThePaths.m_carPathLinks[i].pathNodeIndex].pos.z -
+ light->GetPosition().z;
+ if(dz < 15.0f){
+ ThePaths.m_carPathLinks[i].trafficLightType = FindTrafficLightType(light);
+ // Find two neighbour nodes of this one
+ int n1 = -1;
+ int n2 = -1;
+ for(j = 0; j < ThePaths.m_numPathNodes; j++)
+ for(l = 0; l < ThePaths.m_pathNodes[j].numLinks; l++)
+ if(ThePaths.m_carPathConnections[ThePaths.m_pathNodes[j].firstLink + l] == i){
+ if(n1 == -1)
+ n1 = j;
+ else
+ n2 = j;
+ }
+ // What's going on here?
+ if(ThePaths.m_pathNodes[n1].numLinks <= ThePaths.m_pathNodes[n2].numLinks)
+ n1 = n2;
+ if(ThePaths.m_carPathLinks[i].pathNodeIndex != n1)
+ ThePaths.m_carPathLinks[i].trafficLightType |= SOME_FLAG;
+ }
+ }
+ }
+
+ // Check peds
+ for(i = ThePaths.m_numCarPathNodes; i < ThePaths.m_numPathNodes; i++){
+ float dist1, dist2;
+ dist1 = Abs(ThePaths.m_pathNodes[i].pos.x - light->GetPosition().x) +
+ Abs(ThePaths.m_pathNodes[i].pos.y - light->GetPosition().y);
+ if(dist1 < 50.0f){
+ for(l = 0; l < ThePaths.m_pathNodes[i].numLinks; l++){
+ j = ThePaths.m_pathNodes[i].firstLink + l;
+ if(ThePaths.m_connectionFlags[j].bCrossesRoad){
+ dist2 = Abs(ThePaths.m_pathNodes[j].pos.x - light->GetPosition().x) +
+ Abs(ThePaths.m_pathNodes[j].pos.y - light->GetPosition().y);
+ if(dist1 < 15.0f || dist2 < 15.0f)
+ ThePaths.m_connectionFlags[j].bTrafficLight = true;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+bool
+CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
+{
+ int node, type;
-WRAPPER void CTrafficLights::DisplayActualLight(CEntity *ent) { EAXJMP(0x455800); }
-WRAPPER void CTrafficLights::ScanForLightsOnMap(void) { EAXJMP(0x454F40); }
-WRAPPER bool CTrafficLights::ShouldCarStopForLight(CVehicle*, bool) { EAXJMP(0x455350); }
-WRAPPER bool CTrafficLights::ShouldCarStopForBridge(CVehicle*) { EAXJMP(0x456460); }
+ node = vehicle->AutoPilot.m_nNextPathNodeInfo;
+ type = ThePaths.m_carPathLinks[node].trafficLightType;
+ if(type){
+ if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) &&
+ (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode))
+ if(alwaysStop ||
+ (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
+ (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
+ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
+ ThePaths.m_carPathLinks[node].dir);
+ if(vehicle->AutoPilot.m_nNextDirection == -1){
+ if(dist > 0.0f && dist < 8.0f)
+ return true;
+ }else{
+ if(dist < 0.0f && dist > -8.0f)
+ return true;
+ }
+ }
+ }
+
+ node = vehicle->AutoPilot.m_nCurrentPathNodeInfo;
+ type = ThePaths.m_carPathLinks[node].trafficLightType;
+ if(type){
+ if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) &&
+ (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode))
+ if(alwaysStop ||
+ (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
+ (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
+ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
+ ThePaths.m_carPathLinks[node].dir);
+ if(vehicle->AutoPilot.m_nCurrentDirection == -1){
+ if(dist > 0.0f && dist < 8.0f)
+ return true;
+ }else{
+ if(dist < 0.0f && dist > -8.0f)
+ return true;
+ }
+ }
+ }
+
+ if(vehicle->m_status == STATUS_PHYSICS){
+ node = vehicle->AutoPilot.m_nPreviousPathNodeInfo;
+ type = ThePaths.m_carPathLinks[node].trafficLightType;
+ if(type){
+ if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) &&
+ (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode))
+ if(alwaysStop ||
+ (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
+ (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
+ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
+ ThePaths.m_carPathLinks[node].dir);
+ if(vehicle->AutoPilot.m_nPreviousDirection == -1){
+ if(dist > 0.0f && dist < 6.0f)
+ return true;
+ }else{
+ if(dist < 0.0f && dist > -6.0f)
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+bool
+CTrafficLights::ShouldCarStopForBridge(CVehicle *vehicle)
+{
+ return ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nNextPathNodeInfo].bBridgeLights &&
+ !ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nCurrentPathNodeInfo].bBridgeLights;
+}
+
+int
+CTrafficLights::FindTrafficLightType(CEntity *light)
+{
+ float orientation = RADTODEG(CGeneral::GetATanOfXY(light->GetForward().x, light->GetForward().y));
+ if((orientation > 60.0f && orientation < 60.0f + 90.0f) ||
+ (orientation > 240.0f && orientation < 240.0f + 90.0f))
+ return 1;
+ return 2;
+}
uint8
CTrafficLights::LightForPeds(void)
{
- uint32 period = CTimer::GetTimeInMilliseconds() & 0x3FFF; // Equals to % 16384
+ uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
- if (period >= 15384)
- return PED_LIGHTS_WALK_BLINK;
- else if (period >= 12000)
+ if(period < 12000)
+ return PED_LIGHTS_DONT_WALK;
+ else if(period < 16384 - 1000)
return PED_LIGHTS_WALK;
else
- return PED_LIGHTS_DONT_WALK;
-} \ No newline at end of file
+ return PED_LIGHTS_WALK_BLINK;
+}
+
+uint8
+CTrafficLights::LightForCars1(void)
+{
+ uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
+
+ if(period < 5000)
+ return CAR_LIGHTS_GREEN;
+ else if(period < 5000 + 1000)
+ return CAR_LIGHTS_YELLOW;
+ else
+ return CAR_LIGHTS_RED;
+}
+
+uint8
+CTrafficLights::LightForCars2(void)
+{
+ uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
+
+ if(period < 6000)
+ return CAR_LIGHTS_RED;
+ else if(period < 12000 - 1000)
+ return CAR_LIGHTS_GREEN;
+ else if(period < 12000)
+ return CAR_LIGHTS_YELLOW;
+ else
+ return CAR_LIGHTS_RED;
+}
+
+STARTPATCHES
+ InjectHook(0x455760, &CTrafficLights::LightForCars1, PATCH_JUMP);
+ InjectHook(0x455790, &CTrafficLights::LightForCars2, PATCH_JUMP);
+ InjectHook(0x4557D0, &CTrafficLights::LightForPeds, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/control/TrafficLights.h b/src/control/TrafficLights.h
index 06505ed6..f3df6cd5 100644
--- a/src/control/TrafficLights.h
+++ b/src/control/TrafficLights.h
@@ -7,6 +7,10 @@ enum {
PED_LIGHTS_WALK,
PED_LIGHTS_WALK_BLINK,
PED_LIGHTS_DONT_WALK,
+
+ CAR_LIGHTS_GREEN = 0,
+ CAR_LIGHTS_YELLOW,
+ CAR_LIGHTS_RED
};
class CTrafficLights
@@ -14,7 +18,10 @@ class CTrafficLights
public:
static void DisplayActualLight(CEntity *ent);
static void ScanForLightsOnMap(void);
+ static int FindTrafficLightType(CEntity *light);
static uint8 LightForPeds(void);
+ static uint8 LightForCars1(void);
+ static uint8 LightForCars2(void);
static bool ShouldCarStopForLight(CVehicle*, bool);
static bool ShouldCarStopForBridge(CVehicle*);
};
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index dc9ef74f..cfdea46a 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -3511,7 +3511,7 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
Up = CVector(0.0f, 0.0f, 1.0f);
if(TheCamera.m_bStartingSpline)
- m_fTimeElapsedFloat += CTimer::GetTimeStepInMilliseconds();
+ m_fTimeElapsedFloat += CTimer::GetTimeStepNonClippedInMilliseconds();
else{
m_fTimeElapsedFloat = 0.0f;
m_uiFinishTime = MS(TheCamera.m_arrPathArray[2].m_arr_PathData[10*((int)TheCamera.m_arrPathArray[2].m_arr_PathData[0]-1) + 1]);
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index c884f751..85145e86 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -31,8 +31,8 @@ enum Direction
DIR_Z_NEG,
};
-eLevelName &CCollision::ms_collisionInMemory = *(eLevelName*)0x8F6250;
-CLinkList<CColModel*> &CCollision::ms_colModelCache = *(CLinkList<CColModel*>*)0x95CB58;
+eLevelName CCollision::ms_collisionInMemory;
+CLinkList<CColModel*> CCollision::ms_colModelCache;
void
CCollision::Init(void)
@@ -1355,6 +1355,7 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
modelB.triangles[aTriangleIndicesB[j]],
modelB.trianglePlanes[aTriangleIndicesB[j]],
spherepoints[numCollisions], coldist);
+
if(hasCollided)
numCollisions++;
}
diff --git a/src/core/Collision.h b/src/core/Collision.h
index 1cbd1690..bdf51eb8 100644
--- a/src/core/Collision.h
+++ b/src/core/Collision.h
@@ -3,6 +3,13 @@
#include "templates.h"
#include "Game.h" // for eLevelName
+// If you spawn many tanks at once, you will see that collisions of two entity exceeds 32.
+#ifdef FIX_BUGS
+#define MAX_COLLISION_POINTS 64
+#else
+#define MAX_COLLISION_POINTS 32
+#endif
+
struct CColSphere
{
CVector center;
@@ -110,8 +117,8 @@ struct CColModel
class CCollision
{
public:
- static eLevelName &ms_collisionInMemory;
- static CLinkList<CColModel*> &ms_colModelCache;
+ static eLevelName ms_collisionInMemory;
+ static CLinkList<CColModel*> ms_colModelCache;
static void Init(void);
static void Shutdown(void);
diff --git a/src/core/Debug.cpp b/src/core/Debug.cpp
index 2b713198..917c99ab 100644
--- a/src/core/Debug.cpp
+++ b/src/core/Debug.cpp
@@ -24,7 +24,7 @@ CDebug::DebugAddText(const char *str)
{
int32 i = 0;
if (*str != '\0') {
- while (i < MAX_STR_LEN) {
+ while (i < MAX_STR_LEN - 1) {
ms_aTextBuffer[ms_nCurrentTextLine][i++] = *(str++);
if (*str == '\0')
break;
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index e0c8b01e..e0a0fafc 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -25,8 +25,6 @@
#include "CdStream.h"
#include "FileLoader.h"
-WRAPPER void CFileLoader::ReloadPaths(const char *filename) { EAXJMP(0x476DB0); }
-
char CFileLoader::ms_line[256];
const char*
@@ -1198,6 +1196,165 @@ CFileLoader::LoadMapZones(const char *filename)
debug("Finished loading IPL\n");
}
+void
+CFileLoader::ReloadPaths(const char *filename)
+{
+ enum {
+ NONE,
+ PATH,
+ };
+ char *line;
+ int section = NONE;
+ int id, pathType, pathIndex = -1;
+ char pathTypeStr[20];
+ debug("Reloading paths from %s...\n", filename);
+
+ int fd = CFileMgr::OpenFile(filename, "r");
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '\0' || *line == '#')
+ continue;
+
+ if (section == NONE) {
+ if (strncmp(line, "path", 4) == 0) {
+ section = PATH;
+ ThePaths.AllocatePathFindInfoMem(4500);
+ }
+ } else if (strncmp(line, "end", 3) == 0) {
+ section = NONE;
+ } else {
+ switch (section) {
+ case PATH:
+ if (pathIndex == -1) {
+ id = LoadPathHeader(line, pathTypeStr);
+ if (strncmp(pathTypeStr, "ped", 4) == 0)
+ pathType = 1;
+ else if (strncmp(pathTypeStr, "car", 4) == 0)
+ pathType = 0;
+ pathIndex = 0;
+ } else {
+ if (pathType == 1)
+ LoadPedPathNode(line, id, pathIndex);
+ else if (pathType == 0)
+ LoadCarPathNode(line, id, pathIndex);
+ pathIndex++;
+ if (pathIndex == 12)
+ pathIndex = -1;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
+
+void
+CFileLoader::ReloadObjectTypes(const char *filename)
+{
+ enum {
+ NONE,
+ OBJS,
+ TOBJ,
+ TWODFX
+ };
+ char *line;
+ int section = NONE;
+ CModelInfo::ReInit2dEffects();
+ debug("Reloading object types from %s...\n", filename);
+
+ CFileMgr::ChangeDir("\\DATA\\MAPS\\");
+ int fd = CFileMgr::OpenFile(filename, "r");
+ CFileMgr::ChangeDir("\\");
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '\0' || *line == '#')
+ continue;
+
+ if (section == NONE) {
+ if (strncmp(line, "objs", 4) == 0) section = OBJS;
+ else if (strncmp(line, "tobj", 4) == 0) section = TOBJ;
+ else if (strncmp(line, "2dfx", 4) == 0) section = TWODFX;
+ } else if (strncmp(line, "end", 3) == 0) {
+ section = NONE;
+ } else {
+ switch (section) {
+ case OBJS:
+ case TOBJ:
+ ReloadObject(line);
+ break;
+ case TWODFX:
+ Load2dEffect(line);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
+
+void
+CFileLoader::ReloadObject(const char *line)
+{
+ int id, numObjs;
+ char model[24], txd[24];
+ float dist[3];
+ uint32 flags;
+ CSimpleModelInfo *mi;
+
+ if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
+ return;
+
+ switch(numObjs){
+ case 1:
+ sscanf(line, "%d %s %s %d %f %d",
+ &id, model, txd, &numObjs, &dist[0], &flags);
+ break;
+ case 2:
+ sscanf(line, "%d %s %s %d %f %f %d",
+ &id, model, txd, &numObjs, &dist[0], &dist[1], &flags);
+ break;
+ case 3:
+ sscanf(line, "%d %s %s %d %f %f %f %d",
+ &id, model, txd, &numObjs, &dist[0], &dist[1], &dist[2], &flags);
+ break;
+ }
+
+ mi = (CSimpleModelInfo*) CModelInfo::GetModelInfo(id);
+ if (
+#ifdef FIX_BUGS
+ mi &&
+#endif
+ mi->m_type == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
+ mi->SetLodDistances(dist);
+ SetModelInfoFlags(mi, flags);
+ } else {
+ printf("Can't reload %s\n", model);
+ }
+}
+
+// unused mobile function - crashes
+void
+CFileLoader::ReLoadScene(const char *filename)
+{
+ char *line;
+ CFileMgr::ChangeDir("\\DATA\\");
+ int fd = CFileMgr::OpenFile(filename, "r");
+ CFileMgr::ChangeDir("\\");
+
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '#')
+ continue;
+
+ if (strncmp(line, "EXIT", 9) == 0) // BUG: 9?
+ break;
+
+ if (strncmp(line, "IDE", 3) == 0) {
+ LoadObjectTypes(line + 4);
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
STARTPATCHES
InjectHook(0x476290, CFileLoader::LoadLevel, PATCH_JUMP);
@@ -1233,4 +1390,8 @@ STARTPATCHES
InjectHook(0x478A90, CFileLoader::LoadCullZone, PATCH_JUMP);
InjectHook(0x478550, CFileLoader::LoadMapZones, PATCH_JUMP);
+
+ InjectHook(0x476DB0, CFileLoader::ReloadPaths, PATCH_JUMP);
+ InjectHook(0x476F30, CFileLoader::ReloadObjectTypes, PATCH_JUMP);
+ InjectHook(0x4772B0, CFileLoader::ReloadObject, PATCH_JUMP);
ENDPATCHES
diff --git a/src/core/FileLoader.h b/src/core/FileLoader.h
index 1b390279..87b8fe61 100644
--- a/src/core/FileLoader.h
+++ b/src/core/FileLoader.h
@@ -43,4 +43,7 @@ public:
static void LoadMapZones(const char *filename);
static void ReloadPaths(const char *filename);
+ static void ReloadObjectTypes(const char *filename);
+ static void ReloadObject(const char *line);
+ static void ReLoadScene(const char *filename); // unused mobile function
};
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index beebacf9..166ecb35 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -8,6 +8,7 @@
#include "Pad.h"
#include "Text.h"
#include "main.h"
+#include "RwHelper.h"
#include "Timer.h"
#include "Game.h"
#include "DMAudio.h"
@@ -28,14 +29,43 @@
#include "Renderer.h"
#include "CdStream.h"
#include "Radar.h"
+#include "Stats.h"
+#include "Messages.h"
+#include "FileLoader.h"
-#define DONT_USE_SUSPICIOUS_FUNCS 1
#define TIDY_UP_PBP // ProcessButtonPresses
#define MAX_VISIBLE_LIST_ROW 30
-#define SCROLLBAR_MAX_HEIGHT 263.0f // actually it's 273. but calculating it from scrollbar drawing code gives 287. i don't know
+#define SCROLLBAR_MAX_HEIGHT 263.0f // not in end result
+
+#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
+#define MILES_IN_METER 0.000621371192f
+#define FEET_IN_METER 3.28084f
+#else
+#define MILES_IN_METER 0.00059880241f
+#define FEET_IN_METER 3.33f
+#endif
+
+#ifdef SCROLLABLE_STATS_PAGE
+#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS)
+#else
+#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS)
+#endif
+
+#ifdef TRIANGLE_BACK_BUTTON
+#define GetBackJustUp GetTriangleJustUp
+#define GetBackJustDown GetTriangleJustDown
+#elif defined(CIRCLE_BACK_BUTTON)
+#define GetBackJustUp GetCircleJustUp
+#define GetBackJustDown GetCircleJustDown
+#else
+#define GetBackJustUp GetSquareJustUp
+#define GetBackJustDown GetSquareJustDown
+#endif
#ifdef MENU_MAP
bool CMenuManager::bMenuMapActive = false;
+bool CMenuManager::bMapMouseShownOnce = false;
+bool CMenuManager::bMapLoaded = false;
float CMenuManager::fMapSize;
float CMenuManager::fMapCenterY;
float CMenuManager::fMapCenterX;
@@ -52,54 +82,63 @@ int curBottomBarOption = -1;
int hoveredBottomBarOption = -1;
#endif
-int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78; // 9
-int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
-int8 &CMenuManager::m_DisplayControllerOnFoot = *(int8*)0x95CD8D;
-int8 &CMenuManager::m_PrefsVsync = *(int8*)0x5F2E58; // 1
-int8 &CMenuManager::m_PrefsVsyncDisp = *(int8*)0x5F2E5C; // 1
-int8 &CMenuManager::m_PrefsFrameLimiter = *(int8*)0x5F2E60; // 1
-int8 &CMenuManager::m_PrefsShowSubtitles = *(int8*)0x5F2E54; // 1
-int8 &CMenuManager::m_PrefsSpeakers = *(int8*)0x95CD7E;
-int32 &CMenuManager::m_ControlMethod = *(int32*)0x8F5F7C;
-int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74; // 1
-int32 &CMenuManager::m_PrefsLanguage = *(int32*)0x941238;
-
-bool &CMenuManager::m_PrefsAllowNastyGame = *(bool*)0x5F2E64; // true
-bool &CMenuManager::m_bStartUpFrontEndRequested = *(bool*)0x95CCF4;
-bool &CMenuManager::m_bShutDownFrontEndRequested = *(bool*)0x95CD6A;
-
-int8 &CMenuManager::m_PrefsUseWideScreen = *(int8*)0x95CD23;
-int8 &CMenuManager::m_PrefsRadioStation = *(int8*)0x95CDA4;
-int32 &CMenuManager::m_PrefsBrightness = *(int32*)0x5F2E50; // 256
-float &CMenuManager::m_PrefsLOD = *(float*)0x8F42C4;
-int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC;
-int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C; // 102
-int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48; // 102
-
-char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74; //[256] "$$\"\""
-
-int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70; // -1
-
-float &CMenuManager::menuXYpadding = *(float*)0x5F355C; // don't know the original name. MENUACTION_X_MARGIN, never changes
-float &CMenuManager::actionTextScaleX = *(float*)0x5F2E40;
-float &CMenuManager::actionTextScaleY = *(float*)0x5F2E44;
-
-int32 &CMenuManager::sthWithButtons = *(int32*)0x8E2880;
-int32 &CMenuManager::sthWithButtons2 = *(int32*)0x942F88;
-
-CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
-
-// Move this somewhere else.
-float &CRenderer::ms_lodDistScale = *(float*)0x5F726C; // 1.2
-
-// Stuff not in CMenuManager:
-uint32 &TimeToStopPadShaking = *(uint32*)0x628CF8;
-char *&pEditString = *(char**)0x628D00;
-int32 *&pControlEdit = *(int32**)0x628D08;
-bool &DisplayComboButtonErrMsg = *(bool*)0x628D14;
-int32 &MouseButtonJustClicked = *(int32*)0x628D0C;
-int32 &JoyButtonJustClicked = *(int32*)0x628D10;
-bool &holdingScrollBar = *(bool*)0x628D59;
+int32 CMenuManager::OS_Language = LANG_ENGLISH;
+int8 CMenuManager::m_PrefsUseVibration;
+int8 CMenuManager::m_DisplayControllerOnFoot;
+int8 CMenuManager::m_PrefsVsync = 1;
+int8 CMenuManager::m_PrefsVsyncDisp = 1;
+int8 CMenuManager::m_PrefsFrameLimiter = 1;
+int8 CMenuManager::m_PrefsShowSubtitles = 1;
+int8 CMenuManager::m_PrefsSpeakers;
+int32 CMenuManager::m_ControlMethod;
+int8 CMenuManager::m_PrefsDMA = 1;
+int32 CMenuManager::m_PrefsLanguage;
+uint8 CMenuManager::m_PrefsStereoMono; // *(bool*)0x95CDB5; // unused except restore settings
+
+bool CMenuManager::m_PrefsAllowNastyGame = true;
+bool CMenuManager::m_bStartUpFrontEndRequested;
+bool CMenuManager::m_bShutDownFrontEndRequested;
+
+int8 CMenuManager::m_PrefsUseWideScreen;
+int8 CMenuManager::m_PrefsRadioStation;
+int32 CMenuManager::m_PrefsBrightness = 256;
+float CMenuManager::m_PrefsLOD = CRenderer::ms_lodDistScale;
+int8 CMenuManager::m_bFrontEnd_ReloadObrTxtGxt;
+int32 CMenuManager::m_PrefsMusicVolume = 102;
+int32 CMenuManager::m_PrefsSfxVolume = 102;
+
+char CMenuManager::m_PrefsSkinFile[256] = "$$\"\"";
+
+int32 CMenuManager::m_KeyPressedCode = -1;
+
+// Originally that was PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway)
+#ifdef PS2_LIKE_MENU
+const CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255);
+#else
+const CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color
+#endif
+
+const float menuXYpadding = MENUACTION_POS_Y; // *(float*)0x5F355C; // not original name
+float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE;
+float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE;
+
+bool holdingScrollBar; // *(bool*)0x628D59; // not original name
+int32 CMenuManager::m_SelectedMap;
+int32 CMenuManager::m_SelectedGameType;
+
+// Used in a hidden menu
+uint8 CMenuManager::m_PrefsPlayerRed = 255;
+uint8 CMenuManager::m_PrefsPlayerGreen = 128;
+uint8 CMenuManager::m_PrefsPlayerBlue; // why??
+
+CMenuManager FrontEndMenuManager;
+
+uint32 TimeToStopPadShaking;
+char *pEditString;
+int32 *pControlEdit;
+bool DisplayComboButtonErrMsg;
+int32 MouseButtonJustClicked;
+int32 JoyButtonJustClicked;
//int32 *pControlTemp = 0;
#ifndef MASTER
@@ -204,8 +243,6 @@ ScaleAndCenterX(float x)
#define MENU_Y(y) StretchY(y)
#endif
-#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS)
-
#ifdef PS2_LIKE_MENU
#define ChangeScreen(screen, option, updateDelay, withReverseAlpha) \
do { \
@@ -243,16 +280,22 @@ ScaleAndCenterX(float x)
} while(0)
#endif
+#define PREPARE_MENU_HEADER \
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); \
+ CFont::SetRightJustifyOn(); \
+ CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); \
+ CFont::SetFontStyle(FONT_HEADING);
+
#define ProcessSlider(value, increaseAction, decreaseAction, hoverStartX, hoverEndX) \
do { \
- lastBarX = DisplaySlider(SCREEN_STRETCH_FROM_RIGHT(MENUSLIDER_X + columnWidth), MENU_Y(bitAboveNextItemY), MENU_Y(smallestSliderBar), MENU_Y(usableLineHeight), MENU_X(MENUSLIDER_UNK), value); \
+ lastActiveBarX = DisplaySlider(SCREEN_STRETCH_FROM_RIGHT(MENUSLIDER_X + columnWidth), MENU_Y(bitAboveNextItemY), MENU_Y(smallestSliderBar), MENU_Y(usableLineHeight), MENU_X(MENUSLIDER_UNK), value); \
if (i != m_nCurrOption || !itemsAreSelectable) \
break; \
\
- if (CheckHover(hoverStartX, lastBarX - MENU_X(10.0f), MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \
+ if (CheckHover(hoverStartX, lastActiveBarX - MENU_X(10.0f), MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \
m_nHoverOption = decreaseAction; \
\
- if (!CheckHover(MENU_X(10.0f) + lastBarX, hoverEndX, MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \
+ if (!CheckHover(MENU_X(10.0f) + lastActiveBarX, hoverEndX, MENU_Y(nextYToUse), MENU_Y(28.0f + nextYToUse))) \
break; \
\
m_nHoverOption = increaseAction; \
@@ -356,18 +399,18 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
// ------ Functions not in the game/inlined ends
void
-CMenuManager::BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2)
+CMenuManager::BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2)
{
if (!text)
return;
if (stat2) {
- if (aFloat)
+ if (itsFloat)
sprintf(gString2, " %.2f %s %.2f", *(float*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(float*)stat2);
else
sprintf(gString2, " %d %s %d", *(int*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(int*)stat2);
} else if (stat) {
- if (aFloat)
+ if (itsFloat)
sprintf(gString2, " %.2f", *(float*)stat);
else
sprintf(gString2, " %d", *(int*)stat);
@@ -378,10 +421,8 @@ CMenuManager::BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2)
AsciiToUnicode(gString2, gUString2);
}
-#if 0
-WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); }
-#else
-void CMenuManager::CentreMousePointer()
+void
+CMenuManager::CentreMousePointer()
{
tagPOINT Point;
@@ -395,28 +436,88 @@ void CMenuManager::CentreMousePointer()
PSGLOBAL(lastMousePos.y) = SCREEN_HEIGHT / 2;
}
}
-#endif
-#if 1
-WRAPPER int CMenuManager::CheckCodesForControls(int32) { EAXJMP(0x48A950); }
-#else
-void CMenuManager::CheckCodesForControls(int, int)
+void
+CMenuManager::CheckCodesForControls(int typeOfControl)
{
- DisplayComboButtonErrMsg = 0;
-}
+ DisplayComboButtonErrMsg = false;
+ bool invalidKey = false;
+ bool escPressed = false;
+ eControllerType typeToSave;
+ // GetStartOptionsCntrlConfigScreens();
+ e_ControllerAction action = (e_ControllerAction) m_CurrCntrlAction;
+
+ if (typeOfControl == KEYBOARD) {
+ if (*pControlEdit == rsESC) {
+ escPressed = true;
+ } else if (*pControlEdit != rsF1 && *pControlEdit != rsF2 && *pControlEdit != rsF3 && *pControlEdit != rsF9 &&
+ *pControlEdit != rsLWIN && *pControlEdit != rsRWIN && *pControlEdit != rsRALT) {
+ typeToSave = KEYBOARD;
+ if (ControlsManager.GetControllerKeyAssociatedWithAction(action, KEYBOARD) != rsNULL &&
+ *pControlEdit != ControlsManager.GetControllerKeyAssociatedWithAction(action, KEYBOARD)) {
+ typeToSave = OPTIONAL_EXTRA;
+ }
+ } else {
+ invalidKey = true;
+ }
+ } else if (typeOfControl == MOUSE) {
+ typeToSave = MOUSE;
+ } else if (typeOfControl == JOYSTICK) {
+ typeToSave = JOYSTICK;
+ if (ControlsManager.GetIsActionAButtonCombo(action))
+ DisplayComboButtonErrMsg = true;
+ }
+
+#ifdef FIX_BUGS
+ if(!escPressed && !invalidKey)
#endif
+ ControlsManager.ClearSettingsAssociatedWithAction(action, typeToSave);
+ if (!DisplayComboButtonErrMsg && !escPressed && !invalidKey) {
+ if (typeOfControl == KEYBOARD) {
+ ControlsManager.DeleteMatchingActionInitiators(action, *pControlEdit, KEYBOARD);
+ ControlsManager.DeleteMatchingActionInitiators(action, *pControlEdit, OPTIONAL_EXTRA);
+ } else {
+ if (typeOfControl == MOUSE) {
+ ControlsManager.DeleteMatchingActionInitiators(action, MouseButtonJustClicked, MOUSE);
+ } else if (typeOfControl == JOYSTICK) {
+ ControlsManager.DeleteMatchingActionInitiators(action, JoyButtonJustClicked, JOYSTICK);
+ }
+ }
+ if (typeOfControl == KEYBOARD) {
+ ControlsManager.SetControllerKeyAssociatedWithAction(action, *pControlEdit, typeToSave);
-#if 0
-WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); }
-#else
-bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
+ } else if (typeOfControl == MOUSE) {
+ ControlsManager.SetControllerKeyAssociatedWithAction(action, MouseButtonJustClicked, typeToSave);
+ } else {
+ if (typeOfControl == JOYSTICK) {
+ ControlsManager.SetControllerKeyAssociatedWithAction(action, JoyButtonJustClicked, typeToSave);
+ }
+ }
+ pControlEdit = nil;
+ m_bWaitingForNewKeyBind = false;
+ m_KeyPressedCode = -1;
+ m_bStartWaitingForKeyBind = false;
+ SaveSettings();
+ }
+
+ if (escPressed) {
+ pControlEdit = nil;
+ m_bWaitingForNewKeyBind = false;
+ m_KeyPressedCode = -1;
+ m_bStartWaitingForKeyBind = false;
+ SaveSettings();
+ }
+}
+
+bool
+CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
{
return m_nMousePosX > x1 && m_nMousePosX < x2 &&
m_nMousePosY > y1 && m_nMousePosY < y2;
}
-#endif
-void CMenuManager::CheckSliderMovement(int value)
+void
+CMenuManager::CheckSliderMovement(int value)
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_BRIGHTNESS:
@@ -452,103 +553,106 @@ void CMenuManager::CheckSliderMovement(int value)
SaveSettings();
}
-#if 1
-WRAPPER int CMenuManager::CostructStatLine(int) { EAXJMP(0x482800); }
-#else
-int CMenuManager::CostructStatLine(int)
+void
+CMenuManager::DisplayHelperText()
{
+ // there was a unused static bool
+ static uint32 LastFlash = 0;
+ int32 alpha;
-}
-#endif
-
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::DisplayHelperText() { EAXJMP(0x48B490); }
-#else
-void CMenuManager::DisplayHelperText()
-{
- static int32 AlphaText = 255;
- static int32 Time = 0;
+ if (m_nHelperTextMsgId != 0 && m_nHelperTextMsgId != 1) {
- if (m_nHelperTextMsgId && m_nHelperTextMsgId != 1) {
- if (CTimer::GetTimeInMillisecondsPauseMode() - Time > 10) {
- Time = CTimer::GetTimeInMillisecondsPauseMode();
+ // FIX: High fps bug
+#ifndef FIX_BUGS
+ if (CTimer::GetTimeInMillisecondsPauseMode() - LastFlash > 10) {
+ LastFlash = CTimer::GetTimeInMillisecondsPauseMode();
m_nHelperTextAlpha -= 2;
+ }
+#else
+ static float fadeAlpha = 0.0f; // To keep it precisely
+ if (m_nHelperTextAlpha >= 255 && fadeAlpha < 250) fadeAlpha = m_nHelperTextAlpha;
- if (AlphaText < 1)
- ResetHelperText();
+ // -2 per every 33 ms (1000.f/30.f - original frame limiter fps)
+ fadeAlpha -= (frameTime / 33.0f) * 2.0f;
+ m_nHelperTextAlpha = fadeAlpha;
+#endif
+ if (m_nHelperTextAlpha < 1)
+ ResetHelperText();
- AlphaText = m_nHelperTextAlpha > 255 ? 255 : m_nHelperTextAlpha;
- }
+ alpha = m_nHelperTextAlpha > 255 ? 255 : m_nHelperTextAlpha;
}
- wchar *HelperTextToPrint = nil;
+ CFont::SetCentreOn();
+ CFont::SetScale(SCREEN_SCALE_X(SMALLESTTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_HEADING);
+
// TODO: name this cases?
switch (m_nHelperTextMsgId) {
- case 0:
- HelperTextToPrint = TheText.Get("FET_MIG");
- break;
- case 1:
- HelperTextToPrint = TheText.Get("FET_APP");
- break;
- case 2:
- HelperTextToPrint = TheText.Get("FET_HRD");
- break;
- case 3:
- HelperTextToPrint = TheText.Get("FET_RSO");
- break;
- case 4:
- HelperTextToPrint = TheText.Get("FET_RSC");
- break;
- default:
- break;
+ case 0:
+ {
+ int action = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
+ if (action != MENUACTION_CHANGEMENU && action != MENUACTION_REDEFCTRL && 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"));
+ }
+ break;
+ }
+ case 1:
+ CFont::SetColor(CRGBA(255, 255, 255, 255));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_APP"));
+ break;
+ case 2:
+ CFont::SetColor(CRGBA(255, 255, 255, alpha));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_HRD"));
+ break;
+ case 3:
+ CFont::SetColor(CRGBA(255, 255, 255, alpha));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_RSO"));
+ break;
+ case 4:
+ CFont::SetColor(CRGBA(255, 255, 255, alpha));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_RSC"));
+ break;
+ default:
+ break;
}
-
- CFont::SetAlignment(ALIGN_CENTER);
- CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f));
- CFont::SetFontStyle(FONT_HEADING);
- CFont::SetDropColor(CRGBA(0, 0, 0, AlphaText));
- CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
- CFont::SetColor(CRGBA(255, 255, 255, AlphaText));
-
- CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_FROM_BOTTOM(120.0f), HelperTextToPrint);
+ CFont::SetRightJustifyOff();
}
-#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER int CMenuManager::DisplaySlider(float, float, float, float, float, float) { EAXJMP(0x488420); }
-#else
-int CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightSize, float rectSize, float progress)
+int
+CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostRightBarSize, float rectSize, float progress)
{
CRGBA color;
- float sizeRange;
+ float maxBarHeight;
- float input = 0.0f;
+ int lastActiveBarX = 0;
+ float curBarX = 0.0f;
+ float spacing = SCREEN_SCALE_X(10.0f);
for (int i = 0; i < 16; i++) {
- input = i * rectSize/16.0f + x;
+ curBarX = i * rectSize/16.0f + x;
- if (i/16.0f + 1/32.0f < progress)
+ if (i / 16.0f + 1 / 32.0f < progress) {
color = CRGBA(255, 217, 106, FadeIn(255));
- else
+ lastActiveBarX = curBarX;
+ } else
color = CRGBA(185, 120, 0, FadeIn(255));
- sizeRange = max(leftSize, rightSize);
+ maxBarHeight = max(mostLeftBarSize, mostRightBarSize);
- float _x = i * rectSize/16.0f + x;
- float _y = y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f;
- float _w = SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x;
- float _h = y + sizeRange;
- float _s = SCREEN_SCALE_X(2.0f);
- CSprite2d::DrawRect(CRect(_x + _s, _y + _s, _w + _s, _h + _s), CRGBA(0, 0, 0, FadeIn(255))); // Shadow
- CSprite2d::DrawRect(CRect(i * rectSize/16.0f + x, y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f, SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x, y + sizeRange), color);
+ float curBarFreeSpace = ((16 - i) * mostLeftBarSize + i * mostRightBarSize) / 16.0f;
+ float left = curBarX;
+ float top = y + maxBarHeight - curBarFreeSpace;
+ float right = spacing + curBarX;
+ float bottom = y + maxBarHeight;
+ float shadowOffset = SCREEN_SCALE_X(2.0f);
+ CSprite2d::DrawRect(CRect(left + shadowOffset, top + shadowOffset, right + shadowOffset, bottom + shadowOffset), CRGBA(0, 0, 0, FadeIn(200))); // Shadow
+ CSprite2d::DrawRect(CRect(left, top, right, bottom), color);
}
- return input;
+ return lastActiveBarX;
}
-#endif
-#if 0
-WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x48AB40); }
-#else
-void CMenuManager::DoSettingsBeforeStartingAGame()
+void
+CMenuManager::DoSettingsBeforeStartingAGame()
{
CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
if (m_PrefsVsyncDisp != m_PrefsVsync)
@@ -563,19 +667,27 @@ void CMenuManager::DoSettingsBeforeStartingAGame()
DMAudio.SetMusicFadeVol(0);
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
}
-#endif
-#if 0
-WRAPPER void CMenuManager::Draw() { EAXJMP(0x47AE00); }
-#else
-void CMenuManager::Draw()
+void
+CMenuManager::Draw()
{
CFont::SetBackgroundOff();
CFont::SetPropOn();
CFont::SetCentreOff();
CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn();
- CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENUACTION_X_MARGIN));
+#ifdef GTA3_1_1_PATCH
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ CFont::SetRightJustifyOn();
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(MENU_X(0.7f), MENU_Y(0.5f));
+ CFont::SetWrapx(SCREEN_WIDTH);
+ CFont::SetRightJustifyWrap(0.0f);
+ strcpy(gString, "V1.1");
+ AsciiToUnicode(gString, gUString);
+ CFont::PrintString(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 45, gUString);
+#endif
+ CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
switch (m_nCurrScreen) {
@@ -601,24 +713,16 @@ void CMenuManager::Draw()
#endif
if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') {
- CFont::SetRightJustifyOn();
- CFont::SetFontStyle(FONT_HEADING);
-#ifdef PS2_LIKE_MENU
- CFont::SetColor(CRGBA(0, 0, 0, 255));
- CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(1.3f));
- CFont::PrintString(MENU_X_RIGHT_ALIGNED(50.0f), SCREEN_SCALE_FROM_BOTTOM(75.0f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
-#else
- CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
- CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT));
+ PREPARE_MENU_HEADER
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
-#endif
+
// Weird place to put that.
nextYToUse += 24.0f + 10.0f;
}
CFont::SetFontStyle(FONT_BANK);
- CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * actionTextScaleX), MENU_Y(MENUACTION_SCALE_MULT * actionTextScaleY));
- CFont::SetRightJustifyOff(); // AG used SetAlignment(ALIGN_LEFT);
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y));
+ CFont::SetRightJustifyOff();
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
// Label
@@ -649,10 +753,10 @@ void CMenuManager::Draw()
}
#ifdef FIX_BUGS
- // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in menu.
- CFont::PrintString(MENU_X_LEFT_ALIGNED(MENUACTION_X_MARGIN), MENU_Y(menuXYpadding), str);
+ // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in here.
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(menuXYpadding), str);
#else
- CFont::PrintString(MENUACTION_X_MARGIN, menuXYpadding, str);
+ CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str);
#endif
}
@@ -673,7 +777,7 @@ void CMenuManager::Draw()
headerHeight = 240;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
case MENUPAGE_SOUND_SETTINGS:
@@ -690,7 +794,7 @@ void CMenuManager::Draw()
headerHeight = 0;
lineHeight = 20;
CFont::SetFontStyle(FONT_HEADING);
- CFont::SetScale(MENU_X(actionTextScaleX = 0.55f), MENU_Y(actionTextScaleY = 0.8f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = MEDIUMTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = MEDIUMTEXT_Y_SCALE));
CFont::SetRightJustifyOff();
break;
case MENUPAGE_CHOOSE_LOAD_SLOT:
@@ -700,7 +804,7 @@ void CMenuManager::Draw()
headerHeight = 38;
lineHeight = 20;
CFont::SetFontStyle(FONT_BANK);
- CFont::SetScale(MENU_X(actionTextScaleX = SMALLTEXT_X_SCALE), MENU_Y(actionTextScaleY = SMALLTEXT_Y_SCALE));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE));
CFont::SetRightJustifyOff();
break;
case MENUPAGE_NEW_GAME_RELOAD:
@@ -712,7 +816,7 @@ void CMenuManager::Draw()
headerHeight = 60;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
case MENUPAGE_START_MENU:
@@ -720,7 +824,7 @@ void CMenuManager::Draw()
headerHeight = 140;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
case MENUPAGE_PAUSE_MENU:
@@ -728,7 +832,7 @@ void CMenuManager::Draw()
headerHeight = 117;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
#ifdef PS2_SAVE_DIALOG
@@ -737,7 +841,7 @@ void CMenuManager::Draw()
headerHeight = 60;
lineHeight = 24;
CFont::SetFontStyle(FONT_BANK);
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
break;
#endif
default:
@@ -745,11 +849,15 @@ void CMenuManager::Draw()
headerHeight = 40;
lineHeight = 24;
CFont::SetFontStyle(FONT_HEADING);
- CFont::SetScale(MENU_X(actionTextScaleX = 0.75f), MENU_Y(actionTextScaleY = 0.9f));
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
CFont::SetCentreOn();
break;
}
+#ifdef PS2_LIKE_MENU
+ CFont::SetFontStyle(FONT_BANK);
+#endif
+
switch (m_nCurrScreen) {
case MENUPAGE_CONTROLLER_PC_OLD1:
case MENUPAGE_CONTROLLER_PC_OLD2:
@@ -759,7 +867,7 @@ void CMenuManager::Draw()
if (m_bWaitingForNewKeyBind)
itemsAreSelectable = false;
- CMenuManager::DrawControllerScreenExtraText(nextYToUse - 8.0f, 350, lineHeight);
+ DrawControllerScreenExtraText(nextYToUse - 8.0f, MENU_X_LEFT_ALIGNED(350), lineHeight);
break;
default:
break;
@@ -794,7 +902,7 @@ void CMenuManager::Draw()
case MENUACTION_CHANGEMENU: {
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu) {
case MENUPAGE_MULTIPLAYER_MAP:
- switch (sthWithButtons) {
+ switch (m_SelectedMap) {
case 0:
rightText = TheText.Get("FEM_MA0");
break;
@@ -824,7 +932,7 @@ void CMenuManager::Draw()
}
break;
case MENUPAGE_MULTIPLAYER_MODE:
- switch (sthWithButtons2) {
+ switch (m_SelectedGameType) {
case 0:
rightText = TheText.Get("FEN_TY0");
break;
@@ -859,7 +967,7 @@ void CMenuManager::Draw()
break;
}
case MENUACTION_CTRLVIBRATION:
- if (CMenuManager::m_PrefsUseVibration)
+ if (m_PrefsUseVibration)
rightText = TheText.Get("FEM_ON");
else
rightText = TheText.Get("FEM_OFF");
@@ -1025,23 +1133,23 @@ void CMenuManager::Draw()
#endif
m_nMousePosY < MENU_Y((nextYToCheck + 2) + usableLineHeight)) {
- static int lastHoveringOption = -99;
- static int lastScreen = m_nCurrScreen;
+ static int oldOption = -99;
+ static int oldScreen = m_nCurrScreen;
m_nPrevOption = rowToCheck;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrOption = rowToCheck;
m_bShowMouse = true;
}
- if (lastHoveringOption != m_nCurrOption) {
- if (lastScreen == m_nCurrScreen && m_bShowMouse)
+ if (oldOption != m_nCurrOption) {
+ if (oldScreen == m_nCurrScreen && m_bShowMouse)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
- lastHoveringOption = m_nCurrOption;
- lastScreen = m_nCurrScreen;
+ oldOption = m_nCurrOption;
+ oldScreen = m_nCurrScreen;
}
- if (lastScreen == m_nPrevScreen)
- lastScreen = m_nCurrScreen;
+ if (oldScreen == m_nPrevScreen)
+ oldScreen = m_nCurrScreen;
m_nHoverOption = HOVEROPTION_RANDOM_ITEM;
foundTheHoveringItem = true;
@@ -1124,7 +1232,7 @@ void CMenuManager::Draw()
// Sliders
// We stretch slider start X here(like original code), because it will always be center of screen
- int lastBarX;
+ int lastActiveBarX;
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_BRIGHTNESS:
ProcessSlider(m_PrefsBrightness / 512.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
@@ -1184,21 +1292,18 @@ void CMenuManager::Draw()
if (m_nCurrScreen == MENUPAGE_CONTROLLER_SETTINGS)
PrintController();
-
-/* else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT_OLD) {
- CSprite2d::DrawRect(CRect(StretchX(180), MENU_Y(98), StretchX(230), MENU_Y(123)), CRGBA(255, 255, 255, FadeIn(255)));
- CSprite2d::DrawRect(CRect(StretchX(181), MENU_Y(99), StretchX(229), MENU_Y(233)), CRGBA(Player color from PickNewPlayerColour, FadeIn(255)));
+ else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT_OLD) {
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(180), MENU_Y(98), MENU_X_LEFT_ALIGNED(230), MENU_Y(123)), CRGBA(255, 255, 255, FadeIn(255)));
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(181), MENU_Y(99), MENU_X_LEFT_ALIGNED(229), MENU_Y(122)), CRGBA(m_PrefsPlayerRed, m_PrefsPlayerGreen, m_PrefsPlayerBlue, FadeIn(255)));
}
-*/
+
}
-#endif
int
CMenuManager::GetNumOptionsCntrlConfigScreens(void)
{
int number = 0;
- switch (m_nCurrScreen)
- {
+ switch (m_nCurrScreen) {
case MENUPAGE_CONTROLLER_PC_OLD3:
number = 2;
break;
@@ -1227,12 +1332,12 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
int numOptions = GetNumOptionsCntrlConfigScreens();
int bindingMargin = MENU_X(3.0f);
float rowHeight;
- switch (CMenuManager::m_ControlMethod) {
+ switch (m_ControlMethod) {
case CONTROL_STANDARD:
- rowHeight = 10.7f;
+ rowHeight = CONTSETUP_STANDARD_ROW_HEIGHT;
break;
case CONTROL_CLASSIC:
- rowHeight = 9.0f;
+ rowHeight = CONTSETUP_CLASSIC_ROW_HEIGHT;
break;
default:
break;
@@ -1302,13 +1407,13 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
controllerAction = PED_LOOKBEHIND;
break;
case 23:
- if (CMenuManager::m_ControlMethod == CONTROL_STANDARD)
+ if (m_ControlMethod == CONTROL_STANDARD)
controllerAction = -1;
else
controllerAction = PED_1RST_PERSON_LOOK_LEFT;
break;
case 24:
- if (CMenuManager::m_ControlMethod == CONTROL_STANDARD)
+ if (m_ControlMethod == CONTROL_STANDARD)
controllerAction = -1;
else
controllerAction = PED_1RST_PERSON_LOOK_RIGHT;
@@ -1415,15 +1520,19 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
if (column == CONTSETUP_PED_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_PED_COLUMN) {
#ifdef FIX_BUGS
if (controllerAction == -1) {
- CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(190.0f), MENU_Y(bgY + 10)), CRGBA(235, 170, 50, FadeIn(150)));
+ CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
+ MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150)));
} else {
- CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(190.0f), MENU_Y(bgY + 10)), CRGBA(255, 217, 106, FadeIn(210)));
+ CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
+ MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210)));
}
#else
if (controllerAction == -1) {
- CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY), MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + 10)), CRGBA(235, 170, 50, FadeIn(150)));
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY),
+ MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150)));
} else {
- CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY), MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + 10)), CRGBA(255, 217, 106, FadeIn(210)));
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY),
+ MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210)));
}
#endif
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
@@ -1432,9 +1541,11 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
} else if (column == CONTSETUP_VEHICLE_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_VEHICLE_COLUMN) {
#ifdef FIX_BUGS
if (controllerAction == -1) {
- CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(190.0f), MENU_Y(bgY + 10)), CRGBA(235, 170, 50, FadeIn(150)));
+ CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
+ MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(235, 170, 50, FadeIn(150)));
} else {
- CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(190.0f), MENU_Y(bgY + 10)), CRGBA(255, 217, 106, FadeIn(210)));
+ CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
+ MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(255, 217, 106, FadeIn(210)));
}
#else
if (controllerAction == -1) {
@@ -1553,25 +1664,269 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
}
}
-#if 1
-WRAPPER void CMenuManager::DrawControllerScreenExtraText(int, int, int) { EAXJMP(0x4892F0); }
-#else
-void CMenuManager::DrawControllerScreenExtraText(int, int, int)
+void
+CMenuManager::DrawControllerScreenExtraText(int yStart, int xStart, int lineHeight)
{
+ int extraTextStart = GetStartOptionsCntrlConfigScreens();
+ int numOpts = GetNumOptionsCntrlConfigScreens();
+ int spacing = MENU_X(10.0f);
+ for (int i = extraTextStart; i < extraTextStart + numOpts; i++) {
+ int numTextsPrinted = 0;
+ int nextX = xStart;
+ for (int j = 1; j < 5; j++) {
+ wchar *text = ControlsManager.GetControllerSettingTextWithOrderNumber((e_ControllerAction)i, (eContSetOrder)j);
+ if (text)
+ ++numTextsPrinted;
+
+ if (text) {
+ // Seperator
+ if (numTextsPrinted > 1) {
+ CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT"));
+ nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX;
+ }
+ CFont::PrintString(nextX, MENU_Y(yStart), text);
+ }
+ if (text)
+ nextX = CFont::GetStringWidth(text, true) + spacing + nextX;
+ }
+ if (m_nCurrOption == i - extraTextStart && m_bWaitingForNewKeyBind) {
+ static bool waitingTextVisible = false;
+ // Seperator
+ if (numTextsPrinted > 0) {
+ CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT"));
+ nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX;
+ }
+ static uint32 lastStateChange = 0;
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastStateChange > 150) {
+ waitingTextVisible = !waitingTextVisible;
+ lastStateChange = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+ if (waitingTextVisible) {
+ CFont::SetColor(CRGBA(255, 255, 0, FadeIn(255)));
+ CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_QUE"));
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ }
+ }
+ yStart += lineHeight;
+ }
+ wchar *error = nil;
+ if (DisplayComboButtonErrMsg)
+ error = ControlsManager.GetButtonComboText((e_ControllerAction)(m_nCurrOption + extraTextStart));
+
+ if (error) {
+ CFont::SetColor(CRGBA(233, 22, 159, 255));
+ CFont::PrintString(xStart, MENU_Y(yStart + 10), error);
+ }
}
+
+void
+CMenuManager::DrawControllerSetupScreen()
+{
+ float rowHeight;
+ switch (m_ControlMethod) {
+ case CONTROL_STANDARD:
+ rowHeight = CONTSETUP_STANDARD_ROW_HEIGHT;
+ break;
+ case CONTROL_CLASSIC:
+ rowHeight = CONTSETUP_CLASSIC_ROW_HEIGHT;
+ break;
+ default:
+ break;
+ }
+ CFont::SetBackgroundOff();
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
+ CFont::SetPropOn();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOn();
+ CFont::SetRightJustifyOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
+
+ PREPARE_MENU_HEADER
+
+ switch (m_ControlMethod) {
+ case CONTROL_STANDARD:
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y),
+ TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
+ break;
+ case CONTROL_CLASSIC:
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y),
+ TheText.Get("FET_CTI"));
+ break;
+ default:
+ break;
+ }
+ wchar *actionTexts[31];
+ actionTexts[0] = TheText.Get("FEC_FIR");
+ actionTexts[1] = TheText.Get("FEC_NWE");
+ actionTexts[2] = TheText.Get("FEC_PWE");
+ actionTexts[3] = TheText.Get("FEC_FOR");
+ actionTexts[4] = TheText.Get("FEC_BAC");
+ actionTexts[5] = TheText.Get("FEC_LEF");
+ actionTexts[6] = TheText.Get("FEC_RIG");
+ actionTexts[7] = TheText.Get("FEC_ZIN");
+ actionTexts[8] = TheText.Get("FEC_ZOT");
+ actionTexts[9] = TheText.Get("FEC_EEX");
+ actionTexts[10] = TheText.Get("FEC_RAD");
+ actionTexts[11] = TheText.Get("FEC_HRN");
+ actionTexts[12] = TheText.Get("FEC_SUB");
+ actionTexts[13] = TheText.Get("FEC_CMR");
+ actionTexts[14] = TheText.Get("FEC_JMP");
+ actionTexts[15] = TheText.Get("FEC_SPN");
+ actionTexts[16] = TheText.Get("FEC_HND");
+ actionTexts[17] = TheText.Get("FEC_TAR");
+ if (m_ControlMethod == CONTROL_CLASSIC) {
+ actionTexts[18] = TheText.Get("FEC_TFL");
+ actionTexts[19] = TheText.Get("FEC_TFR");
+ actionTexts[20] = TheText.Get("FEC_TFU");
+ actionTexts[21] = TheText.Get("FEC_TFD");
+ actionTexts[22] = TheText.Get("FEC_LBA");
+ actionTexts[23] = TheText.Get("FEC_LOL");
+ actionTexts[24] = TheText.Get("FEC_LOR");
+ actionTexts[25] = TheText.Get("FEC_LUD");
+ actionTexts[26] = TheText.Get("FEC_LDU");
+ actionTexts[27] = TheText.Get("FEC_NTR");
+ actionTexts[28] = TheText.Get("FEC_PTT");
+ actionTexts[29] = TheText.Get("FEC_CEN");
+ actionTexts[30] = nil;
+ } else {
+ actionTexts[18] = TheText.Get("FEC_TFL");
+ actionTexts[19] = TheText.Get("FEC_TFR");
+ actionTexts[20] = TheText.Get("FEC_TFU");
+ actionTexts[21] = TheText.Get("FEC_TFD");
+ actionTexts[22] = TheText.Get("FEC_LBA");
+ actionTexts[23] = TheText.Get("FEC_LOL");
+ actionTexts[24] = TheText.Get("FEC_LOR");
+ actionTexts[25] = nil;
+ }
+
+ // Gray panel background
+ CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT), MENU_Y(CONTSETUP_LIST_TOP),
+ MENU_X_RIGHT_ALIGNED(CONTSETUP_LIST_RIGHT), SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_LIST_BOTTOM)),
+ CRGBA(200, 200, 50, FadeIn(50)));
+
+ if (m_nCurrExLayer == HOVEROPTION_LIST)
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+ else
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+
+ // List header
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_1_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CAC"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CFT"));
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CCR"));
+ CFont::SetRightJustifyOff();
+ CFont::SetScale(MENU_X_LEFT_ALIGNED(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ CFont::SetFontStyle(FONT_BANK);
+ int yStart;
+ if (m_ControlMethod == CONTROL_CLASSIC)
+ yStart = CONTSETUP_LIST_HEADER_HEIGHT + 29;
+ else
+ yStart = CONTSETUP_LIST_HEADER_HEIGHT + 34;
+
+ for (int i = 0; i < ARRAY_SIZE(actionTexts); ++i) {
+ wchar *actionText = actionTexts[i];
+ if (!actionText)
+ break;
+
+ if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT + 2.0f) &&
+ m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X + CONTSETUP_BOUND_COLUMN_WIDTH)) {
+
+ 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);
+
+ m_nPrevOption = i;
+ if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
+ m_nCurrExLayer = HOVEROPTION_LIST;
+ m_nSelectedListRow = i;
+
+ // why different number for 3rd column hovering X?? this function is a mess
+#ifdef FIX_BUGS
+ if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH)) {
+#else
+ 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);
-#if 1
-WRAPPER void CMenuManager::DrawControllerSetupScreen() { EAXJMP(0x481210); }
+ m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN;
+#ifdef FIX_BUGS
+ } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH) && m_nMousePosX < SCREEN_WIDTH) {
#else
-void 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);
+
+ m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
+ }
+ }
+ // what??
+ if (m_nHoverOption == HOVEROPTION_SKIN) {
+ if (i == m_nSelectedListRow) {
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ m_bWaitingForNewKeyBind = true;
+ m_bStartWaitingForKeyBind = true;
+ pControlEdit = &m_KeyPressedCode;
+ }
+ } else
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ }
+ }
+ if (m_nSelectedListRow != 35)
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ else if (m_nCurrExLayer == HOVEROPTION_LIST)
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+
+ CFont::SetRightJustifyOff();
+ if (m_PrefsLanguage != LANGUAGE_GERMAN || i != 20 && i != 21)
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE));
+ else
+ CFont::SetScale(MENU_X(0.32f), MENU_Y(SMALLESTTEXT_Y_SCALE));
+
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_1_X), MENU_Y(i * rowHeight + yStart), actionText);
+ }
+ DrawControllerBound(yStart, MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X), rowHeight, CONTSETUP_PED_COLUMN);
+ DrawControllerBound(yStart, MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), rowHeight, CONTSETUP_VEHICLE_COLUMN);
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
+
+ if ((m_nMousePosX > MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT) - CFont::GetStringWidth(TheText.Get("FEDS_TB"), true)
+ && m_nMousePosX < MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT) && m_nMousePosY > SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM)
+ && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM - CONTSETUP_BACK_HEIGHT)) || m_nCurrExLayer == HOVEROPTION_BACK) {
+ m_nHoverOption = HOVEROPTION_BACK;
+
+ } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT + 2.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X + CONTSETUP_BOUND_COLUMN_WIDTH)
+ && m_nMousePosY > MENU_Y(CONTSETUP_LIST_TOP + CONTSETUP_LIST_HEADER_HEIGHT) && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_LIST_BOTTOM + 5.0f)) {
+ m_nHoverOption = HOVEROPTION_LIST;
+
+ } else {
+ m_nHoverOption = HOVEROPTION_NOT_HOVERING;
+ }
+
+ // Back button and it's shadow
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
+ CFont::SetRightJustifyOn();
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90)));
+ for (int i = 0; i < 2; i++) {
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT - 2.0f - i),
+ SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM - 4.0f - i), TheText.Get("FEDS_TB"));
+ if (m_nHoverOption == HOVEROPTION_BACK)
+ CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255)));
+ else
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ }
}
-#endif
-void CMenuManager::DrawFrontEnd()
+void
+CMenuManager::DrawFrontEnd()
{
CFont::SetAlphaFade(255.0f);
@@ -1628,7 +1983,8 @@ void CMenuManager::DrawFrontEnd()
}
#ifdef PS2_SAVE_DIALOG
-void CMenuManager::DrawFrontEndSaveZone()
+void
+CMenuManager::DrawFrontEndSaveZone()
{
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -1640,7 +1996,7 @@ void CMenuManager::DrawFrontEndSaveZone()
m_nMenuFadeAlpha = 255;
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
- CMenuManager::Draw();
+ Draw();
CFont::DrawFonts();
@@ -1671,7 +2027,8 @@ void CMenuManager::DrawFrontEndSaveZone()
#endif
#ifdef PS2_LIKE_MENU
-void CMenuManager::DrawFrontEndNormal()
+void
+CMenuManager::DrawFrontEndNormal()
{
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -1747,13 +2104,11 @@ void CMenuManager::DrawFrontEndNormal()
reverseAlpha = false;
ChangeScreen(pendingScreen, pendingOption, true, false);
} else {
- float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
-
// +20 per every 33 ms (1000.f/30.f - original frame limiter fps)
if (!reverseAlpha)
- fadeAlpha += (timestep * 100.f) * 20.f / 33.f;
+ fadeAlpha += (frameTime) * 20.f / 33.f;
else
- fadeAlpha = max(0.0f, fadeAlpha - (timestep * 100.f) * 30.f / 33.f);
+ fadeAlpha = max(0.0f, fadeAlpha - (frameTime) * 30.f / 33.f);
m_nMenuFadeAlpha = fadeAlpha;
}
@@ -1762,8 +2117,7 @@ void CMenuManager::DrawFrontEndNormal()
if (lastState == 0) fadeAlpha = 255.f;
if (reverseAlpha) {
- float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
- fadeAlpha -= (timestep * 100.f) * 30.f / 33.f;
+ fadeAlpha -= (frameTime) * 30.f / 33.f;
m_nMenuFadeAlpha = fadeAlpha;
}
@@ -1785,18 +2139,18 @@ void CMenuManager::DrawFrontEndNormal()
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
- CMenuManager::DrawPlayerSetupScreen();
+ DrawPlayerSetupScreen();
break;
case MENUPAGE_KEYBOARD_CONTROLS:
- CMenuManager::DrawControllerSetupScreen();
+ DrawControllerSetupScreen();
break;
default:
- CMenuManager::Draw();
+ Draw();
break;
}
#define optionWidth MENU_X(66.0f)
- #define rawOptionHeight 20.0f
+ #define rawOptionHeight 22.0f
#define optionBottom SCREEN_SCALE_FROM_BOTTOM(20.0f)
#define optionTop SCREEN_SCALE_FROM_BOTTOM(20.0f + rawOptionHeight)
#define leftPadding MENU_X_LEFT_ALIGNED(90.0f)
@@ -1865,7 +2219,8 @@ void CMenuManager::DrawFrontEndNormal()
}
}
#else
-void CMenuManager::DrawFrontEndNormal()
+void
+CMenuManager::DrawFrontEndNormal()
{
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -1971,10 +2326,8 @@ void CMenuManager::DrawFrontEndNormal()
static float fadeAlpha = 0.0f;
if (m_nMenuFadeAlpha == 0 && fadeAlpha > 1.0f) fadeAlpha = 0.0f;
- float timestep = CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
-
// +20 per every 33 ms (1000.f/30.f - original frame limiter fps)
- fadeAlpha += (timestep * 100.f) * 20.f / 33.f;
+ fadeAlpha += (frameTime) * 20.f / 33.f;
m_nMenuFadeAlpha = fadeAlpha;
#else
static uint32 LastFade = 0;
@@ -2019,13 +2372,13 @@ void CMenuManager::DrawFrontEndNormal()
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
- CMenuManager::DrawPlayerSetupScreen();
+ DrawPlayerSetupScreen();
break;
case MENUPAGE_KEYBOARD_CONTROLS:
- CMenuManager::DrawControllerSetupScreen();
+ DrawControllerSetupScreen();
break;
default:
- CMenuManager::Draw();
+ Draw();
break;
}
@@ -2057,10 +2410,8 @@ void CMenuManager::DrawFrontEndNormal()
}
#endif
-#if 0
-WRAPPER void CMenuManager::DrawPlayerSetupScreen() { EAXJMP(0x47F2B0); }
-#else
-void CMenuManager::DrawPlayerSetupScreen()
+void
+CMenuManager::DrawPlayerSetupScreen()
{
CFont::SetBackgroundOff();
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
@@ -2069,13 +2420,11 @@ void CMenuManager::DrawPlayerSetupScreen()
CFont::SetJustifyOn();
CFont::SetRightJustifyOff();
CFont::SetBackGroundOnlyTextOn();
- CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENUACTION_X_MARGIN));
+ CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
- CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
- CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT));
- CFont::SetRightJustifyOn();
- CFont::SetFontStyle(FONT_HEADING);
+ PREPARE_MENU_HEADER
+
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get("FET_PS"));
// lstrcpy's changed with strcpy
@@ -2117,8 +2466,9 @@ void CMenuManager::DrawPlayerSetupScreen()
m_pSelectedSkin->skinNameDisplayed[oldLength - 4] = '\0';
m_pSelectedSkin->skinNameOriginal[oldLength - 4] = '\0';
- // Truncate to 40 bytes-39 chars, idk why. This is done in sepearate function in game.
- strncpy(m_pSelectedSkin->skinNameDisplayed, m_pSelectedSkin->skinNameDisplayed, 39);
+ // Fill to 40 bytes-39 chars, idk why. This is done in sepearate function in game.
+ strncpy(nameTemp, m_pSelectedSkin->skinNameDisplayed, 39); // game doesn't do that, but in our day strncpy to same string is forbidden
+ strncpy(m_pSelectedSkin->skinNameDisplayed, nameTemp, 39);
if (oldLength - 4 > 39)
m_pSelectedSkin->skinNameDisplayed[39] = '\0';
@@ -2173,7 +2523,7 @@ void CMenuManager::DrawPlayerSetupScreen()
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
CFont::SetRightJustifyOn();
CFont::PrintString(MENU_X_RIGHT_ALIGNED(PLAYERSETUP_DATE_COLUMN_RIGHT), MENU_Y(PLAYERSETUP_LIST_TOP), TheText.Get("FES_DAT"));
- switch (CMenuManager::m_PrefsLanguage) {
+ switch (m_PrefsLanguage) {
case LANGUAGE_FRENCH:
case LANGUAGE_SPANISH:
CFont::SetScale(MENU_X(0.6f), MENU_Y(MENUACTION_SCALE_MULT));
@@ -2343,7 +2693,7 @@ void CMenuManager::DrawPlayerSetupScreen()
// Big apply button
if (strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CFont::SetFontStyle(FONT_HEADING);
- switch (CMenuManager::m_PrefsLanguage) {
+ switch (m_PrefsLanguage) {
case LANGUAGE_FRENCH:
CFont::SetScale(MENU_X(1.1f), MENU_Y(1.9f));
break;
@@ -2470,12 +2820,9 @@ void CMenuManager::DrawPlayerSetupScreen()
}
}
-#endif
-#if 0
-WRAPPER int CMenuManager::FadeIn(int alpha) { EAXJMP(0x48AC60); }
-#else
-int CMenuManager::FadeIn(int alpha)
+int
+CMenuManager::FadeIn(int alpha)
{
if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS ||
m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS ||
@@ -2484,27 +2831,57 @@ int CMenuManager::FadeIn(int alpha)
return min(m_nMenuFadeAlpha, alpha);
}
-#endif
-#if 1
-WRAPPER void CMenuManager::FilterOutColorMarkersFromString(uint16, CRGBA &) { EAXJMP(0x4889C0); }
-#else
-void CMenuManager::FilterOutColorMarkersFromString(uint16, CRGBA &)
+void
+CMenuManager::FilterOutColorMarkersFromString(wchar *str, CRGBA &newColor)
{
-
+ int newIdx = 0;
+ wchar copy[256], *c;
+ UnicodeStrcpy(copy, str);
+
+ for (c = copy; *c != '\0'; c++) {
+ if (*c == '~') {
+ c++;
+ switch (*c) {
+ case 'b': newColor = CRGBA(40, 40, 255, 255); break;
+ case 'g': newColor = CRGBA(40, 235, 40, 255); break;
+ // There is no case for "h", is that a mistake?
+ case 'l': newColor = CRGBA(0, 0, 0, 255); break;
+ case 'p': newColor = CRGBA(255, 0, 255, 255); break;
+ case 'r': newColor = CRGBA(255, 0, 0, 255); break;
+ case 'w': newColor = CRGBA(255, 255, 255, 255); break;
+ case 'y': newColor = CRGBA(255, 255, 0, 255); break;
+ }
+ while (*c != '~') c++;
+ } else {
+ str[newIdx++] = *c;
+ }
+ }
+ str[newIdx] = '\0';
}
-#endif
-#if 1
-WRAPPER int CMenuManager::GetStartOptionsCntrlConfigScreens() { EAXJMP(0x489270); }
-#else
-int CMenuManager::GetStartOptionsCntrlConfigScreens()
+int
+CMenuManager::GetStartOptionsCntrlConfigScreens()
{
-
+ int number = 0;
+ switch (m_nCurrScreen) {
+ case MENUPAGE_CONTROLLER_PC_OLD3:
+ number = 34;
+ break;
+ case MENUPAGE_CONTROLLER_DEBUG:
+ number = 35;
+ break;
+ case MENUPAGE_KEYBOARD_CONTROLS:
+ number = 0;
+ break;
+ default:
+ break;
+ }
+ return number;
}
-#endif
-void CMenuManager::InitialiseChangedLanguageSettings()
+void
+CMenuManager::InitialiseChangedLanguageSettings()
{
if (m_bFrontEnd_ReloadObrTxtGxt) {
m_bFrontEnd_ReloadObrTxtGxt = false;
@@ -2515,7 +2892,7 @@ void CMenuManager::InitialiseChangedLanguageSettings()
CGame::frenchGame = false;
CGame::germanGame = false;
#ifdef MORE_LANGUAGES
- switch (CMenuManager::m_PrefsLanguage) {
+ switch (m_PrefsLanguage) {
case LANGUAGE_RUSSIAN:
CFont::ReloadFonts(FONT_LANGSET_RUSSIAN);
break;
@@ -2525,7 +2902,7 @@ void CMenuManager::InitialiseChangedLanguageSettings()
}
#endif
- switch (CMenuManager::m_PrefsLanguage) {
+ switch (m_PrefsLanguage) {
case LANGUAGE_FRENCH:
CGame::frenchGame = true;
break;
@@ -2543,22 +2920,23 @@ void CMenuManager::InitialiseChangedLanguageSettings()
}
}
-void CMenuManager::LoadAllTextures()
+void
+CMenuManager::LoadAllTextures()
{
if (m_bSpritesLoaded)
return;
- CMenuManager::CentreMousePointer();
+ CentreMousePointer();
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
m_nCurrOption = 0;
m_PrefsRadioStation = DMAudio.GetRadioInCar();
if (DMAudio.IsMP3RadioChannelAvailable()) {
- if (CMenuManager::m_PrefsRadioStation > USERTRACK)
- CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
- } else if (CMenuManager::m_PrefsRadioStation > CHATTERBOX)
- CMenuManager::m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
+ if (m_PrefsRadioStation > USERTRACK)
+ m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
+ } else if (m_PrefsRadioStation > CHATTERBOX)
+ m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
CFileMgr::SetDir("");
//CFileMgr::SetDir("");
@@ -2607,10 +2985,9 @@ void CMenuManager::LoadAllTextures()
m_bSpritesLoaded = true;
CTxdStore::PopCurrentTxd();
}
-#if 0
-WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); }
-#else
-void CMenuManager::LoadSettings()
+
+void
+CMenuManager::LoadSettings()
{
CFileMgr::SetDirMyDocuments();
int fileHandle = CFileMgr::OpenFile("gta3.set", "r");
@@ -2699,12 +3076,9 @@ void CMenuManager::LoadSettings()
strcpy(m_aSkinName, "$$\"\"");
}
}
-#endif
-#if 0
-WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); }
-#else
-void CMenuManager::SaveSettings()
+void
+CMenuManager::SaveSettings()
{
static char RubbishString[48] = "stuffmorestuffevenmorestuff etc";
@@ -2747,44 +3121,117 @@ void CMenuManager::SaveSettings()
CFileMgr::CloseFile(fileHandle);
CFileMgr::SetDir("");
}
-#endif
-#if 1
-WRAPPER void CMenuManager::MessageScreen(char *) { EAXJMP(0x48B7E0); }
-#else
-void CMenuManager::MessageScreen(char *)
+bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
+void DoRWStuffEndOfFrame(void);
+
+void
+CMenuManager::MessageScreen(const char *text)
{
+ CSprite2d *splash = LoadSplash(nil);
+ if (!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255))
+ return;
+ CSprite2d::SetRecipNearClip();
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+ DefinedState();
+
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
+ splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
+
+ CFont::SetBackgroundOff();
+ CFont::SetPropOn();
+ CFont::SetJustifyOn();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f));
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_FROM_RIGHT(170.0f));
+ CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(120.0f), SCREEN_SCALE_Y(150.0f), SCREEN_SCALE_FROM_RIGHT(120.0f), SCREEN_SCALE_FROM_BOTTOM(220.0f)), CRGBA(50, 50, 50, 210));
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetCentreSize(SCREEN_SCALE_X(380.0f));
+ CFont::SetCentreOn();
+ CFont::SetColor(CRGBA(255, 217, 106, 255));
+ CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE));
+ CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(170.0f), TheText.Get(text));
+ CFont::DrawFonts();
+ DoRWStuffEndOfFrame();
}
-#endif
-#if 1
-WRAPPER void CMenuManager::PickNewPlayerColour() { EAXJMP(0x488C40); }
-#else
-void CMenuManager::PickNewPlayerColour()
+void
+CMenuManager::PickNewPlayerColour()
{
-
+ m_PrefsPlayerRed = 0;
+ m_PrefsPlayerGreen = 0;
+ m_PrefsPlayerBlue = 0;
+ while (true) {
+ int sum = m_PrefsPlayerRed + m_PrefsPlayerGreen + m_PrefsPlayerBlue;
+ if (sum >= 100 && sum <= 650)
+ break;
+ m_PrefsPlayerRed = CGeneral::GetRandomNumber();
+ m_PrefsPlayerGreen = CGeneral::GetRandomNumber();
+ m_PrefsPlayerBlue = CGeneral::GetRandomNumber();
+ }
}
-#endif
-#if 1
-WRAPPER void CMenuManager::PrintBriefs() { EAXJMP(0x484D60); }
-#else
-void CMenuManager::PrintBriefs()
+void
+CMenuManager::PrintBriefs()
{
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetRightJustifyOff();
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
+
+ float nextY = 40.0f;
+ CRGBA newColor;
+ for (int i = 4; i >= 0; i--) {
+ tPreviousBrief &brief = CMessages::PreviousBriefs[i];
+ if (brief.m_pText) {
+ CMessages::InsertNumberInString(brief.m_pText,
+ brief.m_nNumber[0], brief.m_nNumber[1],
+ brief.m_nNumber[2], brief.m_nNumber[3],
+ brief.m_nNumber[4], brief.m_nNumber[5], gUString);
+ CMessages::InsertStringInString(gUString, brief.m_pString);
+ CMessages::InsertPlayerControlKeysInString(gUString);
+ newColor = TEXT_COLOR;
+ FilterOutColorMarkersFromString(gUString, newColor);
-}
+#ifdef PS2_LIKE_MENU
+ // This PS2 code was always here, but unused
+ bool rgSame = newColor.r == TEXT_COLOR.r && newColor.g == TEXT_COLOR.g;
+ bool bSame = rgSame && newColor.b == TEXT_COLOR.b;
+ bool colorNotChanged = bSame; /* && newColor.a == TEXT_COLOR.a; */
+
+ if (!colorNotChanged) {
+ newColor.r /= 2;
+ newColor.g /= 2;
+ newColor.b /= 2;
+ }
+ CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); // But this is from PS2
+ CFont::SetDropShadowPosition(1);
#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::PrintErrorMessage() { EAXJMP(0x484F70); }
-#else
-void CMenuManager::PrintErrorMessage()
+#if defined(FIX_BUGS) || defined(PS2_LIKE_MENU)
+ newColor.a = FadeIn(255);
+ CFont::SetColor(newColor);
+#endif
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(50.0f), nextY, gUString);
+ nextY += MENU_Y(menuXYpadding);
+ }
+ }
+
+#ifdef PS2_LIKE_MENU
+ CFont::SetDropShadowPosition(0);
+#endif
+}
+
+// Not sure about name. Not to be confused with CPad::PrintErrorMessage
+void
+CMenuManager::PrintErrorMessage()
{
if (!CPad::bDisplayNoControllerMessage && !CPad::bObsoleteControllerMessage)
return;
- CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_WIDTH - SCREEN_SCALE_X(20.0f), SCREEN_HEIGHT - SCREEN_SCALE_Y(140.0f)), CRGBA(64, 16, 16, 224));
+ CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f)), CRGBA(64, 16, 16, 224));
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOff();
CFont::SetPropOn();
@@ -2792,27 +3239,93 @@ void CMenuManager::PrintErrorMessage()
CFont::SetJustifyOn();
CFont::SetRightJustifyOff();
CFont::SetBackGroundOnlyTextOn();
- CFont::SetWrapx(SCREEN_WIDTH - 40.0f);
- CFont::SetColor(CRGBA(165, 165, 165, 255));
- CFont::SetScale(SCREEN_SCALE_X(0.9f), SCREEN_SCALE_Y(0.9f));
- CFont::PrintString(SCREEN_SCALE_X(40.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(60.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT"));
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(40.0f));
+#ifdef FIX_BUGS
+ CFont::PrintString(SCREEN_SCALE_X(50.0f), SCREEN_SCALE_Y(180.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT"));
+#else
+ CFont::PrintString(SCREEN_SCALE_X(50.0f), SCREEN_SCALE_Y(40.0f), TheText.Get(CPad::bDisplayNoControllerMessage ? "NOCONT" : "WRCONT"));
+#endif
CFont::DrawFonts();
}
-#endif
-#if 1
-WRAPPER void CMenuManager::PrintStats() { EAXJMP(0x482100); }
-#else
-void CMenuManager::PrintStats()
+void
+CMenuManager::PrintStats()
{
+ int rowNum = ConstructStatLine(99999);
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
+ float nextYChange, y, alphaMult;
+
+ // Scroll stats with mouse
+#ifdef SCROLLABLE_STATS_PAGE
+ static float scrollY = 0;
+ static uint32 lastChange = m_nScreenChangeDelayTimer;
+ if (CPad::GetPad(0)->GetLeftMouse()) {
+ scrollY += (m_nMouseOldPosY - m_nMousePosY);
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ } else {
+ scrollY += MENU_Y(STATS_SLIDE_Y_PER_SECOND) / 1000.0f * (CTimer::GetTimeInMillisecondsPauseMode() - lastChange);
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+#else
+ // MENU_Y(30.0f) per second
+ float scrollY = MENU_Y(STATS_SLIDE_Y_PER_SECOND) * (CTimer::GetTimeInMillisecondsPauseMode() - m_nScreenChangeDelayTimer) / 1000.0f;
+#endif
+
+ for (int row = 0; row < rowNum; ++row) {
+ // Put just got hidden text at the top back to the bottom, in circular fashion
+ for (y = MENU_Y(STATS_ROW_HEIGHT - 1) * row + SCREEN_HEIGHT - scrollY; MENU_Y(STATS_PUT_BACK_TO_BOTTOM_Y) > y; y += nextYChange) {
+ nextYChange = (MENU_Y(STATS_ROW_HEIGHT) + rowNum) * MENU_Y(STATS_ROW_HEIGHT - 1);
+ }
+
+ // If it's still on screen
+ if (y > 0.0f && SCREEN_HEIGHT > y) {
+ ConstructStatLine(row);
+
+ // But about to dim from top
+ if (y - MENU_Y(STATS_BOTTOM_MARGIN) < MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH)) {
+ if ((y - MENU_Y(STATS_BOTTOM_MARGIN)) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH) < 0.0f)
+ alphaMult = 0.0f;
+ else
+ alphaMult = (y - MENU_Y(STATS_BOTTOM_MARGIN)) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH);
+
+ // About to dim from bottom
+ } else if (y > SCREEN_SCALE_FROM_BOTTOM(STATS_TOP_DIMMING_AREA_LENGTH) - MENU_Y(STATS_BOTTOM_DIMMING_AREA_LENGTH)) {
+ if ((SCREEN_SCALE_FROM_BOTTOM(STATS_BOTTOM_DIMMING_AREA_LENGTH) - y) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH) < 0.0f)
+ alphaMult = 0.0f;
+ else
+ alphaMult = (SCREEN_SCALE_FROM_BOTTOM(STATS_BOTTOM_DIMMING_AREA_LENGTH) - y) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH);
+ } else
+ alphaMult = 1.0f;
+
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255.0f * alphaMult)));
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(STATS_ROW_X_MARGIN), y - MENU_Y(STATS_BOTTOM_MARGIN - STATS_TOP_MARGIN), gUString);
+ CFont::SetRightJustifyOn();
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(STATS_ROW_X_MARGIN), y - MENU_Y(STATS_BOTTOM_MARGIN - STATS_TOP_MARGIN), gUString2);
+ }
+ }
+ // Game doesn't do that, but it's better
+ float nextX = MENU_X_LEFT_ALIGNED(STATS_RATING_X);
+ CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
+ CFont::SetRightJustifyOff();
+ CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), TheText.Get("CRIMRA")); nextX += MENU_X(10.0f) + CFont::GetStringWidth(TheText.Get("CRIMRA"), true);
+ UnicodeStrcpy(gUString, CStats::FindCriminalRatingString());
+ CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), gUString); nextX += MENU_X(6.0f) + CFont::GetStringWidth(gUString, true);
+ sprintf(gString, "%d", CStats::FindCriminalRatingNumber());
+ AsciiToUnicode(gString, gUString);
+ CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), gUString);
+
+ // ::Draw already does that.
+ /*
+ PREPARE_MENU_HEADER
+ CFont::PrintString(MENU_X_RIGHT_ALIGNED(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
+ */
+ CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y));
}
-#endif
-#if 0
-WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); }
-#else
-void CMenuManager::Process(void)
+void
+CMenuManager::Process(void)
{
m_bMenuStateChanged = false;
@@ -2822,6 +3335,7 @@ void CMenuManager::Process(void)
m_bWantToRestart = false;
InitialiseChangedLanguageSettings();
+ // Just a hack by R* to not make game continuously resume/pause. But we it seems we can live with it.
if (CPad::GetPad(0)->GetEscapeJustDown())
RequestFrontEndStartUp();
@@ -2888,8 +3402,8 @@ void CMenuManager::Process(void)
m_bStartWaitingForKeyBind = false;
else {
pControlEdit = CPad::EditCodesForControls(pControlEdit, 1);
- JoyButtonJustClicked = 0;
- MouseButtonJustClicked = 0;
+ JoyButtonJustClicked = false;
+ MouseButtonJustClicked = false;
if (CPad::GetPad(0)->GetLeftMouseJustDown())
MouseButtonJustClicked = 1;
@@ -2905,13 +3419,13 @@ void CMenuManager::Process(void)
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
- int32 TypeOfControl = 0;
+ int32 TypeOfControl = KEYBOARD;
if (JoyButtonJustClicked)
- TypeOfControl = 3;
+ TypeOfControl = JOYSTICK;
if (MouseButtonJustClicked)
- TypeOfControl = 2;
+ TypeOfControl = MOUSE;
if (*pControlEdit != rsNULL)
- TypeOfControl = 0;
+ TypeOfControl = KEYBOARD;
if (!m_bKeyIsOK) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
@@ -2919,14 +3433,12 @@ void CMenuManager::Process(void)
m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false;
- }
- else if (!m_bKeyChangeNotProcessed) {
+ } else if (!m_bKeyChangeNotProcessed) {
if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked)
CheckCodesForControls(TypeOfControl);
field_535 = true;
- }
- else {
+ } else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i);
@@ -2940,7 +3452,7 @@ void CMenuManager::Process(void)
}
}
- if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) {
+ if ((m_nCurrScreen == MENUPAGE_NO_MEMORY_CARD || m_nCurrScreen == MENUPAGE_PS2_LOAD_FAILED) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) {
m_nCurrScreen = m_nPrevScreen;
m_nCurrOption = 0;
}
@@ -2965,11 +3477,7 @@ void CMenuManager::Process(void)
DMAudio.Service();
}
}
-#endif
-#if 0
-WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); }
-#else
void
CMenuManager::ProcessButtonPresses(void)
{
@@ -3153,7 +3661,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#ifndef TIDY_UP_PBP
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustDown()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustDown()) {
m_bShowMouse = false;
goBack = true;
}
@@ -3232,7 +3740,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) {
optionSelected = true;
}
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustUp()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
if (m_nCurrScreen != MENUPAGE_START_MENU) {
goBack = true;
}
@@ -3277,10 +3785,10 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef TIDY_UP_PBP
if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0;
+ m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
} else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM
&& aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) {
@@ -3291,82 +3799,82 @@ CMenuManager::ProcessButtonPresses(void)
switch (m_nHoverOption) {
case HOVEROPTION_RADIO_0:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
+ m_PrefsRadioStation = HEAD_RADIO;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_1:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = DOUBLE_CLEF;
+ m_PrefsRadioStation = DOUBLE_CLEF;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_2:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = JAH_RADIO;
+ m_PrefsRadioStation = JAH_RADIO;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_3:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = RISE_FM;
+ m_PrefsRadioStation = RISE_FM;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_4:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = LIPS_106;
+ m_PrefsRadioStation = LIPS_106;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_5:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = GAME_FM;
+ m_PrefsRadioStation = GAME_FM;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_6:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = MSX_FM;
+ m_PrefsRadioStation = MSX_FM;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_7:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = FLASHBACK;
+ m_PrefsRadioStation = FLASHBACK;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_8:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = CHATTERBOX;
+ m_PrefsRadioStation = CHATTERBOX;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RADIO_9:
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::m_PrefsRadioStation = USERTRACK;
+ m_PrefsRadioStation = USERTRACK;
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case HOVEROPTION_RANDOM_ITEM:
@@ -3383,74 +3891,74 @@ CMenuManager::ProcessButtonPresses(void)
#ifndef TIDY_UP_PBP
switch (m_nHoverOption) {
case HOVEROPTION_INCREASE_BRIGHTNESS:
- CMenuManager::m_PrefsBrightness = CMenuManager::m_PrefsBrightness + 32;
- if (CMenuManager::m_PrefsBrightness < 0) {
- CMenuManager::m_PrefsBrightness = 0;
+ m_PrefsBrightness = m_PrefsBrightness + 32;
+ if (m_PrefsBrightness < 0) {
+ m_PrefsBrightness = 0;
}
- if (510 < CMenuManager::m_PrefsBrightness) {
- CMenuManager::m_PrefsBrightness = 511;
+ if (510 < m_PrefsBrightness) {
+ m_PrefsBrightness = 511;
}
SaveSettings();
break;
case HOVEROPTION_DECREASE_BRIGHTNESS:
- CMenuManager::m_PrefsBrightness = CMenuManager::m_PrefsBrightness - 32;
- if (CMenuManager::m_PrefsBrightness < 0) {
- CMenuManager::m_PrefsBrightness = 0;
+ m_PrefsBrightness = m_PrefsBrightness - 32;
+ if (m_PrefsBrightness < 0) {
+ m_PrefsBrightness = 0;
}
- if (510 < CMenuManager::m_PrefsBrightness) {
- CMenuManager::m_PrefsBrightness = 511;
+ if (510 < m_PrefsBrightness) {
+ m_PrefsBrightness = 511;
}
SaveSettings();
break;
case HOVEROPTION_INCREASE_DRAWDIST:
- CMenuManager::m_PrefsLOD = CMenuManager::m_PrefsLOD + (1.0f / 16);
+ m_PrefsLOD = m_PrefsLOD + (1.0f / 16);
m_PrefsLOD = min(1.8f, m_PrefsLOD);
- CRenderer::ms_lodDistScale = CMenuManager::m_PrefsLOD;
+ CRenderer::ms_lodDistScale = m_PrefsLOD;
SaveSettings();
break;
case HOVEROPTION_DECREASE_DRAWDIST:
- CMenuManager::m_PrefsLOD = CMenuManager::m_PrefsLOD - (1.0f / 16);
+ m_PrefsLOD = m_PrefsLOD - (1.0f / 16);
m_PrefsLOD = max(0.8f, m_PrefsLOD);
- CRenderer::ms_lodDistScale = CMenuManager::m_PrefsLOD;
+ CRenderer::ms_lodDistScale = m_PrefsLOD;
SaveSettings();
break;
case HOVEROPTION_INCREASE_MUSICVOLUME:
- CMenuManager::m_PrefsMusicVolume = CMenuManager::m_PrefsMusicVolume + 8;
+ m_PrefsMusicVolume = m_PrefsMusicVolume + 8;
m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127);
- DMAudio.SetMusicMasterVolume(uchar)(CMenuManager::m_PrefsMusicVolume);
+ DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume);
SaveSettings();
break;
case HOVEROPTION_DECREASE_MUSICVOLUME:
- CMenuManager::m_PrefsMusicVolume = CMenuManager::m_PrefsMusicVolume - 8;
- if (CMenuManager::m_PrefsMusicVolume < 0) {
- CMenuManager::m_PrefsMusicVolume = 0;
+ m_PrefsMusicVolume = m_PrefsMusicVolume - 8;
+ if (m_PrefsMusicVolume < 0) {
+ m_PrefsMusicVolume = 0;
}
- if (126 < CMenuManager::m_PrefsMusicVolume) {
- CMenuManager::m_PrefsMusicVolume = 127;
+ if (126 < m_PrefsMusicVolume) {
+ m_PrefsMusicVolume = 127;
}
- DMAudio.SetMusicMasterVolume(uchar)(CMenuManager::m_PrefsMusicVolume);
+ DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume);
SaveSettings();
break;
case HOVEROPTION_INCREASE_SFXVOLUME:
- CMenuManager::m_PrefsSFXVolume = CMenuManager::m_PrefsSFXVolume + 8;
- if (CMenuManager::m_PrefsSFXVolume < 0) {
- CMenuManager::m_PrefsSFXVolume = 0;
+ m_PrefsSFXVolume = m_PrefsSFXVolume + 8;
+ if (m_PrefsSFXVolume < 0) {
+ m_PrefsSFXVolume = 0;
}
- if (126 < CMenuManager::m_PrefsSFXVolume) {
- CMenuManager::m_PrefsSFXVolume = 127;
+ if (126 < m_PrefsSFXVolume) {
+ m_PrefsSFXVolume = 127;
}
- DMAudio.SetEffectsMasterVolume(uchar)(CMenuManager::m_PrefsSFXVolume);
+ DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume);
SaveSettings();
break;
case HOVEROPTION_DECREASE_SFXVOLUME:
- CMenuManager::m_PrefsSFXVolume = CMenuManager::m_PrefsSFXVolume - 8;
- if (CMenuManager::m_PrefsSFXVolume < 0) {
- CMenuManager::m_PrefsSFXVolume = 0;
+ m_PrefsSFXVolume = m_PrefsSFXVolume - 8;
+ if (m_PrefsSFXVolume < 0) {
+ m_PrefsSFXVolume = 0;
}
- if (126 < CMenuManager::m_PrefsSFXVolume) {
- CMenuManager::m_PrefsSFXVolume = 127;
+ if (126 < m_PrefsSFXVolume) {
+ m_PrefsSFXVolume = 127;
}
- DMAudio.SetEffectsMasterVolume(uchar)(CMenuManager::m_PrefsSFXVolume);
+ DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume);
SaveSettings();
break;
case HOVEROPTION_INCREASE_MOUSESENS:
@@ -3500,7 +4008,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#ifndef TIDY_UP_PBP
- if (CPad::GetPad(0)->GetSquareJustDown()) {
+ if (CPad::GetPad(0)->GetBackJustDown()) {
if (m_nCurrScreen != MENUPAGE_START_MENU && m_nCurrScreen != MENUPAGE_PAUSE_MENU) {
m_bShowMouse = false;
goBack = true;
@@ -3541,11 +4049,11 @@ CMenuManager::ProcessButtonPresses(void)
if (!goDown && !goUp && !optionSelected) {
if (m_nCurrScreen != MENUPAGE_START_MENU) {
if (isPlainTextScreen(m_nCurrScreen)) {
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustUp()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
goBack = true;
}
} else {
- if (CPad::GetPad(0)->GetEscapeJustDown() || (m_nCurrScreen != MENUPAGE_PAUSE_MENU && CPad::GetPad(0)->GetSquareJustDown())) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || (m_nCurrScreen != MENUPAGE_PAUSE_MENU && CPad::GetPad(0)->GetBackJustDown())) {
m_bShowMouse = false;
goBack = true;
}
@@ -3664,7 +4172,7 @@ CMenuManager::ProcessButtonPresses(void)
strcpy(m_PrefsSkinFile, m_aSkinName);
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
m_nCurrExLayer = HOVEROPTION_BACK;
- CMenuManager::SaveSettings();
+ SaveSettings();
}
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
break;
@@ -3700,54 +4208,54 @@ CMenuManager::ProcessButtonPresses(void)
#ifdef TIDY_UP_PBP
assumeIncrease = true;
#else
- ++CMenuManager::m_PrefsRadioStation;
+ ++m_PrefsRadioStation;
if (DMAudio.IsMP3RadioChannelAvailable()) {
- if (CMenuManager::m_PrefsRadioStation > USERTRACK)
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
- } else if (CMenuManager::m_PrefsRadioStation > CHATTERBOX) {
- CMenuManager::m_PrefsRadioStation = USERTRACK;
+ if (m_PrefsRadioStation > USERTRACK)
+ m_PrefsRadioStation = HEAD_RADIO;
+ } else if (m_PrefsRadioStation > CHATTERBOX) {
+ m_PrefsRadioStation = USERTRACK;
}
SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
#endif
break;
case MENUACTION_LANG_ENG:
m_PrefsLanguage = LANGUAGE_AMERICAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- CMenuManager::SaveSettings();
+ InitialiseChangedLanguageSettings();
+ SaveSettings();
break;
case MENUACTION_LANG_FRE:
m_PrefsLanguage = LANGUAGE_FRENCH;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- CMenuManager::SaveSettings();
+ InitialiseChangedLanguageSettings();
+ SaveSettings();
break;
case MENUACTION_LANG_GER:
m_PrefsLanguage = LANGUAGE_GERMAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- CMenuManager::SaveSettings();
+ InitialiseChangedLanguageSettings();
+ SaveSettings();
break;
case MENUACTION_LANG_ITA:
m_PrefsLanguage = LANGUAGE_ITALIAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
- CMenuManager::SaveSettings();
+ InitialiseChangedLanguageSettings();
+ SaveSettings();
break;
case MENUACTION_LANG_SPA:
m_PrefsLanguage = LANGUAGE_SPANISH;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
+ InitialiseChangedLanguageSettings();
SaveSettings();
break;
#ifdef MORE_LANGUAGES
case MENUACTION_LANG_RUS:
m_PrefsLanguage = LANGUAGE_RUSSIAN;
m_bFrontEnd_ReloadObrTxtGxt = true;
- CMenuManager::InitialiseChangedLanguageSettings();
+ InitialiseChangedLanguageSettings();
SaveSettings();
break;
#endif
@@ -3779,7 +4287,7 @@ CMenuManager::ProcessButtonPresses(void)
if (changeMenu) {
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) {
#ifndef TIDY_UP_PBP
- CMenuManager::ResetHelperText();
+ ResetHelperText();
if (!m_bGameNotLoaded)
ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true);
else
@@ -3791,9 +4299,7 @@ CMenuManager::ProcessButtonPresses(void)
} else {
#ifdef MENU_MAP
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu == MENUPAGE_MAP) {
- fMapCenterX = SCREEN_WIDTH / 2;
- fMapCenterY = SCREEN_HEIGHT / 3;
- fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio();
+ bMapLoaded = false;
}
#endif
@@ -3815,11 +4321,10 @@ CMenuManager::ProcessButtonPresses(void)
break;
}
case MENUACTION_NEWGAME:
- CMenuManager::DoSettingsBeforeStartingAGame();
+ DoSettingsBeforeStartingAGame();
break;
case MENUACTION_RELOADIDE:
- // TODO
- // CFileLoader::ReloadObjectTypes("GTA3.IDE");
+ CFileLoader::ReloadObjectTypes("GTA3.IDE");
break;
case MENUACTION_RELOADIPL:
CGame::ReloadIPLs();
@@ -3830,7 +4335,7 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_MEMCARDSAVECONFIRM:
return;
case MENUACTION_RESUME_FROM_SAVEZONE:
- CMenuManager::RequestFrontEndShutDown();
+ RequestFrontEndShutDown();
break;
case MENUACTION_MPMAP_LIBERTY:
case MENUACTION_MPMAP_REDLIGHT:
@@ -3840,8 +4345,8 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_MPMAP_INDUSTPARK:
case MENUACTION_MPMAP_DOCKS:
case MENUACTION_MPMAP_STAUNTON:
- sthWithButtons = option - MENUACTION_MPMAP_LIBERTY;
- CMenuManager::SaveSettings();
+ m_SelectedMap = option - MENUACTION_MPMAP_LIBERTY;
+ SaveSettings();
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
break;
case MENUACTION_MPMAP_DEATHMATCH1:
@@ -3852,8 +4357,8 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_MPMAP_CAPTURE:
case MENUACTION_MPMAP_RATRACE:
case MENUACTION_MPMAP_DOMINATION:
- sthWithButtons2 = option - MENUACTION_MPMAP_DEATHMATCH1;
- CMenuManager::SaveSettings();
+ m_SelectedGameType = option - MENUACTION_MPMAP_DEATHMATCH1;
+ SaveSettings();
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
break;
case MENUACTION_REDEFCTRL:
@@ -3874,10 +4379,10 @@ CMenuManager::ProcessButtonPresses(void)
break;
case MENUACTION_RESUME:
#ifndef TIDY_UP_PBP
- if (CMenuManager::m_PrefsVsyncDisp != CMenuManager::m_PrefsVsync) {
- CMenuManager::m_PrefsVsync = CMenuManager::m_PrefsVsyncDisp;
+ if (m_PrefsVsyncDisp != m_PrefsVsync) {
+ m_PrefsVsync = m_PrefsVsyncDisp;
}
- CMenuManager::RequestFrontEndShutDown();
+ RequestFrontEndShutDown();
#else
goBack = true;
#endif
@@ -3929,26 +4434,25 @@ CMenuManager::ProcessButtonPresses(void)
break;
case MENUACTION_RESTOREDEF:
if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
- CMenuManager::m_PrefsSfxVolume = 102;
+ m_PrefsSfxVolume = 102;
m_PrefsSpeakers = 0;
- CMenuManager::m_PrefsMusicVolume = 102;
- // unused
- // byte_95CDB5 = 0;
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
+ m_PrefsMusicVolume = 102;
+ m_PrefsStereoMono = 0;
+ m_PrefsRadioStation = HEAD_RADIO;
DMAudio.SetMusicMasterVolume(102);
- DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume);
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
SaveSettings();
} else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) {
- CMenuManager::m_PrefsFrameLimiter = true;
- CMenuManager::m_PrefsBrightness = 256;
- CMenuManager::m_PrefsVsyncDisp = true;
- CMenuManager::m_PrefsLOD = 1.2f;
- CMenuManager::m_PrefsVsync = true;
+ m_PrefsFrameLimiter = true;
+ m_PrefsBrightness = 256;
+ m_PrefsVsyncDisp = true;
+ m_PrefsLOD = 1.2f;
+ m_PrefsVsync = true;
CRenderer::ms_lodDistScale = 1.2f;
- CMenuManager::m_PrefsUseWideScreen = false;
- CMenuManager::m_PrefsShowSubtitles = true;
+ m_PrefsUseWideScreen = false;
+ m_PrefsShowSubtitles = true;
m_nDisplayVideoMode = m_nPrefsVideoMode;
CMBlur::BlurOn = true;
SaveSettings();
@@ -3962,23 +4466,23 @@ CMenuManager::ProcessButtonPresses(void)
PSGLOBAL(joy1)->GetCapabilities(&devCaps);
ControlsManager.InitDefaultControlConfigJoyPad(devCaps.dwButtons);
}
- CMenuManager::m_ControlMethod = CONTROL_STANDARD;
+ m_ControlMethod = CONTROL_STANDARD;
MousePointerStateHelper.bInvertVertically = false;
TheCamera.m_fMouseAccelHorzntl = 0.0025f;
CVehicle::m_bDisableMouseSteering = true;
TheCamera.m_bHeadBob = false;
SaveSettings();
}
- CMenuManager::SetHelperText(2);
+ SetHelperText(2);
break;
case MENUACTION_CTRLMETHOD:
#ifndef TIDY_UP_PBP
- if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC) {
+ if (m_ControlMethod == CONTROL_CLASSIC) {
CCamera::m_bUseMouse3rdPerson = true;
- CMenuManager::m_ControlMethod = CONTROL_STANDARD;
+ m_ControlMethod = CONTROL_STANDARD;
} else {
CCamera::m_bUseMouse3rdPerson = false;
- CMenuManager::m_ControlMethod = CONTROL_CLASSIC;
+ m_ControlMethod = CONTROL_CLASSIC;
}
SaveSettings();
#else
@@ -3987,7 +4491,7 @@ CMenuManager::ProcessButtonPresses(void)
break;
case MENUACTION_LOADRADIO:
ChangeScreen(MENUPAGE_SOUND_SETTINGS, 0, true, true);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK");
break;
}
@@ -3996,7 +4500,7 @@ CMenuManager::ProcessButtonPresses(void)
}
if (goBack) {
- CMenuManager::ResetHelperText();
+ ResetHelperText();
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0);
#ifdef PS2_LIKE_MENU
if (m_nCurrScreen == MENUPAGE_PAUSE_MENU || bottomBarActive) {
@@ -4004,10 +4508,10 @@ CMenuManager::ProcessButtonPresses(void)
if (m_nCurrScreen == MENUPAGE_PAUSE_MENU) {
#endif
if (!m_bGameNotLoaded && !m_bMenuStateChanged) {
- if (CMenuManager::m_PrefsVsyncDisp != CMenuManager::m_PrefsVsync) {
- CMenuManager::m_PrefsVsync = CMenuManager::m_PrefsVsyncDisp;
+ if (m_PrefsVsyncDisp != m_PrefsVsync) {
+ m_PrefsVsync = m_PrefsVsyncDisp;
}
- CMenuManager::RequestFrontEndShutDown();
+ RequestFrontEndShutDown();
}
// We're already resuming, we don't need further processing.
@@ -4020,7 +4524,7 @@ CMenuManager::ProcessButtonPresses(void)
#else
else if (m_nCurrScreen == MENUPAGE_CHOOSE_SAVE_SLOT) {
#endif
- CMenuManager::RequestFrontEndShutDown();
+ RequestFrontEndShutDown();
}
// It's now in ThingsToDoBeforeLeavingPage()
#ifndef TIDY_UP_PBP
@@ -4068,13 +4572,13 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetPedWalkLeftRight() < 0 || CPad::GetPad(0)->GetDPadLeft()) {
static uint32 lastSliderDecrease = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderDecrease > 150) {
- CMenuManager::CheckSliderMovement(-1);
+ CheckSliderMovement(-1);
lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode();
}
} else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetPedWalkLeftRight() > 0 || CPad::GetPad(0)->GetDPadRight()) {
static uint32 lastSliderIncrease = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderIncrease > 150) {
- CMenuManager::CheckSliderMovement(1);
+ CheckSliderMovement(1);
lastSliderIncrease = CTimer::GetTimeInMillisecondsPauseMode();
}
}
@@ -4084,7 +4588,7 @@ CMenuManager::ProcessButtonPresses(void)
increase = true;
} else if (CPad::GetPad(0)->GetMouseWheelUpJustDown() && m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) {
increase = true;
- CMenuManager::CheckSliderMovement(1);
+ CheckSliderMovement(1);
m_bShowMouse = true;
}
@@ -4092,7 +4596,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) {
if (m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) {
decrease = true;
- CMenuManager::CheckSliderMovement(-1);
+ CheckSliderMovement(-1);
m_bShowMouse = true;
}
}
@@ -4109,22 +4613,22 @@ CMenuManager::ProcessButtonPresses(void)
if (changeValueBy != 0) {
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_RADIO:
- CMenuManager::m_PrefsRadioStation += changeValueBy;
+ m_PrefsRadioStation += changeValueBy;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
if (DMAudio.IsMP3RadioChannelAvailable()) {
- if (CMenuManager::m_PrefsRadioStation < HEAD_RADIO)
- CMenuManager::m_PrefsRadioStation = USERTRACK;
- if (CMenuManager::m_PrefsRadioStation > USERTRACK)
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
+ if (m_PrefsRadioStation < HEAD_RADIO)
+ m_PrefsRadioStation = USERTRACK;
+ if (m_PrefsRadioStation > USERTRACK)
+ m_PrefsRadioStation = HEAD_RADIO;
} else {
- if (CMenuManager::m_PrefsRadioStation < HEAD_RADIO)
- CMenuManager::m_PrefsRadioStation = CHATTERBOX;
- if (CMenuManager::m_PrefsRadioStation > CHATTERBOX)
- CMenuManager::m_PrefsRadioStation = HEAD_RADIO;
+ if (m_PrefsRadioStation < HEAD_RADIO)
+ m_PrefsRadioStation = CHATTERBOX;
+ if (m_PrefsRadioStation > CHATTERBOX)
+ m_PrefsRadioStation = HEAD_RADIO;
}
- CMenuManager::SaveSettings();
- DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation);
- DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1);
+ SaveSettings();
+ DMAudio.SetRadioInCar(m_PrefsRadioStation);
+ DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
OutputDebugString("FRONTEND RADIO STATION CHANGED");
break;
case MENUACTION_SCREENRES:
@@ -4160,15 +4664,15 @@ CMenuManager::ProcessButtonPresses(void)
m_PrefsSpeakers -= changeValueBy;
m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2);
DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
- CMenuManager::SaveSettings();
+ SaveSettings();
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
}
break;
case MENUACTION_CTRLMETHOD:
- CMenuManager::m_ControlMethod = !m_ControlMethod;
+ m_ControlMethod = !m_ControlMethod;
CCamera::m_bUseMouse3rdPerson = !m_ControlMethod;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
- CMenuManager::SaveSettings();
+ SaveSettings();
break;
}
ProcessOnOffMenuOptions();
@@ -4182,12 +4686,9 @@ CMenuManager::ProcessButtonPresses(void)
}
}
}
-#endif
-#if 0
-WRAPPER void CMenuManager::ProcessOnOffMenuOptions() { EAXJMP(0x48AE60); }
-#else
-void CMenuManager::ProcessOnOffMenuOptions()
+void
+CMenuManager::ProcessOnOffMenuOptions()
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_CTRLVIBRATION:
@@ -4265,7 +4766,9 @@ void CMenuManager::ProcessOnOffMenuOptions()
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
break;
case MENUACTION_MP_PLAYERCOLOR:
- assert(0 && "Not implemented");
+ PickNewPlayerColour();
+ DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
+ SaveSettings();
break;
case MENUACTION_SHOWHEADBOB:
TheCamera.m_bHeadBob = !TheCamera.m_bHeadBob;
@@ -4290,34 +4793,29 @@ void CMenuManager::ProcessOnOffMenuOptions()
break;
}
}
-#endif
-void CMenuManager::RequestFrontEndShutDown()
+void
+CMenuManager::RequestFrontEndShutDown()
{
m_bShutDownFrontEndRequested = true;
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
}
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::RequestFrontEndStartUp() { EAXJMP(0x488770); }
-#else
-void CMenuManager::RequestFrontEndStartUp()
+void
+CMenuManager::RequestFrontEndStartUp()
{
m_bStartUpFrontEndRequested = true;
}
-#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::ResetHelperText() { EAXJMP(0x48B470); }
-#else
-void CMenuManager::ResetHelperText()
+void
+CMenuManager::ResetHelperText()
{
m_nHelperTextMsgId = 0;
m_nHelperTextAlpha = 300;
}
-#endif
-void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
+void
+CMenuManager::SaveLoadFileError_SetUpErrorScreen()
{
switch (PcSaveHelper.nErrorCode) {
case SAVESTATUS_ERR_SAVE_CREATE:
@@ -4341,27 +4839,22 @@ void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
}
}
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::SetHelperText(int text) { EAXJMP(0x48B450); }
-#else
-void CMenuManager::SetHelperText(int text)
+void
+CMenuManager::SetHelperText(int text)
{
m_nHelperTextMsgId = text;
m_nHelperTextAlpha = 300;
}
-#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::ShutdownJustMenu() { EAXJMP(0x488920); }
-#else
-void CMenuManager::ShutdownJustMenu()
+void
+CMenuManager::ShutdownJustMenu()
{
m_bMenuActive = false;
CTimer::EndUserPause();
}
-#endif
-float CMenuManager::StretchX(float x)
+float
+CMenuManager::StretchX(float x)
{
if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH)
return x;
@@ -4379,12 +4872,10 @@ float CMenuManager::StretchY(float y)
return SCREEN_STRETCH_Y(y);
}
-#if 0
-WRAPPER void CMenuManager::SwitchMenuOnAndOff() { EAXJMP(0x488790); }
-#else
-void CMenuManager::SwitchMenuOnAndOff()
+void
+CMenuManager::SwitchMenuOnAndOff()
{
- bool menuWasActive = !!m_bMenuActive;
+ bool menuWasActive = GetIsMenuActive();
// Reminder: You need REGISTER_START_BUTTON defined to make it work.
if (CPad::GetPad(0)->GetStartJustDown()
@@ -4414,9 +4905,20 @@ void CMenuManager::SwitchMenuOnAndOff()
m_bStartUpFrontEndRequested = false;
pControlEdit = nil;
m_bShutDownFrontEndRequested = false;
- DisplayComboButtonErrMsg = 0;
- CPad::GetPad(0)->Clear(0);
- CPad::GetPad(1)->Clear(0);
+ DisplayComboButtonErrMsg = false;
+
+#ifdef REGISTER_START_BUTTON
+ int16 start1 = CPad::GetPad(0)->PCTempJoyState.Start, start2 = CPad::GetPad(0)->PCTempKeyState.Start,
+ start3 = CPad::GetPad(0)->OldState.Start, start4 = CPad::GetPad(0)->NewState.Start;
+#endif
+ CPad::GetPad(0)->Clear(false);
+ CPad::GetPad(1)->Clear(false);
+#ifdef REGISTER_START_BUTTON
+ CPad::GetPad(0)->PCTempJoyState.Start = start1;
+ CPad::GetPad(0)->PCTempKeyState.Start = start2;
+ CPad::GetPad(0)->OldState.Start = start3;
+ CPad::GetPad(0)->NewState.Start = start4;
+#endif
m_nCurrScreen = MENUPAGE_NONE;
}
}
@@ -4449,12 +4951,9 @@ void CMenuManager::SwitchMenuOnAndOff()
m_bStartUpFrontEndRequested = false;
m_bShutDownFrontEndRequested = false;
}
-#endif
-#if 0
-WRAPPER void CMenuManager::UnloadTextures() { EAXJMP(0x47A440); }
-#else
-void CMenuManager::UnloadTextures()
+void
+CMenuManager::UnloadTextures()
{
if (!m_bSpritesLoaded)
return;
@@ -4478,26 +4977,34 @@ void CMenuManager::UnloadTextures()
m_bSpritesLoaded = false;
}
-#endif
-#if DONT_USE_SUSPICIOUS_FUNCS
-WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); }
-#else
-void CMenuManager::WaitForUserCD()
+void
+CMenuManager::WaitForUserCD()
{
- LoadSplash(0);
- if (!RsGlobal.quit) {
- HandleExit();
- CPad::UpdatePads();
- MessageScreen("NO_PCCD");
-
- if (GetPadBack()) {
- m_bQuitGameNoCD = true;
- RsEventHandler(rsQUITAPP, 0);
- }
+ CSprite2d *splash;
+ char *splashscreen = nil;
+
+#ifndef RANDOMSPLASH
+ if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
+ splashscreen = "mainsc2";
+ else
+ splashscreen = "mainsc1";
+#endif
+
+ splash = LoadSplash(splashscreen);
+
+ if (RsGlobal.quit)
+ return;
+
+ HandleExit();
+ CPad::UpdatePads();
+ MessageScreen("NO_PCCD");
+
+ if (CPad::GetPad(0)->GetEscapeJustDown()) {
+ m_bQuitGameNoCD = true;
+ RsEventHandler(rsQUITAPP, nil);
}
}
-#endif
void
CMenuManager::PrintController(void)
@@ -4522,7 +5029,7 @@ CMenuManager::PrintController(void)
CFont::SetFontStyle(FONT_BANK); // X
// CFont::SetScale(0.4f, 0.4f);
- CFont::SetScale(MENU_X(SMALLTEXT_X_SCALE), MENU_Y(SMALLTEXT_Y_SCALE)); // X
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); // X
// CFont::SetColor(CRGBA(128, 128, 128, FadeIn(255)));
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); // X
@@ -4716,6 +5223,8 @@ CMenuManager::PrintController(void)
return;
}
}
+
+ CFont::SetDropShadowPosition(0); // X
}
#ifdef MENU_MAP
@@ -4740,6 +5249,20 @@ CMenuManager::PrintMap(void)
bMenuMapActive = true;
CRadar::InitFrontEndMap();
+ if (!bMapLoaded) {
+ fMapCenterX = SCREEN_WIDTH / 2;
+ fMapCenterY = SCREEN_HEIGHT / 3;
+ fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio();
+ bMapMouseShownOnce = false;
+ bMapLoaded = true;
+
+ // Let's wait for a frame to not toggle the waypoint
+ if (CPad::GetPad(0)->NewState.Cross) {
+ bMenuMapActive = false;
+ return;
+ }
+ }
+
// Because fMapSize is half of the map length, and map consists of 3x3 tiles.
float halfTile = fMapSize / 3.0f;
@@ -4760,7 +5283,7 @@ CMenuManager::PrintMap(void)
fMapCenterX + halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
}
- if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
+ if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
m_aMapSprites[MAPTOP3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - fMapSize,
fMapCenterX + fMapSize, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
}
@@ -4775,47 +5298,55 @@ CMenuManager::PrintMap(void)
fMapCenterX + halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
}
- if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
m_aMapSprites[MAPMID3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - halfTile,
fMapCenterX + fMapSize, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
}
- if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
m_aMapSprites[MAPBOT1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY + halfTile,
fMapCenterX - halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
}
- if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
m_aMapSprites[MAPBOT2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY + halfTile,
fMapCenterX + halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
}
- if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ if (SCREEN_WIDTH >= fMapCenterX + halfTile || SCREEN_HEIGHT >= fMapCenterY + halfTile) {
m_aMapSprites[MAPBOT3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY + halfTile,
fMapCenterX + fMapSize, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
}
CRadar::DrawBlips();
- if (CPad::GetPad(0)->GetRightMouseJustDown()) {
- if (m_nMousePosY > fMapCenterY - fMapSize && m_nMousePosY < fMapCenterY + fMapSize &&
- m_nMousePosX > fMapCenterX - fMapSize && m_nMousePosX < fMapCenterX + fMapSize) {
+ CVector2D mapPoint;
+ mapPoint.x = m_nMousePosX;
+ mapPoint.y = m_nMousePosY;
- float diffX = fMapCenterX - fMapSize, diffY = fMapCenterY - fMapSize;
- float x = ((m_nMousePosX - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f;
- float y = 2000.0f - ((m_nMousePosY - diffY) / (fMapSize * 2)) * 4000.0f;
- CRadar::ToggleTargetMarker(x, y);
- }
+ if (m_bShowMouse) {
+ bMapMouseShownOnce = true;
+ } else if (!bMapMouseShownOnce) {
+ mapPoint.x = SCREEN_WIDTH / 2;
+ mapPoint.y = SCREEN_HEIGHT / 2;
}
- if (CPad::GetPad(0)->GetCrossJustDown()) {
- if (SCREEN_HEIGHT / 2 > fMapCenterY - fMapSize && SCREEN_HEIGHT / 2 < fMapCenterY + fMapSize &&
- SCREEN_WIDTH / 2 > fMapCenterX - fMapSize && SCREEN_WIDTH / 2 < fMapCenterX + fMapSize) {
+ CSprite2d::DrawRect(CRect(mapPoint.x - MENU_X(1.0f), 0.0f,
+ mapPoint.x + MENU_X(1.0f), SCREEN_HEIGHT),
+ CRGBA(0, 0, 0, 150));
+ CSprite2d::DrawRect(CRect(0.0f, mapPoint.y + MENU_X(1.0f),
+ SCREEN_WIDTH, mapPoint.y - MENU_X(1.0f)),
+ CRGBA(0, 0, 0, 150));
+
+ if (CPad::GetPad(0)->GetRightMouseJustDown() || CPad::GetPad(0)->GetCrossJustDown()) {
+ if (mapPoint.y > fMapCenterY - fMapSize && mapPoint.y < fMapCenterY + fMapSize &&
+ mapPoint.x > fMapCenterX - fMapSize && mapPoint.x < fMapCenterX + fMapSize) {
float diffX = fMapCenterX - fMapSize, diffY = fMapCenterY - fMapSize;
- float x = ((SCREEN_WIDTH / 2 - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f;
- float y = 2000.0f - ((SCREEN_HEIGHT / 2 - diffY) / (fMapSize * 2)) * 4000.0f;
+ 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);
}
}
@@ -4838,14 +5369,14 @@ CMenuManager::PrintMap(void)
fMapCenterY -= CPad::GetPad(0)->GetLeftStickY() / 128.0f * 20.0f;
}
- if (CPad::GetPad(0)->GetMouseWheelDown() || CPad::GetPad(0)->GetPageUp() || CPad::GetPad(0)->GetRightShoulder2()) {
+ if (CPad::GetPad(0)->GetMouseWheelDown() || CPad::GetPad(0)->GetPageDown() || CPad::GetPad(0)->GetRightShoulder2()) {
if (CPad::GetPad(0)->GetMouseWheelDown())
- ZOOM(m_nMousePosX, m_nMousePosY, false);
+ ZOOM(mapPoint.x, mapPoint.y, false);
else
ZOOM(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, false);
- } else if (CPad::GetPad(0)->GetMouseWheelUp() || CPad::GetPad(0)->GetPageDown() || CPad::GetPad(0)->GetRightShoulder1()) {
+ } else if (CPad::GetPad(0)->GetMouseWheelUp() || CPad::GetPad(0)->GetPageUp() || CPad::GetPad(0)->GetRightShoulder1()) {
if (CPad::GetPad(0)->GetMouseWheelUp())
- ZOOM(m_nMousePosX, m_nMousePosY, true);
+ ZOOM(mapPoint.x, mapPoint.y, true);
else
ZOOM(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, true);
}
@@ -4880,11 +5411,11 @@ CMenuManager::PrintMap(void)
text = TheText.Get(key); CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), text); nextX += CFont::GetStringWidth(text, true) + MENU_X(extraSpace);
TEXT_PIECE("FEC_MWF", 3.0f);
- TEXT_PIECE("FEC_PGD", 1.0f);
+ TEXT_PIECE("FEC_PGU", 1.0f);
TEXT_PIECE("FEC_IBT", 1.0f);
TEXT_PIECE("FEC_ZIN", 20.0f);
TEXT_PIECE("FEC_MWB", 3.0f);
- TEXT_PIECE("FEC_PGU", 1.0f);
+ TEXT_PIECE("FEC_PGD", 1.0f);
TEXT_PIECE("FEC_IBT", 1.0f);
CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_ZOT")); nextX = MENU_X(30.0f); nextY -= 11.0f;
TEXT_PIECE("FEC_UPA", 2.0f);
@@ -4903,6 +5434,179 @@ CMenuManager::PrintMap(void)
#undef ZOOM
#endif
+// rowIdx 99999 returns total numbers of rows. otherwise it returns 0.
+int
+CMenuManager::ConstructStatLine(int rowIdx)
+{
+#define STAT_LINE(str, left, isFloat, right) \
+ do { \
+ if(counter == rowIdx){ \
+ BuildStatLine(str, left, isFloat, right); \
+ return 0; \
+ } counter++; \
+ } while(0)
+
+ int counter = 0, nTemp;
+
+ STAT_LINE("PL_STAT", nil, false, nil);
+
+ int percentCompleted = (CStats::TotalProgressInGame == 0 ? 0 :
+ CStats::ProgressMade * 100.0f / (CGame::nastyGame ? CStats::TotalProgressInGame : CStats::TotalProgressInGame - 1));
+ percentCompleted = min(percentCompleted, 100);
+
+ STAT_LINE("PER_COM", &percentCompleted, false, nil);
+ STAT_LINE("NMISON", &CStats::MissionsGiven, false, nil);
+ STAT_LINE("FEST_MP", &CStats::MissionsPassed, 0, &CStats::TotalNumberMissions);
+ if (CGame::nastyGame) {
+ STAT_LINE("FEST_RP", &CStats::NumberKillFrenziesPassed, 0, &CStats::TotalNumberKillFrenzies);
+ }
+
+ CPlayerInfo &player = CWorld::Players[CWorld::PlayerInFocus];
+ float packagesPercent = 0.0f;
+ if (player.m_nTotalPackages != 0)
+ packagesPercent = player.m_nCollectedPackages * 100.0f / player.m_nTotalPackages;
+
+ STAT_LINE("PERPIC", &packagesPercent, 0, &(nTemp = 100));
+ STAT_LINE("NOUNIF", &CStats::TotalNumberOfUniqueJumps, 0, &CStats::NumberOfUniqueJumpsFound);
+ STAT_LINE("DAYSPS", &CStats::DaysPassed, false, nil);
+ if (CGame::nastyGame) {
+ STAT_LINE("PE_WAST", &CStats::PeopleKilledByPlayer, false, nil);
+ STAT_LINE("PE_WSOT", &CStats::PeopleKilledByOthers, false, nil);
+ }
+ STAT_LINE("CAR_EXP", &CStats::CarsExploded, false, nil);
+ STAT_LINE("TM_BUST", &CStats::TimesArrested, false, nil);
+ STAT_LINE("TM_DED", &CStats::TimesDied, false, nil);
+ STAT_LINE("GNG_WST", &(nTemp = CStats::PedsKilledOfThisType[PEDTYPE_GANG9] + CStats::PedsKilledOfThisType[PEDTYPE_GANG8]
+ + CStats::PedsKilledOfThisType[PEDTYPE_GANG7] + CStats::PedsKilledOfThisType[PEDTYPE_GANG6]
+ + CStats::PedsKilledOfThisType[PEDTYPE_GANG5] + CStats::PedsKilledOfThisType[PEDTYPE_GANG4]
+ + CStats::PedsKilledOfThisType[PEDTYPE_GANG3] + CStats::PedsKilledOfThisType[PEDTYPE_GANG2]
+ + CStats::PedsKilledOfThisType[PEDTYPE_GANG1]), false, nil);
+ STAT_LINE("DED_CRI", &(nTemp = CStats::PedsKilledOfThisType[PEDTYPE_CRIMINAL]), false, nil);
+ STAT_LINE("HEL_DST", &CStats::HelisDestroyed, false, nil);
+ STAT_LINE("KGS_EXP", &CStats::KgsOfExplosivesUsed, false, nil);
+ STAT_LINE("ACCURA", &(nTemp = (CStats::InstantHitsFiredByPlayer == 0 ? 0 :
+ CStats::InstantHitsHitByPlayer * 100.0f / CStats::InstantHitsFiredByPlayer)), false, nil);
+
+ if (CStats::ElBurroTime > 0) {
+ STAT_LINE("ELBURRO", &CStats::ElBurroTime, false, nil);
+ }
+ if (CStats::Record4x4One > 0) {
+ STAT_LINE("FEST_R1", &CStats::Record4x4One, false, nil);
+ }
+ if (CStats::Record4x4Two > 0) {
+ STAT_LINE("FEST_R2", &CStats::Record4x4Two, false, nil);
+ }
+ if (CStats::Record4x4Three > 0) {
+ STAT_LINE("FEST_R3", &CStats::Record4x4Three, false, nil);
+ }
+ if (CStats::Record4x4Mayhem > 0) {
+ STAT_LINE("FEST_RM", &CStats::Record4x4Mayhem, false, nil);
+ }
+ if (CStats::LongestFlightInDodo > 0) {
+ STAT_LINE("FEST_LF", &CStats::LongestFlightInDodo, false, nil);
+ }
+ if (CStats::TimeTakenDefuseMission > 0) {
+ STAT_LINE("FEST_BD", &CStats::TimeTakenDefuseMission, false, nil);
+ }
+ STAT_LINE("CAR_CRU", &CStats::CarsCrushed, false, nil);
+
+ if (CStats::HighestScores[0] > 0) {
+ STAT_LINE("FEST_BB", nil, false, nil);
+ STAT_LINE("FEST_H0", &CStats::HighestScores[0], false, nil);
+ }
+ if (CStats::HighestScores[4] + CStats::HighestScores[3] + CStats::HighestScores[2] + CStats::HighestScores[1] > 0) {
+ STAT_LINE("FEST_GC", nil, false, nil);
+ }
+ if (CStats::HighestScores[1] > 0) {
+ STAT_LINE("FEST_H1", &CStats::HighestScores[1], false, nil);
+ }
+ if (CStats::HighestScores[2] > 0) {
+ STAT_LINE("FEST_H2", &CStats::HighestScores[2], false, nil);
+ }
+ if (CStats::HighestScores[3] > 0) {
+ STAT_LINE("FEST_H3", &CStats::HighestScores[3], false, nil);
+ }
+ if (CStats::HighestScores[4] > 0) {
+ STAT_LINE("FEST_H4", &CStats::HighestScores[4], false, nil);
+ }
+
+ switch (m_PrefsLanguage) {
+ case LANGUAGE_AMERICAN:
+#ifndef USE_MEASUREMENTS_IN_METERS
+ float fTemp;
+ STAT_LINE("FEST_DF", &(fTemp = CStats::DistanceTravelledOnFoot * MILES_IN_METER), true, nil);
+ STAT_LINE("FEST_DC", &(fTemp = CStats::DistanceTravelledInVehicle * MILES_IN_METER), true, nil);
+ STAT_LINE("MMRAIN", &CStats::mmRain, false, nil);
+ STAT_LINE("MXCARD", &(fTemp = CStats::MaximumJumpDistance * FEET_IN_METER), true, nil);
+ STAT_LINE("MXCARJ", &(fTemp = CStats::MaximumJumpHeight * FEET_IN_METER), true, nil);
+ break;
+#endif
+ case LANGUAGE_FRENCH:
+ case LANGUAGE_GERMAN:
+ case LANGUAGE_ITALIAN:
+ case LANGUAGE_SPANISH:
+#ifdef MORE_LANGUAGES
+ case LANGUAGE_RUSSIAN:
+#endif
+ STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, true, nil);
+ STAT_LINE("FESTDCM", &CStats::DistanceTravelledInVehicle, true, nil);
+ STAT_LINE("MMRAIN", &CStats::mmRain, false, nil);
+ STAT_LINE("MXCARDM", &CStats::MaximumJumpDistance, true, nil);
+ STAT_LINE("MXCARJM", &CStats::MaximumJumpHeight, true, nil);
+ break;
+ default:
+ break;
+ }
+
+ STAT_LINE("MXFLIP", &CStats::MaximumJumpFlips, false, nil);
+ STAT_LINE("MXJUMP", &CStats::MaximumJumpSpins, false, nil);
+ STAT_LINE("BSTSTU", nil, false, nil);
+
+ if (counter == rowIdx) {
+ gUString[0] = '\0';
+ switch (CStats::BestStuntJump) {
+ case 1:
+ UnicodeStrcpy(gUString2, TheText.Get("INSTUN"));
+ return 0;
+ case 2:
+ UnicodeStrcpy(gUString2, TheText.Get("PRINST"));
+ return 0;
+ case 3:
+ UnicodeStrcpy(gUString2, TheText.Get("DBINST"));
+ return 0;
+ case 4:
+ UnicodeStrcpy(gUString2, TheText.Get("DBPINS"));
+ return 0;
+ case 5:
+ UnicodeStrcpy(gUString2, TheText.Get("TRINST"));
+ return 0;
+ case 6:
+ UnicodeStrcpy(gUString2, TheText.Get("PRTRST"));
+ return 0;
+ case 7:
+ UnicodeStrcpy(gUString2, TheText.Get("QUINST"));
+ return 0;
+ case 8:
+ UnicodeStrcpy(gUString2, TheText.Get("PQUINS"));
+ return 0;
+ default:
+ UnicodeStrcpy(gUString2, TheText.Get("NOSTUC"));
+ return 0;
+ }
+ }
+ counter++;
+ STAT_LINE("PASDRO", &CStats::PassengersDroppedOffWithTaxi, false, nil);
+ STAT_LINE("MONTAX", &CStats::MoneyMadeWithTaxi, false, nil);
+ STAT_LINE("FEST_LS", &CStats::LivesSavedWithAmbulance, false, nil);
+ STAT_LINE("FEST_HA", &CStats::HighestLevelAmbulanceMission, false, nil);
+ STAT_LINE("FEST_CC", &CStats::CriminalsCaught, false, nil);
+ STAT_LINE("FEST_FE", &CStats::FiresExtinguished, false, nil);
+ STAT_LINE("DAYPLC", &(nTemp = CTimer::GetTimeInMilliseconds() + 100), false, nil);
+ return counter;
+
+#undef STAT_LINE
+}
+
#if 0
uint8 CMenuManager::GetNumberOfMenuOptions()
{
@@ -4917,12 +5621,12 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
}
#endif
+#undef GetBackJustUp
+#undef GetBackJustDown
+
STARTPATCHES
-#if DONT_USE_SUSPICIOUS_FUNCS
-#else
for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);
-#endif
InjectHook(0x4856F0, &CMenuManager::ProcessButtonPresses, PATCH_JUMP);
InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 20cf9e42..8fe61a36 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -2,33 +2,22 @@
#include "Sprite2d.h"
+#ifdef PS2_LIKE_MENU
+#define MENUHEADER_POS_X 50.0f
+#define MENUHEADER_POS_Y 75.0f
+#define MENUHEADER_HEIGHT 1.3f
+#else
#define MENUHEADER_POS_X 35.0f
#define MENUHEADER_POS_Y 93.0f
-#define MENUHEADER_WIDTH 0.84f
#define MENUHEADER_HEIGHT 1.6f
+#endif
+#define MENUHEADER_WIDTH 0.84f
-#define MENUACTION_X_MARGIN 40.0f
+#define MENU_X_MARGIN 40.0f
#define MENUACTION_POS_Y 60.0f
-#define MENUACTION_WIDTH 0.38f
+#define MENUACTION_WIDTH 38.0f
#define MENUACTION_SCALE_MULT 0.9f
-#define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f
-#define MENUCOLUMN_MAX_Y 149.0f
-#define MENUCOLUMN_MID_Y 100.0f
-#define MENUCOLUMN_MIN_Y 110.0f
-#define MENUCOLUMN_PAUSE_Y 25.0f
-#define MENUCOLUMN_START_Y 9.0f
-#define MENUCOLUMN_FEDS 139.0f
-
-#define MENUCOLUMN_SAVE_X 121.0f
-#define MENUCOLUMN_SAVE_Y 111.0f
-
-#define MENUCOLUMN_SPACING_MAX 24.0f
-#define MENUCOLUMN_SPACING_MIN 20.0f
-
-#define MENUSELECT_BOX_MAX 20.5f
-#define MENUSELECT_BOX_MIN 17.0f
-
#ifndef ASPECT_RATIO_SCALE
#define MENURADIO_ICON_X 31.5f
#else
@@ -38,12 +27,13 @@
#define MENURADIO_ICON_W 60.0f
#define MENURADIO_ICON_H 60.0f
-#define MENUDROP_COLOR_A 150
-#define MENUDROP_COLOR_SIZE -1
-
#define MENUSLIDER_X 256.0f
#define MENUSLIDER_UNK 256.0f
+#define BIGTEXT_X_SCALE 0.75f
+#define BIGTEXT_Y_SCALE 0.9f
+#define MEDIUMTEXT_X_SCALE 0.55f
+#define MEDIUMTEXT_Y_SCALE 0.8f
#define SMALLTEXT_X_SCALE 0.45f
#define SMALLTEXT_Y_SCALE 0.7f
#define SMALLESTTEXT_X_SCALE 0.4f
@@ -67,6 +57,33 @@
#define PLAYERSETUP_LIST_BODY_TOP 47
#define PLAYERSETUP_ROW_HEIGHT 9
+#define STATS_SLIDE_Y_PER_SECOND 30.0f
+#define STATS_ROW_HEIGHT 20.0f
+#define STATS_ROW_X_MARGIN 50.0f
+#define STATS_BOTTOM_MARGIN 135.0f
+#define STATS_TOP_MARGIN 40.0f
+#define STATS_TOP_DIMMING_AREA_LENGTH (93.0f - STATS_TOP_MARGIN)
+#define STATS_BOTTOM_DIMMING_AREA_LENGTH 55.0f
+#define STATS_PUT_BACK_TO_BOTTOM_Y 50.0f
+#define STATS_RATING_X 24.0f
+#define STATS_RATING_Y 20.0f
+
+#define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f
+#define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f
+#define CONTSETUP_BOUND_HIGHLIGHT_HEIGHT 10
+#define CONTSETUP_BOUND_COLUMN_WIDTH 190.0f
+#define CONTSETUP_LIST_HEADER_HEIGHT 20.0f
+#define CONTSETUP_LIST_TOP 28.0f
+#define CONTSETUP_LIST_RIGHT 18.0f
+#define CONTSETUP_LIST_BOTTOM 120.0f
+#define CONTSETUP_LIST_LEFT 18.0f
+#define CONTSETUP_COLUMN_1_X 40.0f
+#define CONTSETUP_COLUMN_2_X 210.0f
+#define CONTSETUP_COLUMN_3_X (CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH + 10.0f)
+#define CONTSETUP_BACK_RIGHT 35.0f
+#define CONTSETUP_BACK_BOTTOM 122.0f
+#define CONTSETUP_BACK_HEIGHT 25.0f
+
enum eLanguages
{
LANGUAGE_AMERICAN,
@@ -185,19 +202,19 @@ enum eMenuScreen
MENUPAGE_NEW_GAME_RELOAD = 10,
MENUPAGE_LOAD_SLOT_CONFIRM = 11,
MENUPAGE_DELETE_SLOT_CONFIRM = 12,
- MENUPAGE_13 = 13,
+ MENUPAGE_NO_MEMORY_CARD = 13, // hud adjustment page in mobile
MENUPAGE_LOADING_IN_PROGRESS = 14,
MENUPAGE_DELETING_IN_PROGRESS = 15,
- MENUPAGE_16 = 16,
+ MENUPAGE_PS2_LOAD_FAILED = 16,
MENUPAGE_DELETE_FAILED = 17,
MENUPAGE_DEBUG_MENU = 18,
- MENUPAGE_MEMORY_CARD_1 = 19,
- MENUPAGE_MEMORY_CARD_2 = 20,
+ MENUPAGE_MEMORY_CARD_DEBUG = 19,
+ MENUPAGE_MEMORY_CARD_TEST = 20,
MENUPAGE_MULTIPLAYER_MAIN = 21,
- MENUPAGE_SAVE_FAILED_1 = 22,
- MENUPAGE_SAVE_FAILED_2 = 23,
+ MENUPAGE_PS2_SAVE_FAILED = 22,
+ MENUPAGE_PS2_SAVE_FAILED_2 = 23,
MENUPAGE_SAVE = 24,
- MENUPAGE_NO_MEMORY_CARD = 25,
+ MENUPAGE_NO_MEMORY_CARD_2 = 25,
MENUPAGE_CHOOSE_SAVE_SLOT = 26,
MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27,
MENUPAGE_MULTIPLAYER_MAP = 28,
@@ -229,7 +246,7 @@ enum eMenuScreen
MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
- MENUPAGE_57 = 57,
+ MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile
MENUPAGE_58 = 58,
#ifdef MENU_MAP
MENUPAGE_MAP = 59,
@@ -438,7 +455,7 @@ struct BottomBarOption
struct CMenuScreen
{
char m_ScreenName[8];
- int32 unk;
+ int32 unk; // 2 on MENUPAGE_MULTIPLAYER_START, 1 on everywhere else
int32 m_PreviousPage[2]; // eMenuScreen
int32 m_ParentEntry[2]; // row
@@ -519,36 +536,37 @@ public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
public:
- static int32 &OS_Language;
- static int8 &m_PrefsUseVibration;
- static int8 &m_DisplayControllerOnFoot;
- static int8 &m_PrefsUseWideScreen;
- static int8 &m_PrefsRadioStation;
- static int8 &m_PrefsVsync;
- static int8 &m_PrefsVsyncDisp;
- static int8 &m_PrefsFrameLimiter;
- static int8 &m_PrefsShowSubtitles;
- static int8 &m_PrefsSpeakers;
- static int32 &m_ControlMethod;
- static int8 &m_PrefsDMA;
- static int32 &m_PrefsLanguage;
- static int32 &m_PrefsBrightness;
- static float &m_PrefsLOD;
- static int8 &m_bFrontEnd_ReloadObrTxtGxt;
- static int32 &m_PrefsMusicVolume;
- static int32 &m_PrefsSfxVolume;
- static char *m_PrefsSkinFile;
- static int32 &m_KeyPressedCode;
-
- static bool &m_bStartUpFrontEndRequested;
- static bool &m_bShutDownFrontEndRequested;
- static bool &m_PrefsAllowNastyGame;
+ static int32 OS_Language;
+ static int8 m_PrefsUseVibration;
+ static int8 m_DisplayControllerOnFoot;
+ static int8 m_PrefsUseWideScreen;
+ static int8 m_PrefsRadioStation;
+ static int8 m_PrefsVsync;
+ static int8 m_PrefsVsyncDisp;
+ static int8 m_PrefsFrameLimiter;
+ static int8 m_PrefsShowSubtitles;
+ static int8 m_PrefsSpeakers;
+ static int32 m_ControlMethod;
+ static int8 m_PrefsDMA;
+ static int32 m_PrefsLanguage;
+ static int32 m_PrefsBrightness;
+ static float m_PrefsLOD;
+ static int8 m_bFrontEnd_ReloadObrTxtGxt;
+ static int32 m_PrefsMusicVolume;
+ static int32 m_PrefsSfxVolume;
+ static char m_PrefsSkinFile[256];
+ static int32 m_KeyPressedCode;
+
+ static bool m_bStartUpFrontEndRequested;
+ static bool m_bShutDownFrontEndRequested;
+ static bool m_PrefsAllowNastyGame;
- static float &menuXYpadding;
- static float &actionTextScaleX;
- static float &actionTextScaleY;
- static int32 &sthWithButtons;
- static int32 &sthWithButtons2;
+ static uint8 m_PrefsStereoMono;
+ static int32 m_SelectedMap;
+ static int32 m_SelectedGameType;
+ static uint8 m_PrefsPlayerRed;
+ static uint8 m_PrefsPlayerGreen;
+ static uint8 m_PrefsPlayerBlue;
#ifndef MASTER
static bool m_PrefsMarketing;
@@ -557,6 +575,8 @@ public:
#ifdef MENU_MAP
static bool bMenuMapActive;
+ static bool bMapMouseShownOnce;
+ static bool bMapLoaded;
static float fMapSize;
static float fMapCenterY;
static float fMapCenterX;
@@ -565,9 +585,9 @@ public:
#endif
public:
- static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);
+ static void BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2);
static void CentreMousePointer();
- int CheckCodesForControls(int32);
+ void CheckCodesForControls(int);
bool CheckHover(int x1, int x2, int y1, int y2);
void CheckSliderMovement(int);
int CostructStatLine(int);
@@ -585,13 +605,13 @@ public:
#endif
void DrawPlayerSetupScreen();
int FadeIn(int alpha);
- void FilterOutColorMarkersFromString(uint16, CRGBA &);
+ void FilterOutColorMarkersFromString(wchar*, CRGBA &);
int GetStartOptionsCntrlConfigScreens();
static void InitialiseChangedLanguageSettings();
void LoadAllTextures();
void LoadSettings();
- static void MessageScreen(char *);
- static void PickNewPlayerColour();
+ void MessageScreen(const char *);
+ void PickNewPlayerColour();
void PrintBriefs();
static void PrintErrorMessage();
void PrintStats();
@@ -612,6 +632,7 @@ public:
void WaitForUserCD();
void PrintController();
int GetNumOptionsCntrlConfigScreens();
+ int ConstructStatLine(int);
// New (not in function or inlined in the game)
void ThingsToDoBeforeLeavingPage();
@@ -625,4 +646,4 @@ public:
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
-extern CMenuManager &FrontEndMenuManager;
+extern CMenuManager FrontEndMenuManager;
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index daac3ec5..fe747ac1 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -350,7 +350,7 @@ bool CGame::Initialise(const char* datFile)
CAntennas::Init();
CGlass::Init();
gPhoneInfo.Initialise();
- CSceneEdit::Init();
+ CSceneEdit::Initialise();
LoadingScreen("Loading the Game", "Load scripts", nil);
CTheScripts::Init();
CGangs::Initialise();
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h
index bac8f0a8..e1b1bac6 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.h
@@ -1,22 +1,22 @@
#pragma once
-// There are some missing/wrong entries in here.
+// TODO: There are some missing/wrong entries in here.
const CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
+ { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
- // MENUPAGE_STATS = 1 - Both PrintStats and Draw were printing the page name, so deleted the string Draw looked for.
+ // MENUPAGE_STATS = 1
#ifdef MENU_MAP
- { ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
+ { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
#else
- { ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
+ { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_NEW_GAME = 2
- { "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
+ { "FET_SGA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_POPULATESLOTS_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
@@ -25,15 +25,15 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_BRIEFS = 3
#ifdef MENU_MAP
- { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4,
+ { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4,
#else
- { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
+ { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENU_CONTROLLER_SETTINGS = 4
- { "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
+ { "FET_CON", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
MENUACTION_CTRLCONFIG, "FEC_CCF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
MENUACTION_CTRLDISPLAY, "FEC_CDP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
MENUACTION_CTRLVIBRATION, "FEC_VIB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
@@ -41,7 +41,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_SOUND_SETTINGS = 5
- { "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1,
+ { "FET_AUD", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1,
MENUACTION_MUSICVOLUME, "FEA_MUS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_SFXVOLUME, "FEA_SFX", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
@@ -53,7 +53,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_GRAPHICS_SETTINGS = 6
- { "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
+ { "FET_DIS", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@@ -67,7 +67,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_LANGUAGE_SETTINGS = 7
- { "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
+ { "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,
@@ -80,7 +80,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
- { "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
+ { "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,
@@ -93,7 +93,7 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
- { "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
+ { "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,
@@ -106,104 +106,123 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_NEW_GAME_RELOAD = 10
- { "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0,
+ { "FET_NG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0,
MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
},
// MENUPAGE_LOAD_SLOT_CONFIRM = 11
- { "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0,
+ { "FET_LG", 1, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QL", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
},
// MENUPAGE_DELETE_SLOT_CONFIRM = 12
- { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
+ { "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QD", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_DELETING,
},
- // MENUPAGE_13 = 13
- { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ // MENUPAGE_NO_MEMORY_CARD = 13
+ { "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ // hud adjustment page in mobile
},
// MENUPAGE_LOADING_IN_PROGRESS = 14
- { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_LG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FED_LDW", SAVESLOT_NONE, MENUPAGE_LOAD_SLOT_CONFIRM,
},
// MENUPAGE_DELETING_IN_PROGRESS = 15
- { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_DG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FEDL_WR", SAVESLOT_NONE, MENUPAGE_NONE,
},
- // MENUPAGE_16 = 16
- { "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ // MENUPAGE_PS2_LOAD_FAILED = 16
+ { "FET_LG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_LOE", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_DELETE_FAILED = 17
- { "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_DG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_DEE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
},
// MENUPAGE_DEBUG_MENU = 18
- { "FED_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ { "FED_DBG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 4, 0,
+ MENUACTION_RELOADIDE, "FED_RID", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_RELOADIPL, "FED_RIP", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SETDBGFLAG, "FED_DFL", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SWITCHBIGWHITEDEBUGLIGHT, "FED_DLS", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_PEDROADGROUPS, "FED_SPR", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CARROADGROUPS, "FED_SCR", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_COLLISIONPOLYS, "FED_SCP", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_PARSEHEAP, "FED_PAH", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SHOWCULL, "FED_SCZ", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_DEBUGSTREAM, "FED_DSR", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
- // MENUPAGE_MEMORY_CARD_1 = 19
- { "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ // MENUPAGE_MEMORY_CARD_DEBUG = 19
+ { "FEM_MCM", 1, MENUPAGE_NONE, MENUPAGE_NONE, 7, 0,
+ MENUACTION_REGMEMCARD1, "FEM_RMC", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_TESTFORMATMEMCARD1, "FEM_TFM", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_TESTUNFORMATMEMCARD1, "FEM_TUM", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CREATEROOTDIR, "FEM_CRD", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CREATELOADICONS, "FEM_CLI", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_FILLWITHGUFF, "FEM_FFF", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SAVEONLYTHEGAME, "FEM_SOG", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SAVEGAME, "FEM_STG", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_SAVEGAMEUNDERGTA, "FEM_STS", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CREATECOPYPROTECTED, "FEM_CPD", SAVESLOT_NONE, MENUPAGE_NONE,
},
- // MENUPAGE_MEMORY_CARD_2 = 20
- { "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ // MENUPAGE_MEMORY_CARD_TEST = 20
+ { "FEM_MC2", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_MAIN = 21
- { "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_MP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
- // MENUPAGE_SAVE_FAILED_1 = 22
- { "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ // MENUPAGE_PS2_SAVE_FAILED = 22
+ { "MCDNSP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
- // MENUPAGE_SAVE_FAILED_2 = 23
- { "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ // MENUPAGE_PS2_SAVE_FAILED_2 = 23
+ { "MCGNSP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
// Unused in PC but anyway
// MENUPAGE_SAVE = 24
#ifdef PS2_SAVE_DIALOG
- { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_CHANGEMENU, "FESZ_SA", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
#else
- { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif
- // MENUPAGE_NO_MEMORY_CARD = 25
- { "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ // MENUPAGE_NO_MEMORY_CARD_2 = 25
+ { "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_CHOOSE_SAVE_SLOT = 26
- { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
@@ -216,59 +235,58 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
+ { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FESZ_QO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_SAVING_IN_PROGRESS,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_MULTIPLAYER_MAP = 28
- { "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_MAP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_CONNECTION = 29
- { "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_CON", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_FIND_GAME = 30
- { "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_FG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_MODE = 31
- { "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_GT", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_CREATE = 32
- { "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_HG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_MULTIPLAYER_START = 33
- { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FEN_STA", 2, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_SKIN_SELECT_OLD = 34
- { "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FET_PS", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_CONTROLLER_PC = 35
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
+ { "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_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,
},
// MENUPAGE_CONTROLLER_PC_OLD1 = 36
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0,
+ { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0,
MENUACTION_GETKEY, "FEC_PLB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
MENUACTION_GETKEY, "FEC_CWL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
MENUACTION_GETKEY, "FEC_CWR", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
@@ -282,12 +300,12 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CONTROLLER_PC_OLD2 = 37
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
+ { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
},
// MENUPAGE_CONTROLLER_PC_OLD3 = 38
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
+ { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
MENUACTION_GETKEY, "FEC_LUP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
MENUACTION_GETKEY, "FEC_LDN", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
MENUACTION_GETKEY, "FEC_SMS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
@@ -296,20 +314,24 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CONTROLLER_PC_OLD4 = 39
- { "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
+ { "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
},
// MENUPAGE_CONTROLLER_DEBUG = 40
- { "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ { "FEC_DBG", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
+ MENUACTION_GETKEY, "FEC_TGD", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
+ MENUACTION_GETKEY, "FEC_TDO", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
+ MENUACTION_GETKEY, "FEC_TSS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
+ MENUACTION_GETKEY, "FEC_SMS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
+ MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_OPTIONS = 41
#ifdef MENU_MAP
- { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5,
+ { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5,
#else
- { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
+ { "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,
@@ -321,9 +343,9 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_EXIT = 42
#ifdef MENU_MAP
- { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6,
+ { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6,
#else
- { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
+ { "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,
@@ -331,58 +353,58 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_SAVING_IN_PROGRESS = 43
- { "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
+ { "", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FES_WAR", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVE_SUCCESSFUL = 44
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
+ { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE,
MENUACTION_RESUME_FROM_SAVEZONE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_DELETING = 45
- { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
+ { "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "FED_DLW", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_DELETE_SUCCESS = 46
- { "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
+ { "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
MENUACTION_LABEL, "DEL_FNM", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
},
// MENUPAGE_SAVE_FAILED = 47
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
+ { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_LOAD_FAILED = 48
- { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
+ { "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_LOAD_FAILED_2 = 49
- { "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
+ { "FET_LG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FEC_LUN", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
},
// MENUPAGE_FILTER_GAME = 50
- { "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FIL_FLT", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
// MENUPAGE_START_MENU = 51
- { "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "FEM_MM", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
MENUACTION_CHANGEMENU, "FEM_QT", SAVESLOT_NONE, MENUPAGE_EXIT,
},
// MENUPAGE_PAUSE_MENU = 52
- { "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "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
@@ -395,22 +417,24 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_CHOOSE_MODE = 53
- { "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ { "FEN_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
+ MENUACTION_CHANGEMENU, "FET_SP", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
+ MENUACTION_INITMP, "FET_MP", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
+ MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SKIN_SELECT = 54
- { "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4,
- MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
+ { "FET_PSU", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4,
+ MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
},
// MENUPAGE_KEYBOARD_CONTROLS = 55
- { "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
- MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
+ { "FET_STI", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
+ MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
},
// MENUPAGE_MOUSE_CONTROLS = 56
- { "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
+ { "FET_MTI", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
MENUACTION_MOUSESENS, "FEC_MSH", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_INVVERT, "FEC_IVV", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
@@ -418,18 +442,18 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_57 = 57
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
-
+ { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
+ // mission failed, wanna restart page in mobile
},
// MENUPAGE_58 = 58
- { "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
},
#ifdef MENU_MAP
// MENUPAGE_MAP = 59
- { "FEG_MAP", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
+ { "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
},
#endif
};
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 9d00cef7..201dc5b6 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -21,10 +21,12 @@
#include "Hud.h"
#include "Text.h"
#include "Timer.h"
+#include "Record.h"
#include "World.h"
#include "Vehicle.h"
#include "Ped.h"
#include "Population.h"
+#include "Record.h"
#include "Replay.h"
#include "Weather.h"
#include "win.h"
@@ -969,9 +971,14 @@ void CPad::Update(int16 unk)
{
OldState = NewState;
- NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
- NewState = ReconcileTwoControllersInput(PCTempMouseState, NewState);
-
+#if (defined GTA_PS2 || defined FIX_BUGS)
+ if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(unk))
+#endif
+ {
+ NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
+ NewState = ReconcileTwoControllersInput(PCTempMouseState, NewState);
+ }
+
PCTempJoyState.Clear();
PCTempKeyState.Clear();
PCTempMouseState.Clear();
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 78bfac1d..cb705c6b 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -418,6 +418,7 @@ public:
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
+ bool GetTriangleJustUp() { return !!(!NewState.Triangle && OldState.Triangle); }
bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); }
bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); }
bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); }
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 75536b88..6add9e0c 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -1,8 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "Pools.h"
-#include "World.h"
+
+#include "Boat.h"
+#include "CarCtrl.h"
+#include "Population.h"
#include "ProjectileInfo.h"
+#include "Streaming.h"
+#include "Wanted.h"
+#include "World.h"
CCPtrNodePool *&CPools::ms_pPtrNodePool = *(CCPtrNodePool**)0x943044;
CEntryInfoNodePool *&CPools::ms_pEntryInfoNodePool = *(CEntryInfoNodePool**)0x941448;
@@ -14,13 +20,6 @@ CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28;
CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18;
CAudioScriptObjectPool *&CPools::ms_pAudioScriptObjectPool = *(CAudioScriptObjectPool**)0x8F1B6C;
-WRAPPER void CPools::LoadObjectPool(uint8* buf, uint32 size) { EAXJMP(0x4a2550); }
-WRAPPER void CPools::LoadPedPool(uint8* buf, uint32 size) { EAXJMP(0x4a2b50); }
-WRAPPER void CPools::LoadVehiclePool(uint8* buf, uint32 size) { EAXJMP(0x4a1b40); }
-WRAPPER void CPools::SaveObjectPool(uint8* buf, uint32 *size) { EAXJMP(0x4a22d0); }
-WRAPPER void CPools::SavePedPool(uint8* buf, uint32 *size) { EAXJMP(0x4a29b0); }
-WRAPPER void CPools::SaveVehiclePool(uint8* buf, uint32 *size) { EAXJMP(0x4a2080); }
-
void
CPools::Initialise(void)
{
@@ -99,6 +98,333 @@ CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
}
}
+void CPools::LoadVehiclePool(uint8* buf, uint32 size)
+{
+INITSAVEBUF
+ int nNumCars = ReadSaveBuf<int>(buf);
+ int nNumBoats = ReadSaveBuf<int>(buf);
+ for (int i = 0; i < nNumCars + nNumBoats; i++) {
+ uint32 type = ReadSaveBuf<uint32>(buf);
+ int16 model = ReadSaveBuf<int16>(buf);
+ CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
+ CStreaming::LoadAllRequestedModels(false);
+ int32 slot = ReadSaveBuf<int32>(buf);
+ CVehicle* pVehicle;
+ char* vbuf = new char[max(sizeof(CAutomobile), sizeof(CBoat))];
+ if (type == VEHICLE_TYPE_BOAT) {
+ memcpy(vbuf, buf, sizeof(CBoat));
+ SkipSaveBuf(buf, sizeof(CBoat));
+ CBoat* pBoat = new(slot) CBoat(model, RANDOM_VEHICLE);
+ pVehicle = pBoat;
+ --CCarCtrl::NumRandomCars; // why?
+ }
+ else if (type == VEHICLE_TYPE_CAR) {
+ memcpy(vbuf, buf, sizeof(CAutomobile));
+ SkipSaveBuf(buf, sizeof(CAutomobile));
+ CStreaming::RequestModel(model, 0); // is it needed?
+ CStreaming::LoadAllRequestedModels(false);
+ CAutomobile* pAutomobile = new(slot) CAutomobile(model, RANDOM_VEHICLE);
+ pVehicle = pAutomobile;
+ CCarCtrl::NumRandomCars--; // why?
+ pAutomobile->Damage = ((CAutomobile*)vbuf)->Damage;
+ pAutomobile->SetupDamageAfterLoad();
+ }
+ else
+ assert(0);
+ CVehicle* pBufferVehicle = (CVehicle*)vbuf;
+ pVehicle->GetMatrix() = pBufferVehicle->GetMatrix();
+ pVehicle->VehicleCreatedBy = pBufferVehicle->VehicleCreatedBy;
+ pVehicle->m_currentColour1 = pBufferVehicle->m_currentColour1;
+ pVehicle->m_currentColour2 = pBufferVehicle->m_currentColour2;
+ pVehicle->m_nAlarmState = pBufferVehicle->m_nAlarmState;
+ pVehicle->m_nNumMaxPassengers = pBufferVehicle->m_nNumMaxPassengers;
+ pVehicle->field_1D0[0] = pBufferVehicle->field_1D0[0];
+ pVehicle->field_1D0[1] = pBufferVehicle->field_1D0[1];
+ pVehicle->field_1D0[2] = pBufferVehicle->field_1D0[2];
+ pVehicle->field_1D0[3] = pBufferVehicle->field_1D0[3];
+ pVehicle->m_fSteerAngle = pBufferVehicle->m_fSteerAngle;
+ pVehicle->m_fGasPedal = pBufferVehicle->m_fGasPedal;
+ pVehicle->m_fBrakePedal = pBufferVehicle->m_fBrakePedal;
+ pVehicle->bIsLawEnforcer = pBufferVehicle->bIsLawEnforcer;
+ pVehicle->bIsLocked = pBufferVehicle->bIsLocked;
+ pVehicle->bEngineOn = pBufferVehicle->bEngineOn;
+ pVehicle->bIsHandbrakeOn = pBufferVehicle->bIsHandbrakeOn;
+ pVehicle->bLightsOn = pBufferVehicle->bLightsOn;
+ pVehicle->bFreebies = pBufferVehicle->bFreebies;
+ pVehicle->m_fHealth = pBufferVehicle->m_fHealth;
+ pVehicle->m_nCurrentGear = pBufferVehicle->m_nCurrentGear;
+ pVehicle->m_fChangeGearTime = pBufferVehicle->m_fChangeGearTime;
+ pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath;
+#ifdef FIX_BUGS //must be copypaste
+ pVehicle->m_nBombTimer = pBufferVehicle->m_nBombTimer;
+#else
+ pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath;
+#endif
+ pVehicle->m_nDoorLock = pBufferVehicle->m_nDoorLock;
+ pVehicle->m_status = pBufferVehicle->m_status;
+ pVehicle->m_type = pBufferVehicle->m_type;
+ (pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
+ (pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
+ pVehicle->AutoPilot = pBufferVehicle->AutoPilot;
+ CWorld::Add(pVehicle);
+ delete[] vbuf;
+ }
+VALIDATESAVEBUF(size)
+}
+
+void CPools::SaveVehiclePool(uint8* buf, uint32* size)
+{
+INITSAVEBUF
+ int nNumCars = 0;
+ int nNumBoats = 0;
+ int nPoolSize = GetVehiclePool()->GetSize();
+ for (int i = 0; i < nPoolSize; i++) {
+ CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
+ if (!pVehicle)
+ continue;
+ bool bHasPassenger = false;
+ for (int j = 0; j < ARRAY_SIZE(pVehicle->pPassengers); j++) {
+ if (pVehicle->pPassengers[i])
+ bHasPassenger = true;
+ }
+ if (!pVehicle->pDriver && !bHasPassenger) {
+ if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
+ ++nNumCars;
+ if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
+ ++nNumBoats;
+ }
+ }
+ *size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + sizeof(CAutomobile)) + sizeof(int) +
+ nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + sizeof(CBoat)) + sizeof(int);
+ WriteSaveBuf(buf, nNumCars);
+ WriteSaveBuf(buf, nNumBoats);
+ for (int i = 0; i < nPoolSize; i++) {
+ CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
+ if (!pVehicle)
+ continue;
+ bool bHasPassenger = false;
+ for (int j = 0; j < ARRAY_SIZE(pVehicle->pPassengers); j++) {
+ if (pVehicle->pPassengers[j])
+ bHasPassenger = true;
+ }
+ if (!pVehicle->pDriver && !bHasPassenger) {
+ if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+ WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
+ WriteSaveBuf(buf, pVehicle->m_modelIndex);
+ WriteSaveBuf(buf, GetVehicleRef(pVehicle));
+ memcpy(buf, pVehicle, sizeof(CAutomobile));
+ SkipSaveBuf(buf, sizeof(CAutomobile));
+ }
+ if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+ WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
+ WriteSaveBuf(buf, pVehicle->m_modelIndex);
+ WriteSaveBuf(buf, GetVehicleRef(pVehicle));
+ memcpy(buf, pVehicle, sizeof(CBoat));
+ SkipSaveBuf(buf, sizeof(CBoat));
+ }
+ }
+ }
+VALIDATESAVEBUF(*size)
+}
+
+void CPools::SaveObjectPool(uint8* buf, uint32* size)
+{
+INITSAVEBUF
+ CProjectileInfo::RemoveAllProjectiles();
+ CObject::DeleteAllTempObjects();
+ int nObjects = 0;
+ int nPoolSize = GetObjectPool()->GetSize();
+ for (int i = 0; i < nPoolSize; i++) {
+ CObject* pObject = GetObjectPool()->GetSlot(i);
+ if (!pObject)
+ continue;
+ if (pObject->ObjectCreatedBy == MISSION_OBJECT)
+ ++nObjects;
+ }
+ *size = nObjects * (sizeof(int16) + sizeof(int) + sizeof(CCompressedMatrixNotAligned) + sizeof(uint32) +
+ sizeof(float) + sizeof(CCompressedMatrixNotAligned) + sizeof(uint32) + sizeof(int8) + 7 * sizeof(bool) + sizeof(float) +
+ sizeof(int8) + sizeof(int8) + sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
+ WriteSaveBuf(buf, nObjects);
+ for (int i = 0; i < nPoolSize; i++) {
+ CObject* pObject = GetObjectPool()->GetSlot(i);
+ if (!pObject)
+ continue;
+ if (pObject->ObjectCreatedBy == MISSION_OBJECT) {
+ bool bIsPickup = pObject->bIsPickup;
+ bool bFlag2 = pObject->m_obj_flag2;
+ bool bOutOfStock = pObject->bOutOfStock;
+ bool bGlassCracked = pObject->bGlassCracked;
+ bool bGlassBroken = pObject->bGlassBroken;
+ bool bHasBeenDamaged = pObject->bHasBeenDamaged;
+ bool bUseVehicleColours = pObject->bUseVehicleColours;
+ CCompressedMatrixNotAligned tmp;
+ WriteSaveBuf(buf, pObject->m_modelIndex);
+ WriteSaveBuf(buf, GetObjectRef(pObject));
+ tmp.CompressFromFullMatrix(pObject->GetMatrix());
+ WriteSaveBuf(buf, tmp);
+ WriteSaveBuf(buf, (uint32)0); // game writes ununitialized data here
+ WriteSaveBuf(buf, pObject->m_fUprootLimit);
+ tmp.CompressFromFullMatrix(pObject->m_objectMatrix);
+ WriteSaveBuf(buf, tmp);
+ WriteSaveBuf(buf, (uint32)0); // same
+ WriteSaveBuf(buf, pObject->ObjectCreatedBy);
+ WriteSaveBuf(buf, bIsPickup);
+ WriteSaveBuf(buf, bFlag2);
+ WriteSaveBuf(buf, bOutOfStock);
+ WriteSaveBuf(buf, bGlassCracked);
+ WriteSaveBuf(buf, bGlassBroken);
+ WriteSaveBuf(buf, bHasBeenDamaged);
+ WriteSaveBuf(buf, bUseVehicleColours);
+ WriteSaveBuf(buf, pObject->m_fCollisionDamageMultiplier);
+ WriteSaveBuf(buf, pObject->m_nCollisionDamageEffect);
+ WriteSaveBuf(buf, pObject->m_nSpecialCollisionResponseCases);
+ WriteSaveBuf(buf, pObject->m_nEndOfLifeTime);
+ WriteSaveBuf(buf, (pObject->GetAddressOfEntityProperties())[0]);
+ WriteSaveBuf(buf, (pObject->GetAddressOfEntityProperties())[1]);
+ }
+ }
+VALIDATESAVEBUF(*size)
+}
+
+void CPools::LoadObjectPool(uint8* buf, uint32 size)
+{
+INITSAVEBUF
+ int nObjects = ReadSaveBuf<int>(buf);
+ for (int i = 0; i < nObjects; i++) {
+ int16 mi = ReadSaveBuf<int16>(buf);
+ int ref = ReadSaveBuf<int>(buf);
+ char* obuf = new char[sizeof(CObject)];
+ CObject* pBufferObject = (CObject*)obuf;
+ CCompressedMatrixNotAligned tmp;
+ tmp = ReadSaveBuf<CCompressedMatrixNotAligned>(buf);
+ tmp.DecompressIntoFullMatrix(pBufferObject->GetMatrix());
+ ReadSaveBuf<uint32>(buf);
+ pBufferObject->m_fUprootLimit = ReadSaveBuf<float>(buf);
+ tmp = ReadSaveBuf<CCompressedMatrixNotAligned>(buf);
+ tmp.DecompressIntoFullMatrix(pBufferObject->m_objectMatrix);
+ ReadSaveBuf<uint32>(buf);
+ pBufferObject->ObjectCreatedBy = ReadSaveBuf<int8>(buf);
+ pBufferObject->bIsPickup = ReadSaveBuf<bool>(buf);
+ pBufferObject->m_flagE2 = ReadSaveBuf<bool>(buf);
+ pBufferObject->bOutOfStock = ReadSaveBuf<bool>(buf);
+ pBufferObject->bGlassCracked = ReadSaveBuf<bool>(buf);
+ pBufferObject->bGlassBroken = ReadSaveBuf<bool>(buf);
+ pBufferObject->bHasBeenDamaged = ReadSaveBuf<bool>(buf);
+ pBufferObject->bUseVehicleColours = ReadSaveBuf<bool>(buf);
+ pBufferObject->m_fCollisionDamageMultiplier = ReadSaveBuf<float>(buf);
+ pBufferObject->m_nCollisionDamageEffect = ReadSaveBuf<uint8>(buf);
+ pBufferObject->m_nSpecialCollisionResponseCases = ReadSaveBuf<uint8>(buf);
+ pBufferObject->m_nEndOfLifeTime = ReadSaveBuf<uint32>(buf);
+ (pBufferObject->GetAddressOfEntityProperties())[0] = ReadSaveBuf<uint32>(buf);
+ (pBufferObject->GetAddressOfEntityProperties())[1] = ReadSaveBuf<uint32>(buf);
+ if (GetObjectPool()->GetSlot(ref >> 8))
+ CPopulation::ConvertToDummyObject(GetObjectPool()->GetSlot(ref >> 8));
+ CObject* pObject = new(ref) CObject(mi, false);
+ pObject->GetMatrix() = pBufferObject->GetMatrix();
+ pObject->m_fUprootLimit = pBufferObject->m_fUprootLimit;
+ pObject->m_objectMatrix = pBufferObject->m_objectMatrix;
+ pObject->ObjectCreatedBy = pBufferObject->ObjectCreatedBy;
+ pObject->bIsPickup = pBufferObject->bIsPickup;
+ pObject->m_flagE2 = pBufferObject->m_flagE2;
+ pObject->bOutOfStock = pBufferObject->bOutOfStock;
+ pObject->bGlassCracked = pBufferObject->bGlassCracked;
+ pObject->bGlassBroken = pBufferObject->bGlassBroken;
+ pObject->bHasBeenDamaged = pBufferObject->bHasBeenDamaged;
+ pObject->bUseVehicleColours = pBufferObject->bUseVehicleColours;
+ pObject->m_fCollisionDamageMultiplier = pBufferObject->m_fCollisionDamageMultiplier;
+ pObject->m_nCollisionDamageEffect = pBufferObject->m_nCollisionDamageEffect;
+ pObject->m_nSpecialCollisionResponseCases = pBufferObject->m_nSpecialCollisionResponseCases;
+ pObject->m_nEndOfLifeTime = pBufferObject->m_nEndOfLifeTime;
+ (pObject->GetAddressOfEntityProperties())[0] = (pBufferObject->GetAddressOfEntityProperties())[0];
+ (pObject->GetAddressOfEntityProperties())[1] = (pBufferObject->GetAddressOfEntityProperties())[1];
+ pObject->bHasCollided = false;
+ CWorld::Add(pObject);
+ delete[] obuf;
+ }
+VALIDATESAVEBUF(size)
+}
+
+void CPools::SavePedPool(uint8* buf, uint32* size)
+{
+INITSAVEBUF
+ int nNumPeds = 0;
+ int nPoolSize = GetPedPool()->GetSize();
+ for (int i = 0; i < nPoolSize; i++) {
+ CPed* pPed = GetPedPool()->GetSlot(i);
+ if (!pPed)
+ continue;
+ if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1)
+ nNumPeds++;
+ }
+ *size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + sizeof(CPlayerPed) +
+ sizeof(CWanted::MaximumWantedLevel) + sizeof(CWanted::nMaximumWantedLevel) + MAX_MODEL_NAME);
+ WriteSaveBuf(buf, nNumPeds);
+ for (int i = 0; i < nPoolSize; i++) {
+ CPed* pPed = GetPedPool()->GetSlot(i);
+ if (!pPed)
+ continue;
+ if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) {
+ WriteSaveBuf(buf, pPed->m_nPedType);
+ WriteSaveBuf(buf, pPed->m_modelIndex);
+ WriteSaveBuf(buf, GetPedRef(pPed));
+ memcpy(buf, pPed, sizeof(CPlayerPed));
+ SkipSaveBuf(buf, sizeof(CPlayerPed));
+ WriteSaveBuf(buf, CWanted::MaximumWantedLevel);
+ WriteSaveBuf(buf, CWanted::nMaximumWantedLevel);
+ memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName(), MAX_MODEL_NAME);
+ SkipSaveBuf(buf, MAX_MODEL_NAME);
+ }
+ }
+VALIDATESAVEBUF(*size);
+}
+
+void CPools::LoadPedPool(uint8* buf, uint32 size)
+{
+INITSAVEBUF
+ int nPeds = ReadSaveBuf<int>(buf);
+ for (int i = 0; i < nPeds; i++) {
+ uint32 pedtype = ReadSaveBuf<uint32>(buf);
+ int16 model = ReadSaveBuf<int16>(buf);
+ int ref = ReadSaveBuf<int>(buf);
+ char* pbuf = new char[sizeof(CPlayerPed)];
+ CPlayerPed* pBufferPlayer = (CPlayerPed*)pbuf;
+ CPed* pPed;
+ char name[MAX_MODEL_NAME];
+ // the code implies that there was idea to load non-player ped
+ if (pedtype == PEDTYPE_PLAYER1) { // always true
+ memcpy(pbuf, buf, sizeof(CPlayerPed));
+ SkipSaveBuf(buf, sizeof(CPlayerPed));
+ CWanted::MaximumWantedLevel = ReadSaveBuf<int32>(buf);
+ CWanted::nMaximumWantedLevel = ReadSaveBuf<int32>(buf);
+ memcpy(name, buf, MAX_MODEL_NAME);
+ SkipSaveBuf(buf, MAX_MODEL_NAME);
+ }
+ CStreaming::RequestSpecialModel(model, name, STREAMFLAGS_DONT_REMOVE);
+ CStreaming::LoadAllRequestedModels(false);
+ if (pedtype == PEDTYPE_PLAYER1) {
+ CPlayerPed* pPlayerPed = new(ref) CPlayerPed();
+ for (int i = 0; i < ARRAY_SIZE(pPlayerPed->m_nTargettableObjects); i++)
+ pPlayerPed->m_nTargettableObjects[i] = pBufferPlayer->m_nTargettableObjects[i];
+ pPlayerPed->m_fMaxStamina = pBufferPlayer->m_fMaxStamina;
+ pPed = pPlayerPed;
+ }
+ pPed->GetPosition() = pBufferPlayer->GetPosition();
+ pPed->m_fHealth = pBufferPlayer->m_fHealth;
+ pPed->m_fArmour = pBufferPlayer->m_fArmour;
+ pPed->CharCreatedBy = pBufferPlayer->CharCreatedBy;
+ pPed->m_currentWeapon = 0;
+ pPed->m_maxWeaponTypeAllowed = pBufferPlayer->m_maxWeaponTypeAllowed;
+ for (int i = 0; i < WEAPONTYPE_TOTAL_INVENTORY_WEAPONS; i++)
+ pPed->m_weapons[i] = pBufferPlayer->m_weapons[i];
+ if (pedtype == PEDTYPE_PLAYER1) {
+ pPed->m_wepAccuracy = 100;
+ CWorld::Players[0].m_pPed = (CPlayerPed*)pPed;
+ }
+ CWorld::Add(pPed);
+ delete[] pbuf;
+ }
+VALIDATESAVEBUF(size)
+}
STARTPATCHES
InjectHook(0x4A1770, CPools::Initialise, PATCH_JUMP);
@@ -111,4 +437,7 @@ STARTPATCHES
InjectHook(0x4A1B00, CPools::GetObjectRef, PATCH_JUMP);
InjectHook(0x4A1B20, CPools::GetObject, PATCH_JUMP);
InjectHook(0x4A2DB0, CPools::MakeSureSlotInObjectPoolIsEmpty, PATCH_JUMP);
+ InjectHook(0x4A1B40, CPools::LoadVehiclePool, PATCH_JUMP);
+ InjectHook(0x4A2550, CPools::LoadObjectPool, PATCH_JUMP);
+ InjectHook(0x4A2B50, CPools::LoadPedPool, PATCH_JUMP);
ENDPATCHES
diff --git a/src/core/Profile.cpp b/src/core/Profile.cpp
new file mode 100644
index 00000000..56584d12
--- /dev/null
+++ b/src/core/Profile.cpp
@@ -0,0 +1,71 @@
+#include "common.h"
+#include "Profile.h"
+
+#ifndef MASTER
+float CProfile::ms_afStartTime[NUM_PROFILES];
+float CProfile::ms_afCumulativeTime[NUM_PROFILES];
+float CProfile::ms_afEndTime[NUM_PROFILES];
+float CProfile::ms_afMaxEndTime[NUM_PROFILES];
+float CProfile::ms_afMaxCumulativeTime[NUM_PROFILES];
+char *CProfile::ms_pProfileString[NUM_PROFILES];
+RwRGBA CProfile::ms_aBarColours[NUM_PROFILES];
+
+void CProfile::Initialise()
+{
+ ms_afMaxEndTime[PROFILE_FRAME_RATE] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PHYSICS] = 0.0f;
+ ms_afMaxEndTime[PROFILE_COLLISION] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PED_AI] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = 0.0f;
+ ms_afMaxEndTime[PROFILE_RENDERING_TIME] = 0.0f;
+ ms_afMaxEndTime[PROFILE_TOTAL] = 0.0f;
+
+ ms_pProfileString[PROFILE_FRAME_RATE] = "Frame rate";
+ ms_pProfileString[PROFILE_PHYSICS] = "Physics";
+ ms_pProfileString[PROFILE_COLLISION] = "Collision";
+ ms_pProfileString[PROFILE_PED_AI] = "Ped AI";
+ ms_pProfileString[PROFILE_PROCESSING_TIME] = "Processing time";
+ ms_pProfileString[PROFILE_RENDERING_TIME] = "Rendering time";
+ ms_pProfileString[PROFILE_TOTAL] = "Total";
+
+ ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PHYSICS] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_COLLISION] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PED_AI] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_TOTAL] = 0.0f;
+
+ ms_aBarColours[PROFILE_PHYSICS] = { 0, 127, 255, 255 };
+ ms_aBarColours[PROFILE_COLLISION] = { 0, 255, 255, 255 };
+ ms_aBarColours[PROFILE_PED_AI] = { 255, 0, 0, 255 };
+ ms_aBarColours[PROFILE_PROCESSING_TIME] = { 0, 255, 0, 255 };
+ ms_aBarColours[PROFILE_RENDERING_TIME] = { 0, 0, 255, 255 };
+ ms_aBarColours[PROFILE_TOTAL] = { 255, 255, 255, 255 };
+}
+
+void CProfile::SuspendProfile(eProfile profile)
+{
+ ms_afEndTime[profile] = -ms_afStartTime[profile];
+ ms_afCumulativeTime[profile] -= ms_afStartTime[profile];
+}
+
+void CProfile::ShowResults()
+{
+ ms_afMaxEndTime[PROFILE_FRAME_RATE] = max(ms_afMaxEndTime[PROFILE_FRAME_RATE], ms_afEndTime[PROFILE_FRAME_RATE]);
+ ms_afMaxEndTime[PROFILE_PHYSICS] = max(ms_afMaxEndTime[PROFILE_PHYSICS], ms_afEndTime[PROFILE_PHYSICS]);
+ ms_afMaxEndTime[PROFILE_COLLISION] = max(ms_afMaxEndTime[PROFILE_COLLISION], ms_afEndTime[PROFILE_COLLISION]);
+ ms_afMaxEndTime[PROFILE_PED_AI] = max(ms_afMaxEndTime[PROFILE_PED_AI], ms_afEndTime[PROFILE_PED_AI]);
+ ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxEndTime[PROFILE_PROCESSING_TIME], ms_afEndTime[PROFILE_PROCESSING_TIME]);
+ ms_afMaxEndTime[PROFILE_RENDERING_TIME] = max(ms_afMaxEndTime[PROFILE_RENDERING_TIME], ms_afEndTime[PROFILE_RENDERING_TIME]);
+ ms_afMaxEndTime[PROFILE_TOTAL] = max(ms_afMaxEndTime[PROFILE_TOTAL], ms_afEndTime[PROFILE_TOTAL]);
+
+ ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = max(ms_afMaxCumulativeTime[PROFILE_FRAME_RATE], ms_afCumulativeTime[PROFILE_FRAME_RATE]);
+ ms_afMaxCumulativeTime[PROFILE_PHYSICS] = max(ms_afMaxCumulativeTime[PROFILE_PHYSICS], ms_afCumulativeTime[PROFILE_PHYSICS]);
+ ms_afMaxCumulativeTime[PROFILE_COLLISION] = max(ms_afMaxCumulativeTime[PROFILE_COLLISION], ms_afCumulativeTime[PROFILE_COLLISION]);
+ ms_afMaxCumulativeTime[PROFILE_PED_AI] = max(ms_afMaxCumulativeTime[PROFILE_PED_AI], ms_afCumulativeTime[PROFILE_PED_AI]);
+ ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME], ms_afCumulativeTime[PROFILE_PROCESSING_TIME]);
+ ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME], ms_afCumulativeTime[PROFILE_RENDERING_TIME]);
+ ms_afMaxCumulativeTime[PROFILE_TOTAL] = max(ms_afMaxCumulativeTime[PROFILE_TOTAL], ms_afCumulativeTime[PROFILE_TOTAL]);
+}
+#endif \ No newline at end of file
diff --git a/src/core/Profile.h b/src/core/Profile.h
new file mode 100644
index 00000000..d2e8054b
--- /dev/null
+++ b/src/core/Profile.h
@@ -0,0 +1,28 @@
+#pragma once
+
+enum eProfile
+{
+ PROFILE_FRAME_RATE,
+ PROFILE_PHYSICS,
+ PROFILE_COLLISION,
+ PROFILE_PED_AI,
+ PROFILE_PROCESSING_TIME,
+ PROFILE_RENDERING_TIME,
+ PROFILE_TOTAL,
+ NUM_PROFILES,
+};
+
+class CProfile
+{
+ static float ms_afStartTime[NUM_PROFILES];
+ static float ms_afCumulativeTime[NUM_PROFILES];
+ static float ms_afEndTime[NUM_PROFILES];
+ static float ms_afMaxEndTime[NUM_PROFILES];
+ static float ms_afMaxCumulativeTime[NUM_PROFILES];
+ static char *ms_pProfileString[NUM_PROFILES];
+ static RwRGBA ms_aBarColours[NUM_PROFILES];
+public:
+ static void Initialise();
+ static void SuspendProfile(eProfile profile);
+ static void ShowResults();
+}; \ No newline at end of file
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 994c94ca..154e7e9a 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -1412,8 +1412,8 @@ CRadar::DrawYouAreHereSprite(float x, float y)
}
} else {
if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 200) {
- lastChange = CTimer::GetTimeInMillisecondsPauseMode();
- show = !show;
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ show = !show;
}
}
@@ -1422,7 +1422,7 @@ CRadar::DrawYouAreHereSprite(float x, float y)
float top = y - SCREEN_SCALE_Y(2.0f);
float right = SCREEN_SCALE_X(12.0) + x;
float bottom = y - SCREEN_SCALE_Y(26.0f);
- CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 217, 106, 255));
+ CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
}
MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
}
@@ -1503,4 +1503,4 @@ STARTPATCHES
InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP);
//InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP);
//InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP);
-ENDPATCHES
+ENDPATCHES \ No newline at end of file
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 3dcb767a..d00edf51 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1247,8 +1247,8 @@ CStreaming::StreamVehiclesAndPeds(void)
static int timeBeforeNextLoad = 0;
static int modelQualityClass = 0;
- if(CRecordDataForGame::RecordingState == RECORDSTATE_1 ||
- CRecordDataForGame::RecordingState == RECORDSTATE_2)
+ if(CRecordDataForGame::IsRecording() ||
+ CRecordDataForGame::IsPlayingBack())
return;
if(FindPlayerPed()->m_pWanted->AreSwatRequired()){
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp
index 18d6b6a3..fda862f1 100644
--- a/src/core/Timer.cpp
+++ b/src/core/Timer.cpp
@@ -34,6 +34,10 @@ LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318;
//UInt32 suspendDepth;
uint32 &suspendDepth = *(uint32*)0x62A320;
+#ifdef FIX_BUGS
+double frameTime;
+#endif
+
void CTimer::Initialise(void)
{
debug("Initialising CTimer...\n");
@@ -90,17 +94,21 @@ void CTimer::Update(void)
float updInCyclesScaled = updInCycles * ms_fTimeScale;
- double upd = updInCyclesScaled / (double)_nCyclesPerMS;
+ // We need that real frame time to fix transparent menu bug.
+#ifndef FIX_BUGS
+ double
+#endif
+ frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
- m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd;
+ m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
if ( GetIsPaused() )
ms_fTimeStep = 0.0f;
else
{
- m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd;
- m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd;
- ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0f;
+ m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
+ m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
+ ms_fTimeStep = frameTime / 1000.0f * 50.0f;
}
}
else
@@ -109,19 +117,23 @@ void CTimer::Update(void)
uint32 updInMs = timer - oldPcTimer;
- double upd = (double)updInMs * ms_fTimeScale;
+ // We need that real frame time to fix transparent menu bug.
+#ifndef FIX_BUGS
+ double
+#endif
+ frameTime = (double)updInMs * ms_fTimeScale;
oldPcTimer = timer;
- m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd;
+ m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
if ( GetIsPaused() )
ms_fTimeStep = 0.0f;
else
{
- m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd;
- m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd;
- ms_fTimeStep = upd / 1000.0f * 50.0f;
+ m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
+ m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
+ ms_fTimeStep = frameTime / 1000.0f * 50.0f;
}
}
@@ -130,7 +142,7 @@ void CTimer::Update(void)
ms_fTimeStepNonClipped = ms_fTimeStep;
- if ( CRecordDataForGame::RecordingState != RECORDSTATE_2 )
+ if ( !CRecordDataForGame::IsPlayingBack() )
{
ms_fTimeStep = min(3.0f, ms_fTimeStep);
@@ -138,7 +150,7 @@ void CTimer::Update(void)
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60;
}
- if ( CRecordDataForChase::Status == RECORDSTATE_1 )
+ if ( CRecordDataForChase::IsRecording() )
{
ms_fTimeStep = 1.0f;
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 16;
diff --git a/src/core/Timer.h b/src/core/Timer.h
index 2498ec8a..a4d674da 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -21,6 +21,7 @@ public:
static float 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; }
static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; }
static const uint32 &GetFrameCounter(void) { return m_FrameCounter; }
static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; }
@@ -52,4 +53,11 @@ public:
static void Stop(void);
static void StartUserPause(void);
static void EndUserPause(void);
+
+ friend bool GenericLoad(void);
+ friend bool GenericSave(int file);
};
+
+#ifdef FIX_BUGS
+extern double frameTime;
+#endif
diff --git a/src/core/World.cpp b/src/core/World.cpp
index b4ae9346..313b958a 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -21,7 +21,7 @@
#include "Population.h"
#include "Fire.h"
-CColPoint *gaTempSphereColPoints = (CColPoint*)0x6E64C0; // [32]
+CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
@@ -29,7 +29,7 @@ CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x6656
uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
-CPlayerInfo (&CWorld::Players)[NUMPLAYERS] = *(CPlayerInfo (*)[NUMPLAYERS])*(uintptr*)0x9412F0;
+CPlayerInfo CWorld::Players[NUMPLAYERS];
bool &CWorld::bNoMoreCollisionTorque = *(bool*)0x95CDCC;
CEntity *&CWorld::pIgnoreEntity = *(CEntity**)0x8F6494;
bool &CWorld::bIncludeDeadPeds = *(bool*)0x95CD8F;
diff --git a/src/core/World.h b/src/core/World.h
index 0ee3fdda..d3f1e2d5 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -61,7 +61,7 @@ class CWorld
public:
static uint8 &PlayerInFocus;
- static CPlayerInfo (&Players)[NUMPLAYERS];
+ static CPlayerInfo Players[NUMPLAYERS];
static CEntity *&pIgnoreEntity;
static bool &bIncludeDeadPeds;
static bool &bNoMoreCollisionTorque;
@@ -146,7 +146,7 @@ public:
static void UseDetonator(CEntity *);
};
-extern CColPoint *gaTempSphereColPoints;
+extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
class CPlayerPed;
class CVehicle;
diff --git a/src/core/common.h b/src/core/common.h
index 9b897cca..7688b182 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -74,9 +74,11 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
}
+#ifndef RWLIBS
// little hack
extern void **rwengine;
#define RwEngineInstance (*rwengine)
+#endif
#include "skeleton.h"
#include "Draw.h"
@@ -107,10 +109,8 @@ extern void **rwengine;
#ifdef ASPECT_RATIO_SCALE
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
-#define SCREEN_SCALE_AR2(a) ((a) / (DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO))
#else
#define SCREEN_SCALE_AR(a) (a)
-#define SCREEN_SCALE_AR2(a) (a)
#endif
#include "maths.h"
diff --git a/src/core/config.h b/src/core/config.h
index 8dea3216..f7fde579 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -87,6 +87,7 @@ enum Config {
NUMSCRIPTEDPICKUPS = 16,
NUMPICKUPS = NUMGENERALPICKUPS + NUMSCRIPTEDPICKUPS,
NUMCOLLECTEDPICKUPS = 20,
+ NUMPACMANPICKUPS = 256,
NUMEVENTS = 64,
NUM_CARGENS = 160,
@@ -192,7 +193,7 @@ enum Config {
// Pad
#define XINPUT
#define KANGAROO_CHEAT
-#define REGISTER_START_BUTTON // currently only in menu sadly. resumes the game
+#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
@@ -200,6 +201,9 @@ enum Config {
#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.
#define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
+#define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
+#define TRIANGLE_BACK_BUTTON
+// #define CIRCLE_BACK_BUTTON
// Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 02f7d523..b028b5fb 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1,8 +1,7 @@
#include "common.h"
#include "rpmatfx.h"
-#include "rpskin.h"
#include "rphanim.h"
-#include "rtbmp.h"
+#include "rpskin.h"
#include "patcher.h"
#include "main.h"
#include "CdStream.h"
@@ -54,10 +53,12 @@
#include "Frontend.h"
#include "AnimViewer.h"
#include "Script.h"
+#include "PathFind.h"
#include "Debug.h"
#include "Console.h"
#include "timebars.h"
#include "GenericGameStorage.h"
+#include "SceneEdit.h"
GlobalScene &Scene = *(GlobalScene*)0x726768;
@@ -690,14 +691,14 @@ DisplayGameDebugText()
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetFontStyle(FONT_BANK);
- CFont::SetScale(SCREEN_STRETCH_X(0.5f), SCREEN_STRETCH_Y(0.5f));
+ CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f));
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetJustifyOff();
CFont::SetBackGroundOnlyTextOff();
CFont::SetColor(CRGBA(255, 108, 0, 255));
- CFont::PrintString(10.0f, 10.0f, ver);
+ CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver);
FrameSamples++;
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
@@ -748,6 +749,7 @@ DisplayGameDebugText()
AsciiToUnicode(str, ustr);
+ // Let's not scale those numbers, they look better that way :eyes:
CFont::SetPropOff();
CFont::SetBackgroundOff();
CFont::SetScale(0.7f, 1.5f);
@@ -788,8 +790,11 @@ void
RenderDebugShit(void)
{
CTheScripts::RenderTheScriptDebugLines();
+#ifndef FINAL
if(gbShowCollisionLines)
CRenderer::RenderCollisionLines();
+ ThePaths.DisplayPathData();
+#endif
}
void
@@ -860,11 +865,9 @@ Render2dStuff(void)
MusicManager.DisplayRadioStationName();
TheConsole.Display();
-/*
if(CSceneEdit::m_bEditOn)
CSceneEdit::Draw();
else
-*/
CHud::Draw();
CUserDisplay::OnscnTimer.ProcessForDisplay();
CMessages::Display();
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 6eae8685..5d76d642 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -21,10 +21,17 @@
#include "Particle.h"
#include "Console.h"
#include "Debug.h"
+#include "Hud.h"
+#include "SceneEdit.h"
+#include "Pad.h"
#include <list>
+#ifndef RWLIBS
void **rwengine = *(void***)0x5A10E1;
+#else
+extern "C" int vsprintf(char* const _Buffer, char const* const _Format, va_list _ArgList);
+#endif
DebugMenuAPI gDebugMenuAPI;
@@ -145,19 +152,6 @@ SpawnCar(int id)
}
static void
-LetThemFollowYou(void) {
- CPed *player = (CPed*) FindPlayerPed();
- for (int i = 0; i < player->m_numNearPeds; i++) {
- CPed *nearPed = player->m_nearPeds[i];
- if (nearPed && !nearPed->IsPlayer()) {
- nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
- nearPed->m_pedFormation = (eFormation)(1 + (rand() & 7));
- nearPed->bScriptObjectiveCompleted = false;
- }
- }
-}
-
-static void
FixCar(void)
{
CVehicle *veh = FindPlayerVehicle();
@@ -337,7 +331,10 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
+ DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); });
+ DebugMenuAddVarBool8("Debug", "Draw hud", (int8*)&CHud::m_Wants_To_Draw_Hud, nil);
+ DebugMenuAddVarBool8("Debug", "Edit on", (int8*)&CSceneEdit::m_bEditOn, nil);
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
@@ -350,6 +347,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", (int8*)0x95CD43, nil);
+ DebugMenuAddVarBool8("Debug", "Show Ped Paths", (int8*)&gbShowPedPaths, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Paths", (int8*)&gbShowCarPaths, nil);
+ DebugMenuAddVarBool8("Debug", "Show Car Path Links", (int8*)&gbShowCarPathsLinks, nil);
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
@@ -359,8 +359,6 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
-
- DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou);
#ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 07d70394..25e5db48 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -62,11 +62,11 @@ CEntity::CEntity(void)
bRemoveFromWorld = false;
bHasHitWall = false;
bImBeingRendered = false;
- m_flagD8 = false;
+ bTouchingWater = false;
bIsSubway = false;
bDrawLast = false;
bNoBrightHeadLights = false;
- m_flagD80 = false;
+ bDoNotRender = false;
bDistanceFade = false;
m_flagE2 = false;
diff --git a/src/entities/Entity.h b/src/entities/Entity.h
index 99cc7f17..ca501ba4 100644
--- a/src/entities/Entity.h
+++ b/src/entities/Entity.h
@@ -73,11 +73,11 @@ public:
uint32 bRemoveFromWorld : 1;
uint32 bHasHitWall : 1;
uint32 bImBeingRendered : 1;
- uint32 m_flagD8 : 1; // used by cBuoyancy::ProcessBuoyancy
+ uint32 bTouchingWater : 1; // used by cBuoyancy::ProcessBuoyancy
uint32 bIsSubway : 1; // set when subway, but maybe different meaning?
uint32 bDrawLast : 1;
uint32 bNoBrightHeadLights : 1;
- uint32 m_flagD80 : 1; // CObject visibility?
+ uint32 bDoNotRender : 1;
// flagsE
uint32 bDistanceFade : 1;
@@ -90,6 +90,7 @@ public:
CReference *m_pFirstReference;
CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); }
+ uint32* GetAddressOfEntityProperties() { /* AWFUL */ return (uint32*)((char*)&m_rwObject + sizeof(m_rwObject)); }
CEntity(void);
~CEntity(void);
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index bd13ff37..bbdf68f5 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -21,7 +21,7 @@ CPhysical::CPhysical(void)
{
int i;
- fForceMultiplier = 1.0f;
+ m_fForceMultiplier = 1.0f;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecMoveFriction = CVector(0.0f, 0.0f, 0.0f);
@@ -1037,7 +1037,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
int numCollisions;
int mostColliding;
- CColPoint colpoints[32];
+ CColPoint colpoints[MAX_COLLISION_POINTS];
CVector shift = { 0.0f, 0.0f, 0.0f };
bool doShift = false;
CEntity *boat = nil;
@@ -1187,7 +1187,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
bool
CPhysical::ProcessCollisionSectorList_SimpleCar(CPtrList *lists)
{
- static CColPoint aColPoints[32];
+ static CColPoint aColPoints[MAX_COLLISION_POINTS];
float radius;
CVector center;
int listtype;
@@ -1349,7 +1349,7 @@ collision:
bool
CPhysical::ProcessCollisionSectorList(CPtrList *lists)
{
- static CColPoint aColPoints[32];
+ static CColPoint aColPoints[MAX_COLLISION_POINTS];
float radius;
CVector center;
CPtrList *list;
diff --git a/src/entities/Physical.h b/src/entities/Physical.h
index 1b9f0e02..6fbc3ffd 100644
--- a/src/entities/Physical.h
+++ b/src/entities/Physical.h
@@ -29,7 +29,7 @@ public:
CVector m_vecTurnSpeedAvg;
float m_fMass;
float m_fTurnMass; // moment of inertia
- float fForceMultiplier;
+ float m_fForceMultiplier;
float m_fAirResistance;
float m_fElasticity;
float m_fBuoyancy;
diff --git a/src/math/Vector.h b/src/math/Vector.h
index 9b732610..269ffc88 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -90,7 +90,7 @@ public:
return x == right.x && y == right.y && z == right.z;
}
- bool IsZero(void) { return x == 0.0f && y == 0.0f && z == 0.0f; }
+ bool IsZero(void) const { return x == 0.0f && y == 0.0f && z == 0.0f; }
};
inline CVector operator+(const CVector &left, const CVector &right)
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
index a9bafb64..0c4bf934 100644
--- a/src/modelinfo/BaseModelInfo.h
+++ b/src/modelinfo/BaseModelInfo.h
@@ -2,6 +2,8 @@
#include "Collision.h"
+#define MAX_MODEL_NAME (24)
+
enum ModeInfoType : uint8
{
MITYPE_NA = 0,
@@ -21,7 +23,7 @@ class CBaseModelInfo
{
protected:
// TODO?: make more things protected
- char m_name[24];
+ char m_name[MAX_MODEL_NAME];
CColModel *m_colModel;
C2dEffect *m_twodEffects;
int16 m_objectId;
diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp
index d956abaa..b6a95992 100644
--- a/src/modelinfo/ModelInfo.cpp
+++ b/src/modelinfo/ModelInfo.cpp
@@ -234,12 +234,6 @@ CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level)
}
}
-CStore<CInstance, MLOINSTANCESIZE>&
-CModelInfo::GetMloInstanceStore()
-{
- return CModelInfo::ms_mloInstanceStore;
-}
-
void
CModelInfo::ConstructMloClumps()
{
@@ -247,6 +241,17 @@ CModelInfo::ConstructMloClumps()
ms_mloModelStore.store[i].ConstructClump();
}
+void
+CModelInfo::ReInit2dEffects()
+{
+ ms_2dEffectStore.clear();
+
+ for (int i = 0; i < MODELINFOSIZE; i++) {
+ if (ms_modelInfoPtrs[i])
+ ms_modelInfoPtrs[i]->Init2dEffects();
+ }
+}
+
STARTPATCHES
InjectHook(0x50B310, CModelInfo::Initialise, PATCH_JUMP);
InjectHook(0x50B5B0, CModelInfo::ShutDown, PATCH_JUMP);
diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h
index 13756ddf..e6dec1d8 100644
--- a/src/modelinfo/ModelInfo.h
+++ b/src/modelinfo/ModelInfo.h
@@ -36,7 +36,7 @@ public:
static CVehicleModelInfo *AddVehicleModel(int id);
static CStore<C2dEffect, TWODFXSIZE> &Get2dEffectStore(void) { return ms_2dEffectStore; }
- static CStore<CInstance, MLOINSTANCESIZE> &GetMloInstanceStore();
+ static CStore<CInstance, MLOINSTANCESIZE> &GetMloInstanceStore(void) { return ms_mloInstanceStore; }
static CBaseModelInfo *GetModelInfo(const char *name, int *id);
static CBaseModelInfo *GetModelInfo(int id){
@@ -47,4 +47,5 @@ public:
static bool IsBikeModel(int32 id);
static void RemoveColModelsFromOtherLevels(eLevelName level);
static void ConstructMloClumps();
+ static void ReInit2dEffects();
};
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index 432a9ea2..0c45aa12 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -12,6 +12,7 @@
#include "World.h"
#include "Vehicle.h"
#include "Automobile.h"
+#include "Boat.h"
#include "Train.h"
#include "Plane.h"
#include "Heli.h"
@@ -80,9 +81,9 @@ RwObjectNameIdAssocation carIds[] = {
};
RwObjectNameIdAssocation boatIds[] = {
- { "boat_moving_hi", 1, VEHICLE_FLAG_COLLAPSE },
- { "boat_rudder_hi", 3, VEHICLE_FLAG_COLLAPSE },
- { "windscreen", 2, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE },
+ { "boat_moving_hi", BOAT_MOVING, VEHICLE_FLAG_COLLAPSE },
+ { "boat_rudder_hi", BOAT_RUDDER, VEHICLE_FLAG_COLLAPSE },
+ { "windscreen", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE },
{ "ped_frontseat", BOAT_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ nil, 0, 0 }
};
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index aa366aa0..867624c7 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -6,12 +6,11 @@
#include "Radar.h"
#include "Object.h"
#include "DummyObject.h"
-
-WRAPPER void CObject::ObjectDamage(float amount) { EAXJMP(0x4BB240); }
-WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
-WRAPPER void CObject::Init(void) { EAXJMP(0x4BAEC0); }
-WRAPPER void CObject::ProcessControl(void) { EAXJMP(0x4BB040); }
-WRAPPER void CObject::Teleport(CVector) { EAXJMP(0x4BBDA0); }
+#include "Particle.h"
+#include "General.h"
+#include "ObjectData.h"
+#include "World.h"
+#include "Floater.h"
int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2;
int16 &CObject::nBodyCastHealth = *(int16*)0x5F7D4C; // 1000
@@ -28,13 +27,13 @@ CObject::CObject(void)
m_nCollisionDamageEffect = 0;
m_nSpecialCollisionResponseCases = COLLRESPONSE_NONE;
m_bCameraToAvoidThisObject = false;
- ObjectCreatedBy = 0;
+ ObjectCreatedBy = UNKNOWN_OBJECT;
m_nEndOfLifeTime = 0;
// m_nRefModelIndex = -1; // duplicate
// bUseVehicleColours = false; // duplicate
m_colour2 = 0;
m_colour1 = m_colour2;
- field_172 = 0;
+ m_nBonusValue = 0;
bIsPickup = false;
m_obj_flag2 = false;
bOutOfStock = false;
@@ -82,10 +81,46 @@ CObject::~CObject(void)
nNoTempObjects--;
}
+void
+CObject::ProcessControl(void)
+{
+ CVector point, impulse;
+ if (m_nCollisionDamageEffect)
+ ObjectDamage(m_fDamageImpulse);
+ CPhysical::ProcessControl();
+ if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
+ bIsInWater = true;
+ bIsStatic = false;
+ ApplyMoveForce(impulse);
+ ApplyTurnForce(impulse, point);
+ float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
+ m_vecMoveSpeed *= fTimeStep;
+ m_vecTurnSpeed *= fTimeStep;
+ }
+ if ((m_modelIndex == MI_EXPLODINGBARREL || m_modelIndex == MI_PETROLPUMP) && bHasBeenDamaged && bIsVisible
+ && (CGeneral::GetRandomNumber() & 0x1F) == 10) {
+ bExplosionProof = true;
+ bIsVisible = false;
+ bUsesCollision = false;
+ bAffectedByGravity = false;
+ m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
+ }
+}
+
+void
+CObject::Teleport(CVector vecPos)
+{
+ CWorld::Remove(this);
+ m_matrix.GetPosition() = vecPos;
+ m_matrix.UpdateRW();
+ UpdateRwFrame();
+ CWorld::Add(this);
+}
+
void
CObject::Render(void)
{
- if(m_flagD80)
+ if(bDoNotRender)
return;
if(m_nRefModelIndex != -1 && ObjectCreatedBy == TEMP_OBJECT && bUseVehicleColours){
@@ -117,6 +152,152 @@ CObject::RemoveLighting(bool reset)
WorldReplaceScorchedLightsWithNormal(Scene.world);
}
+void
+CObject::ObjectDamage(float amount)
+{
+ if (!m_nCollisionDamageEffect || !bUsesCollision)
+ return;
+ static int8 nFrameGen = 0;
+ bool bBodyCastDamageEffect = false;
+ if (m_modelIndex == MI_BODYCAST){
+ if (amount > 50.0f)
+ nBodyCastHealth = (int16)(nBodyCastHealth - 0.5f * amount);
+ if (nBodyCastHealth < 0)
+ nBodyCastHealth = 0;
+ if (nBodyCastHealth < 200)
+ bBodyCastDamageEffect = true;
+ amount = 0.0f;
+ }
+ if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) {
+ const CVector& vecPos = m_matrix.GetPosition();
+ const float fDirectionZ = 0.0002f * amount;
+ switch (m_nCollisionDamageEffect)
+ {
+ case COLDAMAGE_EFFECT_CHANGE_MODEL:
+ bRenderDamaged = true;
+ break;
+ case COLDAMAGE_EFFECT_SPLIT_MODEL:
+ break;
+ case COLDAMAGE_EFFECT_SMASH_COMPLETELY:
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ break;
+ case COLDAMAGE_EFFECT_CHANGE_THEN_SMASH:
+ if (!bRenderDamaged) {
+ bRenderDamaged = true;
+ }
+ else {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ }
+ break;
+ case COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY: {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ const RwRGBA color = { 96, 48, 0, 255 };
+ for (int32 i = 0; i < 25; i++) {
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ ++nFrameGen;
+ int32 currentFrame = nFrameGen & 3;
+ float fRandom = CGeneral::GetRandomNumberInRange(0.01f, 1.0f);
+ RwRGBA randomColor = { color.red * fRandom, color.green * fRandom , color.blue, color.alpha };
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
+ 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);
+ break;
+ }
+ case COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ const RwRGBA color = { 128, 128, 128, 255 };
+ for (int32 i = 0; i < 45; i++) {
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ ++nFrameGen;
+ int32 currentFrame = nFrameGen & 3;
+ float fRandom = CGeneral::GetRandomNumberInRange(0.5f, 0.5f);
+ RwRGBA randomColor = { color.red * fRandom, color.green * fRandom , color.blue * fRandom, color.alpha };
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
+ 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);
+ break;
+ }
+ case COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ const RwRGBA color1 = { 200, 0, 0, 255 };
+ const RwRGBA color2 = { 200, 200, 200, 255 };
+ for (int32 i = 0; i < 10; i++) {
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ ++nFrameGen;
+ int32 currentFrame = nFrameGen & 3;
+ RwRGBA color = color2;
+ if (nFrameGen & 1)
+ color = color1;
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
+ 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);
+ break;
+ }
+ case COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
+ bIsVisible = false;
+ bUsesCollision = false;
+ bIsStatic = true;
+ bExplosionProof = true;
+ SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ SetTurnSpeed(0.0f, 0.0f, 0.0f);
+ const RwRGBA color1 = { 200, 0, 0, 255 };
+ const RwRGBA color2 = { 200, 200, 200, 255 };
+ for (int32 i = 0; i < 32; i++) {
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ ++nFrameGen;
+ int32 currentFrame = nFrameGen & 3;
+ RwRGBA color = color2;
+ if (nFrameGen & 1)
+ color = color1;
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
+ 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);
+ break;
+ }
+ }
+ }
+}
void
CObject::RefModelInfo(int32 modelId)
@@ -125,6 +306,39 @@ CObject::RefModelInfo(int32 modelId)
CModelInfo::GetModelInfo(modelId)->AddRef();
}
+void
+CObject::Init(void)
+{
+ m_type = ENTITY_TYPE_OBJECT;;
+ CObjectData::SetObjectData(m_modelIndex, *this);
+ m_nEndOfLifeTime = 0;
+ ObjectCreatedBy = GAME_OBJECT;
+ bIsStatic = true;
+ bIsPickup = false;
+ m_obj_flag2 = false;
+ bOutOfStock = false;
+ bGlassCracked = false;
+ bGlassBroken = false;
+ bHasBeenDamaged = false;
+ bUseVehicleColours = false;
+ m_nRefModelIndex = -1;
+ m_colour1 = 0;
+ m_colour2 = 0;
+ m_nBonusValue = 0;
+ m_pCollidingEntity = nil;
+ CColPoint point;
+ CEntity* outEntity = nil;
+ const CVector& vecPos = m_matrix.GetPosition();
+ if (CWorld::ProcessVerticalLine(vecPos, vecPos.z - 10.0f, point, outEntity, true, false, false, false, false, false, nil))
+ m_pCurSurface = outEntity;
+ else
+ m_pCurSurface = nil;
+ if (m_modelIndex == MI_BODYCAST)
+ nBodyCastHealth = 1000;
+ else if (m_modelIndex == MI_BUOY)
+ bTouchingWater = true;
+}
+
bool
CObject::CanBeDeleted(void)
{
@@ -142,6 +356,45 @@ CObject::CanBeDeleted(void)
}
}
+void
+CObject::DeleteAllMissionObjects()
+{
+ CObjectPool* objectPool = CPools::GetObjectPool();
+ for (int32 i = 0; i < objectPool->GetSize(); i++) {
+ CObject* pObject = objectPool->GetSlot(i);
+ if (pObject && pObject->ObjectCreatedBy == MISSION_OBJECT) {
+ CWorld::Remove(pObject);
+ delete pObject;
+ }
+ }
+}
+
+void
+CObject::DeleteAllTempObjects()
+{
+ CObjectPool* objectPool = CPools::GetObjectPool();
+ for (int32 i = 0; i < objectPool->GetSize(); i++) {
+ CObject* pObject = objectPool->GetSlot(i);
+ if (pObject && pObject->ObjectCreatedBy == TEMP_OBJECT) {
+ CWorld::Remove(pObject);
+ delete pObject;
+ }
+ }
+}
+
+void
+CObject::DeleteAllTempObjectInArea(CVector point, float fRadius)
+{
+ CObjectPool *objectPool = CPools::GetObjectPool();
+ for (int32 i = 0; i < objectPool->GetSize(); i++) {
+ CObject *pObject = objectPool->GetSlot(i);
+ if (pObject && pObject->ObjectCreatedBy == TEMP_OBJECT && fRadius * fRadius > pObject->GetPosition().MagnitudeSqr()) {
+ CWorld::Remove(pObject);
+ delete pObject;
+ }
+ }
+}
+
#include <new>
class CObject_ : public CObject
@@ -152,6 +405,9 @@ public:
CObject *ctor(CDummyObject *dummy) { return ::new (this) CObject(dummy); }
void dtor(void) { CObject::~CObject(); }
void Render_(void) { CObject::Render(); }
+ void ProcessControl_(void) { CObject::ProcessControl(); }
+ bool SetupLighting_(void) { return CObject::SetupLighting(); }
+ void RemoveLighting_(bool reset) { CObject::RemoveLighting(reset); }
};
STARTPATCHES
@@ -159,5 +415,16 @@ STARTPATCHES
InjectHook(0x4BACE0, (CObject* (CObject::*)(int32, bool)) &CObject_::ctor, PATCH_JUMP);
InjectHook(0x4BAD50, (CObject* (CObject::*)(CDummyObject*)) &CObject_::ctor, PATCH_JUMP);
InjectHook(0x4BAE00, &CObject_::dtor, PATCH_JUMP);
+ InjectHook(0x4BB040, &CObject_::ProcessControl_, PATCH_JUMP);
+ InjectHook(0x4BBDA0, &CObject::Teleport, PATCH_JUMP);
InjectHook(0x4BB1E0, &CObject_::Render_, PATCH_JUMP);
+ InjectHook(0x4A7C90, &CObject_::SetupLighting_, PATCH_JUMP);
+ InjectHook(0x4A7CD0, &CObject_::RemoveLighting_, PATCH_JUMP);
+ InjectHook(0x4BB240, &CObject::ObjectDamage, PATCH_JUMP);
+ InjectHook(0x4BBD80, &CObject::RefModelInfo, PATCH_JUMP);
+ InjectHook(0x4BAEC0, &CObject::Init, PATCH_JUMP);
+ InjectHook(0x4BB010, &CObject::CanBeDeleted, PATCH_JUMP);
+ InjectHook(0x4BBE60, &CObject::DeleteAllMissionObjects, PATCH_JUMP);
+ InjectHook(0x4BBDF0, &CObject::DeleteAllTempObjects, PATCH_JUMP);
+ InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectInArea, PATCH_JUMP);
ENDPATCHES
diff --git a/src/objects/Object.h b/src/objects/Object.h
index 27346e23..6d04c78a 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -3,6 +3,7 @@
#include "Physical.h"
enum {
+ UNKNOWN_OBJECT = 0,
GAME_OBJECT = 1,
MISSION_OBJECT = 2,
TEMP_OBJECT = 3,
@@ -10,6 +11,18 @@ enum {
};
enum {
+ COLDAMAGE_EFFECT_NONE = 0,
+ COLDAMAGE_EFFECT_CHANGE_MODEL = 1,
+ COLDAMAGE_EFFECT_SPLIT_MODEL = 2,
+ COLDAMAGE_EFFECT_SMASH_COMPLETELY = 3,
+ COLDAMAGE_EFFECT_CHANGE_THEN_SMASH = 4,
+ COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY = 50,
+ COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY = 60,
+ COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY = 70,
+ COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY = 80,
+};
+
+enum {
COLLRESPONSE_NONE,
COLLRESPONSE_CHANGE_MODEL,
COLLRESPONSE_SPLIT_MODEL,
@@ -41,21 +54,21 @@ public:
int8 bHasBeenDamaged : 1;
int8 bUseVehicleColours : 1;
int8 m_obj_flag80 : 1;
- int8 field_172; // car for a bonus pickup?
- int8 field_173;
+ int8 m_nBonusValue;
+ int8 field_173;
float m_fCollisionDamageMultiplier;
uint8 m_nCollisionDamageEffect;
uint8 m_nSpecialCollisionResponseCases;
bool m_bCameraToAvoidThisObject;
- int8 field_17B;
- int8 field_17C;
- int8 field_17D;
- int8 field_17E;
- int8 field_17F;
+ int8 field_17B;
+ int8 field_17C;
+ int8 field_17D;
+ int8 field_17E;
+ int8 field_17F;
uint32 m_nEndOfLifeTime;
int16 m_nRefModelIndex;
- int8 field_186;
- int8 field_187;
+ int8 field_186;
+ int8 field_187;
CEntity *m_pCurSurface;
CEntity *m_pCollidingEntity;
int8 m_colour1, m_colour2;
@@ -74,7 +87,7 @@ public:
~CObject(void);
void ProcessControl(void);
- void Teleport(CVector);
+ void Teleport(CVector vecPos);
void Render(void);
bool SetupLighting(void);
void RemoveLighting(bool reset);
@@ -84,6 +97,8 @@ public:
void Init(void);
bool CanBeDeleted(void);
- static void DeleteAllTempObjectInArea(CVector, float);
+ static void DeleteAllMissionObjects();
+ static void DeleteAllTempObjects();
+ static void DeleteAllTempObjectInArea(CVector point, float fRadius);
};
static_assert(sizeof(CObject) == 0x198, "CObject: error");
diff --git a/src/objects/ParticleObject.cpp b/src/objects/ParticleObject.cpp
index 9f7bcda5..60827411 100644
--- a/src/objects/ParticleObject.cpp
+++ b/src/objects/ParticleObject.cpp
@@ -154,7 +154,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_nRemoveTimer = 0;
if ( color.alpha != 0 )
- pobj->m_Color, color;
+ pobj->m_Color = color;
else
pobj->m_Color.alpha = 0;
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index 533d7c98..a9e0580e 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -28,10 +28,8 @@ CCivilianPed::CivilianAI(void)
return;
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
- if (m_pedInObjective) {
- if (m_pedInObjective->IsPlayer())
- return;
- }
+ if (m_pedInObjective && m_pedInObjective->IsPlayer())
+ return;
}
if (CTimer::GetTimeInMilliseconds() <= m_lookTimer)
return;
@@ -75,7 +73,7 @@ CCivilianPed::CivilianAI(void)
} else {
SetMoveState(PEDMOVE_WALK);
}
- } else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops) {
+ } else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
SetFindPathAndFlee(m_threatEntity, 5000);
if (threatDistSqr < sq(10.0f)) {
SetMoveState(PEDMOVE_RUN);
@@ -170,8 +168,8 @@ CCivilianPed::CivilianAI(void)
if (m_threatEntity && m_threatEntity->IsPed()) {
CPed *threatPed = (CPed*)m_threatEntity;
if (m_pedStats->m_fear <= 100 - threatPed->m_pedStats->m_temper && threatPed->m_nPedType != PEDTYPE_COP) {
- if (threatPed->GetWeapon()->IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
- if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops) {
+ if (threatPed->GetWeapon(m_currentWeapon).IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
+ if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
SetFindPathAndFlee(m_threatEntity, 10000);
}
diff --git a/src/control/Gangs.cpp b/src/peds/Gangs.cpp
index 57d9c67e..c67fe599 100644
--- a/src/control/Gangs.cpp
+++ b/src/peds/Gangs.cpp
@@ -4,7 +4,6 @@
#include "Gangs.h"
#include "Weapon.h"
-//CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[NUM_GANGS])*(uintptr*)0x6EDF78;
CGangInfo CGangs::Gang[NUM_GANGS];
CGangInfo::CGangInfo() :
@@ -70,7 +69,6 @@ void CGangs::LoadAllGangData(uint8 *buf, uint32 size)
Initialise();
INITSAVEBUF
- // original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE);
for (int i = 0; i < NUM_GANGS; i++)
diff --git a/src/control/Gangs.h b/src/peds/Gangs.h
index dd7a7f93..dd7a7f93 100644
--- a/src/control/Gangs.h
+++ b/src/peds/Gangs.h
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 4ee31a30..4696df31 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -62,7 +62,7 @@
CPed *gapTempPedList[50];
uint16 gnNumTempPedList;
-CColPoint &aTempPedColPts = *(CColPoint*)0x62DB14;
+CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
PedAudioData CommentWaitTime[39] = {
@@ -106,8 +106,6 @@ PedAudioData CommentWaitTime[39] = {
{1000, 1000, 1000, 1000},
{1000, 1000, 5000, 5000},
};
-// *(CPedAudioData(*)[39]) * (uintptr*)0x5F94C4;
-
uint16 nPlayerInComboMove;
RpClump *flyingClumpTemp;
@@ -139,10 +137,9 @@ FightMove tFightMoves[NUM_FIGHTMOVES] = {
{ANIM_HIT_BEHIND, 0.0f, 0.0f, 0.0f, 0.0f, HITLEVEL_NULL, 0, 0},
{ANIM_FIGHT2_IDLE, 0.0f, 0.0f, 0.0f, 0.0f, HITLEVEL_NULL, 0, 0},
};
-// *(FightMove(*)[NUM_FIGHTMOVES])* (uintptr*)0x5F9844;
-uint16 &CPed::nThreatReactionRangeMultiplier = *(uint16*)0x5F8C98;
-uint16 &CPed::nEnterCarRangeMultiplier = *(uint16*)0x5F8C94;
+uint16 CPed::nThreatReactionRangeMultiplier = 1;
+uint16 CPed::nEnterCarRangeMultiplier = 1;
CVector vecPedCarDoorAnimOffset;
CVector vecPedCarDoorLoAnimOffset;
@@ -151,9 +148,9 @@ CVector vecPedQuickDraggedOutCarAnimOffset;
CVector vecPedDraggedOutCarAnimOffset;
CVector vecPedTrainDoorAnimOffset;
-bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
-bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
-bool &CPed::bPedCheat3 = *(bool*)0x95CD59;
+bool CPed::bNastyLimbsCheat;
+bool CPed::bPedCheat2;
+bool CPed::bPedCheat3;
CVector2D CPed::ms_vec2DFleePosition;
void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
@@ -2733,7 +2730,6 @@ CPed::SetObjective(eObjective newObj, void *entity)
}
#ifdef VC_PED_PORTS
- SetObjectiveTimer(0);
ClearPointGunAt();
#endif
bObjectiveCompleted = false;
@@ -4144,7 +4140,7 @@ CPed::SetGetUp(void)
&& ((CTimer::GetFrameCounter() + m_randomSeed % 256 + 5) % 8
|| CCollision::ProcessColModels(GetMatrix(), *CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(),
collidingVeh->GetMatrix(), *CModelInfo::GetModelInfo(collidingVeh->m_modelIndex)->GetColModel(),
- &aTempPedColPts, nil, nil) > 0)) {
+ aTempPedColPts, nil, nil) > 0)) {
bGetUpAnimStarted = false;
if (IsPlayer())
@@ -15027,7 +15023,7 @@ CPed::ProcessBuoyancy(void)
#endif
if (mod_Buoyancy.ProcessBuoyancy(this, GRAVITY * m_fMass * buoyancyLevel, &buoyancyPoint, &buoyancyImpulse)) {
- m_flagD8 = true;
+ bTouchingWater = true;
CEntity *entity;
CColPoint point;
if (CWorld::ProcessVerticalLine(GetPosition(), GetPosition().z - 3.0f, point, entity, false, true, false, false, false, false, false)
@@ -15093,7 +15089,7 @@ CPed::ProcessBuoyancy(void)
} else
return;
} else
- m_flagD8 = false;
+ bTouchingWater = false;
if (nGenerateWaterCircles && CTimer::GetTimeInMilliseconds() >= nGenerateWaterCircles) {
CVector pos = GetPosition();
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index ea8c4080..9f660693 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -828,14 +828,14 @@ public:
}
// set by 0482:set_threat_reaction_range_multiplier opcode
- static uint16 &nThreatReactionRangeMultiplier;
+ static uint16 nThreatReactionRangeMultiplier;
// set by 0481:set_enter_car_range_multiplier opcode
- static uint16 &nEnterCarRangeMultiplier;
+ static uint16 nEnterCarRangeMultiplier;
- static bool &bNastyLimbsCheat;
- static bool &bPedCheat2;
- static bool &bPedCheat3;
+ static bool bNastyLimbsCheat;
+ static bool bPedCheat2;
+ static bool bPedCheat3;
static CVector2D ms_vec2DFleePosition;
#ifdef TOGGLEABLE_BETA_FEATURES
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 3bf81066..e26e2eaf 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -29,39 +29,54 @@
#define PED_REMOVE_DIST (MIN_CREATION_DIST + CREATION_RANGE + 1.0f)
#define PED_REMOVE_DIST_SPECIAL (MIN_CREATION_DIST + CREATION_RANGE + 15.0f) // for peds with bCullExtraFarAway flag
-// TO-DO: These are hard-coded, reverse them.
-// More clearly they're transition areas between zones.
-RegenerationPoint (&aSafeZones)[8] = *(RegenerationPoint(*)[8]) * (uintptr*)0x5FA578;
+// Transition areas between zones
+const RegenerationPoint aSafeZones[] = {
+ { LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 400.0f, 814.0f, -954.0f, -903.0f, 30.0f, 100.0f,
+ CVector(790.0f, -917.0f, 39.0f), CVector(775.0f, -921.0f, 39.0f), CVector(424.0f, -942.0f, 38.0f), CVector(439.0f, -938.0f, 38.0f) },
+ { LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 555.0f, 711.0f, 118.0f, 186.0f, -30.0f, -10.0f,
+ CVector(698.0f, 182.0f, -20.0f), CVector(681.0f, 178.0f, -20.0f), CVector(586.0f, 144.0f, -20.0f), CVector(577.0f, 135.0f, -20.0f) },
+ { LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 26.0f, 44.0f, 124.0f, 87.0f, 20.0f, 6.0f,
+ CVector(736.0f, -117.0f, -13.0f), CVector(730.0f, -115.0f, -13.0f), CVector(635.0f, -93.0f, -12.5f), CVector(650.0f, -89.0f, -12.5f) },
+ { LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 45.0f, 34.0f, 780.0f, 750.0f, 25.0f, 6.0f,
+ CVector(729.0f, -764.0f, -18.0f), CVector(720.0f, -769.0f, -17.0f), CVector(652.0f, -774.0f, -10.5f), CVector(659.0f, -770.0f, -10.5f) },
+ { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 532.0f, 136.0f, 668.0f, 599.0f, 4.0f, 0.0f,
+ CVector(-172.0f, -619.0f, 44.0f), CVector(-183.0f, -623.0f, 44.0f), CVector(-511.0f, -645.0f, 41.0f), CVector(-493.0f, -639.0f, 41.5f) },
+ { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 325.0f, 175.0f, 7.0f, 5.0f, 30.0f, 10.0f,
+ CVector(-185.0f, 40.8f, -20.5f), CVector(-202.0f, 37.0f, -20.5f), CVector(-315.0f, 65.5f, -20.5f), CVector(-306.0f, 62.4f, -20.5f) },
+ { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 410.0f, 310.0f, 1055.0f, 1030.0f, 20.0f, 6.0f,
+ CVector(-321.0f, -1043.0f, -13.2f), CVector(-328.0f, -1045.0f, -13.2f), CVector(-398.0f, -1044.0f, -13.5f), CVector(-390.0f, -1040.5f, -13.5f) },
+ { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 425.0f, 280.0f, 471.0f, 447.0f, 20.0f, 5.0f,
+ CVector(-292.0f, -457.0f, -11.6f), CVector(-310.0f, -461.0f, -11.6f), CVector(-413.0f, -461.0f, -11.5f), CVector(-399.0f, -457.0f, -11.3f) }
+};
-//PedGroup (&CPopulation::ms_pPedGroups)[NUMPEDGROUPS] = *(PedGroup(*)[NUMPEDGROUPS]) * (uintptr*)0x6E9248;
PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS];
-bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
-int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570;
-float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C;
-uint32 &CPopulation::ms_nTotalMissionPeds = *(uint32*)0x8F5F70;
-int32 &CPopulation::MaxNumberOfPedsInUse = *(int32*)0x5FA574;
-uint32& CPopulation::ms_nNumCivMale = *(uint32*)0x8F2548;
-uint32& CPopulation::ms_nNumCivFemale = *(uint32*)0x8F5F44;
-uint32& CPopulation::ms_nNumCop = *(uint32*)0x885AFC;
-bool& CPopulation::bZoneChangeHasHappened = *(bool*)0x95CD79;
-uint32& CPopulation::ms_nNumEmergency = *(uint32*)0x94071C;
-int8& CPopulation::m_CountDownToPedsAtStart = *(int8*)0x95CD4F;
-uint32& CPopulation::ms_nNumGang1 = *(uint32*)0x8F1B1C;
-uint32& CPopulation::ms_nNumGang2 = *(uint32*)0x8F1B14;
-uint32& CPopulation::ms_nTotalPeds = *(uint32*)0x95CB50;
-uint32& CPopulation::ms_nNumGang3 = *(uint32*)0x8F2548;
-uint32& CPopulation::ms_nTotalGangPeds = *(uint32*)0x885AF0;
-uint32& CPopulation::ms_nNumGang4 = *(uint32*)0x8F1B2C;
-uint32& CPopulation::ms_nTotalCivPeds = *(uint32*)0x8F2C3C;
-uint32& CPopulation::ms_nNumGang5 = *(uint32*)0x8F1B30;
-uint32& CPopulation::ms_nNumDummy = *(uint32*)0x8F1A98;
-uint32& CPopulation::ms_nNumGang6 = *(uint32*)0x8F1B20;
-uint32& CPopulation::ms_nNumGang9 = *(uint32*)0x8F1B10;
-uint32& CPopulation::ms_nNumGang7 = *(uint32*)0x8F1B28;
-uint32& CPopulation::ms_nNumGang8 = *(uint32*)0x8F1B0C;
-CVector &CPopulation::RegenerationPoint_a = *(CVector*)0x8E2AA4;
-CVector &CPopulation::RegenerationPoint_b = *(CVector*)0x8E2A98;
-CVector &CPopulation::RegenerationForward = *(CVector*)0x8F1AD4;
+bool CPopulation::ms_bGivePedsWeapons;
+int32 CPopulation::m_AllRandomPedsThisType = -1;
+float CPopulation::PedDensityMultiplier = 1.0f;
+uint32 CPopulation::ms_nTotalMissionPeds;
+int32 CPopulation::MaxNumberOfPedsInUse = 25;
+uint32 CPopulation::ms_nNumCivMale;
+uint32 CPopulation::ms_nNumCivFemale;
+uint32 CPopulation::ms_nNumCop;
+bool CPopulation::bZoneChangeHasHappened;
+uint32 CPopulation::ms_nNumEmergency;
+int8 CPopulation::m_CountDownToPedsAtStart;
+uint32 CPopulation::ms_nNumGang1;
+uint32 CPopulation::ms_nNumGang2;
+uint32 CPopulation::ms_nTotalPeds;
+uint32 CPopulation::ms_nNumGang3;
+uint32 CPopulation::ms_nTotalGangPeds;
+uint32 CPopulation::ms_nNumGang4;
+uint32 CPopulation::ms_nTotalCivPeds;
+uint32 CPopulation::ms_nNumGang5;
+uint32 CPopulation::ms_nNumDummy;
+uint32 CPopulation::ms_nNumGang6;
+uint32 CPopulation::ms_nNumGang9;
+uint32 CPopulation::ms_nNumGang7;
+uint32 CPopulation::ms_nNumGang8;
+CVector CPopulation::RegenerationPoint_a;
+CVector CPopulation::RegenerationPoint_b;
+CVector CPopulation::RegenerationForward;
void
CPopulation::Initialise()
@@ -704,12 +719,15 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
if (i != 0) {
// Gang member
newPed->SetLeader(gangLeader);
+#ifndef FIX_BUGS
+ // seems to be a miami leftover (this code is not on PS2) but gang peds end up just being frozen
newPed->m_nPedState = PED_UNKNOWN;
gangLeader->m_nPedState = PED_UNKNOWN;
newPed->m_fRotationCur = CGeneral::GetRadianAngleBetweenPoints(
gangLeader->GetPosition().x, gangLeader->GetPosition().y,
newPed->GetPosition().x, newPed->GetPosition().y);
newPed->m_fRotationDest = newPed->m_fRotationCur;
+#endif
} else {
gangLeader = newPed;
}
@@ -964,7 +982,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
} else if (obj->m_modelIndex == MI_BUOY) {
obj->bIsStatic = false;
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
- obj->m_flagD8 = true;
+ obj->bTouchingWater = true;
obj->AddToMovingList();
}
}
diff --git a/src/peds/Population.h b/src/peds/Population.h
index f9e6c3b7..aa8129c0 100644
--- a/src/peds/Population.h
+++ b/src/peds/Population.h
@@ -34,33 +34,33 @@ class CPopulation
{
public:
static PedGroup ms_pPedGroups[NUMPEDGROUPS];
- static bool &ms_bGivePedsWeapons;
- static int32 &m_AllRandomPedsThisType;
- static float &PedDensityMultiplier;
- static uint32 &ms_nTotalMissionPeds;
- static int32 &MaxNumberOfPedsInUse;
- static uint32& ms_nNumCivMale;
- static uint32 &ms_nNumCivFemale;
- static uint32 &ms_nNumCop;
- static bool &bZoneChangeHasHappened;
- static uint32 &ms_nNumEmergency;
- static int8& m_CountDownToPedsAtStart;
- static uint32& ms_nNumGang1;
- static uint32& ms_nNumGang2;
- static uint32& ms_nTotalPeds;
- static uint32& ms_nNumGang3;
- static uint32& ms_nTotalGangPeds;
- static uint32& ms_nNumGang4;
- static uint32& ms_nTotalCivPeds;
- static uint32& ms_nNumGang5;
- static uint32& ms_nNumDummy;
- static uint32& ms_nNumGang6;
- static uint32& ms_nNumGang9;
- static uint32& ms_nNumGang7;
- static uint32& ms_nNumGang8;
- static CVector& RegenerationPoint_a;
- static CVector& RegenerationPoint_b;
- static CVector& RegenerationForward;
+ static bool ms_bGivePedsWeapons;
+ static int32 m_AllRandomPedsThisType;
+ static float PedDensityMultiplier;
+ static uint32 ms_nTotalMissionPeds;
+ static int32 MaxNumberOfPedsInUse;
+ static uint32 ms_nNumCivMale;
+ static uint32 ms_nNumCivFemale;
+ static uint32 ms_nNumCop;
+ static bool bZoneChangeHasHappened;
+ static uint32 ms_nNumEmergency;
+ static int8 m_CountDownToPedsAtStart;
+ static uint32 ms_nNumGang1;
+ static uint32 ms_nNumGang2;
+ static uint32 ms_nTotalPeds;
+ static uint32 ms_nNumGang3;
+ static uint32 ms_nTotalGangPeds;
+ static uint32 ms_nNumGang4;
+ static uint32 ms_nTotalCivPeds;
+ static uint32 ms_nNumGang5;
+ static uint32 ms_nNumDummy;
+ static uint32 ms_nNumGang6;
+ static uint32 ms_nNumGang9;
+ static uint32 ms_nNumGang7;
+ static uint32 ms_nNumGang8;
+ static CVector RegenerationPoint_a;
+ static CVector RegenerationPoint_b;
+ static CVector RegenerationForward;
static void Initialise();
static void Update(void);
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index 39866294..7debe3d3 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -233,7 +233,7 @@ CClouds::Render(void)
szx*55.0f, szy*55.0f,
tr, tg, tb, br, bg, bb, 0.0f, -1.0f,
1.0f/screenpos.z,
- IndividualRotation/65336.0f * 2*3.14f + ms_cameraRoll,
+ (uint16)IndividualRotation/65336.0f * 6.28f + ms_cameraRoll,
fluffyalpha);
bCloudOnScreen[i] = true;
}else
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index c934540b..68994b0b 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -320,7 +320,7 @@ CCoronas::Render(void)
CSprite::RenderOneXLUSprite(spriteCoors.x, spriteCoors.y, spriteCoors.z,
spritew * aCoronas[i].size * wscale,
- spriteh * SCREEN_SCALE_AR2(aCoronas[i].size * fogscale * hscale),
+ spriteh * aCoronas[i].size * fogscale * hscale,
CCoronas::aCoronas[i].red / fogscale,
CCoronas::aCoronas[i].green / fogscale,
CCoronas::aCoronas[i].blue / fogscale,
@@ -331,7 +331,7 @@ CCoronas::Render(void)
CSprite::RenderOneXLUSprite_Rotate_Aspect(
spriteCoors.x, spriteCoors.y, spriteCoors.z,
spritew * aCoronas[i].size * fogscale,
- spriteh * SCREEN_SCALE_AR2(aCoronas[i].size * fogscale),
+ spriteh * aCoronas[i].size * fogscale,
CCoronas::aCoronas[i].red / fogscale,
CCoronas::aCoronas[i].green / fogscale,
CCoronas::aCoronas[i].blue / fogscale,
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 80d7fe47..f8b86bd2 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -21,54 +21,52 @@
#include "User.h"
#include "World.h"
-wchar *CHud::m_HelpMessage = (wchar*)0x86B888;
-wchar *CHud::m_LastHelpMessage = (wchar*)0x6E8F28;
-int32 &CHud::m_HelpMessageState = *(int32*)0x880E1C;
-int32 &CHud::m_HelpMessageTimer = *(int32*)0x880FA4;
-int32 &CHud::m_HelpMessageFadeTimer = *(int32*)0x8F6258;
-wchar *CHud::m_HelpMessageToPrint = (wchar*)0x664480;
-float &CHud::m_HelpMessageDisplayTime = *(float*)0x8E2C28;
-float &CHud::m_fTextBoxNumLines = *(float*)0x8E2C28;
-float &CHud::m_fHelpMessageTime = *(float *)0x8E2C28;
-bool &CHud::m_HelpMessageQuick = *(bool *)0x95CCF7;
-int32 CHud::m_ZoneState = *(int32*)0x8F29AC;
+wchar CHud::m_HelpMessage[256]; // = (wchar*)0x86B888;
+wchar CHud::m_LastHelpMessage[256]; // = (wchar*)0x6E8F28;
+uint32 CHud::m_HelpMessageState; // = *(int32*)0x880E1C;
+uint32 CHud::m_HelpMessageTimer; // = *(int32*)0x880FA4;
+int32 CHud::m_HelpMessageFadeTimer; // = *(int32*)0x8F6258;
+wchar CHud::m_HelpMessageToPrint[256]; // = (wchar*)0x664480;
+float CHud::m_fHelpMessageTime; // *(float *)0x8E2C28;
+bool CHud::m_HelpMessageQuick; // = *(bool*)0x95CCF7;
+uint32 CHud::m_ZoneState; // = *(int32*)0x8F29AC;
int32 CHud::m_ZoneFadeTimer;
-int32 CHud::m_ZoneNameTimer = *(int32*)0x8F1A50;
-wchar *&CHud::m_pZoneName = *(wchar **)0x8E2C2C;
-wchar *CHud::m_pLastZoneName = (wchar*)0x8F432C;
+uint32 CHud::m_ZoneNameTimer; // = *(int32*)0x8F1A50;
+wchar *CHud::m_pZoneName; // = *(wchar**)0x8E2C2C;
+wchar *CHud::m_pLastZoneName; // = (wchar*)0x8F432C;
wchar *CHud::m_ZoneToPrint;
-int32 CHud::m_VehicleState = *(int32*)0x940560;
+uint32 CHud::m_VehicleState; // = *(int32*)0x940560;
int32 CHud::m_VehicleFadeTimer;
-int32 CHud::m_VehicleNameTimer = *(int32*)0x8F2A14;
-wchar *&CHud::m_VehicleName = *(wchar **)0x942FB4;
-wchar *CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8;
+uint32 CHud::m_VehicleNameTimer; // = *(int32*)0x8F2A14;
+wchar *CHud::m_VehicleName; // = *(wchar**)0x942FB4;
+wchar *CHud::m_pLastVehicleName; // = *(wchar**)0x8E2DD8;
wchar *CHud::m_pVehicleNameToPrint;
-wchar *CHud::m_Message = (wchar*)0x72E318;
-wchar *CHud::m_PagerMessage = (wchar*)0x878840;
-bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89;
-bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62;
-wchar(&CHud::m_BigMessage)[6][128] = *(wchar(*)[6][128])*(uintptr*)0x664CE0;
-int16 &CHud::m_ItemToFlash = *(int16*)0x95CC82;
+wchar CHud::m_Message[256];// = (wchar*)0x72E318;
+wchar CHud::m_PagerMessage[256]; // = (wchar*)0x878840;
+bool CHud::m_Wants_To_Draw_Hud; // (bool*)0x95CD89;
+bool CHud::m_Wants_To_Draw_3dMarkers; // = *(bool*)0x95CD62;
+wchar CHud::m_BigMessage[6][128]; // = *(wchar(*)[6][128]) * (uintptr*)0x664CE0;
+int16 CHud::m_ItemToFlash; // = *(int16*)0x95CC82;
// These aren't really in CHud
float CHud::BigMessageInUse[6];
float CHud::BigMessageAlpha[6];
float CHud::BigMessageX[6];
-float &CHud::OddJob2OffTimer = *(float*)0x942FA0;
-int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67;
-float &CHud::OddJob2XOffset = *(float*)0x8F1B5C;
-int16 &CHud::CounterFlashTimer = *(int16*)0x95CC20;
-int16 &CHud::OddJob2Timer = *(int16*)0x95CC52;
-int8 &CHud::TimerOnLastFrame = *(int8*)0x95CDA7;
-int16 &CHud::OddJob2On = *(int16*)0x95CC78;
-int16 &CHud::TimerFlashTimer = *(int16*)0x95CC6C;
-int16 &CHud::PagerSoundPlayed = *(int16*)0x95CC4A;
-int32 &CHud::SpriteBrightness = *(int32*)0x95CC54;
-float &CHud::PagerXOffset = *(float*)0x941590;
-int16 &CHud::PagerTimer = *(int16*)0x95CC3A;
-int16 &CHud::PagerOn = *(int16*)0x95CCA0;
-
-CSprite2d *CHud::Sprites = (CSprite2d*)0x95CB9C;
+float CHud::OddJob2OffTimer; // = *(float*)0x942FA0;
+bool CHud::CounterOnLastFrame; // = *(int8*)0x95CD67;
+float CHud::OddJob2XOffset; // = *(float*)0x8F1B5C;
+uint16 CHud::CounterFlashTimer; // = *(int16*)0x95CC20;
+uint16 CHud::OddJob2Timer; // = *(int16*)0x95CC52;
+bool CHud::TimerOnLastFrame; //= *(int8*)0x95CDA7;
+int16 CHud::OddJob2On; //= *(int16*)0x95CC78;
+uint16 CHud::TimerFlashTimer; //= *(int16*)0x95CC6C;
+int16 CHud::PagerSoundPlayed; //= *(int16*)0x95CC4A;
+int32 CHud::SpriteBrightness; //= *(int32*)0x95CC54;
+float CHud::PagerXOffset; //= *(float*)0x941590;
+int16 CHud::PagerTimer; //= *(int16*)0x95CC3A;
+int16 CHud::PagerOn; //= *(int16*)0x95CCA0;
+
+CSprite2d CHud::Sprites[NUM_HUD_SPRITES]; // = (CSprite2d*)0x95CB9C;
struct
{
@@ -90,14 +88,14 @@ struct
{"detonator", "detonator_mask"},
{"", ""},
{"", ""},
- {"radardisc", "radardiscm"},
+ {"radardisc", "radardisc"},
{"pager", "pagerm"},
{"", ""},
{"", ""},
{"bleeder", ""},
{"sitesniper", "sitesniperm"},
{"siteM16", "siteM16m"},
- {"siterocket", "siterocketm"}
+ {"siterocket", "siterocket"}
};
RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834;
@@ -415,7 +413,7 @@ void CHud::Draw()
DrawZoneName
*/
if (m_pZoneName) {
- float fZoneAlpha = 0.0f;
+ float fZoneAlpha = 255.0f;
if (m_pZoneName != m_pLastZoneName) {
switch (m_ZoneState) {
@@ -429,7 +427,7 @@ void CHud::Draw()
case 2:
case 3:
case 4:
- m_ZoneNameTimer = 0;
+ m_ZoneNameTimer = 5;
m_ZoneState = 4;
break;
default:
@@ -441,6 +439,7 @@ void CHud::Draw()
if (m_ZoneState) {
switch (m_ZoneState) {
case 1:
+ m_ZoneFadeTimer = 1000;
if (m_ZoneNameTimer > 10000) {
m_ZoneFadeTimer = 1000;
m_ZoneState = 3;
@@ -468,7 +467,6 @@ void CHud::Draw()
if (m_ZoneFadeTimer < 0) {
m_ZoneFadeTimer = 0;
m_ZoneToPrint = m_pLastZoneName;
- m_ZoneNameTimer = 0;
m_ZoneState = 2;
}
fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f;
@@ -500,12 +498,6 @@ void CHud::Draw()
}
}
}
- /*else {
- m_pLastZoneName = nil;
- m_ZoneState = 0;
- m_ZoneFadeTimer = 0;
- m_ZoneNameTimer = 0;
- }*/
/*
DrawVehicleName
@@ -633,9 +625,9 @@ void CHud::Draw()
wchar sTimer[16];
if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed)
- TimerOnLastFrame = 0;
+ TimerOnLastFrame = false;
if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed)
- CounterOnLastFrame = 0;
+ CounterOnLastFrame = false;
#ifdef FIX_BUGS
#define TIMER_RIGHT_OFFSET 34.0f // Taken from VC frenzy timer
@@ -647,7 +639,7 @@ void CHud::Draw()
if (!TimerOnLastFrame)
TimerFlashTimer = 1;
- TimerOnLastFrame = 1;
+ TimerOnLastFrame = true;
if (TimerFlashTimer) {
if (++TimerFlashTimer > 50)
@@ -685,7 +677,7 @@ void CHud::Draw()
if (!CounterOnLastFrame)
CounterFlashTimer = 1;
- CounterOnLastFrame = 1;
+ CounterOnLastFrame = true;
if (CounterFlashTimer) {
if (++CounterFlashTimer > 50)
@@ -739,11 +731,9 @@ void CHud::Draw()
/*
DrawPager
*/
- if (!m_PagerMessage[0]) {
- if (PagerOn == 1) {
- PagerSoundPlayed = false;
- PagerOn = 2;
- }
+ if (!m_PagerMessage[0] && PagerOn == 1) {
+ PagerSoundPlayed = false;
+ PagerOn = 2;
}
if (m_PagerMessage[0] || PagerOn == 2) {
if (!PagerOn) {
@@ -752,7 +742,7 @@ void CHud::Draw()
}
if (PagerOn == 1) {
if (PagerXOffset > 0.0f) {
- float fStep = PagerXOffset * 0.05f;
+ float fStep = PagerXOffset * 0.1f;
if (fStep > 10.0f)
fStep = 10.0f;
PagerXOffset -= fStep * CTimer::GetTimeStep();
@@ -763,10 +753,10 @@ void CHud::Draw()
}
}
else if (PagerOn == 2) {
- float fStep = PagerXOffset * 0.05f;
+ float fStep = PagerXOffset * 0.1f;
if (fStep < 2.0f)
fStep = 2.0f;
- PagerXOffset += fStep * CTimer::GetTimeStep();
+ PagerXOffset += fStep;
if (PagerXOffset > 150.0f) {
PagerXOffset = 150.0f;
PagerOn = 0;
@@ -815,9 +805,7 @@ void CHud::Draw()
DrawScriptText
*/
if (!CTimer::GetIsUserPaused()) {
- intro_text_line* IntroText = CTheScripts::IntroTextLines;
-
- for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++) {
+ for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
if (CTheScripts::IntroTextLines[i].m_Text[0] && CTheScripts::IntroTextLines[i].m_bTextBeforeFade) {
CFont::SetScale(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f));
CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor);
@@ -858,31 +846,31 @@ void CHud::Draw()
CFont::SetPropOff();
CFont::SetFontStyle(CTheScripts::IntroTextLines[i].m_nFont);
- CFont::PrintString(SCREEN_SCALE_X(640.0f - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(448.0f - CTheScripts::IntroTextLines[i].m_fAtY), IntroText->m_Text);
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - CTheScripts::IntroTextLines[i].m_fAtY), CTheScripts::IntroTextLines[i].m_Text);
}
}
+ for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroRectangles); i++) {
+ intro_script_rectangle &IntroRect = CTheScripts::IntroRectangles[i];
- intro_script_rectangle* IntroRect = CTheScripts::IntroRectangles;
-
- for (int i = 0; i < 16; i++) {
- if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bBeforeFade) {
- if (CTheScripts::IntroRectangles[i].m_nTextureId >= 0) {
+ // Yeah, top and bottom changed place. R* vision
+ if (IntroRect.m_bIsUsed && IntroRect.m_bBeforeFade) {
+ if (IntroRect.m_nTextureId >= 0) {
CRect rect = {
- CTheScripts::IntroRectangles[i].m_sRect.left,
- CTheScripts::IntroRectangles[i].m_sRect.bottom,
- CTheScripts::IntroRectangles[i].m_sRect.right,
- CTheScripts::IntroRectangles[i].m_sRect.bottom };
+ IntroRect.m_sRect.left,
+ IntroRect.m_sRect.top,
+ IntroRect.m_sRect.right,
+ IntroRect.m_sRect.bottom };
- CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[i].m_nTextureId].Draw(rect, IntroRect->m_sColor);
+ CTheScripts::ScriptSprites[IntroRect.m_nTextureId].Draw(rect, IntroRect.m_sColor);
}
else {
CRect rect = {
- CTheScripts::IntroRectangles[i].m_sRect.left,
- CTheScripts::IntroRectangles[i].m_sRect.bottom,
- CTheScripts::IntroRectangles[i].m_sRect.right,
- CTheScripts::IntroRectangles[i].m_sRect.bottom };
+ IntroRect.m_sRect.left,
+ IntroRect.m_sRect.top,
+ IntroRect.m_sRect.right,
+ IntroRect.m_sRect.bottom };
- CSprite2d::DrawRect(rect, IntroRect->m_sColor);
+ CSprite2d::DrawRect(rect, IntroRect.m_sColor);
}
}
}
@@ -928,7 +916,7 @@ void CHud::Draw()
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
CFont::SetFontStyle(FONT_HEADING);
- if (BigMessageX[0] >= (SCREEN_WIDTH - 20)) {
+ if (BigMessageX[0] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
BigMessageInUse[0] += CTimer::GetTimeStep();
if (BigMessageInUse[0] >= 120.0f) {
@@ -945,7 +933,7 @@ void CHud::Draw()
BigMessageX[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
BigMessageAlpha[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
- if (BigMessageAlpha[0] >= 255.0f)
+ if (BigMessageAlpha[0] > 255.0f)
BigMessageAlpha[0] = 255.0f;
}
@@ -989,7 +977,7 @@ void CHud::Draw()
CFont::SetFontStyle(FONT_HEADING);
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::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::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
@@ -1018,7 +1006,7 @@ void CHud::DrawAfterFade()
m_HelpMessageState = 2;
m_HelpMessageTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
- m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
+ m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_A0, 0);
@@ -1036,14 +1024,14 @@ void CHud::DrawAfterFade()
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
}
- float fAlpha = 255.0f;
+ float fAlpha = 225.0f;
- if (m_HelpMessageState) {
+ if (m_HelpMessageState != 0) {
switch (m_HelpMessageState) {
case 1:
- fAlpha = 255.0f;
+ fAlpha = 225.0f;
m_HelpMessageFadeTimer = 600;
- if (m_HelpMessageTimer > m_fHelpMessageTime * 1000 || m_HelpMessageQuick && m_HelpMessageTimer > 1500) {
+ if (m_HelpMessageTimer > m_fHelpMessageTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
m_HelpMessageFadeTimer = 600;
m_HelpMessageState = 3;
}
@@ -1054,24 +1042,24 @@ void CHud::DrawAfterFade()
m_HelpMessageState = 1;
m_HelpMessageFadeTimer = 0;
}
- fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
+ fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 3:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
- if (m_HelpMessageFadeTimer >= 0) {
+ if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 0;
m_HelpMessageFadeTimer = 0;
}
- fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
+ fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 4:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
- if (m_HelpMessageFadeTimer >= 0) {
+ if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 2;
m_HelpMessageFadeTimer = 0;
- CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 400);
+ CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 256);
}
- fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
+ fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
default:
break;
@@ -1088,19 +1076,75 @@ void CHud::DrawAfterFade()
else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
+ CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff();
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
- CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.8f));
- CFont::SetColor(CRGBA(175, 175, 175, 255));
+ CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
CFont::SetAlphaFade(255.0f);
}
}
- else
- m_HelpMessageState = 0;
+
+ for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
+ intro_text_line &line = CTheScripts::IntroTextLines[i];
+ if (line.m_Text[0] != '\0' && !line.m_bTextBeforeFade) {
+ CFont::SetScale(SCREEN_SCALE_X(line.m_fScaleX), SCREEN_SCALE_Y(line.m_fScaleY) / 2);
+
+ CFont::SetColor(line.m_sColor);
+ if (line.m_bJustify)
+ CFont::SetJustifyOn();
+ else
+ CFont::SetJustifyOff();
+
+ if (line.m_bRightJustify)
+ CFont::SetRightJustifyOn();
+ else
+ CFont::SetRightJustifyOff();
+
+ if (line.m_bCentered)
+ CFont::SetCentreOn();
+ else
+ CFont::SetCentreOff();
+
+ CFont::SetWrapx(SCREEN_SCALE_X(line.m_fWrapX));
+ CFont::SetCentreSize(SCREEN_SCALE_X(line.m_fCenterSize));
+ if (line.m_bBackground)
+ CFont::SetBackgroundOn();
+ else
+ CFont::SetBackgroundOff();
+
+ CFont::SetBackgroundColor(line.m_sBackgroundColor);
+ if (line.m_bBackgroundOnly)
+ CFont::SetBackGroundOnlyTextOn();
+ else
+ CFont::SetBackGroundOnlyTextOff();
+
+ if (line.m_bTextProportional)
+ CFont::SetPropOn();
+ else
+ CFont::SetPropOff();
+
+ CFont::SetFontStyle(line.m_nFont);
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - line.m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - line.m_fAtY), line.m_Text);
+ }
+ }
+ for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroRectangles); i++) {
+ intro_script_rectangle &rectangle = CTheScripts::IntroRectangles[i];
+ if (rectangle.m_bIsUsed && !rectangle.m_bBeforeFade) {
+
+ // Yeah, top and bottom changed place. R* vision
+ if (rectangle.m_nTextureId >= 0) {
+ CTheScripts::ScriptSprites[rectangle.m_nTextureId].Draw(CRect(rectangle.m_sRect.left, rectangle.m_sRect.bottom,
+ rectangle.m_sRect.right, rectangle.m_sRect.top), rectangle.m_sColor);
+ } else {
+ CSprite2d::DrawRect(CRect(rectangle.m_sRect.left, rectangle.m_sRect.bottom,
+ rectangle.m_sRect.right, rectangle.m_sRect.top), rectangle.m_sColor);
+ }
+ }
+ }
/*
DrawBigMessage2
@@ -1142,10 +1186,9 @@ void CHud::DrawAfterFade()
if (OddJob2OffTimer > 0)
OddJob2OffTimer -= CTimer::GetTimeStepInMilliseconds();
- static float fStep;
+ float fStep;
if (m_BigMessage[5][0] && OddJob2OffTimer <= 0.0f) {
- if (OddJob2On <= 3) {
- switch (OddJob2On) {
+ switch (OddJob2On) {
case 0:
OddJob2On = 1;
OddJob2XOffset = 380.0f;
@@ -1156,9 +1199,7 @@ void CHud::DrawAfterFade()
OddJob2On = 2;
}
else {
- fStep = 40.0f;
- if ((OddJob2XOffset / 6.0f) <= 40.0f)
- fStep = OddJob2XOffset / 6.0f;
+ fStep = min(40.0f, OddJob2XOffset / 6.0f);
OddJob2XOffset = OddJob2XOffset - fStep;
}
break;
@@ -1169,9 +1210,7 @@ void CHud::DrawAfterFade()
}
break;
case 3:
- fStep = 30.0f;
- if ((OddJob2XOffset / 5.0f) >= 30.0f)
- fStep = OddJob2XOffset / 5.0f;
+ fStep = max(30.0f, OddJob2XOffset / 5.0f);
OddJob2XOffset = OddJob2XOffset - fStep;
@@ -1182,7 +1221,6 @@ void CHud::DrawAfterFade()
break;
default:
break;
- }
}
if (!m_BigMessage[1][0]) {
@@ -1216,10 +1254,10 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));
CFont::SetPropOn();
- CFont::SetRightJustifyWrap(-500.0f);
+ CFont::SetRightJustifyWrap(SCREEN_SCALE_X(-500.0f));
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
- if (BigMessageX[1] >= (SCREEN_WIDTH - 20)) {
+ if (BigMessageX[1] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
BigMessageInUse[1] += CTimer::GetTimeStep();
if (BigMessageInUse[1] >= 120.0f) {
@@ -1230,12 +1268,11 @@ void CHud::DrawAfterFade()
m_BigMessage[1][0] = 0;
BigMessageAlpha[1] = 0.0f;
}
- }
- else {
+ } else {
BigMessageX[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
BigMessageAlpha[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
- if (BigMessageAlpha[1] >= 255.0f)
+ if (BigMessageAlpha[1] > 255.0f)
BigMessageAlpha[1] = 255.0f;
}
@@ -1273,7 +1310,7 @@ void CHud::GetRidOfAllHudMessages()
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 0;
m_HelpMessageQuick = 0;
- m_HelpMessageDisplayTime = 1.0f;
+ m_fHelpMessageTime = 1.0f;
m_VehicleName = nil;
m_pLastVehicleName = nil;
m_pVehicleNameToPrint = nil;
@@ -1303,7 +1340,7 @@ void CHud::Initialise()
CTxdStore::PopCurrentTxd();
CTxdStore::SetCurrentTxd(HudTXD);
- for (int i = 0; i < ARRAY_SIZE(WeaponFilenames); i++) {
+ for (int i = 0; i < NUM_HUD_SPRITES; i++) {
Sprites[i].SetTexture(WeaponFilenames[i].name, WeaponFilenames[i].mask);
}
@@ -1314,14 +1351,14 @@ void CHud::Initialise()
if (gpRocketSightTex == nil)
gpRocketSightTex = RwTextureRead("siterocket", nil);
- CounterOnLastFrame = 0;
+ CounterOnLastFrame = false;
m_ItemToFlash = ITEM_NONE;
OddJob2Timer = 0;
OddJob2OffTimer = 0.0f;
OddJob2On = 0;
OddJob2XOffset = 0.0f;
CounterFlashTimer = 0;
- TimerOnLastFrame = 0;
+ TimerOnLastFrame = false;
TimerFlashTimer = 0;
SpriteBrightness = 0;
PagerOn = 0;
@@ -1338,14 +1375,14 @@ void CHud::ReInitialise() {
GetRidOfAllHudMessages();
- CounterOnLastFrame = 0;
+ CounterOnLastFrame = false;
m_ItemToFlash = ITEM_NONE;
OddJob2Timer = 0;
OddJob2OffTimer = 0.0f;
OddJob2On = 0;
OddJob2XOffset = 0.0f;
CounterFlashTimer = 0;
- TimerOnLastFrame = 0;
+ TimerOnLastFrame = false;
TimerFlashTimer = 0;
SpriteBrightness = 0;
PagerOn = 0;
@@ -1435,7 +1472,7 @@ void CHud::SetZoneName(wchar *name)
void CHud::Shutdown()
{
- for (int i = 0; i < ARRAY_SIZE(WeaponFilenames); ++i) {
+ for (int i = 0; i < NUM_HUD_SPRITES; ++i) {
Sprites[i].Delete();
}
diff --git a/src/render/Hud.h b/src/render/Hud.h
index d3482ae6..701e47e2 100644
--- a/src/render/Hud.h
+++ b/src/render/Hud.h
@@ -27,59 +27,60 @@ enum eSprites
HUD_RADARDISC = 15,
HUD_PAGER = 16,
HUD_SITESNIPER = 20,
- HUD_SITEM16 = 21
+ HUD_SITEM16,
+ HUD_SITEROCKET,
+ NUM_HUD_SPRITES,
};
class CHud
{
public:
- static CSprite2d *Sprites;
- static int32 &SpriteBrightness;
- static wchar *m_HelpMessage;
- static wchar *m_LastHelpMessage;
- static int32 &m_HelpMessageState;
- static int32 &m_HelpMessageTimer;
- static int32 &m_HelpMessageFadeTimer;
- static wchar *m_HelpMessageToPrint;
+ static CSprite2d Sprites[NUM_HUD_SPRITES];
+ static wchar m_HelpMessage[256];
+ static wchar m_LastHelpMessage[256];
+ static uint32 m_HelpMessageState;
+ static uint32 m_HelpMessageTimer;
+ static int32 m_HelpMessageFadeTimer;
+ static wchar m_HelpMessageToPrint[256];
static float &m_HelpMessageDisplayTime;
- static float &m_fTextBoxNumLines;
- static float &m_fHelpMessageTime;
- static bool &m_HelpMessageQuick;
- static int32 m_ZoneState;
+ static float m_fHelpMessageTime;
+ static bool m_HelpMessageQuick;
+ static uint32 m_ZoneState;
static int32 m_ZoneFadeTimer;
- static int32 m_ZoneNameTimer;
- static wchar *&m_pZoneName;
+ static uint32 m_ZoneNameTimer;
+ static wchar *m_pZoneName;
static wchar *m_pLastZoneName;
static wchar *m_ZoneToPrint;
- static wchar *&m_VehicleName;
+ static wchar *m_VehicleName;
static wchar *m_pLastVehicleName;
static wchar *m_pVehicleNameToPrint;
- static int32 m_VehicleState;
+ static uint32 m_VehicleState;
static int32 m_VehicleFadeTimer;
- static int32 m_VehicleNameTimer;
- static wchar *m_Message;
- static wchar *m_PagerMessage;
- static bool &m_Wants_To_Draw_Hud;
- static bool &m_Wants_To_Draw_3dMarkers;
- static wchar(&m_BigMessage)[6][128];
- static int16 &m_ItemToFlash;
+ static uint32 m_VehicleNameTimer;
+ static wchar m_Message[256];
+ static wchar m_PagerMessage[256];
+ static bool m_Wants_To_Draw_Hud;
+ static bool m_Wants_To_Draw_3dMarkers;
+ static wchar m_BigMessage[6][128];
+ static int16 m_ItemToFlash;
// These aren't really in CHud
static float BigMessageInUse[6];
static float BigMessageAlpha[6];
static float BigMessageX[6];
- static float &OddJob2OffTimer;
- static int8 &CounterOnLastFrame;
- static float &OddJob2XOffset;
- static int16 &CounterFlashTimer;
- static int16 &OddJob2Timer;
- static int8 &TimerOnLastFrame;
- static int16 &OddJob2On;
- static int16 &TimerFlashTimer;
- static int16 &PagerSoundPlayed;
- static float &PagerXOffset;
- static int16 &PagerTimer;
- static int16 &PagerOn;
+ static float OddJob2OffTimer;
+ static bool CounterOnLastFrame;
+ static float OddJob2XOffset;
+ static uint16 CounterFlashTimer;
+ static uint16 OddJob2Timer;
+ static bool TimerOnLastFrame;
+ static int16 OddJob2On;
+ static uint16 TimerFlashTimer;
+ static int16 PagerSoundPlayed;
+ static int32 SpriteBrightness;
+ static float PagerXOffset;
+ static int16 PagerTimer;
+ static int16 PagerOn;
public:
static void Draw();
diff --git a/src/core/PlayerSkin.cpp b/src/render/PlayerSkin.cpp
index 62bcd07d..2cba45fe 100644
--- a/src/core/PlayerSkin.cpp
+++ b/src/render/PlayerSkin.cpp
@@ -15,6 +15,9 @@
#include "Timer.h"
#include "Lights.h"
+RpClump *gpPlayerClump;
+float gOldFov;
+
int CPlayerSkin::m_txdSlot;
void
@@ -92,7 +95,7 @@ CPlayerSkin::GetSkinTexture(const char *texName)
CTxdStore::SetCurrentTxd(m_txdSlot);
tex = RwTextureRead(texName, NULL);
CTxdStore::PopCurrentTxd();
- if (tex) return tex;
+ if (tex != nil) return tex;
if (strcmp(DEFAULT_SKIN_NAME, texName) == 0)
sprintf(gString, "models\\generic\\player.bmp");
@@ -139,7 +142,7 @@ CPlayerSkin::RenderFrontendSkinEdit(void)
{
static float rotation = 0.0f;
RwRGBAReal AmbientColor = { 0.65f, 0.65f, 0.65f, 1.0f };
- RwV3d pos = { 1.35f, 0.35f, 7.725f };
+ const RwV3d pos = { 1.35f, 0.35f, 7.725f };
const RwV3d axis1 = { 1.0f, 0.0f, 0.0f };
const RwV3d axis2 = { 0.0f, 0.0f, 1.0f };
static uint32 LastFlash = 0;
diff --git a/src/core/PlayerSkin.h b/src/render/PlayerSkin.h
index 2d82ec12..e0214ce0 100644
--- a/src/core/PlayerSkin.h
+++ b/src/render/PlayerSkin.h
@@ -2,12 +2,6 @@
#define DEFAULT_SKIN_NAME "$$\"\""
-static RpClump *gpPlayerClump;// = *(RpClump**)0x660FF8;
-static float gOldFov;// = *(float*)0x660FFC;
-
-void LoadPlayerDff(void);
-void FindPlayerDff(uint32 &offset, uint32 &size);
-
class CPlayerSkin
{
static int m_txdSlot;
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index d7834065..7b2f90e8 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -39,16 +39,17 @@ struct EntityInfo
float sort;
};
-CLinkList<EntityInfo> &gSortedVehiclesAndPeds = *(CLinkList<EntityInfo>*)0x629AC0;
+CLinkList<EntityInfo> gSortedVehiclesAndPeds;
-int32 &CRenderer::ms_nNoOfVisibleEntities = *(int32*)0x940730;
-CEntity *(&CRenderer::ms_aVisibleEntityPtrs)[NUMVISIBLEENTITIES] = *(CEntity * (*)[NUMVISIBLEENTITIES]) * (uintptr*)0x6E9920;
-CEntity *(&CRenderer::ms_aInVisibleEntityPtrs)[NUMINVISIBLEENTITIES] = *(CEntity * (*)[NUMINVISIBLEENTITIES]) * (uintptr*)0x880B50;
-int32 &CRenderer::ms_nNoOfInVisibleEntities = *(int32*)0x8F1B78;
+int32 CRenderer::ms_nNoOfVisibleEntities;
+CEntity *CRenderer::ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES];
+CEntity *CRenderer::ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES];
+int32 CRenderer::ms_nNoOfInVisibleEntities;
-CVector &CRenderer::ms_vecCameraPosition = *(CVector*)0x8E2C3C;
-CVehicle *&CRenderer::m_pFirstPersonVehicle = *(CVehicle**)0x885B80;
-bool &CRenderer::m_loadingPriority = *(bool*)0x95CD86;
+CVector CRenderer::ms_vecCameraPosition;
+CVehicle *CRenderer::m_pFirstPersonVehicle;
+bool CRenderer::m_loadingPriority;
+float CRenderer::ms_lodDistScale = 1.2f;
void
CRenderer::Init(void)
diff --git a/src/render/Renderer.h b/src/render/Renderer.h
index 89fc23cb..362741e3 100644
--- a/src/render/Renderer.h
+++ b/src/render/Renderer.h
@@ -20,17 +20,17 @@ class CPtrList;
class CRenderer
{
- static int32 &ms_nNoOfVisibleEntities;
- static CEntity *(&ms_aVisibleEntityPtrs)[NUMVISIBLEENTITIES];
- static int32 &ms_nNoOfInVisibleEntities;
- static CEntity *(&ms_aInVisibleEntityPtrs)[NUMINVISIBLEENTITIES];
+ static int32 ms_nNoOfVisibleEntities;
+ static CEntity *ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES];
+ static int32 ms_nNoOfInVisibleEntities;
+ static CEntity *ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES];
- static CVector &ms_vecCameraPosition;
- static CVehicle *&m_pFirstPersonVehicle;
+ static CVector ms_vecCameraPosition;
+ static CVehicle *m_pFirstPersonVehicle;
public:
- static float &ms_lodDistScale; // defined in Frontend.cpp
- static bool &m_loadingPriority;
+ static float ms_lodDistScale;
+ static bool m_loadingPriority;
static void Init(void);
static void Shutdown(void);
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index fec50c7e..82754121 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -30,10 +30,12 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
out->x *= SCREEN_WIDTH * recip;
out->y *= SCREEN_HEIGHT * recip;
// What is this? size?
- *outw = 70.0f/CDraw::GetFOV();
- *outh = 70.0f/CDraw::GetFOV();
- *outw *= SCREEN_WIDTH * recip;
- *outh *= SCREEN_HEIGHT * recip;
+ *outw = 70.0f/CDraw::GetFOV() * SCREEN_WIDTH * recip;
+#ifdef ASPECT_RATIO_SCALE
+ *outh = 70.0f/CDraw::GetFOV() / (DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO) * SCREEN_HEIGHT * recip;
+#else
+ *outh = 70.0f/CDraw::GetFOV() * SCREEN_HEIGHT * recip;
+#endif
return true;
}
@@ -135,8 +137,8 @@ CSprite::RenderOneXLUSprite(float x, float y, float z, float w, float h, uint8 r
void
CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a)
{
- float c = Cos(DEGTORAD(rotation));
- float s = Sin(DEGTORAD(rotation));
+ float c = Cos(rotation);
+ float s = Sin(rotation);
float xs[4];
float ys[4];
@@ -313,8 +315,8 @@ void
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a)
{
m_bFlushSpriteBufferSwitchZTest = 0;
- float c = Cos(DEGTORAD(rotation));
- float s = Sin(DEGTORAD(rotation));
+ float c = Cos(rotation);
+ float s = Sin(rotation);
float xs[4];
float ys[4];
@@ -365,8 +367,8 @@ void
CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, float w, float h, uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2, float cx, float cy, float recipz, float rotation, uint8 a)
{
m_bFlushSpriteBufferSwitchZTest = 0;
- float c = Cos(DEGTORAD(rotation));
- float s = Sin(DEGTORAD(rotation));
+ float c = Cos(rotation);
+ float s = Sin(rotation);
float xs[4];
float ys[4];
@@ -396,11 +398,11 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, f
// Colour factors, cx/y is the direction in which colours change from rgb1 to rgb2
cf[0] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;
cf[0] = clamp(cf[0], 0.0f, 1.0f);
- cf[1] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;
+ cf[1] = (cx*(-c+s) + cy*( c+s))*0.5f + 0.5f;
cf[1] = clamp(cf[1], 0.0f, 1.0f);
- cf[2] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;
+ cf[2] = (cx*( c+s) + cy*( c-s))*0.5f + 0.5f;
cf[2] = clamp(cf[2], 0.0f, 1.0f);
- cf[3] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;
+ cf[3] = (cx*( c-s) + cy*(-c-s))*0.5f + 0.5f;
cf[3] = clamp(cf[3], 0.0f, 1.0f);
float screenz = m_f2DNearScreenZ +
diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h
index f126dca6..ed4a026b 100644
--- a/src/render/Timecycle.h
+++ b/src/render/Timecycle.h
@@ -119,8 +119,10 @@ public:
static int GetSunCoronaBlue(void) { return m_nCurrentSunCoronaBlue; }
static float GetSunSize(void) { return m_fCurrentSunSize; }
static float GetSpriteBrightness(void) { return m_fCurrentSpriteBrightness; }
+ 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 GetFarClip(void) { return m_fCurrentFarClip; }
static float GetFogStart(void) { return m_fCurrentFogStart; }
diff --git a/src/render/WeaponEffects.cpp b/src/render/WeaponEffects.cpp
index 3101def9..2ed9e662 100644
--- a/src/render/WeaponEffects.cpp
+++ b/src/render/WeaponEffects.cpp
@@ -83,7 +83,7 @@ CWeaponEffects::Render(void)
{
float recipz = 1.0f / pos.z;
CSprite::RenderOneXLUSprite(pos.x, pos.y, pos.z,
- gCrossHair.m_fSize * w, gCrossHair.m_fSize * SCREEN_SCALE_AR2(h),
+ gCrossHair.m_fSize * w, gCrossHair.m_fSize * h,
gCrossHair.m_nRed, gCrossHair.m_nGreen, gCrossHair.m_nBlue, 255,
recipz, 255);
}
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index 53daa70f..b440e77c 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -475,7 +475,7 @@ void CWeather::RenderRainStreaks(void)
// 1/16 probability
Streaks[i].direction = CVector(4.0f, 4.0f, -4.0f);
Streaks[i].position = 6.0f * TheCamera.GetForward() + TheCamera.GetPosition() + CVector(-1.8f * Streaks[i].direction.x, -1.8f * Streaks[i].direction.y, 8.0f);
- if (!CCutsceneMgr::IsCutsceneProcessing()) {
+ if (!CCutsceneMgr::IsRunning()) {
Streaks[i].position.x += 2.0f * FindPlayerSpeed().x * 60.0f;
Streaks[i].position.y += 2.0f * FindPlayerSpeed().y * 60.0f;
}
diff --git a/src/core/RwClumpRead.cpp b/src/rw/ClumpRead.cpp
index c9f027e7..c9f027e7 100644
--- a/src/core/RwClumpRead.cpp
+++ b/src/rw/ClumpRead.cpp
diff --git a/src/render/Lights.cpp b/src/rw/Lights.cpp
index cd83a898..cd83a898 100644
--- a/src/render/Lights.cpp
+++ b/src/rw/Lights.cpp
diff --git a/src/render/Lights.h b/src/rw/Lights.h
index 6fdd51de..6fdd51de 100644
--- a/src/render/Lights.h
+++ b/src/rw/Lights.h
diff --git a/src/core/NodeName.cpp b/src/rw/NodeName.cpp
index 2aea3c83..2aea3c83 100644
--- a/src/core/NodeName.cpp
+++ b/src/rw/NodeName.cpp
diff --git a/src/core/NodeName.h b/src/rw/NodeName.h
index 1a3e057b..1a3e057b 100644
--- a/src/core/NodeName.h
+++ b/src/rw/NodeName.h
diff --git a/src/core/RwHelper.cpp b/src/rw/RwHelper.cpp
index 44866f4f..44ca3a0a 100644
--- a/src/core/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -3,6 +3,44 @@
#include "patcher.h"
#include "Timecycle.h"
#include "skeleton.h"
+#if defined(RWLIBS) && !defined(FINAL)
+#include "rtcharse.h"
+#pragma comment( lib, "rtcharse.lib" )
+
+RtCharset *debugCharset;
+#endif
+
+void CreateDebugFont()
+{
+#if defined(RWLIBS) && !defined(FINAL)
+ RwRGBA color = { 255, 255, 128, 255 };
+ RwRGBA colorbg = { 0, 0, 0, 0 };
+ RtCharsetOpen();
+ debugCharset = RtCharsetCreate(&color, &colorbg);
+#endif
+}
+
+void DestroyDebugFont()
+{
+#if defined(RWLIBS) && !defined(FINAL)
+ RtCharsetDestroy(debugCharset);
+ RtCharsetClose();
+#endif
+}
+
+void ObrsPrintfString(const char *str, short x, short y)
+{
+#if defined(RWLIBS) && !defined(FINAL)
+ RtCharsetPrintBuffered(debugCharset, str, x, y, true);
+#endif
+}
+
+void FlushObrsPrintfs()
+{
+#if defined(RWLIBS) && !defined(FINAL)
+ RtCharsetBufferFlush();
+#endif
+}
void *
RwMallocAlign(RwUInt32 size, RwUInt32 align)
@@ -347,21 +385,6 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
return (nil);
}
-void CreateDebugFont()
-{
- ;
-}
-
-void DestroyDebugFont()
-{
- ;
-}
-
-void FlushObrsPrintfs()
-{
- ;
-}
-
WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }
diff --git a/src/core/RwHelper.h b/src/rw/RwHelper.h
index a9f0bdf4..5b47cb6f 100644
--- a/src/core/RwHelper.h
+++ b/src/rw/RwHelper.h
@@ -5,6 +5,7 @@ void RwFreeAlign(void *mem);
void CreateDebugFont();
void DestroyDebugFont();
+void ObrsPrintfString(const char *str, short x, short y);
void FlushObrsPrintfs();
void DefinedState(void);
RwFrame *GetFirstChild(RwFrame *frame);
diff --git a/src/core/RwMatFX.cpp b/src/rw/RwMatFX.cpp
index ca9a633b..3af6fabe 100644
--- a/src/core/RwMatFX.cpp
+++ b/src/rw/RwMatFX.cpp
@@ -43,8 +43,16 @@ struct MatFX
int effects;
};
+#ifdef RWLIBS
+extern "C" {
+ extern int MatFXMaterialDataOffset;
+ extern int MatFXAtomicDataOffset;
+ void _rpMatFXD3D8AtomicMatFXEnvRender(RxD3D8InstanceData* inst, int flags, int sel, RwTexture* texture, RwTexture* envMap);
+}
+#else
int &MatFXMaterialDataOffset = *(int*)0x66188C;
int &MatFXAtomicDataOffset = *(int*)0x66189C;
+#endif
#ifdef PS2_MATFX
@@ -206,8 +214,13 @@ _rpMatFXD3D8AtomicMatFXEnvRender_ps2(RxD3D8InstanceData *inst, int flags, int se
RwD3D8SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);
}
+
STARTPATCHES
+#ifdef RWLIBS
+ InjectHook((uintptr)&_rpMatFXD3D8AtomicMatFXEnvRender, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP);
+#else
InjectHook(0x5CF6C0, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP);
+#endif
ENDPATCHES
#endif
diff --git a/src/core/RwTexRead.cpp b/src/rw/TexRead.cpp
index ef1ac197..50b99d47 100644
--- a/src/core/RwTexRead.cpp
+++ b/src/rw/TexRead.cpp
@@ -147,7 +147,11 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
}
#ifdef GTA_PC
+#ifdef RWLIBS
+extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags);
+#else
WRAPPER RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags) { EAXJMP(0x59A350); }
+#endif
void
ReadVideoCardCapsFile(uint32 &cap32, uint32 &cap24, uint32 &cap16, uint32 &cap8)
@@ -260,11 +264,13 @@ CreateTxdImageForVideoCard()
RwStream *img = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, "models\\txd.img");
if (img == nil) {
- if (_dwOperatingSystemVersion == OS_WINNT || _dwOperatingSystemVersion == OS_WIN2000 || _dwOperatingSystemVersion == OS_WINXP) {
+ // original code does otherwise and it leaks
+ delete []buf;
+ delete pDir;
+
+ if (_dwOperatingSystemVersion == OS_WINNT || _dwOperatingSystemVersion == OS_WIN2000 || _dwOperatingSystemVersion == OS_WINXP)
DealWithTxdWriteError(0, TXDSTORESIZE, "CVT_CRT");
- delete []buf;
- delete pDir;
- }
+
return false;
}
diff --git a/src/core/TxdStore.cpp b/src/rw/TxdStore.cpp
index c751147d..c751147d 100644
--- a/src/core/TxdStore.cpp
+++ b/src/rw/TxdStore.cpp
diff --git a/src/core/TxdStore.h b/src/rw/TxdStore.h
index 12ac708f..12ac708f 100644
--- a/src/core/TxdStore.h
+++ b/src/rw/TxdStore.h
diff --git a/src/render/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index f8b1f6b2..f8b1f6b2 100644
--- a/src/render/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
diff --git a/src/render/VisibilityPlugins.h b/src/rw/VisibilityPlugins.h
index 65d2675a..65d2675a 100644
--- a/src/render/VisibilityPlugins.h
+++ b/src/rw/VisibilityPlugins.h
diff --git a/src/core/rw.cpp b/src/rw/rw.cpp
index 52bcf5bb..3875f2a1 100644
--- a/src/core/rw.cpp
+++ b/src/rw/rw.cpp
@@ -11,7 +11,8 @@ typedef RwV3d *(*rwVectorsMultFn) (RwV3d * pointsOut,
const RwV3d * pointsIn,
RwInt32 numPoints,
const RwMatrix * matrix);
-
+
+#ifndef RWLIBS
WRAPPER void _rwObjectHasFrameSetFrame(void* object, RwFrame* frame) { EAXJMP(0x5BC950); }
WRAPPER RpAtomic* AtomicDefaultRenderCallBack(RpAtomic* atomic) { EAXJMP(0x59E690); }
@@ -412,4 +413,427 @@ WRAPPER RxNodeDefinition* RxNodeDefinitionGetAtomicEnumerateLights() { EAXJMP(0x
WRAPPER RxNodeDefinition* RxNodeDefinitionGetMaterialScatter() { EAXJMP(0x5DDAA0); }
WRAPPER RxNodeDefinition* RxNodeDefinitionGetLight() { EAXJMP(0x5DF040); }
WRAPPER RxNodeDefinition* RxNodeDefinitionGetPostLight() { EAXJMP(0x5DF560); }
-WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); } \ No newline at end of file
+WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); }
+#else
+
+extern "C"
+{
+ void* _rwFrameOpen(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwFrameClose(void* instance, RwInt32 offset, RwInt32 size);
+ RwFrame* _rwFrameCloneAndLinkClones(RwFrame* root);
+ RwFrame* _rwFramePurgeClone(RwFrame* root);
+ RwBool RwFrameDirty(RwFrame const* frame);
+ void _rwFrameInit(RwFrame* frame);
+ RwBool _rwMatrixSetMultFn(rwMatrixMultFn multMat);
+ void* _rwMatrixClose(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwMatrixOpen(void* instance, RwInt32 offset, RwInt32 size);
+ RwBool _rwVectorSetMultFn(rwVectorMultFn multPoint, rwVectorsMultFn multPoints, rwVectorMultFn multVector, rwVectorsMultFn multVectors);
+ void* _rwVectorClose(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwVectorOpen(void* instance, RwInt32 offset, RwInt32 size);
+ RwBool _rwPluginRegistryOpen();
+ RwBool _rwPluginRegistryClose();
+}
+
+STARTPATCHES
+InjectHook(0x5BC950, &_rwObjectHasFrameSetFrame, PATCH_JUMP);
+InjectHook(0x59E690, &AtomicDefaultRenderCallBack, PATCH_JUMP);
+InjectHook(0x59E6C0, &_rpAtomicResyncInterpolatedSphere, PATCH_JUMP);
+InjectHook(0x59E800, &RpAtomicGetWorldBoundingSphere, PATCH_JUMP);
+InjectHook(0x59ED50, &RpClumpGetNumAtomics, PATCH_JUMP);
+InjectHook(0x59ED80, &RpClumpRender, PATCH_JUMP);
+InjectHook(0x59EDD0, &RpClumpForAllAtomics, PATCH_JUMP);
+InjectHook(0x59EE10, &RpClumpForAllCameras, PATCH_JUMP);
+InjectHook(0x59EE60, &RpClumpForAllLights, PATCH_JUMP);
+InjectHook(0x59EEB0, &RpAtomicCreate, PATCH_JUMP);
+InjectHook(0x59EFA0, &RpAtomicSetGeometry, PATCH_JUMP);
+InjectHook(0x59F020, &RpAtomicDestroy, PATCH_JUMP);
+InjectHook(0x59F0A0, &RpAtomicClone, PATCH_JUMP);
+InjectHook(0x59F1B0, &RpClumpClone, PATCH_JUMP);
+InjectHook(0x59F490, &RpClumpCreate, PATCH_JUMP);
+InjectHook(0x59F500, &RpClumpDestroy, PATCH_JUMP);
+InjectHook(0x59F680, &RpClumpAddAtomic, PATCH_JUMP);
+InjectHook(0x59F6B0, &RpClumpRemoveAtomic, PATCH_JUMP);
+InjectHook(0x59F6E0, &RpClumpRemoveLight, PATCH_JUMP);
+InjectHook(0x59FC50, &RpClumpStreamRead, PATCH_JUMP);
+InjectHook(0x5A0510, &RpAtomicRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0540, &RpClumpRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0570, &RpAtomicRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5A05A0, &RpAtomicSetStreamAlwaysCallBack, PATCH_JUMP);
+InjectHook(0x5A05C0, &RpAtomicSetStreamRightsCallBack, PATCH_JUMP);
+InjectHook(0x5A05E0, &RpAtomicGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5A0600, &RpAtomicSetFrame, PATCH_JUMP);
+InjectHook(0x5A0DC0, &RwEngineRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0DF0, &RwEngineGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5A0E10, &RwEngineGetNumSubSystems, PATCH_JUMP);
+InjectHook(0x5A0E40, &RwEngineGetSubSystemInfo, PATCH_JUMP);
+InjectHook(0x5A0E70, &RwEngineGetCurrentSubSystem, PATCH_JUMP);
+InjectHook(0x5A0EA0, &RwEngineSetSubSystem, PATCH_JUMP);
+InjectHook(0x5A0ED0, &RwEngineGetNumVideoModes, PATCH_JUMP);
+InjectHook(0x5A0F00, &RwEngineGetVideoModeInfo, PATCH_JUMP);
+InjectHook(0x5A0F30, &RwEngineGetCurrentVideoMode, PATCH_JUMP);
+InjectHook(0x5A0F60, &RwEngineSetVideoMode, PATCH_JUMP);
+InjectHook(0x5A0F90, &RwEngineStop, PATCH_JUMP);
+InjectHook(0x5A0FE0, &RwEngineStart, PATCH_JUMP);
+InjectHook(0x5A1070, &RwEngineClose, PATCH_JUMP);
+InjectHook(0x5A10E0, &RwEngineOpen, PATCH_JUMP);
+InjectHook(0x5A1290, &RwEngineTerm, PATCH_JUMP);
+InjectHook(0x5A12D0, &RwEngineInit, PATCH_JUMP);
+InjectHook(0x5A15E0, &_rwFrameOpen, PATCH_JUMP);
+InjectHook(0x5A1650, &_rwFrameClose, PATCH_JUMP);
+InjectHook(0x5A1690, &_rwFrameCloneAndLinkClones, PATCH_JUMP);
+InjectHook(0x5A1880, &_rwFramePurgeClone, PATCH_JUMP);
+InjectHook(0x5A1930, &RwFrameDirty, PATCH_JUMP);
+InjectHook(0x5A1950, &_rwFrameInit, PATCH_JUMP);
+InjectHook(0x5A1A00, &RwFrameCreate, PATCH_JUMP);
+InjectHook(0x5A1A30, &RwFrameDestroy, PATCH_JUMP);
+InjectHook(0x5A1BF0, &RwFrameDestroyHierarchy, PATCH_JUMP);
+InjectHook(0x5A1C60, &RwFrameUpdateObjects, PATCH_JUMP);
+InjectHook(0x5A1CE0, &RwFrameGetLTM, PATCH_JUMP);
+InjectHook(0x5A1D00, &RwFrameAddChild, PATCH_JUMP);
+InjectHook(0x5A1ED0, &RwFrameRemoveChild, PATCH_JUMP);
+InjectHook(0x5A1FC0, &RwFrameForAllChildren, PATCH_JUMP);
+InjectHook(0x5A2000, &RwFrameTranslate, PATCH_JUMP);
+InjectHook(0x5A20A0, &RwFrameScale, PATCH_JUMP);
+InjectHook(0x5A2140, &RwFrameTransform, PATCH_JUMP);
+InjectHook(0x5A21E0, &RwFrameRotate, PATCH_JUMP);
+InjectHook(0x5A2280, &RwFrameSetIdentity, PATCH_JUMP);
+InjectHook(0x5A2340, &RwFrameForAllObjects, PATCH_JUMP);
+InjectHook(0x5A2380, &RwFrameRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A23B0, &_rwMatrixSetMultFn, PATCH_JUMP);
+InjectHook(0x5A2520, &_rwMatrixDeterminant, PATCH_JUMP);
+InjectHook(0x5A2570, &_rwMatrixOrthogonalError, PATCH_JUMP);
+InjectHook(0x5A25D0, &_rwMatrixNormalError, PATCH_JUMP);
+InjectHook(0x5A2660, &_rwMatrixIdentityError, PATCH_JUMP);
+InjectHook(0x5A2730, &_rwMatrixClose, PATCH_JUMP);
+InjectHook(0x5A2770, &_rwMatrixOpen, PATCH_JUMP);
+InjectHook(0x5A2820, &RwMatrixOptimize, PATCH_JUMP);
+InjectHook(0x5A28E0, &RwMatrixUpdate, PATCH_JUMP);
+InjectHook(0x5A28F0, &RwMatrixMultiply, PATCH_JUMP);
+InjectHook(0x5A2960, &RwMatrixRotateOneMinusCosineSine, PATCH_JUMP);
+InjectHook(0x5A2BF0, &RwMatrixRotate, PATCH_JUMP);
+InjectHook(0x5A2C90, &RwMatrixInvert, PATCH_JUMP);
+InjectHook(0x5A2EE0, &RwMatrixScale, PATCH_JUMP);
+InjectHook(0x5A3070, &RwMatrixTranslate, PATCH_JUMP);
+InjectHook(0x5A31C0, &RwMatrixTransform, PATCH_JUMP);
+InjectHook(0x5A3300, &RwMatrixDestroy, PATCH_JUMP);
+InjectHook(0x5A3330, &RwMatrixCreate, PATCH_JUMP);
+InjectHook(0x5A3450, &_rwVectorSetMultFn, PATCH_JUMP);
+InjectHook(0x5A3600, &_rwV3dNormalize, PATCH_JUMP);
+InjectHook(0x5A36A0, &RwV3dLength, PATCH_JUMP);
+InjectHook(0x5A3710, &_rwSqrt, PATCH_JUMP);
+InjectHook(0x5A3770, &_rwInvSqrt, PATCH_JUMP);
+InjectHook(0x5A37D0, &RwV3dTransformPoints, PATCH_JUMP);
+InjectHook(0x5A37E0, &RwV3dTransformVectors, PATCH_JUMP);
+InjectHook(0x5A37F0, &_rwVectorClose, PATCH_JUMP);
+InjectHook(0x5A3860, &_rwVectorOpen, PATCH_JUMP);
+InjectHook(0x5A3AD0, &RwStreamRead, PATCH_JUMP);
+InjectHook(0x5A3C30, &RwStreamWrite, PATCH_JUMP);
+InjectHook(0x5A3DF0, &RwStreamSkip, PATCH_JUMP);
+InjectHook(0x5A3F10, &RwStreamClose, PATCH_JUMP);
+InjectHook(0x5A3FE0, &RwStreamOpen, PATCH_JUMP);
+InjectHook(0x5A43A0, &RwIm2DGetNearScreenZ, PATCH_JUMP);
+InjectHook(0x5A43B0, &RwIm2DGetFarScreenZ, PATCH_JUMP);
+InjectHook(0x5A43C0, &RwRenderStateSet, PATCH_JUMP);
+InjectHook(0x5A4410, &RwRenderStateGet, PATCH_JUMP);
+InjectHook(0x5A4420, &RwIm2DRenderLine, PATCH_JUMP);
+InjectHook(0x5A4430, &RwIm2DRenderPrimitive, PATCH_JUMP);
+InjectHook(0x5A4440, &RwIm2DRenderIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5A5020, &RwCameraEndUpdate, PATCH_JUMP);
+InjectHook(0x5A5030, &RwCameraBeginUpdate, PATCH_JUMP);
+InjectHook(0x5A5040, &RwCameraSetViewOffset, PATCH_JUMP);
+InjectHook(0x5A5070, &RwCameraSetNearClipPlane, PATCH_JUMP);
+InjectHook(0x5A5140, &RwCameraSetFarClipPlane, PATCH_JUMP);
+InjectHook(0x5A5170, &RwCameraFrustumTestSphere, PATCH_JUMP);
+InjectHook(0x5A51E0, &RwCameraClear, PATCH_JUMP);
+InjectHook(0x5A5210, &RwCameraShowRaster, PATCH_JUMP);
+InjectHook(0x5A5240, &RwCameraSetProjection, PATCH_JUMP);
+InjectHook(0x5A52B0, &RwCameraSetViewWindow, PATCH_JUMP);
+InjectHook(0x5A52F0, &RwCameraRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A5320, &RwCameraDestroy, PATCH_JUMP);
+InjectHook(0x5A5360, &RwCameraCreate, PATCH_JUMP);
+InjectHook(0x5A7100, &RwTextureSetMipmapping, PATCH_JUMP);
+InjectHook(0x5A7120, &RwTextureGetMipmapping, PATCH_JUMP);
+InjectHook(0x5A7130, &RwTextureSetAutoMipmapping, PATCH_JUMP);
+InjectHook(0x5A7150, &RwTextureGetAutoMipmapping, PATCH_JUMP);
+InjectHook(0x5A7160, &RwTexDictionaryCreate, PATCH_JUMP);
+InjectHook(0x5A7200, &RwTexDictionaryDestroy, PATCH_JUMP);
+InjectHook(0x5A7290, &RwTexDictionaryForAllTextures, PATCH_JUMP);
+InjectHook(0x5A72D0, &RwTextureCreate, PATCH_JUMP);
+InjectHook(0x5A7330, &RwTextureDestroy, PATCH_JUMP);
+InjectHook(0x5A73B0, &RwTextureSetName, PATCH_JUMP);
+InjectHook(0x5A7420, &RwTextureSetMaskName, PATCH_JUMP);
+InjectHook(0x5A7490, &RwTexDictionaryAddTexture, PATCH_JUMP);
+InjectHook(0x5A74D0, &RwTexDictionaryFindNamedTexture, PATCH_JUMP);
+InjectHook(0x5A7550, &RwTexDictionarySetCurrent, PATCH_JUMP);
+InjectHook(0x5A7570, &RwTexDictionaryGetCurrent, PATCH_JUMP);
+InjectHook(0x5A7580, &RwTextureRead, PATCH_JUMP);
+InjectHook(0x5A7780, &RwTextureRasterGenerateMipmaps, PATCH_JUMP);
+InjectHook(0x5A9120, &RwImageCreate, PATCH_JUMP);
+InjectHook(0x5A9180, &RwImageDestroy, PATCH_JUMP);
+InjectHook(0x5A91E0, &RwImageAllocatePixels, PATCH_JUMP);
+InjectHook(0x5A92A0, &RwImageFreePixels, PATCH_JUMP);
+InjectHook(0x5A92D0, &RwImageMakeMask, PATCH_JUMP);
+InjectHook(0x5A93A0, &RwImageApplyMask, PATCH_JUMP);
+InjectHook(0x5A9750, &RwImageSetPath, PATCH_JUMP);
+InjectHook(0x5A9810, &RwImageRead, PATCH_JUMP);
+InjectHook(0x5A9B40, &RwImageFindFileType, PATCH_JUMP);
+InjectHook(0x5A9C10, &RwImageReadMaskedImage, PATCH_JUMP);
+InjectHook(0x5A9F50, &RwImageCopy, PATCH_JUMP);
+InjectHook(0x5AA130, &RwImageGammaCorrect, PATCH_JUMP);
+InjectHook(0x5AA2C0, &RwImageSetGamma, PATCH_JUMP);
+InjectHook(0x5AA4E0, &_rwStreamWriteVersionedChunkHeader, PATCH_JUMP);
+InjectHook(0x5AA540, &RwStreamFindChunk, PATCH_JUMP);
+InjectHook(0x5AA640, &RwMemLittleEndian32, PATCH_JUMP);
+InjectHook(0x5AA650, &RwMemNative32, PATCH_JUMP);
+InjectHook(0x5AA660, &RwMemFloat32ToReal, PATCH_JUMP);
+InjectHook(0x5AA680, &RwStreamWriteReal, PATCH_JUMP);
+InjectHook(0x5AA720, &RwStreamWriteInt32, PATCH_JUMP);
+InjectHook(0x5AA740, &RwStreamReadReal, PATCH_JUMP);
+InjectHook(0x5AA7B0, &RwStreamReadInt32, PATCH_JUMP);
+InjectHook(0x5AA800, &RwTextureStreamGetSize, PATCH_JUMP);
+InjectHook(0x5AA870, &RwTextureStreamWrite, PATCH_JUMP);
+InjectHook(0x5AAA40, &RwTextureStreamRead, PATCH_JUMP);
+InjectHook(0x5AB020, &RwTexDictionaryStreamWrite, PATCH_JUMP);
+InjectHook(0x5AC890, &RpMorphTargetCalcBoundingSphere, PATCH_JUMP);
+InjectHook(0x5AC9A0, &RpGeometryAddMorphTargets, PATCH_JUMP);
+InjectHook(0x5ACB60, &RpGeometryTriangleSetVertexIndices, PATCH_JUMP);
+InjectHook(0x5ACB90, &RpGeometryTriangleSetMaterial, PATCH_JUMP);
+InjectHook(0x5ACBF0, &RpGeometryForAllMaterials, PATCH_JUMP);
+InjectHook(0x5ACC30, &RpGeometryLock, PATCH_JUMP);
+InjectHook(0x5ACC60, &RpGeometryUnlock, PATCH_JUMP);
+InjectHook(0x5ACD10, &RpGeometryCreate, PATCH_JUMP);
+InjectHook(0x5ACF40, &_rpGeometryAddRef, PATCH_JUMP);
+InjectHook(0x5ACF50, &RpGeometryDestroy, PATCH_JUMP);
+InjectHook(0x5ACFF0, &RpGeometryRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AD020, &RpGeometryRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5AD050, &RpGeometryStreamRead, PATCH_JUMP);
+InjectHook(0x5AD6D0, &RwRasterGetCurrentContext, PATCH_JUMP);
+InjectHook(0x5AD6F0, &RwRasterUnlock, PATCH_JUMP);
+InjectHook(0x5AD710, &RwRasterRenderFast, PATCH_JUMP);
+InjectHook(0x5AD750, &RwRasterUnlockPalette, PATCH_JUMP);
+InjectHook(0x5AD780, &RwRasterDestroy, PATCH_JUMP);
+InjectHook(0x5AD7C0, &RwRasterPushContext, PATCH_JUMP);
+InjectHook(0x5AD810, &RwRasterRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AD840, &RwRasterLockPalette, PATCH_JUMP);
+InjectHook(0x5AD870, &RwRasterPopContext, PATCH_JUMP);
+InjectHook(0x5AD8C0, &RwRasterGetNumLevels, PATCH_JUMP);
+InjectHook(0x5AD900, &RwRasterShowRaster, PATCH_JUMP);
+InjectHook(0x5AD930, &RwRasterCreate, PATCH_JUMP);
+InjectHook(0x5AD9D0, &RwRasterLock, PATCH_JUMP);
+InjectHook(0x5ADC30, &RpMaterialCreate, PATCH_JUMP);
+InjectHook(0x5ADCB0, &RpMaterialDestroy, PATCH_JUMP);
+InjectHook(0x5ADD10, &RpMaterialSetTexture, PATCH_JUMP);
+InjectHook(0x5ADD40, &RpMaterialRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5ADD70, &RpMaterialRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5ADDA0, &RpMaterialStreamRead, PATCH_JUMP);
+InjectHook(0x5AE0B0, &_rpSectorDefaultRenderCallBack, PATCH_JUMP);
+InjectHook(0x5AE100, &_rpWorldForAllGlobalLights, PATCH_JUMP);
+InjectHook(0x5AE150, &_rpWorldSectorForAllLocalLights, PATCH_JUMP);
+InjectHook(0x5AE190, &RpWorldUnlock, PATCH_JUMP);
+InjectHook(0x5AE2B0, &RpWorldSectorGetWorld, PATCH_JUMP);
+InjectHook(0x5AE340, &RpWorldDestroy, PATCH_JUMP);
+InjectHook(0x5AE6A0, &RpWorldCreate, PATCH_JUMP);
+InjectHook(0x5AEA40, &RpWorldRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AEA70, &RpWorldRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5AEAA0, &RpWorldPluginAttach, PATCH_JUMP);
+InjectHook(0x5AFB80, &RpWorldAddCamera, PATCH_JUMP);
+InjectHook(0x5AFBB0, &RpWorldRemoveCamera, PATCH_JUMP);
+InjectHook(0x5AFC10, &RpAtomicGetWorld, PATCH_JUMP);
+InjectHook(0x5AFC20, &RpWorldAddClump, PATCH_JUMP);
+InjectHook(0x5AFDA0, &RpWorldAddLight, PATCH_JUMP);
+InjectHook(0x5AFDF0, &RpWorldRemoveLight, PATCH_JUMP);
+InjectHook(0x5AFE70, &RtBMPImageRead, PATCH_JUMP);
+InjectHook(0x5B07D0, &RpSkinPluginAttach, PATCH_JUMP);
+InjectHook(0x5B1050, &RpSkinAtomicSetHAnimHierarchy, PATCH_JUMP);
+InjectHook(0x5B1070, &RpSkinAtomicGetHAnimHierarchy, PATCH_JUMP);
+InjectHook(0x5B1080, &RpSkinGeometryGetSkin, PATCH_JUMP);
+InjectHook(0x5B1090, &RpSkinGeometrySetSkin, PATCH_JUMP);
+InjectHook(0x5B10D0, &RpSkinGetSkinToBoneMatrices, PATCH_JUMP);
+InjectHook(0x5B10E0, &RpHAnimHierarchyCreate, PATCH_JUMP);
+InjectHook(0x5B11F0, &RpHAnimFrameGetHierarchy, PATCH_JUMP);
+InjectHook(0x5B1200, &RpHAnimHierarchySetCurrentAnim, PATCH_JUMP);
+InjectHook(0x5B12B0, &RpHAnimHierarchySubAnimTime, PATCH_JUMP);
+InjectHook(0x5B1480, &RpHAnimHierarchyAddAnimTime, PATCH_JUMP);
+InjectHook(0x5B1780, &RpHAnimHierarchyUpdateMatrices, PATCH_JUMP);
+InjectHook(0x5B1C10, &RpHAnimAnimationStreamRead, PATCH_JUMP);
+InjectHook(0x5B1D50, &RpHAnimPluginAttach, PATCH_JUMP);
+InjectHook(0x5B2640, &RpMatFXPluginAttach, PATCH_JUMP);
+InjectHook(0x5B3750, &RpMatFXAtomicEnableEffects, PATCH_JUMP);
+InjectHook(0x5B3780, &RpMatFXMaterialSetEffects, PATCH_JUMP);
+InjectHook(0x5B38D0, &RpMatFXMaterialSetupEnvMap, PATCH_JUMP);
+InjectHook(0x5B3A40, &RpMatFXMaterialSetBumpMapTexture, PATCH_JUMP);
+InjectHook(0x5B3CF0, &RwD3D8SetRenderState, PATCH_JUMP);
+InjectHook(0x5B3D40, &RwD3D8GetRenderState, PATCH_JUMP);
+InjectHook(0x5B3D60, &RwD3D8SetTextureStageState, PATCH_JUMP);
+InjectHook(0x5B53A0, &RwD3D8SetTexture, PATCH_JUMP);
+InjectHook(0x5B6720, &RwIm3DTransform, PATCH_JUMP);
+InjectHook(0x5B67F0, &RwIm3DEnd, PATCH_JUMP);
+InjectHook(0x5B6820, &RwIm3DRenderIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5B6980, &RwIm3DRenderLine, PATCH_JUMP);
+InjectHook(0x5B6A50, &RwIm3DSetTransformPipeline, PATCH_JUMP);
+InjectHook(0x5B6AC0, &RwIm3DSetRenderPipeline, PATCH_JUMP);
+InjectHook(0x5B95D0, &RwD3D8EngineSetRefreshRate, PATCH_JUMP);
+InjectHook(0x5B9640, &RwD3D8CameraAttachWindow, PATCH_JUMP);
+InjectHook(0x5BAEB0, &RwD3D8DeviceSupportsDXTTexture, PATCH_JUMP);
+InjectHook(0x5BAF90, &RwD3D8SetVertexShader, PATCH_JUMP);
+InjectHook(0x5BAFD0, &RwD3D8SetPixelShader, PATCH_JUMP);
+InjectHook(0x5BB010, &RwD3D8SetStreamSource, PATCH_JUMP);
+InjectHook(0x5BB060, &RwD3D8SetIndices, PATCH_JUMP);
+InjectHook(0x5BB0B0, &RwD3D8DrawIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5BB140, &RwD3D8DrawPrimitive, PATCH_JUMP);
+InjectHook(0x5BB1D0, &RwD3D8SetTransform, PATCH_JUMP);
+InjectHook(0x5BB310, &RwD3D8GetTransform, PATCH_JUMP);
+InjectHook(0x5BB340, &RwD3D8SetTransformWorld, PATCH_JUMP);
+InjectHook(0x5BB490, &RwD3D8SetSurfaceProperties, PATCH_JUMP);
+InjectHook(0x5BB7A0, &RwD3D8SetLight, PATCH_JUMP);
+InjectHook(0x5BB890, &RwD3D8EnableLight, PATCH_JUMP);
+InjectHook(0x5BB9F0, &RwD3D8DynamicVertexBufferCreate, PATCH_JUMP);
+InjectHook(0x5BBAE0, &RwD3D8DynamicVertexBufferDestroy, PATCH_JUMP);
+InjectHook(0x5BBB10, &RwD3D8IndexBufferCreate, PATCH_JUMP);
+InjectHook(0x5BBB40, &RwD3D8CreatePixelShader, PATCH_JUMP);
+InjectHook(0x5BBB90, &RwD3D8DeletePixelShader, PATCH_JUMP);
+InjectHook(0x5BBC00, &RwD3D8SetPixelShaderConstant, PATCH_JUMP);
+InjectHook(0x5BBC30, &RwD3D8GetCaps, PATCH_JUMP);
+InjectHook(0x5BBC40, &RwD3D8CameraIsSphereFullyInsideFrustum, PATCH_JUMP);
+InjectHook(0x5BBCA0, &RwD3D8CameraIsBBoxFullyInsideFrustum, PATCH_JUMP);
+InjectHook(0x5BBD30, &RwD3D8DynamicVertexBufferLock, PATCH_JUMP);
+InjectHook(0x5BBEB0, &RwD3D8DynamicVertexBufferUnlock, PATCH_JUMP);
+InjectHook(0x5BBED0, &_rwIntelSSEsupported, PATCH_JUMP);
+InjectHook(0x5BBF10, &RwImageSetFromRaster, PATCH_JUMP);
+InjectHook(0x5BBF50, &RwRasterSetFromImage, PATCH_JUMP);
+InjectHook(0x5BBF80, &RwImageFindRasterFormat, PATCH_JUMP);
+InjectHook(0x5BBFF0, &RwFrameRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5BC020, &_rwFrameListDeinitialize, PATCH_JUMP);
+InjectHook(0x5BC050, &_rwFrameListStreamRead, PATCH_JUMP);
+InjectHook(0x5BC300, &RpLightSetRadius, PATCH_JUMP);
+InjectHook(0x5BC320, &RpLightSetColor, PATCH_JUMP);
+InjectHook(0x5BC370, &RpLightGetConeAngle, PATCH_JUMP);
+InjectHook(0x5BC5B0, &RpLightRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5BC5E0, &RpLightStreamRead, PATCH_JUMP);
+InjectHook(0x5BC780, &RpLightDestroy, PATCH_JUMP);
+InjectHook(0x5BC7C0, &RpLightCreate, PATCH_JUMP);
+InjectHook(0x5BE280, &_rwD3D8TexDictionaryEnableRasterFormatConversion, PATCH_JUMP);
+InjectHook(0x5BF110, &RwOsGetFileInterface, PATCH_JUMP);
+InjectHook(0x5C1720, &RwFreeListDestroy, PATCH_JUMP);
+InjectHook(0x5C1790, &RwFreeListCreate, PATCH_JUMP);
+InjectHook(0x5C19F0, &RwFreeListPurge, PATCH_JUMP);
+InjectHook(0x5C1B90, &RwFreeListPurgeAllFreeLists, PATCH_JUMP);
+InjectHook(0x5C1D40, &RwFreeListForAllUsed, PATCH_JUMP);
+InjectHook(0x5C2780, &_rxPipelineClose, PATCH_JUMP);
+InjectHook(0x5C27E0, &_rxPipelineOpen, PATCH_JUMP);
+InjectHook(0x5C2AD0, &RxHeapGetGlobalHeap, PATCH_JUMP);
+InjectHook(0x5C2AE0, &RxPacketCreate, PATCH_JUMP);
+InjectHook(0x5C2B10, &RxClusterSetExternalData, PATCH_JUMP);
+InjectHook(0x5C2B70, &RxClusterSetData, PATCH_JUMP);
+InjectHook(0x5C2BD0, &RxClusterInitializeData, PATCH_JUMP);
+InjectHook(0x5C2C40, &RxClusterResizeData, PATCH_JUMP);
+InjectHook(0x5C2C90, &RxClusterLockWrite, PATCH_JUMP);
+InjectHook(0x5C2D60, &RxPipelineExecute, PATCH_JUMP);
+InjectHook(0x5C2E00, &RxPipelineCreate, PATCH_JUMP);
+InjectHook(0x5C2E70, &_rxPipelineDestroy, PATCH_JUMP);
+InjectHook(0x5C3080, &RwResourcesFreeResEntry, PATCH_JUMP);
+InjectHook(0x5C30F0, &_rwResourcesPurge, PATCH_JUMP);
+InjectHook(0x5C3170, &RwResourcesAllocateResEntry, PATCH_JUMP);
+InjectHook(0x5C3360, &RwResourcesEmptyArena, PATCH_JUMP);
+InjectHook(0x5C3450, &_rwPluginRegistryOpen, PATCH_JUMP);
+InjectHook(0x5C3480, &_rwPluginRegistryClose, PATCH_JUMP);
+InjectHook(0x5C3590, &_rwPluginRegistryGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5C35C0, &_rwPluginRegistryAddPlugin, PATCH_JUMP);
+InjectHook(0x5C37F0, &_rwPluginRegistryInitObject, PATCH_JUMP);
+InjectHook(0x5C3850, &_rwPluginRegistryDeInitObject, PATCH_JUMP);
+InjectHook(0x5C3880, &_rwPluginRegistryCopyObject, PATCH_JUMP);
+InjectHook(0x5C3910, &RwErrorSet, PATCH_JUMP);
+InjectHook(0x5C3970, &_rwerror, PATCH_JUMP);
+InjectHook(0x5C3980, &_rwPluginRegistryAddPluginStream, PATCH_JUMP);
+InjectHook(0x5C39C0, &_rwPluginRegistryAddPlgnStrmlwysCB, PATCH_JUMP);
+InjectHook(0x5C39F0, &_rwPluginRegistryAddPlgnStrmRightsCB, PATCH_JUMP);
+InjectHook(0x5C3A20, & _rwPluginRegistryReadDataChunks, PATCH_JUMP);
+InjectHook(0x5C3B50, & _rwPluginRegistryInvokeRights, PATCH_JUMP);
+InjectHook(0x5C3BA0, &_rwPluginRegistryGetSize, PATCH_JUMP);
+InjectHook(0x5C3BE0, &_rwPluginRegistryWriteDataChunks, PATCH_JUMP);
+InjectHook(0x5C3CB0, &_rwPluginRegistrySkipDataChunks, PATCH_JUMP);
+InjectHook(0x5C3D30, &RwCameraStreamRead, PATCH_JUMP);
+InjectHook(0x5C5570, &RwBBoxCalculate, PATCH_JUMP);
+InjectHook(0x5C72B0, &RwImageResample, PATCH_JUMP);
+InjectHook(0x5C7B30, &RwImageCreateResample, PATCH_JUMP);
+InjectHook(0x5D9240, &RxRenderStateVectorSetDefaultRenderStateVector, PATCH_JUMP);
+InjectHook(0x5D9340, &RxRenderStateVectorCreate, PATCH_JUMP);
+InjectHook(0x5D9410, &RxRenderStateVectorDestroy, PATCH_JUMP);
+InjectHook(0x5D9460, &RxRenderStateVectorLoadDriverState, PATCH_JUMP);
+InjectHook(0x5D95D0, &_rxEmbeddedPacketBetweenPipelines, PATCH_JUMP);
+InjectHook(0x5D9740, &_rxEmbeddedPacketBetweenNodes, PATCH_JUMP);
+InjectHook(0x5D9810, &_rxPacketDestroy, PATCH_JUMP);
+InjectHook(0x5C8B10, &_rpMaterialListDeinitialize, PATCH_JUMP);
+InjectHook(0x5C8B70, &_rpMaterialListInitialize, PATCH_JUMP);
+InjectHook(0x5C8B80, &_rpMaterialListGetMaterial, PATCH_JUMP);
+InjectHook(0x5C8B90, &_rpMaterialListAppendMaterial, PATCH_JUMP);
+InjectHook(0x5C8C50, &_rpMaterialListFindMaterialIndex, PATCH_JUMP);
+InjectHook(0x5C8C80, &_rpMaterialListStreamRead, PATCH_JUMP);
+InjectHook(0x5C8FE0, &_rpMeshHeaderCreate, PATCH_JUMP);
+InjectHook(0x5C8FF0, &_rpMeshClose, PATCH_JUMP);
+InjectHook(0x5C9020, &_rpMeshOpen, PATCH_JUMP);
+InjectHook(0x5C9140, &_rpBuildMeshCreate, PATCH_JUMP);
+InjectHook(0x5C9220, &_rpBuildMeshDestroy, PATCH_JUMP);
+InjectHook(0x5C9260, &_rpMeshDestroy, PATCH_JUMP);
+InjectHook(0x5C92A0, &_rpBuildMeshAddTriangle, PATCH_JUMP);
+InjectHook(0x5C9380, &_rpMeshHeaderForAllMeshes, PATCH_JUMP);
+InjectHook(0x5C93C0, &_rpMeshWrite, PATCH_JUMP);
+InjectHook(0x5C9510, &_rpMeshRead, PATCH_JUMP);
+InjectHook(0x5C96E0, &_rpMeshSize, PATCH_JUMP);
+InjectHook(0x5C9730, &RpBuildMeshGenerateDefaultTriStrip, PATCH_JUMP);
+InjectHook(0x5CAE10, &_rpTriListMeshGenerate, PATCH_JUMP);
+InjectHook(0x5CB230, &_rpMeshOptimise, PATCH_JUMP);
+InjectHook(0x5CB2B0, &RpWorldSectorRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5CB2E0, &RpWorldSectorRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5CB630, &RpWorldSetDefaultSectorPipeline, PATCH_JUMP);
+InjectHook(0x5CB670, &RpAtomicSetDefaultPipeline, PATCH_JUMP);
+InjectHook(0x5CDEE0, &RpHAnimStdKeyFrameToMatrix, PATCH_JUMP);
+InjectHook(0x5CE000, &RpHAnimStdKeyFrameInterpolate, PATCH_JUMP);
+InjectHook(0x5CE420, &RpHAnimStdKeyFrameBlend, PATCH_JUMP);
+InjectHook(0x5CE820, &RpHAnimStdKeyFrameStreamRead, PATCH_JUMP);
+InjectHook(0x5CE8C0, &RpHAnimStdKeyFrameStreamWrite, PATCH_JUMP);
+InjectHook(0x5CE930, &RpHAnimStdKeyFrameStreamGetSize, PATCH_JUMP);
+InjectHook(0x5CE950, &RpHAnimStdKeyFrameMulRecip, PATCH_JUMP);
+InjectHook(0x5CEAB0, &RpHAnimStdKeyFrameAdd, PATCH_JUMP);
+InjectHook(0x5D1070, &RxHeapFree, PATCH_JUMP);
+InjectHook(0x5D1260, &RxHeapAlloc, PATCH_JUMP);
+InjectHook(0x5D14D0, &RxHeapRealloc, PATCH_JUMP);
+InjectHook(0x5D1680, &_rxHeapReset, PATCH_JUMP);
+InjectHook(0x5D16F0, &RxHeapDestroy, PATCH_JUMP);
+InjectHook(0x5D1750, &RxHeapCreate, PATCH_JUMP);
+InjectHook(0x5D1EC0, &RxPipelineNodeFindOutputByName, PATCH_JUMP);
+InjectHook(0x5D1F20, &RxPipelineNodeFindInput, PATCH_JUMP);
+InjectHook(0x5D1F30, &RxPipelineNodeRequestCluster, PATCH_JUMP);
+InjectHook(0x5D1FA0, &RxLockedPipeUnlock, PATCH_JUMP);
+InjectHook(0x5D29F0, &RxPipelineLock, PATCH_JUMP);
+InjectHook(0x5D2B10, &RxPipelineFindNodeByName, PATCH_JUMP);
+InjectHook(0x5D2BA0, &RxLockedPipeAddFragment, PATCH_JUMP);
+InjectHook(0x5D2EE0, &RxLockedPipeAddPath, PATCH_JUMP);
+InjectHook(0x5D31C0, &RxNodeDefinitionGetImmRenderSetup, PATCH_JUMP);
+InjectHook(0x5D35C0, &RxNodeDefinitionGetImmMangleTriangleIndices, PATCH_JUMP);
+InjectHook(0x5D3C60, &RxNodeDefinitionGetCullTriangle, PATCH_JUMP);
+InjectHook(0x5D4F80, &RxNodeDefinitionGetClipTriangle, PATCH_JUMP);
+InjectHook(0x5D51C0, &RxNodeDefinitionGetSubmitTriangle, PATCH_JUMP);
+InjectHook(0x5D5400, &RxNodeDefinitionGetImmInstance, PATCH_JUMP);
+InjectHook(0x5D6000, &RxNodeDefinitionGetTransform, PATCH_JUMP);
+InjectHook(0x5D61C0, &RxNodeDefinitionGetImmStash, PATCH_JUMP);
+InjectHook(0x5D6470, &RxNodeDefinitionGetImmMangleLineIndices, PATCH_JUMP);
+InjectHook(0x5D7230, &RxNodeDefinitionGetClipLine, PATCH_JUMP);
+InjectHook(0x5D74C0, &RxNodeDefinitionGetSubmitLine, PATCH_JUMP);
+InjectHook(0x5D9C90, &_rwD3D8LightsOpen, PATCH_JUMP);
+InjectHook(0x5D9EF0, &_rwD3D8LightsClose, PATCH_JUMP);
+InjectHook(0x5D9F80, &_rwD3D8LightsGlobalEnable, PATCH_JUMP);
+InjectHook(0x5DA210, &_rwD3D8LightLocalEnable, PATCH_JUMP);
+InjectHook(0x5DA450, &_rwD3D8LightsEnable, PATCH_JUMP);
+InjectHook(0x5DAAC0, &RxNodeDefinitionGetD3D8WorldSectorAllInOne, PATCH_JUMP);
+InjectHook(0x5DC500, &RxNodeDefinitionGetD3D8AtomicAllInOne, PATCH_JUMP);
+InjectHook(0x5DCC50, &RxNodeDefinitionGetWorldSectorInstance, PATCH_JUMP);
+InjectHook(0x5DCD80, &RxNodeDefinitionGetWorldSectorEnumerateLights, PATCH_JUMP);
+InjectHook(0x5DD800, &RxNodeDefinitionGetAtomicInstance, PATCH_JUMP);
+InjectHook(0x5DD9B0, &RxNodeDefinitionGetAtomicEnumerateLights, PATCH_JUMP);
+InjectHook(0x5DDAA0, &RxNodeDefinitionGetMaterialScatter, PATCH_JUMP);
+InjectHook(0x5DF040, &RxNodeDefinitionGetLight, PATCH_JUMP);
+InjectHook(0x5DF560, &RxNodeDefinitionGetPostLight, PATCH_JUMP);
+InjectHook(0x5DFC60, &RxD3D8AllInOneSetRenderCallBack, PATCH_JUMP);
+ENDPATCHES
+#endif \ No newline at end of file
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 2545b9ab..0ec0b117 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -9,17 +9,20 @@
#include "Clock.h"
#include "Date.h"
#include "FileMgr.h"
+#include "Frontend.h"
#include "GameLogic.h"
#include "Gangs.h"
#include "Garages.h"
#include "GenericGameStorage.h"
#include "Pad.h"
+#include "Particle.h"
#include "ParticleObject.h"
#include "PathFind.h"
#include "PCSave.h"
#include "Phones.h"
#include "Pickups.h"
#include "PlayerPed.h"
+#include "ProjectileInfo.h"
#include "Pools.h"
#include "Radar.h"
#include "Restart.h"
@@ -48,7 +51,6 @@ char SaveFileNameJustSaved[260];
int (&Slots)[SLOT_COUNT+1] = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C;
CDate &CompileDateAndTime = *(CDate*)0x72BCB8;
-
bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;
bool &JustLoadedDontFadeInYet = *(bool*)0x95CDB4;
bool &StillToFadeOut = *(bool*)0x95CD99;
@@ -58,10 +60,26 @@ uint32 &TimeToStayFadedBeforeFadeOut = *(uint32*)0x611564;
#define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to));
#define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from));
-WRAPPER bool GenericLoad() { EAXJMP(0x590A00); }
+#define LoadSaveDataBlock()\
+do {\
+ if (!ReadDataFromFile(file, (uint8 *) &size, 4))\
+ return false;\
+ size = align4bytes(size);\
+ if (!ReadDataFromFile(file, work_buff, size))\
+ return false;\
+ buf = work_buff;\
+} while (0)
+#define ReadDataFromBlock(msg,load_func)\
+do {\
+ debug(msg);\
+ ReadDataFromBufferPointer(buf, size);\
+ load_func(buf, size);\
+ size = align4bytes(size);\
+ buf += size;\
+} while (0)
-#define WRITE_BLOCK(save_func)\
+#define WriteSaveDataBlock(save_func)\
do {\
buf = work_buff;\
reserved = 0;\
@@ -117,11 +135,11 @@ GenericSave(int file)
WriteDataToBufferPointer(buf, CClock::ms_nGameClockMinutes);
currPad = CPad::GetPad(0);
WriteDataToBufferPointer(buf, currPad->Mode);
- WriteDataToBufferPointer(buf, CTimer::GetTimeInMilliseconds());
- WriteDataToBufferPointer(buf, CTimer::GetTimeScale());
- WriteDataToBufferPointer(buf, CTimer::GetTimeStep());
- WriteDataToBufferPointer(buf, CTimer::GetTimeStepNonClipped());
- WriteDataToBufferPointer(buf, CTimer::GetFrameCounter());
+ WriteDataToBufferPointer(buf, CTimer::m_snTimeInMilliseconds);
+ WriteDataToBufferPointer(buf, CTimer::ms_fTimeScale);
+ WriteDataToBufferPointer(buf, CTimer::ms_fTimeStep);
+ WriteDataToBufferPointer(buf, CTimer::ms_fTimeStepNonClipped);
+ WriteDataToBufferPointer(buf, CTimer::m_FrameCounter);
WriteDataToBufferPointer(buf, CTimeStep::ms_fTimeStep);
WriteDataToBufferPointer(buf, CTimeStep::ms_fFramesPerUpdate);
WriteDataToBufferPointer(buf, CTimeStep::ms_fTimeScale);
@@ -138,7 +156,6 @@ GenericSave(int file)
WriteDataToBufferPointer(buf, CWeather::WeatherTypeInList);
WriteDataToBufferPointer(buf, TheCamera.CarZoomIndicator);
WriteDataToBufferPointer(buf, TheCamera.PedZoomIndicator);
-
assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
// Save scripts, block is nested within the same block as simple vars for some reason
@@ -153,25 +170,25 @@ GenericSave(int file)
totalSize = buf - work_buff;
// Save the rest
- WRITE_BLOCK(CPools::SavePedPool);
- WRITE_BLOCK(CGarages::Save);
- WRITE_BLOCK(CPools::SaveVehiclePool);
- WRITE_BLOCK(CPools::SaveObjectPool);
- WRITE_BLOCK(ThePaths.Save);
- WRITE_BLOCK(CCranes::Save);
- WRITE_BLOCK(CPickups::Save);
- WRITE_BLOCK(gPhoneInfo.Save);
- WRITE_BLOCK(CRestart::SaveAllRestartPoints);
- WRITE_BLOCK(CRadar::SaveAllRadarBlips);
- WRITE_BLOCK(CTheZones::SaveAllZones);
- WRITE_BLOCK(CGangs::SaveAllGangData);
- WRITE_BLOCK(CTheCarGenerators::SaveAllCarGenerators);
- WRITE_BLOCK(CParticleObject::SaveParticle);
- WRITE_BLOCK(cAudioScriptObject::SaveAllAudioScriptObjects);
- WRITE_BLOCK(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo);
- WRITE_BLOCK(CStats::SaveStats);
- WRITE_BLOCK(CStreaming::MemoryCardSave);
- WRITE_BLOCK(CPedType::Save);
+ WriteSaveDataBlock(CPools::SavePedPool);
+ WriteSaveDataBlock(CGarages::Save);
+ WriteSaveDataBlock(CPools::SaveVehiclePool);
+ WriteSaveDataBlock(CPools::SaveObjectPool);
+ WriteSaveDataBlock(ThePaths.Save);
+ WriteSaveDataBlock(CCranes::Save);
+ WriteSaveDataBlock(CPickups::Save);
+ WriteSaveDataBlock(gPhoneInfo.Save);
+ WriteSaveDataBlock(CRestart::SaveAllRestartPoints);
+ WriteSaveDataBlock(CRadar::SaveAllRadarBlips);
+ WriteSaveDataBlock(CTheZones::SaveAllZones);
+ WriteSaveDataBlock(CGangs::SaveAllGangData);
+ WriteSaveDataBlock(CTheCarGenerators::SaveAllCarGenerators);
+ WriteSaveDataBlock(CParticleObject::SaveParticle);
+ WriteSaveDataBlock(cAudioScriptObject::SaveAllAudioScriptObjects);
+ WriteSaveDataBlock(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo);
+ WriteSaveDataBlock(CStats::SaveStats);
+ WriteSaveDataBlock(CStreaming::MemoryCardSave);
+ WriteSaveDataBlock(CPedType::Save);
// Write padding
for (int i = 0; i < 4; i++) {
@@ -199,6 +216,115 @@ GenericSave(int file)
}
bool
+GenericLoad()
+{
+ uint8 *buf;
+ int32 file;
+ uint32 size;
+
+ int32 saveSize;
+ CPad *currPad;
+
+ // Load SimpleVars and Scripts
+ CheckSum = 0;
+ CDate(CompileDateAndTime);
+ CPad::ResetCheats();
+ if (!ReadInSizeofSaveFileBuffer(file, size))
+ return false;
+ size = align4bytes(size);
+ ReadDataFromFile(file, work_buff, size);
+ buf = (work_buff + 0x40);
+ ReadDataFromBufferPointer(buf, saveSize);
+ ReadDataFromBufferPointer(buf, CGame::currLevel);
+ ReadDataFromBufferPointer(buf, TheCamera.GetPosition().x);
+ ReadDataFromBufferPointer(buf, TheCamera.GetPosition().y);
+ ReadDataFromBufferPointer(buf, TheCamera.GetPosition().z);
+ ReadDataFromBufferPointer(buf, CClock::ms_nMillisecondsPerGameMinute);
+ ReadDataFromBufferPointer(buf, CClock::ms_nLastClockTick);
+ ReadDataFromBufferPointer(buf, CClock::ms_nGameClockHours);
+ ReadDataFromBufferPointer(buf, CClock::ms_nGameClockMinutes);
+ currPad = CPad::GetPad(0);
+ ReadDataFromBufferPointer(buf, currPad->Mode);
+ ReadDataFromBufferPointer(buf, CTimer::m_snTimeInMilliseconds);
+ ReadDataFromBufferPointer(buf, CTimer::ms_fTimeScale);
+ ReadDataFromBufferPointer(buf, CTimer::ms_fTimeStep);
+ ReadDataFromBufferPointer(buf, CTimer::ms_fTimeStepNonClipped);
+ ReadDataFromBufferPointer(buf, CTimer::m_FrameCounter);
+ ReadDataFromBufferPointer(buf, CTimeStep::ms_fTimeStep);
+ ReadDataFromBufferPointer(buf, CTimeStep::ms_fFramesPerUpdate);
+ ReadDataFromBufferPointer(buf, CTimeStep::ms_fTimeScale);
+ ReadDataFromBufferPointer(buf, CWeather::OldWeatherType);
+ ReadDataFromBufferPointer(buf, CWeather::NewWeatherType);
+ ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType);
+ ReadDataFromBufferPointer(buf, CWeather::InterpolationValue);
+ ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nSecond);
+ ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nMinute);
+ ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nHour);
+ ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nDay);
+ ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nMonth);
+ ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nYear);
+ ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList);
+ ReadDataFromBufferPointer(buf, TheCamera.CarZoomIndicator);
+ ReadDataFromBufferPointer(buf, TheCamera.PedZoomIndicator);
+ assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
+ ReadDataFromBlock("Loading Scripts \n", CTheScripts::LoadAllScripts);
+
+ // Load the rest
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading PedPool \n", CPools::LoadPedPool);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Garages \n", CGarages::Load);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Vehicles \n", CPools::LoadVehiclePool);
+ LoadSaveDataBlock();
+ CProjectileInfo::RemoveAllProjectiles();
+ CObject::DeleteAllTempObjects();
+ ReadDataFromBlock("Loading Objects \n", CPools::LoadObjectPool);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Paths \n", ThePaths.Load);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Cranes \n", CCranes::Load);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Pickups \n", CPickups::Load);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Phoneinfo \n", gPhoneInfo.Load);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Restart \n", CRestart::LoadAllRestartPoints);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Radar Blips \n", CRadar::LoadAllRadarBlips);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Zones \n", CTheZones::LoadAllZones);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Gang Data \n", CGangs::LoadAllGangData);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Car Generators \n", CTheCarGenerators::LoadAllCarGenerators);
+ CParticle::ReloadConfig();
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Particles \n", CParticleObject::LoadParticle);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading AudioScript Objects \n", cAudioScriptObject::LoadAllAudioScriptObjects);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Player Info \n", CWorld::Players[CWorld::PlayerInFocus].LoadPlayerInfo);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Stats \n", CStats::LoadStats);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading Streaming Stuff \n", CStreaming::MemoryCardLoad);
+ LoadSaveDataBlock();
+ ReadDataFromBlock("Loading PedType Stuff \n", CPedType::Load);
+
+ DMAudio.SetMusicMasterVolume(CMenuManager::m_PrefsMusicVolume);
+ DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume);
+ if (!CloseFile(file)) {
+ PcSaveHelper.nErrorCode = SAVESTATUS_ERR_LOAD_CLOSE;
+ return false;
+ }
+
+ DoGameSpecificStuffAfterSucessLoad();
+ debug("Game successfully loaded \n");
+ return true;
+}
+
+bool
ReadInSizeofSaveFileBuffer(int32 &file, uint32 &size)
{
file = CFileMgr::OpenFile(LoadFileName, "rb");
@@ -411,7 +537,7 @@ align4bytes(int32 size)
STARTPATCHES
InjectHook(0x58F8D0, GenericSave, PATCH_JUMP);
- //InjectHook(0x590A00, GenericLoad, PATCH_JUMP);
+ InjectHook(0x590A00, GenericLoad, PATCH_JUMP);
InjectHook(0x591910, ReadInSizeofSaveFileBuffer, PATCH_JUMP);
InjectHook(0x591990, ReadDataFromFile, PATCH_JUMP);
InjectHook(0x591A00, CloseFile, PATCH_JUMP);
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 1c0d673e..2a325b3d 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -356,7 +356,7 @@ CAutomobile::ProcessControl(void)
PruneReferences();
- if(m_status == STATUS_PLAYER && CRecordDataForChase::Status != RECORDSTATE_1)
+ if(m_status == STATUS_PLAYER && !CRecordDataForChase::IsRecording())
DoDriveByShootings();
}
break;
@@ -667,7 +667,7 @@ CAutomobile::ProcessControl(void)
if(!strongGrip1 && !CVehicle::bCheat3)
gripCheat = false;
float acceleration = pHandling->Transmission.CalculateDriveAcceleration(m_fGasPedal, m_nCurrentGear, m_fChangeGearTime, fwdSpeed, gripCheat);
- acceleration /= fForceMultiplier;
+ acceleration /= m_fForceMultiplier;
// unused
if(GetModelIndex() == MI_MIAMI_RCBARON ||
@@ -718,7 +718,7 @@ CAutomobile::ProcessControl(void)
else
traction = 0.004f;
traction *= pHandling->fTractionMultiplier / 4.0f;
- traction /= fForceMultiplier;
+ traction /= m_fForceMultiplier;
if(CVehicle::bCheat3)
traction *= 4.0f;
@@ -2814,7 +2814,7 @@ CAutomobile::ProcessBuoyancy(void)
CVector impulse, point;
if(mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)){
- m_flagD8 = true;
+ bTouchingWater = true;
ApplyMoveForce(impulse);
ApplyTurnForce(impulse, point);
@@ -2899,7 +2899,7 @@ CAutomobile::ProcessBuoyancy(void)
}
}else{
bIsInWater = false;
- m_flagD8 = false;
+ bTouchingWater = false;
static RwRGBA splashCol = {155, 155, 185, 196};
static RwRGBA smokeCol = {255, 255, 255, 255};
@@ -3791,7 +3791,7 @@ CAutomobile::BlowUpCar(CEntity *culprit)
}
ChangeLawEnforcerState(false);
- gFireManager.StartFire(this, culprit, 0.8f, 1); // TODO
+ gFireManager.StartFire(this, culprit, 0.8f, true);
CDarkel::RegisterCarBlownUpByPlayer(this);
if(GetModelIndex() == MI_RCBANDIT)
CExplosion::AddExplosion(this, culprit, EXPLOSION_CAR_QUICK, GetPosition(), 0);
@@ -4054,7 +4054,7 @@ CAutomobile::HasCarStoppedBecauseOfLight(void)
if(ThePaths.m_connections[curnode->firstLink + i] == AutoPilot.m_nNextRouteNode)
break;
if(i < curnode->numLinks &&
- ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3) // TODO
+ ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3)
return true;
}
@@ -4064,7 +4064,7 @@ CAutomobile::HasCarStoppedBecauseOfLight(void)
if(ThePaths.m_connections[curnode->firstLink + i] == AutoPilot.m_nPrevRouteNode)
break;
if(i < curnode->numLinks &&
- ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3) // TODO
+ ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3)
return true;
}
@@ -4206,8 +4206,7 @@ GetCurrentAtomicObjectCB(RwObject *object, void *data)
return object;
}
-CColPoint aTempPedColPts[32]; // this name doesn't make any sense
- // they probably copied it from Ped (both serves same purpose) and didn't change the name
+CColPoint spherepoints[MAX_COLLISION_POINTS];
CObject*
CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
@@ -4327,7 +4326,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
if(CCollision::ProcessColModels(obj->GetMatrix(), *obj->GetColModel(),
this->GetMatrix(), *this->GetColModel(),
- aTempPedColPts, nil, nil) > 0)
+ spherepoints, nil, nil) > 0)
obj->m_pCollidingEntity = this;
if(bRenderScorched)
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 9c7cbb4f..0159d168 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -1,12 +1,25 @@
#include "common.h"
#include "patcher.h"
-#include "Boat.h"
+#include "General.h"
+#include "Timecycle.h"
#include "HandlingMgr.h"
+#include "CarCtrl.h"
#include "RwHelper.h"
#include "ModelIndices.h"
+#include "VisibilityPlugins.h"
+#include "DMAudio.h"
+#include "Camera.h"
+#include "Darkel.h"
+#include "Explosion.h"
+#include "Particle.h"
#include "WaterLevel.h"
-#include "Pools.h"
+#include "Floater.h"
#include "World.h"
+#include "Pools.h"
+#include "Pad.h"
+#include "Boat.h"
+
+#define INVALID_ORIENTATION (-9999.99f)
float &fShapeLength = *(float*)0x600E78;
float &fShapeTime = *(float*)0x600E7C;
@@ -19,10 +32,6 @@ float WAKE_LIFETIME = 400.0f;
CBoat * (&CBoat::apFrameWakeGeneratingBoats)[4] = *(CBoat * (*)[4])*(uintptr*)0x8620E0;
-WRAPPER void CBoat::ProcessControl() { EAXJMP(0x53EF10); }
-WRAPPER void CBoat::ProcessControlInputs(uint8) { EAXJMP(0x53EC70); }
-WRAPPER void CBoat::BlowUpCar(CEntity* ent) { EAXJMP(0x541CB0); }
-
CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner)
{
CVehicleModelInfo *minfo = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi);
@@ -47,35 +56,31 @@ CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner)
m_fGasPedal = 0.0f;
m_fBrakePedal = 0.0f;
- field_288 = 0.25f;
- field_28C = 0.35f;
- field_290 = 0.7f;
- field_294 = 0.998f;
- field_298 = 0.999f;
- field_29C = 0.85f;
- field_2A0 = 0.96f;
- field_2A4 = 0.96f;
+ m_fPropellerZ = 0.25f;
+ m_fPropellerY = 0.35f;
+ m_waterMoveDrag = CVector(0.7f, 0.998f, 0.999f);
+ m_waterTurnDrag = CVector(0.85f, 0.96f, 0.96f);
_unk2 = false;
- m_fTurnForceZ = 7.0f;
- field_2FC = 7.0f;
- m_vecMoveForce = CVector(0.0f, 0.0f, 0.0f);
+ m_fVolumeUnderWater = 7.0f;
+ m_fPrevVolumeUnderWater = 7.0f;
+ m_vecBuoyancePoint = CVector(0.0f, 0.0f, 0.0f);
- field_300 = 0;
- m_bBoatFlag1 = true;
- m_bBoatFlag2 = true;
+ m_nDeltaVolumeUnderWater = 0;
+ bBoatInWater = true;
+ bPropellerInWater = true;
bIsInWater = true;
unk1 = 0.0f;
m_bIsAnchored = true;
- field_2C4 = -9999.99f;
- m_flagD8 = true;
- field_2CC = 0.0f;
- field_2D0 = 0;
+ m_fOrientation = INVALID_ORIENTATION;
+ bTouchingWater = true;
+ m_fDamage = 0.0f;
+ m_pSetOnFireEntity = nil;
m_nNumWakePoints = 0;
- for (int16 i = 0; i < 32; i++)
+ for (int16 i = 0; i < ARRAY_SIZE(m_afWakePointLifeTime); i++)
m_afWakePointLifeTime[i] = 0.0f;
m_nAmmoInClip = 20;
@@ -94,6 +99,541 @@ CBoat::GetComponentWorldPosition(int32 component, CVector &pos)
pos = *RwMatrixGetPos(RwFrameGetLTM(m_aBoatNodes[component]));
}
+void
+CBoat::ProcessControl(void)
+{
+ if(m_nZoneLevel > LEVEL_NONE && m_nZoneLevel != CCollision::ms_collisionInMemory)
+ return;
+
+ bool onLand = m_fDamageImpulse > 0.0f && m_vecDamageNormal.z > 0.1f;
+
+ PruneWakeTrail();
+
+ int r, g, b;
+ RwRGBA splashColor, jetColor;
+ r = 114.75f*(CTimeCycle::GetAmbientRed() + 0.5f*CTimeCycle::GetDirectionalRed());
+ g = 114.75f*(CTimeCycle::GetAmbientGreen() + 0.5f*CTimeCycle::GetDirectionalGreen());
+ b = 114.75f*(CTimeCycle::GetAmbientBlue() + 0.5f*CTimeCycle::GetDirectionalBlue());
+ r = clamp(r, 0, 255);
+ g = clamp(g, 0, 255);
+ b = clamp(b, 0, 255);
+ splashColor.red = r;
+ splashColor.green = g;
+ splashColor.blue = b;
+ splashColor.alpha = CGeneral::GetRandomNumberInRange(128, 150);
+
+ r = 242.25f*(CTimeCycle::GetAmbientRed() + 0.5f*CTimeCycle::GetDirectionalRed());
+ g = 242.25f*(CTimeCycle::GetAmbientGreen() + 0.5f*CTimeCycle::GetDirectionalGreen());
+ b = 242.25f*(CTimeCycle::GetAmbientBlue() + 0.5f*CTimeCycle::GetDirectionalBlue());
+ r = clamp(r, 0, 255);
+ g = clamp(g, 0, 255);
+ b = clamp(b, 0, 255);
+ jetColor.red = r;
+ jetColor.green = g;
+ jetColor.blue = b;
+ jetColor.alpha = CGeneral::GetRandomNumberInRange(96, 128);
+
+ CGeneral::GetRandomNumber(); // unused
+
+ ProcessCarAlarm();
+
+ switch(m_status){
+ case STATUS_PLAYER:
+ m_bIsAnchored = false;
+ m_fOrientation = INVALID_ORIENTATION;
+ ProcessControlInputs(0);
+ if(GetModelIndex() == MI_PREDATOR)
+ DoFixedMachineGuns();
+ break;
+ case STATUS_SIMPLE:
+ m_bIsAnchored = false;
+ m_fOrientation = INVALID_ORIENTATION;
+ CPhysical::ProcessControl();
+ bBoatInWater = true;
+ bPropellerInWater = true;
+ bIsInWater = true;
+ return;
+ case STATUS_PHYSICS:
+ m_bIsAnchored = false;
+ m_fOrientation = INVALID_ORIENTATION;
+ CCarCtrl::SteerAIBoatWithPhysics(this);
+ break;
+ case STATUS_ABANDONED:
+ case STATUS_WRECKED:
+ bBoatInWater = true;
+ bPropellerInWater = true;
+ bIsInWater = true;
+ m_fSteerAngle = 0.0;
+ bIsHandbrakeOn = false;
+ m_fBrakePedal = 0.5f;
+ m_fGasPedal = 0.0f;
+ if((GetPosition() - CWorld::Players[CWorld::PlayerInFocus].GetPos()).Magnitude() > 150.0f){
+ m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
+ m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
+ return;
+ }
+ break;
+ }
+
+ float collisionDamage = pHandling->fCollisionDamageMultiplier * m_fDamageImpulse;
+ if(collisionDamage > 25.0f && m_status != STATUS_WRECKED && m_fHealth >= 150.0f){
+ float prevHealth = m_fHealth;
+ if(this == FindPlayerVehicle()){
+ if(bTakeLessDamage)
+ m_fHealth -= (collisionDamage-25.0f)/6.0f;
+ else
+ m_fHealth -= (collisionDamage-25.0f)/2.0f;
+ }else{
+ if(collisionDamage > 60.0f && pDriver)
+ pDriver->Say(SOUND_PED_CAR_COLLISION);
+ if(bTakeLessDamage)
+ m_fHealth -= (collisionDamage-25.0f)/12.0f;
+ else
+ m_fHealth -= (collisionDamage-25.0f)/4.0f;
+ }
+
+ if(m_fHealth <= 0.0f && prevHealth > 0.0f){
+ m_fHealth = 1.0f;
+ m_pSetOnFireEntity = m_pDamageEntity;
+ }
+ }
+
+ // Damage particles
+ if(m_fHealth <= 600.0f && m_status != STATUS_WRECKED &&
+ Abs(GetPosition().x - TheCamera.GetPosition().x) < 200.0f &&
+ Abs(GetPosition().y - TheCamera.GetPosition().y) < 200.0f){
+ float speedSq = m_vecMoveSpeed.MagnitudeSqr();
+ CVector smokeDir = 0.8f*m_vecMoveSpeed;
+ CVector smokePos;
+ switch(GetModelIndex()){
+ case MI_SPEEDER:
+ smokePos = CVector(0.4f, -2.4f, 0.8f);
+ smokeDir += 0.05f*GetRight();
+ smokeDir.z += 0.2f*m_vecMoveSpeed.z;
+ break;
+ case MI_REEFER:
+ smokePos = CVector(2.0f, -1.0f, 0.5f);
+ smokeDir += 0.07f*GetRight();
+ break;
+ case MI_PREDATOR:
+ default:
+ smokePos = CVector(-1.5f, -0.5f, 1.2f);
+ smokeDir += -0.08f*GetRight();
+ break;
+ }
+
+ smokePos = GetMatrix() * smokePos;
+
+ // On fire
+ if(m_fHealth < 150.0f){
+ CParticle::AddParticle(PARTICLE_CARFLAME, smokePos,
+ CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(2.25f/200.0f, 0.09f)),
+ nil, 0.9f);
+ CVector smokePos2 = smokePos;
+ smokePos2.x += CGeneral::GetRandomNumberInRange(-2.25f/4.0f, 2.25f/4.0f);
+ smokePos2.y += CGeneral::GetRandomNumberInRange(-2.25f/4.0f, 2.25f/4.0f);
+ smokePos2.z += CGeneral::GetRandomNumberInRange(2.25f/4.0f, 2.25f);
+ CParticle::AddParticle(PARTICLE_ENGINE_SMOKE2, smokePos2, CVector(0.0f, 0.0f, 0.0f));
+
+ m_fDamage += CTimer::GetTimeStepInMilliseconds();
+ if(m_fDamage > 5000.0f)
+ BlowUpCar(m_pSetOnFireEntity);
+ }
+
+ if(speedSq < 0.25f && (CTimer::GetFrameCounter() + m_randomSeed) & 1)
+ CParticle::AddParticle(PARTICLE_ENGINE_STEAM, smokePos, smokeDir);
+ if(speedSq < 0.25f && m_fHealth <= 350.0f)
+ CParticle::AddParticle(PARTICLE_ENGINE_SMOKE, smokePos, 1.25f*smokeDir);
+ }
+
+ CPhysical::ProcessControl();
+
+ CVector buoyanceImpulse(0.0f, 0.0f, 0.0f);
+ CVector buoyancePoint(0.0f, 0.0f, 0.0f);
+ if(mod_Buoyancy.ProcessBuoyancy(this, pHandling->fBuoyancy, &buoyancePoint, &buoyanceImpulse)){
+ // Process boat in water
+ if(0.1f * m_fMass * GRAVITY*CTimer::GetTimeStep() < buoyanceImpulse.z){
+ bBoatInWater = true;
+ bIsInWater = true;
+ }else{
+ bBoatInWater = false;
+ bIsInWater = false;
+ }
+
+ m_fVolumeUnderWater = mod_Buoyancy.m_volumeUnderWater;
+ m_vecBuoyancePoint = buoyancePoint;
+ ApplyMoveForce(buoyanceImpulse);
+ if(!onLand)
+ ApplyTurnForce(buoyanceImpulse, buoyancePoint);
+
+ if(!onLand && bBoatInWater && GetUp().z > 0.0f){
+ float impulse;
+ if(m_fGasPedal > 0.05f)
+ impulse = m_vecMoveSpeed.MagnitudeSqr()*pHandling->fSuspensionForceLevel*buoyanceImpulse.z*CTimer::GetTimeStep()*0.5f*m_fGasPedal;
+ else
+ impulse = 0.0f;
+ impulse = min(impulse, GRAVITY*pHandling->fSuspensionDampingLevel*m_fMass*CTimer::GetTimeStep());
+ ApplyMoveForce(impulse*GetUp());
+ ApplyTurnForce(impulse*GetUp(), buoyancePoint - pHandling->fSuspensionBias*GetForward());
+ }
+
+ // Handle boat moving forward
+ if(Abs(m_fGasPedal) > 0.05f || m_vecMoveSpeed.Magnitude() > 0.01f){
+ if(bBoatInWater)
+ AddWakePoint(GetPosition());
+
+ float steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward());
+ if(m_modelIndex == MI_GHOST)
+ steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f;
+ if(steerFactor < 0.0f) steerFactor = 0.0f;
+
+ CVector propeller(0.0f, -pHandling->Dimension.y*m_fPropellerY, -pHandling->Dimension.z*m_fPropellerZ);
+ propeller = Multiply3x3(GetMatrix(), propeller);
+ CVector propellerWorld = GetPosition() + propeller;
+
+ float steerSin = Sin(-m_fSteerAngle * steerFactor);
+ float steerCos = Cos(-m_fSteerAngle * steerFactor);
+ float waterLevel;
+ CWaterLevel::GetWaterLevel(propellerWorld, &waterLevel, true);
+ if(propellerWorld.z-0.5f < waterLevel){
+ float propellerDepth = waterLevel - (propellerWorld.z - 0.5f);
+ if(propellerDepth > 1.0f)
+ propellerDepth = 1.0f;
+ else
+ propellerDepth = SQR(propellerDepth);
+ bPropellerInWater = true;
+
+ if(Abs(m_fGasPedal) > 0.05f){
+ CVector forceDir = Multiply3x3(GetMatrix(), CVector(-steerSin, steerCos, -Abs(m_fSteerAngle)));
+ CVector force = propellerDepth * m_fGasPedal * 40.0f * pHandling->Transmission.fEngineAcceleration * pHandling->fMass * forceDir;
+ if(force.z > 0.2f)
+ force.z = SQR(1.2f - force.z) + 0.2f;
+ if(onLand){
+ if(m_fGasPedal < 0.0f){
+ force.x *= 5.0f;
+ force.y *= 5.0f;
+ }
+ if(force.z < 0.0f)
+ force.z = 0.0f;
+ ApplyMoveForce(force * CTimer::GetTimeStep());
+ }else{
+ ApplyMoveForce(force * CTimer::GetTimeStep());
+ ApplyTurnForce(force * CTimer::GetTimeStep(), propeller - pHandling->fTractionBias*GetUp());
+ float rightForce = DotProduct(GetRight(), force);
+ ApplyTurnForce(-rightForce*GetRight() * CTimer::GetTimeStep(), GetUp());
+ }
+
+ // Spray some particles
+ CVector jetDir = -0.04f * force;
+ if(m_fGasPedal > 0.0f){
+ if(m_status == STATUS_PLAYER){
+ bool cameraHack = TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
+ TheCamera.WhoIsInControlOfTheCamera == CAMCONTROL_OBBE;
+ CVector sternPos = GetColModel()->boundingBox.min;
+ sternPos.x = 0.0f;
+ sternPos.z = 0.0f;
+ sternPos = Multiply3x3(GetMatrix(), sternPos);
+
+ CVector jetPos = GetPosition() + sternPos;
+ if(cameraHack)
+ jetPos.z = 1.0f;
+ else
+ jetPos.z = 0.0f;
+
+ CVector wakePos = GetPosition() + sternPos;
+ wakePos.z -= 0.65f;
+
+ CVector wakeDir = 0.75f * jetDir;
+
+ CParticle::AddParticle(PARTICLE_BOAT_THRUSTJET, jetPos, jetDir, nil, 0.0f, jetColor);
+ CParticle::AddParticle(PARTICLE_CAR_SPLASH, jetPos, 0.25f * jetDir, nil, 1.0f, splashColor,
+ CGeneral::GetRandomNumberInRange(0, 30),
+ CGeneral::GetRandomNumberInRange(0, 90), 3);
+ if(!cameraHack)
+ CParticle::AddParticle(PARTICLE_BOAT_WAKE, wakePos, wakeDir, nil, 0.0f, jetColor);
+ }else if((CTimer::GetFrameCounter() + m_randomSeed) & 1){
+ jetDir.z = 0.018f;
+ jetDir.x *= 0.01f;
+ jetDir.y *= 0.01f;
+ propellerWorld.z += 1.5f;
+
+ CParticle::AddParticle(PARTICLE_BOAT_SPLASH, propellerWorld, jetDir, nil, 1.5f, jetColor);
+ CParticle::AddParticle(PARTICLE_CAR_SPLASH, propellerWorld, 0.1f * jetDir, nil, 0.5f, splashColor,
+ CGeneral::GetRandomNumberInRange(0, 30),
+ CGeneral::GetRandomNumberInRange(0, 90), 3);
+ }
+ }
+ }else if(!onLand){
+ float force = 50.0f*DotProduct(m_vecMoveSpeed, GetForward());
+ if(force > 10.0f) force = 10.0f;
+ CVector propellerForce = propellerDepth * Multiply3x3(GetMatrix(), force*CVector(-steerSin, 0.0f, 0.0f));
+ ApplyMoveForce(propellerForce * CTimer::GetTimeStep()*0.5f);
+ ApplyTurnForce(propellerForce * CTimer::GetTimeStep()*0.5f, propeller);
+ }
+ }else
+ bPropellerInWater = false;
+ }
+
+ // Slow down or push down boat as it approaches the world limits
+ m_vecMoveSpeed.x = min(m_vecMoveSpeed.x, -(GetPosition().x - 1900.0f)*0.01f); // east
+ m_vecMoveSpeed.x = max(m_vecMoveSpeed.x, -(GetPosition().x - -1515.0f)*0.01f); // west
+ m_vecMoveSpeed.y = min(m_vecMoveSpeed.y, -(GetPosition().y - 600.0f)*0.01f); // north
+ m_vecMoveSpeed.y = max(m_vecMoveSpeed.y, -(GetPosition().y - -1900.0f)*0.01f); // south
+
+ if(!onLand && bBoatInWater)
+ ApplyWaterResistance();
+
+ // No idea what exactly is going on here besides drag in YZ
+ float fx = Pow(m_waterTurnDrag.x, CTimer::GetTimeStep());
+ float fy = Pow(m_waterTurnDrag.y, CTimer::GetTimeStep());
+ float fz = Pow(m_waterTurnDrag.z, CTimer::GetTimeStep());
+ m_vecTurnSpeed = Multiply3x3(m_vecTurnSpeed, GetMatrix()); // invert - to local space
+ // TODO: figure this out
+ float magic = 1.0f/(1000.0f * SQR(m_vecTurnSpeed.x) + 1.0f) * fx;
+ m_vecTurnSpeed.y *= fy;
+ m_vecTurnSpeed.z *= fz;
+ float forceUp = (magic - 1.0f) * m_vecTurnSpeed.x * m_fTurnMass;
+ m_vecTurnSpeed = Multiply3x3(GetMatrix(), m_vecTurnSpeed); // back to world
+ CVector com = Multiply3x3(GetMatrix(), m_vecCentreOfMass);
+ ApplyTurnForce(CVector(0.0f, 0.0f, forceUp), com + GetForward());
+
+ m_nDeltaVolumeUnderWater = (m_fVolumeUnderWater-m_fPrevVolumeUnderWater)*10000;
+
+ // Falling into water
+ if(!onLand && bBoatInWater && GetUp().z > 0.0f && m_nDeltaVolumeUnderWater > 200){
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_SPLASH, m_nDeltaVolumeUnderWater);
+
+ float speedUp = m_vecMoveSpeed.MagnitudeSqr() * m_nDeltaVolumeUnderWater * 0.0004f;
+ if(speedUp + m_vecMoveSpeed.z > pHandling->fBrakeDeceleration)
+ speedUp = pHandling->fBrakeDeceleration - m_vecMoveSpeed.z;
+ if(speedUp < 0.0f) speedUp = 0.0f;
+ float speedFwd = DotProduct(m_vecMoveSpeed, GetForward());
+ speedFwd *= -m_nDeltaVolumeUnderWater * 0.01f * pHandling->fTractionLoss;
+ CVector speed = speedFwd*GetForward() + CVector(0.0f, 0.0f, speedUp);
+ CVector splashImpulse = speed * m_fMass;
+ ApplyMoveForce(splashImpulse);
+ ApplyTurnForce(splashImpulse, buoyancePoint);
+ }
+
+ // Spray particles on sides of boat
+ if(m_nDeltaVolumeUnderWater > 75){
+ float speed = m_vecMoveSpeed.Magnitude();
+ float splash1Size = speed;
+ float splash2Size = m_nDeltaVolumeUnderWater * 0.005f * 0.2f;
+ float front = 0.9f * GetColModel()->boundingBox.max.y;
+ if(splash1Size > 0.75f) splash1Size = 0.75f;
+
+ CVector dir, pos;
+
+ // right
+ dir = -0.5f*m_vecMoveSpeed;
+ dir.z += 0.1f*speed;
+ dir += 0.5f*GetRight()*speed;
+ pos = front*GetForward() + 0.5f*GetRight() + GetPosition() + m_vecBuoyancePoint;
+ CWaterLevel::GetWaterLevel(pos, &pos.z, true);
+ CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, 0.75f * dir, nil, splash1Size, splashColor,
+ CGeneral::GetRandomNumberInRange(0, 30),
+ CGeneral::GetRandomNumberInRange(0, 90), 1);
+ CParticle::AddParticle(PARTICLE_BOAT_SPLASH, pos, dir, nil, splash2Size, jetColor);
+
+ // left
+ dir = -0.5f*m_vecMoveSpeed;
+ dir.z += 0.1f*speed;
+ dir -= 0.5f*GetRight()*speed;
+ pos = front*GetForward() - 0.5f*GetRight() + GetPosition() + m_vecBuoyancePoint;
+ CWaterLevel::GetWaterLevel(pos, &pos.z, true);
+ CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, 0.75f * dir, nil, splash1Size, splashColor,
+ CGeneral::GetRandomNumberInRange(0, 30),
+ CGeneral::GetRandomNumberInRange(0, 90), 1);
+ CParticle::AddParticle(PARTICLE_BOAT_SPLASH, pos, dir, nil, splash2Size, jetColor);
+ }
+
+ m_fPrevVolumeUnderWater = m_fVolumeUnderWater;
+ }else{
+ bBoatInWater = false;
+ bIsInWater = false;
+ }
+
+ if(m_bIsAnchored){
+ m_vecMoveSpeed.x = 0.0f;
+ m_vecMoveSpeed.y = 0.0f;
+
+ if(m_fOrientation == INVALID_ORIENTATION){
+ m_fOrientation = GetForward().Heading();
+ }else{
+ // is this some inlined CPlaceable method?
+ CVector pos = GetPosition();
+ GetMatrix().RotateZ(m_fOrientation - GetForward().Heading());
+ GetPosition() = pos;
+ }
+ }
+
+ ProcessDelayedExplosion();
+}
+
+void
+CBoat::ProcessControlInputs(uint8 pad)
+{
+ m_nPadID = pad;
+ if(m_nPadID > 3)
+ m_nPadID = 3;
+
+ m_fBrake += (CPad::GetPad(pad)->GetBrake()/255.0f - m_fBrake)*0.1f;
+ m_fBrake = clamp(m_fBrake, 0.0f, 1.0f);
+
+ if(m_fBrake < 0.05f){
+ m_fBrake = 0.0f;
+ m_fAccelerate += (CPad::GetPad(pad)->GetAccelerate()/255.0f - m_fAccelerate)*0.1f;
+ m_fAccelerate = clamp(m_fAccelerate, 0.0f, 1.0f);
+ }else
+ m_fAccelerate = -m_fBrake*0.2f;
+
+ m_fSteeringLeftRight += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteeringLeftRight)*0.2f;
+ m_fSteeringLeftRight = clamp(m_fSteeringLeftRight, -1.0f, 1.0f);
+
+ float steeringSq = m_fSteeringLeftRight < 0.0f ? -SQR(m_fSteeringLeftRight) : SQR(m_fSteeringLeftRight);
+ m_fSteerAngle = pHandling->fSteeringLock * DEGTORAD(steeringSq);
+ m_fGasPedal = m_fAccelerate;
+}
+
+void
+CBoat::ApplyWaterResistance(void)
+{
+ float fwdSpeed = DotProduct(GetMoveSpeed(), GetForward());
+ // TODO: figure out how this works
+ float magic = (SQR(fwdSpeed) + 0.05f) * (0.001f * SQR(m_fVolumeUnderWater) * m_fMass) + 1.0f;
+ magic = Abs(magic);
+ // FRAMETIME
+ float fx = Pow(m_waterMoveDrag.x/magic, 0.5f*CTimer::GetTimeStep());
+ float fy = Pow(m_waterMoveDrag.y/magic, 0.5f*CTimer::GetTimeStep());
+ float fz = Pow(m_waterMoveDrag.z/magic, 0.5f*CTimer::GetTimeStep());
+
+ m_vecMoveSpeed = Multiply3x3(m_vecMoveSpeed, GetMatrix()); // invert - to local space
+ m_vecMoveSpeed.x *= fx;
+ m_vecMoveSpeed.y *= fy;
+ m_vecMoveSpeed.z *= fz;
+ float force = (fy - 1.0f) * m_vecMoveSpeed.y * m_fMass;
+ m_vecMoveSpeed = Multiply3x3(GetMatrix(), m_vecMoveSpeed); // back to world
+
+ ApplyTurnForce(force*GetForward(), -GetUp());
+
+ if(m_vecMoveSpeed.z > 0.0f)
+ m_vecMoveSpeed.z *= fz;
+ else
+ m_vecMoveSpeed.z *= (1.0f - fz)*0.5f + fz;
+}
+
+RwObject*
+GetBoatAtomicObjectCB(RwObject *object, void *data)
+{
+ RpAtomic *atomic = (RpAtomic*)object;
+ assert(RwObjectGetType(object) == rpATOMIC);
+ if(RpAtomicGetFlags(atomic) & rpATOMICRENDER)
+ *(RpAtomic**)data = atomic;
+ return object;
+
+
+}
+
+void
+CBoat::BlowUpCar(CEntity *culprit)
+{
+ RpAtomic *atomic;
+ RwFrame *frame;
+ RwMatrix *matrix;
+ CObject *obj;
+
+ if(!bCanBeDamaged)
+ return;
+
+ // explosion pushes vehicle up
+ m_vecMoveSpeed.z += 0.13f;
+ m_status = STATUS_WRECKED;
+ bRenderScorched = true;
+
+ m_fHealth = 0.0;
+ m_nBombTimer = 0;
+ TheCamera.CamShake(0.7f, GetPosition().x, GetPosition().y, GetPosition().z);
+
+ if(this == FindPlayerVehicle())
+ FindPlayerPed()->m_fHealth = 0.0f; // kill player
+ if(pDriver){
+ CDarkel::RegisterKillByPlayer(pDriver, WEAPONTYPE_EXPLOSION);
+ pDriver->SetDead();
+ pDriver->FlagToDestroyWhenNextProcessed();
+ }
+
+ bEngineOn = false;
+ bLightsOn = false;
+ ChangeLawEnforcerState(false);
+
+ CExplosion::AddExplosion(this, culprit, EXPLOSION_CAR, GetPosition(), 0);
+ if(m_aBoatNodes[BOAT_MOVING] == nil)
+ return;
+
+ // much like CAutomobile::SpawnFlyingComponent from here on
+
+ atomic = nil;
+ RwFrameForAllObjects(m_aBoatNodes[BOAT_MOVING], GetBoatAtomicObjectCB, &atomic);
+ if(atomic == nil)
+ return;
+
+ obj = new CObject();
+ if(obj == nil)
+ return;
+
+ obj->SetModelIndexNoCreate(MI_CAR_WHEEL);
+
+ // object needs base model
+ obj->RefModelInfo(GetModelIndex());
+
+ // create new atomic
+ matrix = RwFrameGetLTM(m_aBoatNodes[BOAT_MOVING]);
+ frame = RwFrameCreate();
+ atomic = RpAtomicClone(atomic);
+ *RwFrameGetMatrix(frame) = *matrix;
+ RpAtomicSetFrame(atomic, frame);
+ CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
+ obj->AttachToRwObject((RwObject*)atomic);
+
+ // init object
+ obj->m_fMass = 10.0f;
+ obj->m_fTurnMass = 25.0f;
+ obj->m_fAirResistance = 0.99f;
+ obj->m_fElasticity = 0.1f;
+ obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
+ obj->ObjectCreatedBy = TEMP_OBJECT;
+ obj->bIsStatic = false;
+ obj->bIsPickup = false;
+
+ // life time
+ CObject::nNoTempObjects++;
+ obj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 20000;
+
+ obj->m_vecMoveSpeed = m_vecMoveSpeed;
+ if(GetUp().z > 0.0f)
+ obj->m_vecMoveSpeed.z = 0.3f;
+ else
+ obj->m_vecMoveSpeed.z = 0.0f;
+
+ obj->m_vecTurnSpeed = m_vecTurnSpeed*2.0f;
+ obj->m_vecTurnSpeed.x = 0.5f;
+
+ // push component away from boat
+ CVector dist = obj->GetPosition() - GetPosition();
+ dist.Normalise();
+ if(GetUp().z > 0.0f)
+ dist += GetUp();
+ obj->GetPosition() += GetUp();
+
+ CWorld::Add(obj);
+
+ atomic = nil;
+ RwFrameForAllObjects(m_aBoatNodes[BOAT_MOVING], GetBoatAtomicObjectCB, &atomic);
+ if(atomic)
+ RpAtomicSetFlags(atomic, 0);
+}
+
RwIm3DVertex KeepWaterOutVertices[4];
RwImVertexIndex KeepWaterOutIndices[6];
@@ -102,8 +642,8 @@ CBoat::Render()
{
CMatrix matrix;
- if (m_aBoatNodes[1] != nil) {
- matrix.Attach(RwFrameGetMatrix(m_aBoatNodes[1]));
+ if (m_aBoatNodes[BOAT_MOVING] != nil) {
+ matrix.Attach(RwFrameGetMatrix(m_aBoatNodes[BOAT_MOVING]));
CVector pos = matrix.GetPosition();
matrix.SetRotateZ(m_fMovingHiRotation);
@@ -111,7 +651,7 @@ CBoat::Render()
matrix.UpdateRW();
if (CVehicle::bWheelsOnlyCheat) {
- RpAtomicRender((RpAtomic*)GetFirstObject(m_aBoatNodes[1]));
+ RpAtomicRender((RpAtomic*)GetFirstObject(m_aBoatNodes[BOAT_MOVING]));
}
}
m_fMovingHiRotation += 0.05f;
@@ -234,10 +774,9 @@ CBoat::IsVertexAffectedByWake(CVector vecVertex, CBoat *pBoat)
void
CBoat::SetupModelNodes()
{
- m_aBoatNodes[0] = nil;
- m_aBoatNodes[1] = nil;
- m_aBoatNodes[2] = nil;
- m_aBoatNodes[3] = nil;
+ int i;
+ for(i = 0; i < ARRAY_SIZE(m_aBoatNodes); i++)
+ m_aBoatNodes[i] = nil;
CClumpModelInfo::FillFrameArray(GetClump(), m_aBoatNodes);
}
@@ -275,6 +814,43 @@ CBoat::FillBoatList()
}
}
+void
+CBoat::PruneWakeTrail(void)
+{
+ int i;
+
+ for(i = 0; i < ARRAY_SIZE(m_afWakePointLifeTime); i++){
+ if(m_afWakePointLifeTime[i] <= 0.0f)
+ break;
+ if(m_afWakePointLifeTime[i] <= CTimer::GetTimeStep()){
+ m_afWakePointLifeTime[i] = 0.0f;
+ break;
+ }
+ m_afWakePointLifeTime[i] -= CTimer::GetTimeStep();
+ }
+ m_nNumWakePoints = i;
+}
+
+void
+CBoat::AddWakePoint(CVector point)
+{
+ int i;
+ if(m_afWakePointLifeTime[0] > 0.0f){
+ if((CVector2D(GetPosition()) - m_avec2dWakePoints[0]).MagnitudeSqr() < SQR(1.0f)){
+ for(i = min(m_nNumWakePoints, ARRAY_SIZE(m_afWakePointLifeTime)-1); i != 0; i--){
+ m_avec2dWakePoints[i] = m_avec2dWakePoints[i-1];
+ m_afWakePointLifeTime[i] = m_afWakePointLifeTime[i-1];
+ }
+ m_avec2dWakePoints[0] = point;
+ m_afWakePointLifeTime[0] = 400.0f;
+ }
+ }else{
+ m_avec2dWakePoints[0] = point;
+ m_afWakePointLifeTime[0] = 400.0f;
+ m_nNumWakePoints = 1;
+ }
+}
+
#include <new>
class CBoat_ : public CBoat
@@ -291,4 +867,7 @@ STARTPATCHES
InjectHook(0x542370, CBoat::IsSectorAffectedByWake, PATCH_JUMP);
InjectHook(0x5424A0, CBoat::IsVertexAffectedByWake, PATCH_JUMP);
InjectHook(0x542250, CBoat::FillBoatList, PATCH_JUMP);
+ InjectHook(0x542140, &CBoat::AddWakePoint, PATCH_JUMP);
+ InjectHook(0x5420D0, &CBoat::PruneWakeTrail, PATCH_JUMP);
+ InjectHook(0x541A30, &CBoat::ApplyWaterResistance, PATCH_JUMP);
ENDPATCHES
diff --git a/src/vehicles/Boat.h b/src/vehicles/Boat.h
index d3a2ac13..f4c6a747 100644
--- a/src/vehicles/Boat.h
+++ b/src/vehicles/Boat.h
@@ -2,47 +2,41 @@
#include "Vehicle.h"
+enum eBoatNodes
+{
+ BOAT_MOVING = 1,
+ BOAT_RUDDER,
+ BOAT_WINDSCREEN
+};
+
class CBoat : public CVehicle
{
public:
// 0x288
- float field_288;
- float field_28C;
- float field_290;
- float field_294;
- float field_298;
- float field_29C;
- float field_2A0;
- float field_2A4;
+ float m_fPropellerZ;
+ float m_fPropellerY;
+ CVector m_waterMoveDrag;
+ CVector m_waterTurnDrag;
float m_fMovingHiRotation;
int32 _unk0;
RwFrame *m_aBoatNodes[4];
- uint8 m_bBoatFlag1 : 1;
- uint8 m_bBoatFlag2 : 1;
- uint8 m_bBoatFlag3 : 1;
- uint8 m_bBoatFlag4 : 1;
- uint8 m_bBoatFlag5 : 1;
- uint8 m_bBoatFlag6 : 1;
- uint8 m_bBoatFlag7 : 1;
- uint8 m_bBoatFlag8 : 1;
+ uint8 bBoatInWater : 1;
+ uint8 bPropellerInWater : 1;
bool m_bIsAnchored;
- char _pad0[2];
- float field_2C4;
+ float m_fOrientation;
int32 _unk1;
- float field_2CC;
- CEntity *field_2D0;
+ float m_fDamage;
+ CEntity *m_pSetOnFireEntity;
bool _unk2;
- char _pad1[3];
float m_fAccelerate;
float m_fBrake;
float m_fSteeringLeftRight;
uint8 m_nPadID;
- char _pad2[3];
int32 _unk3;
- float m_fTurnForceZ;
- CVector m_vecMoveForce;
- float field_2FC;
- uint16 field_300;
+ float m_fVolumeUnderWater;
+ CVector m_vecBuoyancePoint;
+ float m_fPrevVolumeUnderWater;
+ int16 m_nDeltaVolumeUnderWater;
uint16 m_nNumWakePoints;
CVector2D m_avec2dWakePoints[32];
float m_afWakePointLifeTime[32];
@@ -59,7 +53,10 @@ public:
virtual bool IsComponentPresent(int32 component) { return true; }
virtual void BlowUpCar(CEntity *ent);
+ void ApplyWaterResistance(void);
void SetupModelNodes();
+ void PruneWakeTrail(void);
+ void AddWakePoint(CVector point);
static CBoat *(&apFrameWakeGeneratingBoats)[4];
diff --git a/src/control/CarGen.cpp b/src/vehicles/CarGen.cpp
index 49a96f50..c35005a1 100644
--- a/src/control/CarGen.cpp
+++ b/src/vehicles/CarGen.cpp
@@ -14,11 +14,11 @@
#include "Vehicle.h"
#include "World.h"
-uint8 &CTheCarGenerators::ProcessCounter = *(uint8*)0x95CDAF;
-uint32 &CTheCarGenerators::NumOfCarGenerators = *(uint32*)0x8E2C1C;
-CCarGenerator (&CTheCarGenerators::CarGeneratorArray)[NUM_CARGENS] = *(CCarGenerator(*)[NUM_CARGENS])*(uintptr*)0x87CB18;
-uint8 &CTheCarGenerators::GenerateEvenIfPlayerIsCloseCounter = *(uint8*)0x95CDC6;
-uint32 &CTheCarGenerators::CurrentActiveCount = *(uint32*)0x8F2C5C;
+uint8 CTheCarGenerators::ProcessCounter;
+uint32 CTheCarGenerators::NumOfCarGenerators;
+CCarGenerator CTheCarGenerators::CarGeneratorArray[NUM_CARGENS];
+uint8 CTheCarGenerators::GenerateEvenIfPlayerIsCloseCounter;
+uint32 CTheCarGenerators::CurrentActiveCount;
void CCarGenerator::SwitchOff()
{
@@ -187,62 +187,9 @@ bool CCarGenerator::CheckIfWithinRangeOfAnyPlayer()
return DotProduct2D(direction, FindPlayerSpeed()) <= 0;
}
-void CCarGenerator::Save(uint8 *&buffer)
-{
- WriteSaveBuf(buffer, m_nModelIndex);
- WriteSaveBuf(buffer, m_vecPos);
- WriteSaveBuf(buffer, m_fAngle);
- WriteSaveBuf(buffer, m_nColor1);
- WriteSaveBuf(buffer, m_nColor2);
- WriteSaveBuf(buffer, m_bForceSpawn);
- WriteSaveBuf(buffer, m_nAlarm);
- WriteSaveBuf(buffer, m_nDoorlock);
- WriteSaveBuf(buffer, (uint8)0);
- WriteSaveBuf(buffer, m_nMinDelay);
- WriteSaveBuf(buffer, m_nMaxDelay);
- WriteSaveBuf(buffer, m_nTimer);
- WriteSaveBuf(buffer, m_nVehicleHandle);
- WriteSaveBuf(buffer, m_nUsesRemaining);
- WriteSaveBuf(buffer, m_bIsBlocking);
- WriteSaveBuf(buffer, (uint8)0);
- WriteSaveBuf(buffer, m_vecInf);
- WriteSaveBuf(buffer, m_vecSup);
- WriteSaveBuf(buffer, m_fSize);
-
- // or
- //WriteSaveBuf(buffer, *this);
-
-}
-
-void CCarGenerator::Load(uint8 *&buffer)
-{
- m_nModelIndex = ReadSaveBuf<uint32>(buffer);
- m_vecPos = ReadSaveBuf<CVector>(buffer);
- m_fAngle = ReadSaveBuf<float>(buffer);
- m_nColor1 = ReadSaveBuf<int16>(buffer);
- m_nColor2 = ReadSaveBuf<int16>(buffer);
- m_bForceSpawn = ReadSaveBuf<uint8>(buffer);
- m_nAlarm = ReadSaveBuf<uint8>(buffer);
- m_nDoorlock = ReadSaveBuf<uint8>(buffer);
- ReadSaveBuf<uint8>(buffer);
- m_nMinDelay = ReadSaveBuf<uint16>(buffer);
- m_nMaxDelay = ReadSaveBuf<uint16>(buffer);
- m_nTimer = ReadSaveBuf<uint32>(buffer);
- m_nVehicleHandle = ReadSaveBuf<int32>(buffer);
- m_nUsesRemaining = ReadSaveBuf<uint16>(buffer);
- m_bIsBlocking = ReadSaveBuf<bool>(buffer);
- ReadSaveBuf<uint8>(buffer);
- m_vecInf = ReadSaveBuf<CVector>(buffer);
- m_vecSup = ReadSaveBuf<CVector>(buffer);
- m_fSize = ReadSaveBuf<float>(buffer);
-
- // or
- //*this = ReadSaveBuf<CCarGenerator>(buffer);
-}
-
void CTheCarGenerators::Process()
{
- if (FindPlayerTrain() || CCutsceneMgr::IsRunning())
+ if (FindPlayerTrain() || CCutsceneMgr::IsCutsceneProcessing())
return;
if (++CTheCarGenerators::ProcessCounter == 4)
CTheCarGenerators::ProcessCounter = 0;
@@ -268,39 +215,38 @@ void CTheCarGenerators::Init()
void CTheCarGenerators::SaveAllCarGenerators(uint8 *buffer, uint32 *size)
{
- *size = 20 + sizeof(CarGeneratorArray) + SAVE_HEADER_SIZE;
+ const uint32 nGeneralDataSize = sizeof(NumOfCarGenerators) + sizeof(CurrentActiveCount) + sizeof(ProcessCounter) + sizeof(GenerateEvenIfPlayerIsCloseCounter) + sizeof(int16);
+ *size = sizeof(int) + nGeneralDataSize + sizeof(uint32) + sizeof(CarGeneratorArray) + SAVE_HEADER_SIZE;
INITSAVEBUF
WriteSaveHeader(buffer, 'C','G','N','\0', *size - SAVE_HEADER_SIZE);
- WriteSaveBuf(buffer, 12); /* what is this? */
+ WriteSaveBuf(buffer, nGeneralDataSize);
WriteSaveBuf(buffer, NumOfCarGenerators);
WriteSaveBuf(buffer, CurrentActiveCount);
WriteSaveBuf(buffer, ProcessCounter);
WriteSaveBuf(buffer, GenerateEvenIfPlayerIsCloseCounter);
- WriteSaveBuf(buffer, (int16)0);
+ WriteSaveBuf(buffer, (int16)0); // alignment
WriteSaveBuf(buffer, sizeof(CarGeneratorArray));
- for (int i = 0; i < NUM_CARGENS; i++){
- CarGeneratorArray[i].Save(buffer);
- }
+ for (int i = 0; i < NUM_CARGENS; i++)
+ WriteSaveBuf(buffer, CarGeneratorArray[i]);
VALIDATESAVEBUF(*size)
}
void CTheCarGenerators::LoadAllCarGenerators(uint8* buffer, uint32 size)
{
+ const int32 nGeneralDataSize = sizeof(NumOfCarGenerators) + sizeof(CurrentActiveCount) + sizeof(ProcessCounter) + sizeof(GenerateEvenIfPlayerIsCloseCounter) + sizeof(int16);
Init();
INITSAVEBUF
- assert(size == 20 + sizeof(CarGeneratorArray) + SAVE_HEADER_SIZE);
CheckSaveHeader(buffer, 'C','G','N','\0', size - SAVE_HEADER_SIZE);
- ReadSaveBuf<uint32>(buffer);
+ assert(ReadSaveBuf<uint32>(buffer) == nGeneralDataSize);
NumOfCarGenerators = ReadSaveBuf<uint32>(buffer);
CurrentActiveCount = ReadSaveBuf<uint32>(buffer);
ProcessCounter = ReadSaveBuf<uint8>(buffer);
GenerateEvenIfPlayerIsCloseCounter = ReadSaveBuf<uint8>(buffer);
- ReadSaveBuf<int16>(buffer);
+ ReadSaveBuf<int16>(buffer); // alignment
assert(ReadSaveBuf<uint32>(buffer) == sizeof(CarGeneratorArray));
- for (int i = 0; i < NUM_CARGENS; i++) {
- CarGeneratorArray[i].Load(buffer);
- }
+ for (int i = 0; i < NUM_CARGENS; i++)
+ CarGeneratorArray[i] = ReadSaveBuf<CCarGenerator>(buffer);
VALIDATESAVEBUF(size)
}
diff --git a/src/control/CarGen.h b/src/vehicles/CarGen.h
index 75acdd56..9d645318 100644
--- a/src/control/CarGen.h
+++ b/src/vehicles/CarGen.h
@@ -34,19 +34,17 @@ public:
void Setup(float x, float y, float z, float angle, int32 mi, int16 color1, int16 color2, uint8 force, uint8 alarm, uint8 lock, uint16 min_delay, uint16 max_delay);
bool CheckForBlockage();
bool CheckIfWithinRangeOfAnyPlayer();
- void Save(uint8*&);
- void Load(uint8*&);
void SetUsesRemaining(uint16 uses) { m_nUsesRemaining = uses; }
};
class CTheCarGenerators
{
public:
- static uint8 &ProcessCounter;
- static uint32 &NumOfCarGenerators;
- static CCarGenerator (&CarGeneratorArray)[NUM_CARGENS];
- static uint8 &GenerateEvenIfPlayerIsCloseCounter;
- static uint32 &CurrentActiveCount;
+ static uint8 ProcessCounter;
+ static uint32 NumOfCarGenerators;
+ static CCarGenerator CarGeneratorArray[NUM_CARGENS];
+ static uint8 GenerateEvenIfPlayerIsCloseCounter;
+ static uint32 CurrentActiveCount;
static void Process();
static int32 CreateCarGenerator(float x, float y, float z, float angle, int32 mi, int16 color1, int16 color2, uint8 force, uint8 alarm, uint8 lock, uint16 min_delay, uint16 max_delay);
diff --git a/src/control/Cranes.cpp b/src/vehicles/Cranes.cpp
index 021a5c19..dbc3c340 100644
--- a/src/control/Cranes.cpp
+++ b/src/vehicles/Cranes.cpp
@@ -38,9 +38,9 @@
uint32 TimerForCamInterpolation;
-uint32& CCranes::CarsCollectedMilitaryCrane = *(uint32*)0x8F6248;
-int32& CCranes::NumCranes = *(int32*)0x8E28AC;
-CCrane(&CCranes::aCranes)[NUM_CRANES] = *(CCrane(*)[NUM_CRANES])*(uintptr*)0x6FA4E0;
+uint32 CCranes::CarsCollectedMilitaryCrane;
+int32 CCranes::NumCranes;
+CCrane CCranes::aCranes[NUM_CRANES];
void CCranes::InitCranes(void)
{
@@ -410,6 +410,8 @@ void CCrane::FindCarInSectorList(CPtrList* pList)
if (pVehicle->GetPosition().x < m_fPickupX1 || pVehicle->GetPosition().x > m_fPickupX2 ||
pVehicle->GetPosition().y < m_fPickupY1 || pVehicle->GetPosition().y > m_fPickupY2)
continue;
+ if (pVehicle->pDriver)
+ continue;
if (Abs(pVehicle->GetMoveSpeed().x) >= CAR_MOVING_SPEED_THRESHOLD ||
Abs(pVehicle->GetMoveSpeed().y) >= CAR_MOVING_SPEED_THRESHOLD ||
Abs(pVehicle->GetMoveSpeed().z) >= CAR_MOVING_SPEED_THRESHOLD)
@@ -464,13 +466,13 @@ bool CCrane::DoesCranePickUpThisCarType(uint32 mi)
bool CCranes::DoesMilitaryCraneHaveThisOneAlready(uint32 mi)
{
switch (mi) {
- case MI_FIRETRUCK: return (CCranes::CarsCollectedMilitaryCrane & 1);
- case MI_AMBULAN: return (CCranes::CarsCollectedMilitaryCrane & 2);
- case MI_ENFORCER: return (CCranes::CarsCollectedMilitaryCrane & 4);
- case MI_FBICAR: return (CCranes::CarsCollectedMilitaryCrane & 8);
- case MI_RHINO: return (CCranes::CarsCollectedMilitaryCrane & 0x10);
- case MI_BARRACKS: return (CCranes::CarsCollectedMilitaryCrane & 0x20);
- case MI_POLICE: return (CCranes::CarsCollectedMilitaryCrane & 0x40);
+ case MI_FIRETRUCK: return (CarsCollectedMilitaryCrane & 1);
+ case MI_AMBULAN: return (CarsCollectedMilitaryCrane & 2);
+ case MI_ENFORCER: return (CarsCollectedMilitaryCrane & 4);
+ case MI_FBICAR: return (CarsCollectedMilitaryCrane & 8);
+ case MI_RHINO: return (CarsCollectedMilitaryCrane & 0x10);
+ case MI_BARRACKS: return (CarsCollectedMilitaryCrane & 0x20);
+ case MI_POLICE: return (CarsCollectedMilitaryCrane & 0x40);
default: break;
}
return false;
@@ -479,20 +481,20 @@ bool CCranes::DoesMilitaryCraneHaveThisOneAlready(uint32 mi)
void CCranes::RegisterCarForMilitaryCrane(uint32 mi)
{
switch (mi) {
- case MI_FIRETRUCK: CCranes::CarsCollectedMilitaryCrane |= 1; break;
- case MI_AMBULAN: CCranes::CarsCollectedMilitaryCrane |= 2; break;
- case MI_ENFORCER: CCranes::CarsCollectedMilitaryCrane |= 4; break;
- case MI_FBICAR: CCranes::CarsCollectedMilitaryCrane |= 8; break;
- case MI_RHINO: CCranes::CarsCollectedMilitaryCrane |= 0x10; break;
- case MI_BARRACKS: CCranes::CarsCollectedMilitaryCrane |= 0x20; break;
- case MI_POLICE: CCranes::CarsCollectedMilitaryCrane |= 0x40; break;
+ case MI_FIRETRUCK: CarsCollectedMilitaryCrane |= 1; break;
+ case MI_AMBULAN: CarsCollectedMilitaryCrane |= 2; break;
+ case MI_ENFORCER: CarsCollectedMilitaryCrane |= 4; break;
+ case MI_FBICAR: CarsCollectedMilitaryCrane |= 8; break;
+ case MI_RHINO: CarsCollectedMilitaryCrane |= 0x10; break;
+ case MI_BARRACKS: CarsCollectedMilitaryCrane |= 0x20; break;
+ case MI_POLICE: CarsCollectedMilitaryCrane |= 0x40; break;
default: break;
}
}
bool CCranes::HaveAllCarsBeenCollectedByMilitaryCrane()
{
- return (CCranes::CarsCollectedMilitaryCrane & 0x7F) == 0x7F;
+ return (CarsCollectedMilitaryCrane & 0x7F) == 0x7F;
}
bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, float fTargetHeight, float fSpeedMultiplier)
@@ -507,8 +509,7 @@ bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, floa
if (Abs(fHookAngleDelta) < fHookAngleChangeThisFrame) {
m_fHookAngle = fAngleToTarget;
bAngleMovementFinished = true;
- }
- else {
+ } else {
if (fHookAngleDelta < 0.0f) {
m_fHookAngle -= fHookAngleChangeThisFrame;
if (m_fHookAngle < 0.0f)
@@ -526,8 +527,7 @@ bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, floa
if (Abs(fHookOffsetDelta) < fHookOffsetChangeThisFrame) {
m_fHookOffset = fDistanceToTarget;
bOffsetMovementFinished = true;
- }
- else {
+ } else {
if (fHookOffsetDelta < 0.0f)
m_fHookOffset -= fHookOffsetChangeThisFrame;
else
@@ -539,8 +539,7 @@ bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, floa
if (Abs(fHookHeightDelta) < fHookHeightChangeThisFrame) {
m_fHookHeight = fTargetHeight;
bHeightMovementFinished = true;
- }
- else {
+ } else {
if (fHookHeightDelta < 0.0f)
m_fHookHeight -= fHookHeightChangeThisFrame;
else
@@ -558,8 +557,7 @@ bool CCrane::GoTowardsHeightTarget(float fTargetHeight, float fSpeedMultiplier)
if (Abs(fHookHeightDelta) < fHookHeightChangeThisFrame) {
m_fHookHeight = fTargetHeight;
bHeightMovementFinished = true;
- }
- else {
+ } else {
if (fHookHeightDelta < 0.0f)
m_fHookHeight -= fHookHeightChangeThisFrame;
else
@@ -585,7 +583,7 @@ void CCrane::CalcHookCoordinates(float* pX, float* pY, float* pZ)
void CCrane::SetHookMatrix()
{
- if (!m_pHook)
+ if (m_pHook == nil)
return;
m_pHook->GetPosition() = m_vecHookCurPos;
CVector up(m_vecHookInitPos.x - m_vecHookCurPos.x, m_vecHookInitPos.y - m_vecHookCurPos.y, 20.0f);
@@ -630,48 +628,44 @@ void CCranes::Save(uint8* buf, uint32* size)
{
INITSAVEBUF
- *size = 2 * sizeof(uint32) + NUM_CRANES * sizeof(CCrane);
+ *size = 2 * sizeof(uint32) + sizeof(aCranes);
WriteSaveBuf(buf, NumCranes);
WriteSaveBuf(buf, CarsCollectedMilitaryCrane);
for (int i = 0; i < NUM_CRANES; i++) {
- CCrane* pCrane = WriteSaveBuf(buf, aCranes[i]);
- if (pCrane->m_pCraneEntity)
- pCrane->m_pCraneEntity = (CBuilding*)(CPools::GetBuildingPool()->GetJustIndex((CBuilding*)pCrane->m_pCraneEntity) + 1);
- if (pCrane->m_pHook)
- pCrane->m_pHook = (CObject*)(CPools::GetObjectPool()->GetJustIndex((CObject*)pCrane->m_pHook) + 1);
- if (pCrane->m_pVehiclePickedUp)
- pCrane->m_pVehiclePickedUp = (CVehicle*)(CPools::GetVehiclePool()->GetJustIndex((CVehicle*)pCrane->m_pVehiclePickedUp) + 1);
+ CCrane *pCrane = WriteSaveBuf(buf, aCranes[i]);
+ if (pCrane->m_pCraneEntity != nil)
+ pCrane->m_pCraneEntity = (CBuilding*)(CPools::GetBuildingPool()->GetJustIndex(pCrane->m_pCraneEntity) + 1);
+ if (pCrane->m_pHook != nil)
+ pCrane->m_pHook = (CObject*)(CPools::GetObjectPool()->GetJustIndex(pCrane->m_pHook) + 1);
+ if (pCrane->m_pVehiclePickedUp != nil)
+ pCrane->m_pVehiclePickedUp = (CVehicle*)(CPools::GetVehiclePool()->GetJustIndex(pCrane->m_pVehiclePickedUp) + 1);
}
VALIDATESAVEBUF(*size);
}
-void CranesLoad(uint8* buf, uint32 size)
+void CCranes::Load(uint8* buf, uint32 size)
{
INITSAVEBUF
- CCranes::NumCranes = ReadSaveBuf<int32>(buf);
- CCranes::CarsCollectedMilitaryCrane = ReadSaveBuf<uint32>(buf);
+ NumCranes = ReadSaveBuf<int32>(buf);
+ CarsCollectedMilitaryCrane = ReadSaveBuf<uint32>(buf);
for (int i = 0; i < NUM_CRANES; i++)
- CCranes::aCranes[i] = ReadSaveBuf<CCrane>(buf);
+ aCranes[i] = ReadSaveBuf<CCrane>(buf);
for (int i = 0; i < NUM_CRANES; i++) {
- CCrane* pCrane = &CCranes::aCranes[i];
- if (pCrane->m_pCraneEntity)
+ CCrane *pCrane = &aCranes[i];
+ if (pCrane->m_pCraneEntity != nil)
pCrane->m_pCraneEntity = CPools::GetBuildingPool()->GetSlot((uint32)pCrane->m_pCraneEntity - 1);
- if (pCrane->m_pHook)
+ if (pCrane->m_pHook != nil)
pCrane->m_pHook = CPools::GetObjectPool()->GetSlot((uint32)pCrane->m_pHook - 1);
- if (pCrane->m_pVehiclePickedUp)
- pCrane->m_pVehiclePickedUp = CPools::GetVehiclePool()->GetSlot((uint32)pCrane->m_pVehiclePickedUp + 1);
+ if (pCrane->m_pVehiclePickedUp != nil)
+ pCrane->m_pVehiclePickedUp = CPools::GetVehiclePool()->GetSlot((uint32)pCrane->m_pVehiclePickedUp - 1);
}
for (int i = 0; i < NUM_CRANES; i++) {
- CCranes::aCranes[i].m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &CCranes::aCranes[i]);
- if (CCranes::aCranes[i].m_nAudioEntity)
- DMAudio.SetEntityStatus(CCranes::aCranes[i].m_nAudioEntity, 1);
+ aCranes[i].m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &aCranes[i]);
+ if (aCranes[i].m_nAudioEntity != 0)
+ DMAudio.SetEntityStatus(aCranes[i].m_nAudioEntity, 1);
}
VALIDATESAVEBUF(size);
}
-
-STARTPATCHES
- InjectHook(0x5454D0, CranesLoad, PATCH_JUMP); // GenericLoad
-ENDPATCHES \ No newline at end of file
diff --git a/src/control/Cranes.h b/src/vehicles/Cranes.h
index d9817282..c0502638 100644
--- a/src/control/Cranes.h
+++ b/src/vehicles/Cranes.h
@@ -89,10 +89,9 @@ public:
static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle);
static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle);
static void Save(uint8* buf, uint32* size);
+ static void Load(uint8* buf, uint32 size); // on mobile it's CranesLoad outside of the class
- static uint32& CarsCollectedMilitaryCrane;
- static int32& NumCranes;
- static CCrane(&aCranes)[NUM_CRANES];
+ static uint32 CarsCollectedMilitaryCrane;
+ static int32 NumCranes;
+ static CCrane aCranes[NUM_CRANES];
};
-
-void CranesLoad(uint8*, uint32); // is this really outside CCranes?
diff --git a/src/vehicles/Floater.cpp b/src/vehicles/Floater.cpp
index 6b8bf755..62d55925 100644
--- a/src/vehicles/Floater.cpp
+++ b/src/vehicles/Floater.cpp
@@ -26,7 +26,7 @@ cBuoyancy::ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *point, CVec
{
m_numSteps = 2.0f;
- if(!CWaterLevel::GetWaterLevel(phys->GetPosition(), &m_waterlevel, phys->m_flagD8))
+ if(!CWaterLevel::GetWaterLevel(phys->GetPosition(), &m_waterlevel, phys->bTouchingWater))
return false;
m_matrix = phys->GetMatrix();
diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp
index 3dc1deeb..c4cdcb02 100644
--- a/src/vehicles/Heli.cpp
+++ b/src/vehicles/Heli.cpp
@@ -78,6 +78,9 @@ CHeli::CHeli(int32 id, uint8 CreatedBy)
m_bTestRight = true;
m_fTargetOffset = 0.0f;
m_fSearchLightX = m_fSearchLightY = 0.0f;
+
+ // BUG: not in game but gets initialized to CDCDCDCD in debug
+ m_nLastShotTime = 0;
}
void
@@ -590,7 +593,12 @@ CHeli::PreRender(void)
break;
}
RwRGBA col = { r, g, b, 32 };
+#ifdef FIX_BUGS
+ pos.z = m_fHeliDustZ[frm];
+#else
+ // What the hell is the point of this?
pos.z = m_fHeliDustZ[(i - (i&3))/4]; // advance every 4 iterations, why not just /4?
+#endif
if(pos.z > -200.0f && GetPosition().z - pos.z < 20.0f)
CParticle::AddParticle(PARTICLE_HELI_DUST, pos, dir, nil, 0.0f, col);
i++;
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index adeba19e..ed8f4221 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -19,12 +19,12 @@
#include "Fire.h"
#include "Darkel.h"
-bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
-bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
-bool &CVehicle::bCheat3 = *(bool *)0x95CD66;
-bool &CVehicle::bCheat4 = *(bool *)0x95CD65;
-bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
-bool &CVehicle::m_bDisableMouseSteering = *(bool *)0x60252C;
+bool CVehicle::bWheelsOnlyCheat;
+bool CVehicle::bAllDodosCheat;
+bool CVehicle::bCheat3;
+bool CVehicle::bCheat4;
+bool CVehicle::bCheat5;
+bool CVehicle::m_bDisableMouseSteering;
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }
@@ -482,6 +482,55 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
}
void
+CVehicle::DoFixedMachineGuns(void)
+{
+ if(CPad::GetPad(0)->GetCarGunFired() && !bGunSwitchedOff){
+ if(CTimer::GetTimeInMilliseconds() > m_nGunFiringTime + 150){
+ CVector source, target;
+ float dx, dy, len;
+
+ dx = GetForward().x;
+ dy = GetForward().y;
+ len = Sqrt(SQR(dx) + SQR(dy));
+ if(len < 0.1f) len = 0.1f;
+ dx /= len;
+ dy /= len;
+
+ m_nGunFiringTime = CTimer::GetTimeInMilliseconds();
+
+ source = GetMatrix() * CVector(2.0f, 2.5f, 1.0f);
+ target = source + CVector(dx, dy, 0.0f)*60.0f;
+ target += CVector(
+ ((CGeneral::GetRandomNumber()&0xFF)-128) * 0.015f,
+ ((CGeneral::GetRandomNumber()&0xFF)-128) * 0.015f,
+ ((CGeneral::GetRandomNumber()&0xFF)-128) * 0.02f);
+ CWeapon::DoTankDoomAiming(this, pDriver, &source, &target);
+ FireOneInstantHitRound(&source, &target, 15);
+
+ source = GetMatrix() * CVector(-2.0f, 2.5f, 1.0f);
+ target = source + CVector(dx, dy, 0.0f)*60.0f;
+ target += CVector(
+ ((CGeneral::GetRandomNumber()&0xFF)-128) * 0.015f,
+ ((CGeneral::GetRandomNumber()&0xFF)-128) * 0.015f,
+ ((CGeneral::GetRandomNumber()&0xFF)-128) * 0.02f);
+ CWeapon::DoTankDoomAiming(this, pDriver, &source, &target);
+ FireOneInstantHitRound(&source, &target, 15);
+
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
+
+ m_nAmmoInClip--;
+ if(m_nAmmoInClip == 0){
+ m_nAmmoInClip = 20;
+ m_nGunFiringTime = CTimer::GetTimeInMilliseconds() + 1400;
+ }
+ }
+ }else{
+ if(CTimer::GetTimeInMilliseconds() > m_nGunFiringTime + 1400)
+ m_nAmmoInClip = 20;
+ }
+}
+
+void
CVehicle::ExtinguishCarFire(void)
{
m_fHealth = max(m_fHealth, 300.0f);
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index c7be3674..bfc6d95d 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -130,7 +130,8 @@ public:
int8 m_nGettingInFlags;
int8 m_nGettingOutFlags;
uint8 m_nNumMaxPassengers;
- char field_1CD[19];
+ char field_1CD[3];
+ float field_1D0[4];
CEntity *m_pCurGroundEntity;
CFire *m_pCarFire;
float m_fSteerAngle;
@@ -269,18 +270,19 @@ public:
bool IsSphereTouchingVehicle(float sx, float sy, float sz, float radius);
bool ShufflePassengersToMakeSpace(void);
void InflictDamage(CEntity *damagedBy, eWeaponType weaponType, float damage);
+ void DoFixedMachineGuns(void);
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
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); }
- static bool &bWheelsOnlyCheat;
- static bool &bAllDodosCheat;
- static bool &bCheat3;
- static bool &bCheat4;
- static bool &bCheat5;
- static bool &m_bDisableMouseSteering;
+ static bool bWheelsOnlyCheat;
+ static bool bAllDodosCheat;
+ static bool bCheat3;
+ static bool bCheat4;
+ static bool bCheat5;
+ static bool m_bDisableMouseSteering;
};
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");