mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2025-01-11 00:14:09 +00:00
Merge branch 'miami' into miami
This commit is contained in:
commit
70f9832e14
|
@ -332,14 +332,12 @@ project "reVC"
|
||||||
links { "rw" }
|
links { "rw" }
|
||||||
|
|
||||||
filter "platforms:*d3d9*"
|
filter "platforms:*d3d9*"
|
||||||
|
defines { "USE_D3D9" }
|
||||||
links { "d3d9" }
|
links { "d3d9" }
|
||||||
|
|
||||||
filter "platforms:*x86*d3d*"
|
filter "platforms:*x86*d3d*"
|
||||||
includedirs { "sdk/dx8sdk/include" }
|
includedirs { "sdk/dx8sdk/include" }
|
||||||
libdirs { "sdk/dx8sdk/lib" }
|
libdirs { "sdk/dx8sdk/lib" }
|
||||||
|
|
||||||
filter "platforms:*amd64*d3d9*"
|
|
||||||
defines { "USE_D3D9" }
|
|
||||||
|
|
||||||
filter "platforms:win-x86*gl3_glfw*"
|
filter "platforms:win-x86*gl3_glfw*"
|
||||||
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }
|
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
#include "audio_enums.h"
|
#include "audio_enums.h"
|
||||||
|
@ -993,7 +993,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
|
||||||
|
|
||||||
int32 emittingVol;
|
int32 emittingVol;
|
||||||
uint32 freq;
|
uint32 freq;
|
||||||
float modificator;
|
float multiplier;
|
||||||
int sampleFreq;
|
int sampleFreq;
|
||||||
float velocity;
|
float velocity;
|
||||||
|
|
||||||
|
@ -1016,9 +1016,9 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
|
||||||
freq = 6050 * emittingVol / 30 + 16000;
|
freq = 6050 * emittingVol / 30 + 16000;
|
||||||
} else {
|
} else {
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
|
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
|
||||||
modificator = m_sQueueSample.m_fDistance / 190.f;
|
multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
|
||||||
sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
|
sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
|
||||||
freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4);
|
freq = (sampleFreq * multiplier) + ((3 * sampleFreq) / 4);
|
||||||
}
|
}
|
||||||
m_sQueueSample.m_nFrequency = freq;
|
m_sQueueSample.m_nFrequency = freq;
|
||||||
m_sQueueSample.m_nLoopCount = 0;
|
m_sQueueSample.m_nLoopCount = 0;
|
||||||
|
@ -1046,7 +1046,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
|
||||||
|
|
||||||
float relativeVelocity;
|
float relativeVelocity;
|
||||||
int32 emittingVol;
|
int32 emittingVol;
|
||||||
float modificator;
|
float multiplier;
|
||||||
int freq;
|
int freq;
|
||||||
float velChange;
|
float velChange;
|
||||||
|
|
||||||
|
@ -1066,9 +1066,13 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
m_sQueueSample.m_bIs2D = false;
|
m_sQueueSample.m_bIs2D = false;
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 3;
|
m_sQueueSample.m_nReleasingVolumeModificator = 3;
|
||||||
modificator = m_sQueueSample.m_fDistance / 6.f;
|
#ifdef FIX_BUGS
|
||||||
|
multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
|
||||||
|
#else
|
||||||
|
multiplier = (m_sQueueSample.m_fDistance / 3.0f) * 0.5f;
|
||||||
|
#endif
|
||||||
freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
|
freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
|
||||||
m_sQueueSample.m_nFrequency = freq + freq * modificator;
|
m_sQueueSample.m_nFrequency = freq + freq * multiplier;
|
||||||
m_sQueueSample.m_nLoopCount = 0;
|
m_sQueueSample.m_nLoopCount = 0;
|
||||||
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
||||||
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
|
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
|
||||||
|
@ -4923,17 +4927,25 @@ cAudioManager::ProcessFires(int32)
|
||||||
void
|
void
|
||||||
cAudioManager::ProcessWaterCannon(int32)
|
cAudioManager::ProcessWaterCannon(int32)
|
||||||
{
|
{
|
||||||
const float SOUND_INTENSITY = 900.0f;
|
const float SOUND_INTENSITY = 30.0f;
|
||||||
|
|
||||||
for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
|
for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
|
||||||
if (CWaterCannons::aCannons[i].m_nId) {
|
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);
|
float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
||||||
if (distSquared < SOUND_INTENSITY) {
|
if (distSquared < SQR(SOUND_INTENSITY)) {
|
||||||
m_sQueueSample.m_fDistance = Sqrt(distSquared);
|
m_sQueueSample.m_fDistance = Sqrt(distSquared);
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
m_sQueueSample.m_nVolume = ComputeVolume(50, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
|
||||||
|
#else
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
|
||||||
|
#endif
|
||||||
if (m_sQueueSample.m_nVolume != 0) {
|
if (m_sQueueSample.m_nVolume != 0) {
|
||||||
|
#ifdef FIX_BUGS
|
||||||
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
|
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
|
||||||
|
#else
|
||||||
|
m_sQueueSample.m_fSoundIntensity = SQR(SOUND_INTENSITY);
|
||||||
|
#endif
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
|
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
m_sQueueSample.m_nFrequency = 15591;
|
m_sQueueSample.m_nFrequency = 15591;
|
||||||
|
|
|
@ -328,8 +328,13 @@ cAudioManager::Get3DProviderName(uint8 id) const
|
||||||
{
|
{
|
||||||
if (!m_bIsInitialised)
|
if (!m_bIsInitialised)
|
||||||
return nil;
|
return nil;
|
||||||
|
#ifdef AUDIO_OAL
|
||||||
|
id = clamp(id, 0, SampleManager.GetNum3DProvidersAvailable() - 1);
|
||||||
|
#else
|
||||||
|
// We don't want that either since it will crash the game, but skipping for now
|
||||||
if (id >= SampleManager.GetNum3DProvidersAvailable())
|
if (id >= SampleManager.GetNum3DProvidersAvailable())
|
||||||
return nil;
|
return nil;
|
||||||
|
#endif
|
||||||
return SampleManager.Get3DProviderName(id);
|
return SampleManager.Get3DProviderName(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,29 +623,56 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
|
||||||
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
|
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --MIAMI: Done
|
||||||
void
|
void
|
||||||
cAudioManager::AddReflectionsToRequestedQueue()
|
cAudioManager::AddReflectionsToRequestedQueue()
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
uint32 oldFreq = 0;
|
||||||
|
#else
|
||||||
|
uint32 oldFreq;
|
||||||
|
#endif
|
||||||
float reflectionDistance;
|
float reflectionDistance;
|
||||||
int32 noise;
|
int32 noise;
|
||||||
uint8 emittingVolume = (m_sQueueSample.m_nVolume / 2) + (m_sQueueSample.m_nVolume / 8);
|
uint8 emittingVolume;
|
||||||
|
|
||||||
|
uint32 oldCounter = m_sQueueSample.m_nCounter;
|
||||||
|
float oldDist = m_sQueueSample.m_fDistance;
|
||||||
|
CVector oldPos = m_sQueueSample.m_vecPos;
|
||||||
|
if ( CTimer::GetIsSlowMotionActive() ) {
|
||||||
|
emittingVolume = m_sQueueSample.m_nVolume;
|
||||||
|
oldFreq = m_sQueueSample.m_nFrequency;
|
||||||
|
} else {
|
||||||
|
emittingVolume = (m_sQueueSample.m_nVolume / 2) + (m_sQueueSample.m_nVolume / 16);
|
||||||
|
}
|
||||||
|
m_sQueueSample.m_fSoundIntensity = m_sQueueSample.m_fSoundIntensity / 2.f;
|
||||||
|
|
||||||
|
int halfOldFreq = oldFreq >> 1;
|
||||||
|
|
||||||
for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
|
for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
|
||||||
|
if ( CTimer::GetIsSlowMotionActive() )
|
||||||
|
m_afReflectionsDistances[i] = GetRandomNumberInRange(i % 4, 0, 2) * 100.f / 8.f;
|
||||||
|
|
||||||
reflectionDistance = m_afReflectionsDistances[i];
|
reflectionDistance = m_afReflectionsDistances[i];
|
||||||
if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_fSoundIntensity) {
|
if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_fSoundIntensity) {
|
||||||
m_sQueueSample.m_nLoopsRemaining = (reflectionDistance * 500.f / 1029.f);
|
m_sQueueSample.m_nLoopsRemaining = CTimer::GetIsSlowMotionActive() ? (reflectionDistance * 800.f / 1029.f) : (reflectionDistance * 500.f / 1029.f);
|
||||||
if (m_sQueueSample.m_nLoopsRemaining > 5) {
|
if (m_sQueueSample.m_nLoopsRemaining > 3) {
|
||||||
m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
|
m_sQueueSample.m_fDistance = m_afReflectionsDistances[i];
|
||||||
m_sQueueSample.m_nEmittingVolume = emittingVolume;
|
m_sQueueSample.m_nEmittingVolume = emittingVolume;
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
|
||||||
|
|
||||||
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
|
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
|
||||||
m_sQueueSample.m_nCounter += (i + 1) * 256;
|
m_sQueueSample.m_nCounter = oldCounter + (i + 1) * 256;
|
||||||
if (m_sQueueSample.m_nLoopCount) {
|
if (m_sQueueSample.m_nLoopCount) {
|
||||||
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
|
if ( CTimer::GetIsSlowMotionActive() ) {
|
||||||
if (noise <= 0)
|
m_sQueueSample.m_nFrequency = halfOldFreq + ((halfOldFreq * i) / ARRAY_SIZE(m_afReflectionsDistances));
|
||||||
m_sQueueSample.m_nFrequency += noise;
|
} else {
|
||||||
else
|
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
|
||||||
m_sQueueSample.m_nFrequency -= noise;
|
if (noise <= 0)
|
||||||
|
m_sQueueSample.m_nFrequency += noise;
|
||||||
|
else
|
||||||
|
m_sQueueSample.m_nFrequency -= noise;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator += 20;
|
m_sQueueSample.m_nReleasingVolumeModificator += 20;
|
||||||
m_sQueueSample.m_vecPos = m_avecReflectionsPos[i];
|
m_sQueueSample.m_vecPos = m_avecReflectionsPos[i];
|
||||||
|
@ -649,50 +681,85 @@ cAudioManager::AddReflectionsToRequestedQueue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_sQueueSample.m_vecPos = oldPos;
|
||||||
|
m_sQueueSample.m_fDistance = oldDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --MIAMI: Done
|
||||||
void
|
void
|
||||||
cAudioManager::UpdateReflections()
|
cAudioManager::UpdateReflections()
|
||||||
{
|
{
|
||||||
const CVector &camPos = TheCamera.GetPosition();
|
CVector camPos = TheCamera.GetPosition();
|
||||||
CColPoint colpoint;
|
CColPoint colpoint;
|
||||||
CEntity *ent;
|
CEntity *ent;
|
||||||
|
|
||||||
if (m_FrameCounter % 8 == 0) {
|
if (m_FrameCounter % 8 == 0) {
|
||||||
m_avecReflectionsPos[0] = camPos;
|
m_avecReflectionsPos[0] = camPos;
|
||||||
m_avecReflectionsPos[0].y += 50.f;
|
m_avecReflectionsPos[0].y += 100.f;
|
||||||
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true))
|
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true))
|
||||||
m_afReflectionsDistances[0] = Distance(camPos, colpoint.point);
|
m_afReflectionsDistances[0] = Distance(camPos, colpoint.point);
|
||||||
else
|
else
|
||||||
m_afReflectionsDistances[0] = 50.0f;
|
m_afReflectionsDistances[0] = 100.0f;
|
||||||
|
|
||||||
} else if ((m_FrameCounter + 1) % 8 == 0) {
|
} else if ((m_FrameCounter + 1) % 8 == 0) {
|
||||||
m_avecReflectionsPos[1] = camPos;
|
m_avecReflectionsPos[1] = camPos;
|
||||||
m_avecReflectionsPos[1].y -= 50.0f;
|
m_avecReflectionsPos[1].y -= 100.0f;
|
||||||
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true))
|
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true))
|
||||||
m_afReflectionsDistances[1] = Distance(camPos, colpoint.point);
|
m_afReflectionsDistances[1] = Distance(camPos, colpoint.point);
|
||||||
else
|
else
|
||||||
m_afReflectionsDistances[1] = 50.0f;
|
m_afReflectionsDistances[1] = 100.0f;
|
||||||
|
|
||||||
} else if ((m_FrameCounter + 2) % 8 == 0) {
|
} else if ((m_FrameCounter + 2) % 8 == 0) {
|
||||||
m_avecReflectionsPos[2] = camPos;
|
m_avecReflectionsPos[2] = camPos;
|
||||||
m_avecReflectionsPos[2].x -= 50.0f;
|
m_avecReflectionsPos[2].x -= 100.0f;
|
||||||
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true))
|
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true))
|
||||||
m_afReflectionsDistances[2] = Distance(camPos, colpoint.point);
|
m_afReflectionsDistances[2] = Distance(camPos, colpoint.point);
|
||||||
else
|
else
|
||||||
m_afReflectionsDistances[2] = 50.0f;
|
m_afReflectionsDistances[2] = 100.0f;
|
||||||
|
|
||||||
} else if ((m_FrameCounter + 3) % 8 == 0) {
|
} else if ((m_FrameCounter + 3) % 8 == 0) {
|
||||||
m_avecReflectionsPos[3] = camPos;
|
m_avecReflectionsPos[3] = camPos;
|
||||||
m_avecReflectionsPos[3].x += 50.0f;
|
m_avecReflectionsPos[3].x += 100.0f;
|
||||||
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true))
|
if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true))
|
||||||
m_afReflectionsDistances[3] = Distance(camPos, colpoint.point);
|
m_afReflectionsDistances[3] = Distance(camPos, colpoint.point);
|
||||||
else
|
else
|
||||||
m_afReflectionsDistances[3] = 50.0f;
|
m_afReflectionsDistances[3] = 100.0f;
|
||||||
|
|
||||||
} else if ((m_FrameCounter + 4) % 8 == 0) {
|
} else if ((m_FrameCounter + 4) % 8 == 0) {
|
||||||
|
camPos.y += 1.0f;
|
||||||
m_avecReflectionsPos[4] = camPos;
|
m_avecReflectionsPos[4] = camPos;
|
||||||
m_avecReflectionsPos[4].z += 50.0f;
|
m_avecReflectionsPos[4].z += 100.0f;
|
||||||
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, nil))
|
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, nil))
|
||||||
m_afReflectionsDistances[4] = colpoint.point.z - camPos.z;
|
m_afReflectionsDistances[4] = colpoint.point.z - camPos.z;
|
||||||
else
|
else
|
||||||
m_afReflectionsDistances[4] = 50.0f;
|
m_afReflectionsDistances[4] = 100.0f;
|
||||||
|
|
||||||
|
} else if ((m_FrameCounter + 5) % 8 == 0) {
|
||||||
|
camPos.y -= 1.0f;
|
||||||
|
m_avecReflectionsPos[5] = camPos;
|
||||||
|
m_avecReflectionsPos[5].z += 100.0f;
|
||||||
|
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[5].z, colpoint, ent, true, false, false, false, true, false, nil))
|
||||||
|
m_afReflectionsDistances[5] = colpoint.point.z - camPos.z;
|
||||||
|
else
|
||||||
|
m_afReflectionsDistances[5] = 100.0f;
|
||||||
|
|
||||||
|
} else if ((m_FrameCounter + 6) % 8 == 0) {
|
||||||
|
camPos.x -= 1.0f;
|
||||||
|
m_avecReflectionsPos[6] = camPos;
|
||||||
|
m_avecReflectionsPos[6].z += 100.0f;
|
||||||
|
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[6].z, colpoint, ent, true, false, false, false, true, false, nil))
|
||||||
|
m_afReflectionsDistances[6] = colpoint.point.z - camPos.z;
|
||||||
|
else
|
||||||
|
m_afReflectionsDistances[6] = 100.0f;
|
||||||
|
|
||||||
|
} else if ((m_FrameCounter + 7) % 8 == 0) {
|
||||||
|
camPos.x += 1.0f;
|
||||||
|
m_avecReflectionsPos[7] = camPos;
|
||||||
|
m_avecReflectionsPos[7].z += 100.0f;
|
||||||
|
if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[7].z, colpoint, ent, true, false, false, false, true, false, nil))
|
||||||
|
m_afReflectionsDistances[7] = colpoint.point.z - camPos.z;
|
||||||
|
else
|
||||||
|
m_afReflectionsDistances[7] = 100.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,4 +1076,4 @@ cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, floa
|
||||||
return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity;
|
return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity;
|
||||||
return emittingVolume;
|
return emittingVolume;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -156,19 +156,14 @@ public:
|
||||||
VALIDATE_SIZE(cVehicleParams, 0x18);
|
VALIDATE_SIZE(cVehicleParams, 0x18);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/*
|
REFLECTION_NORTH = 0,
|
||||||
REFLECTION_YMAX = 0, top
|
REFLECTION_SOUTH,
|
||||||
REFLECTION_YMIN = 1, bottom
|
REFLECTION_WEST,
|
||||||
REFLECTION_XMIN = 2, left
|
REFLECTION_EAST,
|
||||||
REFLECTION_XMAX = 3, right
|
REFLECTION_CEIL_NORTH,
|
||||||
REFLECTION_ZMAX = 4,
|
REFLECTION_CEIL_SOUTH,
|
||||||
*/
|
REFLECTION_CEIL_WEST,
|
||||||
|
REFLECTION_CEIL_EAST,
|
||||||
REFLECTION_TOP = 0,
|
|
||||||
REFLECTION_BOTTOM,
|
|
||||||
REFLECTION_LEFT,
|
|
||||||
REFLECTION_RIGHT,
|
|
||||||
REFLECTION_UP,
|
|
||||||
MAX_REFLECTIONS,
|
MAX_REFLECTIONS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -377,8 +377,8 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
m_pSoundFile = nil;
|
m_pSoundFile = nil;
|
||||||
ASSERT(m_pSoundFile != nil);
|
|
||||||
if (m_pSoundFile && m_pSoundFile->IsOpened() )
|
if ( IsOpened() )
|
||||||
{
|
{
|
||||||
m_pBuffer = malloc(m_pSoundFile->GetBufferSize());
|
m_pBuffer = malloc(m_pSoundFile->GetBufferSize());
|
||||||
ASSERT(m_pBuffer!=nil);
|
ASSERT(m_pBuffer!=nil);
|
||||||
|
@ -425,14 +425,14 @@ bool CStream::HasSource()
|
||||||
|
|
||||||
bool CStream::IsOpened()
|
bool CStream::IsOpened()
|
||||||
{
|
{
|
||||||
return m_pSoundFile->IsOpened();
|
return m_pSoundFile && m_pSoundFile->IsOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStream::IsPlaying()
|
bool CStream::IsPlaying()
|
||||||
{
|
{
|
||||||
if ( !HasSource() || !IsOpened() ) return false;
|
if ( !HasSource() || !IsOpened() ) return false;
|
||||||
|
|
||||||
if ( m_pSoundFile->IsOpened() && !m_bPaused )
|
if ( !m_bPaused )
|
||||||
{
|
{
|
||||||
ALint sourceState;
|
ALint sourceState;
|
||||||
alGetSourcei(m_alSource, AL_SOURCE_STATE, &sourceState);
|
alGetSourcei(m_alSource, AL_SOURCE_STATE, &sourceState);
|
||||||
|
@ -500,7 +500,7 @@ void CStream::SetPan(uint8 nPan)
|
||||||
|
|
||||||
void CStream::SetPosMS(uint32 nPos)
|
void CStream::SetPosMS(uint32 nPos)
|
||||||
{
|
{
|
||||||
if ( !m_pSoundFile->IsOpened() ) return;
|
if ( !IsOpened() ) return;
|
||||||
m_pSoundFile->Seek(nPos);
|
m_pSoundFile->Seek(nPos);
|
||||||
ClearBuffers();
|
ClearBuffers();
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ void CStream::SetPosMS(uint32 nPos)
|
||||||
uint32 CStream::GetPosMS()
|
uint32 CStream::GetPosMS()
|
||||||
{
|
{
|
||||||
if ( !HasSource() ) return 0;
|
if ( !HasSource() ) return 0;
|
||||||
if ( !m_pSoundFile->IsOpened() ) return 0;
|
if ( !IsOpened() ) return 0;
|
||||||
|
|
||||||
ALint offset;
|
ALint offset;
|
||||||
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
|
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
|
||||||
|
@ -521,7 +521,7 @@ uint32 CStream::GetPosMS()
|
||||||
|
|
||||||
uint32 CStream::GetLengthMS()
|
uint32 CStream::GetLengthMS()
|
||||||
{
|
{
|
||||||
if ( !m_pSoundFile->IsOpened() ) return 0;
|
if ( !IsOpened() ) return 0;
|
||||||
return m_pSoundFile->GetLength();
|
return m_pSoundFile->GetLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ bool CStream::FillBuffer(ALuint alBuffer)
|
||||||
{
|
{
|
||||||
if ( !HasSource() )
|
if ( !HasSource() )
|
||||||
return false;
|
return false;
|
||||||
if ( !m_pSoundFile->IsOpened() )
|
if ( !IsOpened() )
|
||||||
return false;
|
return false;
|
||||||
if ( !(alBuffer != AL_NONE && alIsBuffer(alBuffer)) )
|
if ( !(alBuffer != AL_NONE && alIsBuffer(alBuffer)) )
|
||||||
return false;
|
return false;
|
||||||
|
@ -571,7 +571,7 @@ void CStream::ClearBuffers()
|
||||||
|
|
||||||
bool CStream::Setup()
|
bool CStream::Setup()
|
||||||
{
|
{
|
||||||
if ( m_pSoundFile->IsOpened() )
|
if ( IsOpened() )
|
||||||
{
|
{
|
||||||
m_pSoundFile->Seek(0);
|
m_pSoundFile->Seek(0);
|
||||||
alSourcei(m_alSource, AL_SOURCE_RELATIVE, AL_TRUE);
|
alSourcei(m_alSource, AL_SOURCE_RELATIVE, AL_TRUE);
|
||||||
|
|
|
@ -143,8 +143,8 @@ class cSampleManager
|
||||||
char *m_aAudioProviders[MAXPROVIDERS];
|
char *m_aAudioProviders[MAXPROVIDERS];
|
||||||
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
|
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
|
||||||
char m_MiscomPath[260];
|
char m_MiscomPath[260];
|
||||||
char m_SfxPath[260];
|
char m_WavFilesPath[260];
|
||||||
char m_StreamedAudioPath[188];
|
char m_MP3FilesPath[188];
|
||||||
void *m_aChannels[18];
|
void *m_aChannels[18];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -16,10 +16,12 @@
|
||||||
#include "MusicManager.h"
|
#include "MusicManager.h"
|
||||||
#include "Frontend.h"
|
#include "Frontend.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
#include "crossplatform.h"
|
||||||
|
|
||||||
#pragma comment( lib, "mss32.lib" )
|
#pragma comment( lib, "mss32.lib" )
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
cSampleManager SampleManager;
|
cSampleManager SampleManager;
|
||||||
uint32 BankStartOffset[MAX_SFX_BANKS];
|
uint32 BankStartOffset[MAX_SFX_BANKS];
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
@ -65,11 +67,6 @@ uint8 nStreamLoopedFlag[MAX_STREAMS];
|
||||||
uint32 _CurMP3Index;
|
uint32 _CurMP3Index;
|
||||||
int32 _CurMP3Pos;
|
int32 _CurMP3Pos;
|
||||||
bool _bIsMp3Active;
|
bool _bIsMp3Active;
|
||||||
|
|
||||||
#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
|
|
||||||
bool _bUseHDDAudio;
|
|
||||||
char _aHDDPath[MAX_PATH];
|
|
||||||
#endif
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@ -560,15 +557,6 @@ _FindMP3s(void)
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f = fopen("MP3\\MP3Report.txt", "w");
|
|
||||||
|
|
||||||
if ( f )
|
|
||||||
{
|
|
||||||
fprintf(f, "MP3 Report File\n\n");
|
|
||||||
fprintf(f, "\"%s\"", fd.cFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ( filepathlen > 4 )
|
if ( filepathlen > 4 )
|
||||||
{
|
{
|
||||||
|
@ -578,12 +566,6 @@ _FindMP3s(void)
|
||||||
{
|
{
|
||||||
OutputDebugString("Resolving Link");
|
OutputDebugString("Resolving Link");
|
||||||
OutputDebugString(filepath);
|
OutputDebugString(filepath);
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( f ) fprintf(f, " - couldn't resolve shortcut");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bShortcut = true;
|
bShortcut = true;
|
||||||
|
@ -607,10 +589,6 @@ _FindMP3s(void)
|
||||||
if ( _pMP3List == NULL )
|
if ( _pMP3List == NULL )
|
||||||
{
|
{
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
|
|
||||||
if ( f )
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,9 +611,6 @@ _FindMP3s(void)
|
||||||
{
|
{
|
||||||
_pMP3List->pLinkPath = NULL;
|
_pMP3List->pLinkPath = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - OK\n");
|
|
||||||
|
|
||||||
bInitFirstEntry = false;
|
bInitFirstEntry = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -644,8 +619,6 @@ _FindMP3s(void)
|
||||||
|
|
||||||
OutputDebugString(filepath);
|
OutputDebugString(filepath);
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
|
|
||||||
|
|
||||||
bInitFirstEntry = true;
|
bInitFirstEntry = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,8 +634,6 @@ _FindMP3s(void)
|
||||||
|
|
||||||
int32 filepathlen = strlen(filepath);
|
int32 filepathlen = strlen(filepath);
|
||||||
|
|
||||||
if ( f ) fprintf(f, "\"%s\"", fd.cFileName);
|
|
||||||
|
|
||||||
if ( filepathlen > 0 )
|
if ( filepathlen > 0 )
|
||||||
{
|
{
|
||||||
if ( filepathlen > 4 )
|
if ( filepathlen > 4 )
|
||||||
|
@ -673,12 +644,6 @@ _FindMP3s(void)
|
||||||
{
|
{
|
||||||
OutputDebugString("Resolving Link");
|
OutputDebugString("Resolving Link");
|
||||||
OutputDebugString(filepath);
|
OutputDebugString(filepath);
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( f ) fprintf(f, " - couldn't resolve shortcut");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bShortcut = true;
|
bShortcut = true;
|
||||||
|
@ -689,8 +654,6 @@ _FindMP3s(void)
|
||||||
|
|
||||||
if ( filepathlen > MAX_PATH )
|
if ( filepathlen > MAX_PATH )
|
||||||
{
|
{
|
||||||
if ( f ) fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath);
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,17 +692,13 @@ _FindMP3s(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
pList = _pMP3List;
|
pList = _pMP3List;
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - OK\n");
|
|
||||||
|
|
||||||
bInitFirstEntry = false;
|
bInitFirstEntry = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcat(filepath, " - NOT A VALID MP3");
|
strcat(filepath, " - NOT A VALID MP3");
|
||||||
OutputDebugString(filepath);
|
OutputDebugString(filepath);
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -752,8 +711,6 @@ _FindMP3s(void)
|
||||||
|
|
||||||
if ( filepathlen > 0 )
|
if ( filepathlen > 0 )
|
||||||
{
|
{
|
||||||
if ( f ) fprintf(f, "\"%s\"", fd.cFileName);
|
|
||||||
|
|
||||||
if ( filepathlen > 4 )
|
if ( filepathlen > 4 )
|
||||||
{
|
{
|
||||||
if ( !strcmp(&filepath[filepathlen - 4], ".lnk") )
|
if ( !strcmp(&filepath[filepathlen - 4], ".lnk") )
|
||||||
|
@ -762,12 +719,6 @@ _FindMP3s(void)
|
||||||
{
|
{
|
||||||
OutputDebugString("Resolving Link");
|
OutputDebugString("Resolving Link");
|
||||||
OutputDebugString(filepath);
|
OutputDebugString(filepath);
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( f ) fprintf(f, " - couldn't resolve shortcut");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bShortcut = true;
|
bShortcut = true;
|
||||||
|
@ -812,26 +763,16 @@ _FindMP3s(void)
|
||||||
nNumMP3s++;
|
nNumMP3s++;
|
||||||
|
|
||||||
OutputDebugString(fd.cFileName);
|
OutputDebugString(fd.cFileName);
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - OK\n");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcat(filepath, " - NOT A VALID MP3");
|
strcat(filepath, " - NOT A VALID MP3");
|
||||||
OutputDebugString(filepath);
|
OutputDebugString(filepath);
|
||||||
|
|
||||||
if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( f )
|
|
||||||
{
|
|
||||||
fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,54 +984,37 @@ cSampleManager::Initialise(void)
|
||||||
|
|
||||||
AIL_set_preference(DIG_MIXER_CHANNELS, MAX_DIGITAL_MIXER_CHANNELS);
|
AIL_set_preference(DIG_MIXER_CHANNELS, MAX_DIGITAL_MIXER_CHANNELS);
|
||||||
|
|
||||||
DIG = AIL_open_digital_driver(DIGITALRATE, DIGITALBITS, DIGITALCHANNELS, 0);
|
DIG = AIL_open_digital_driver(DIGITALRATE, DIGITALBITS, DIGITALCHANNELS, 0);
|
||||||
if ( DIG == NULL )
|
|
||||||
{
|
|
||||||
OutputDebugString(AIL_last_error());
|
|
||||||
Terminate();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_providers();
|
|
||||||
|
|
||||||
if ( !InitialiseSampleBanks() )
|
|
||||||
{
|
|
||||||
Terminate();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nSampleBankMemoryStartAddress[SFX_BANK_0] = (int32)AIL_mem_alloc_lock(nSampleBankSize[SFX_BANK_0]);
|
|
||||||
if ( !nSampleBankMemoryStartAddress[SFX_BANK_0] )
|
|
||||||
{
|
|
||||||
Terminate();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AUDIO_CACHE
|
#ifdef AUDIO_CACHE
|
||||||
TRACE("cache");
|
TRACE("cache");
|
||||||
FILE *cacheFile = fopen("audio\\sound.cache", "rb");
|
FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb");
|
||||||
|
bool CreateCache = false;
|
||||||
if (cacheFile) {
|
if (cacheFile) {
|
||||||
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||||
fclose(cacheFile);
|
fclose(cacheFile);
|
||||||
m_bInitialised = true;
|
}else
|
||||||
}else {
|
CreateCache = true;
|
||||||
#endif
|
#endif
|
||||||
TRACE("cdrom");
|
|
||||||
|
|
||||||
S32 tatalms;
|
|
||||||
char filepath[MAX_PATH];
|
char filepath[MAX_PATH];
|
||||||
|
bool bFileNotFound;
|
||||||
|
S32 tatalms;
|
||||||
|
|
||||||
|
TRACE("cdrom");
|
||||||
{
|
{
|
||||||
m_bInitialised = false;
|
m_bInitialised = false;
|
||||||
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Find path of WAVs (originally in HDD)
|
||||||
int32 drive = 'C';
|
int32 drive = 'C';
|
||||||
|
|
||||||
|
#ifndef NO_CDCHECK
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
char latter[2];
|
char latter[2];
|
||||||
|
@ -1111,47 +1035,145 @@ cSampleManager::Initialise(void)
|
||||||
if ( f )
|
if ( f )
|
||||||
{
|
{
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
strcpy(m_MiscomPath, m_szCDRomRootPath);
|
||||||
bool bFileNotFound = false;
|
break;
|
||||||
|
|
||||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
|
||||||
{
|
|
||||||
strcpy(filepath, m_szCDRomRootPath);
|
|
||||||
strcat(filepath, StreamedNameTable[i]);
|
|
||||||
|
|
||||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
|
||||||
|
|
||||||
if ( mp3Stream[0] )
|
|
||||||
{
|
|
||||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
|
||||||
|
|
||||||
AIL_close_stream(mp3Stream[0]);
|
|
||||||
mp3Stream[0] = NULL;
|
|
||||||
|
|
||||||
nStreamLength[i] = tatalms;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bFileNotFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !bFileNotFound )
|
|
||||||
{
|
|
||||||
m_bInitialised = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_bInitialised = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ( ++drive <= 'Z' );
|
} while ( ++drive <= 'Z' );
|
||||||
|
#else
|
||||||
|
m_MiscomPath[0] = '\0';
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( DIG == NULL )
|
||||||
|
{
|
||||||
|
OutputDebugString(AIL_last_error());
|
||||||
|
Terminate();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_providers();
|
||||||
|
|
||||||
|
m_szCDRomRootPath[0] = '\0';
|
||||||
|
|
||||||
|
strcpy(m_WavFilesPath, m_szCDRomRootPath);
|
||||||
|
|
||||||
|
#ifdef AUDIO_CACHE
|
||||||
|
if ( CreateCache )
|
||||||
|
#endif
|
||||||
|
for ( int32 i = STREAMED_SOUND_MISSION_MOBR1; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||||
|
{
|
||||||
|
strcpy(filepath, m_szCDRomRootPath);
|
||||||
|
strcat(filepath, StreamedNameTable[i]);
|
||||||
|
|
||||||
|
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||||
|
|
||||||
|
if ( mp3Stream[0] )
|
||||||
|
{
|
||||||
|
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||||
|
|
||||||
|
AIL_close_stream(mp3Stream[0]);
|
||||||
|
mp3Stream[0] = NULL;
|
||||||
|
|
||||||
|
nStreamLength[i] = tatalms;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_bInitialised = false;
|
||||||
|
Terminate();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find path of MP3s (originally in CD-Rom)
|
||||||
|
// if NO_CDCHECK is NOT defined but AUDIO_CACHE is defined, we still need to find MP3s' path, but will exit after the first file
|
||||||
|
#ifndef NO_CDCHECK
|
||||||
|
int32 drive = 'C';
|
||||||
|
do
|
||||||
|
{
|
||||||
|
latter[0] = drive;
|
||||||
|
latter[1] = '\0';
|
||||||
|
|
||||||
|
strcpy(m_szCDRomRootPath, latter);
|
||||||
|
strcat(m_szCDRomRootPath, ":");
|
||||||
|
strcat(m_MP3FilesPath, m_szCDRomRootPath);
|
||||||
|
#else
|
||||||
|
m_MP3FilesPath[0] = '\0';
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int32 i = 0; i < STREAMED_SOUND_MISSION_MOBR1; i++)
|
||||||
|
{
|
||||||
|
strcpy(filepath, m_MP3FilesPath);
|
||||||
|
strcat(filepath, StreamedNameTable[i]);
|
||||||
|
|
||||||
|
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||||
|
|
||||||
|
if (mp3Stream[0])
|
||||||
|
{
|
||||||
|
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||||
|
|
||||||
|
AIL_close_stream(mp3Stream[0]);
|
||||||
|
mp3Stream[0] = NULL;
|
||||||
|
|
||||||
|
bFileNotFound = false;
|
||||||
|
#ifdef AUDIO_CACHE
|
||||||
|
if (!CreateCache)
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
nStreamLength[i] = tatalms;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bFileNotFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NO_CDCHECK
|
||||||
|
if (!bFileNotFound) // otherwise try next drive
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
while (++drive <= 'Z');
|
||||||
|
#else
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( !bFileNotFound ) {
|
||||||
|
|
||||||
|
#ifdef AUDIO_CACHE
|
||||||
|
if ( CreateCache )
|
||||||
|
#endif
|
||||||
|
for ( int32 i = STREAMED_SOUND_MISSION_COMPLETED4; i < STREAMED_SOUND_MISSION_PAGER; i++ )
|
||||||
|
{
|
||||||
|
strcpy(filepath, m_MiscomPath);
|
||||||
|
strcat(filepath, StreamedNameTable[i]);
|
||||||
|
|
||||||
|
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
||||||
|
|
||||||
|
if ( mp3Stream[0] )
|
||||||
|
{
|
||||||
|
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
||||||
|
|
||||||
|
AIL_close_stream(mp3Stream[0]);
|
||||||
|
mp3Stream[0] = NULL;
|
||||||
|
|
||||||
|
nStreamLength[i] = tatalms;
|
||||||
|
bFileNotFound = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bFileNotFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bInitialised = !bFileNotFound;
|
||||||
|
|
||||||
if ( !m_bInitialised )
|
if ( !m_bInitialised )
|
||||||
{
|
{
|
||||||
#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
|
#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
|
||||||
|
@ -1171,77 +1193,31 @@ cSampleManager::Initialise(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
|
|
||||||
// hddaudio
|
|
||||||
/**
|
|
||||||
Option for user to play audio files directly from hard disk.
|
|
||||||
Copy the contents of the PLAY discs Audio directory into your installed Grand Theft Auto III Audio directory.
|
|
||||||
Grand Theft Auto III still requires the presence of the PLAY disc when started.
|
|
||||||
This may give better performance on some machines (though worse on others).
|
|
||||||
**/
|
|
||||||
TRACE("hddaudio 1.1 patch");
|
|
||||||
{
|
|
||||||
int32 streamLength[TOTAL_STREAMED_SOUNDS];
|
|
||||||
|
|
||||||
bool bFileNotFound = false;
|
|
||||||
char rootpath[MAX_PATH];
|
|
||||||
|
|
||||||
strcpy(_aHDDPath, m_szCDRomRootPath);
|
|
||||||
rootpath[0] = '\0';
|
|
||||||
|
|
||||||
FILE *f = fopen(StreamedNameTable[0], "rb");
|
|
||||||
|
|
||||||
if ( f )
|
|
||||||
{
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
|
||||||
{
|
|
||||||
strcpy(filepath, rootpath);
|
|
||||||
strcat(filepath, StreamedNameTable[i]);
|
|
||||||
|
|
||||||
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
|
|
||||||
|
|
||||||
if ( mp3Stream[0] )
|
|
||||||
{
|
|
||||||
AIL_stream_ms_position(mp3Stream[0], &tatalms, NULL);
|
|
||||||
|
|
||||||
AIL_close_stream(mp3Stream[0]);
|
|
||||||
mp3Stream[0] = NULL;
|
|
||||||
|
|
||||||
streamLength[i] = tatalms;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bFileNotFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bFileNotFound = true;
|
|
||||||
|
|
||||||
if ( !bFileNotFound )
|
|
||||||
{
|
|
||||||
strcpy(m_szCDRomRootPath, rootpath);
|
|
||||||
|
|
||||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
|
||||||
nStreamLength[i] = streamLength[i];
|
|
||||||
|
|
||||||
_bUseHDDAudio = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_bUseHDDAudio = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef AUDIO_CACHE
|
#ifdef AUDIO_CACHE
|
||||||
cacheFile = fopen("audio\\sound.cache", "wb");
|
if (CreateCache) {
|
||||||
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
cacheFile = fcaseopen("audio\\sound.cache", "wb");
|
||||||
fclose(cacheFile);
|
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||||
|
fclose(cacheFile);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ( !InitialiseSampleBanks() )
|
||||||
|
{
|
||||||
|
Terminate();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
nSampleBankMemoryStartAddress[SFX_BANK_0] = (int32)AIL_mem_alloc_lock(nSampleBankSize[SFX_BANK_0]);
|
||||||
|
if ( !nSampleBankMemoryStartAddress[SFX_BANK_0] )
|
||||||
|
{
|
||||||
|
Terminate();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
|
||||||
|
|
||||||
|
LoadSampleBank(SFX_BANK_0);
|
||||||
|
|
||||||
TRACE("stream");
|
TRACE("stream");
|
||||||
{
|
{
|
||||||
for ( int32 i = 0; i < MAX_STREAMS; i++ )
|
for ( int32 i = 0; i < MAX_STREAMS; i++ )
|
||||||
|
@ -1270,7 +1246,7 @@ cSampleManager::Initialise(void)
|
||||||
|
|
||||||
while ( n < m_nNumberOfProviders )
|
while ( n < m_nNumberOfProviders )
|
||||||
{
|
{
|
||||||
if ( !strcmp(providers[n].name, "Miles Fast 2D Positional Audio") )
|
if ( !strcmp(strupr(providers[n].name), "DIRECTSOUND3D SOFTWARE EMULATION") )
|
||||||
{
|
{
|
||||||
set_new_provider(n);
|
set_new_provider(n);
|
||||||
break;
|
break;
|
||||||
|
@ -1285,10 +1261,6 @@ cSampleManager::Initialise(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("bank");
|
|
||||||
|
|
||||||
LoadSampleBank(SFX_BANK_0);
|
|
||||||
|
|
||||||
// mp3
|
// mp3
|
||||||
TRACE("mp3");
|
TRACE("mp3");
|
||||||
{
|
{
|
||||||
|
@ -1411,26 +1383,25 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||||
#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
|
#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
|
||||||
char filepath[MAX_PATH];
|
char filepath[MAX_PATH];
|
||||||
|
|
||||||
#if defined(GTA3_1_1_PATCH)
|
strcpy(filepath, m_MiscomPath);
|
||||||
if (_bUseHDDAudio)
|
strcat(filepath, StreamedNameTable[STREAMED_SOUND_MISSION_COMPLETED4]);
|
||||||
strcpy(filepath, _aHDDPath);
|
|
||||||
else
|
|
||||||
strcpy(filepath, m_szCDRomRootPath);
|
|
||||||
#else
|
|
||||||
strcpy(filepath, m_szCDRomRootPath);
|
|
||||||
#endif // #if defined(GTA3_1_1_PATCH)
|
|
||||||
|
|
||||||
strcat(filepath, StreamedNameTable[AudioManager.GetRandomNumber(1) % TOTAL_STREAMED_SOUNDS]);
|
|
||||||
|
|
||||||
FILE *f = fopen(filepath, "rb");
|
FILE *f = fopen(filepath, "rb");
|
||||||
|
|
||||||
if ( f )
|
if ( f )
|
||||||
{
|
{
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
DMAudio.SetMusicMasterVolume(FrontEndMenuManager.m_PrefsMusicVolume);
|
||||||
|
DMAudio.SetEffectsMasterVolume(FrontEndMenuManager.m_PrefsSfxVolume);
|
||||||
|
DMAudio.Service();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DMAudio.SetMusicMasterVolume(0);
|
||||||
|
DMAudio.SetEffectsMasterVolume(0);
|
||||||
|
DMAudio.Service();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -1441,27 +1412,10 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||||
char
|
char
|
||||||
cSampleManager::GetCDAudioDriveLetter(void)
|
cSampleManager::GetCDAudioDriveLetter(void)
|
||||||
{
|
{
|
||||||
#if defined(GTA3_1_1_PATCH) || defined(GTA3_STEAM_PATCH) || defined(NO_CDCHECK)
|
if ( strlen(m_MiscomPath) != 0 )
|
||||||
if (_bUseHDDAudio)
|
return m_MiscomPath[0];
|
||||||
{
|
|
||||||
if ( strlen(_aHDDPath) != 0 )
|
|
||||||
return _aHDDPath[0];
|
|
||||||
else
|
|
||||||
return '\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( strlen(m_szCDRomRootPath) != 0 )
|
|
||||||
return m_szCDRomRootPath[0];
|
|
||||||
else
|
|
||||||
return '\0';
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if ( strlen(m_szCDRomRootPath) != 0 )
|
|
||||||
return m_szCDRomRootPath[0];
|
|
||||||
else
|
else
|
||||||
return '\0';
|
return '\0';
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1629,14 +1583,6 @@ cSampleManager::LoadPedComment(uint32 nComment)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MUSICMODE_FRONTEND:
|
|
||||||
{
|
|
||||||
if ( MusicManager.GetCurrentTrack() == STREAMED_SOUND_CUTSCENE_FINALE )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1699,69 +1645,45 @@ cSampleManager::UpdateReverb(void)
|
||||||
|
|
||||||
if ( AudioManager.GetFrameCounter() & 15 )
|
if ( AudioManager.GetFrameCounter() & 15 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float y = AudioManager.GetReflectionsDistance(REFLECTION_TOP) + AudioManager.GetReflectionsDistance(REFLECTION_BOTTOM);
|
|
||||||
float x = AudioManager.GetReflectionsDistance(REFLECTION_LEFT) + AudioManager.GetReflectionsDistance(REFLECTION_RIGHT);
|
|
||||||
float z = AudioManager.GetReflectionsDistance(REFLECTION_UP);
|
|
||||||
|
|
||||||
float normy = norm(y, 5.0f, 40.0f);
|
|
||||||
float normx = norm(x, 5.0f, 40.0f);
|
|
||||||
float normz = norm(z, 5.0f, 40.0f);
|
|
||||||
|
|
||||||
float fRatio;
|
float fRatio = 0.0f;
|
||||||
|
|
||||||
|
#define MIN_DIST 0.5f
|
||||||
|
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
|
||||||
|
|
||||||
|
fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_NORTH), 10.0f, 1/2.f);
|
||||||
|
fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_SOUTH), 10.0f, 1/2.f);
|
||||||
|
fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_WEST), 10.0f, 1/2.f);
|
||||||
|
fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_EAST), 10.0f, 1/2.f);
|
||||||
|
|
||||||
|
fRatio += CALCULATE_RATIO((AudioManager.GetReflectionsDistance(REFLECTION_NORTH) + AudioManager.GetReflectionsDistance(REFLECTION_SOUTH)) / 2.f, 4.0f, 1/3.f);
|
||||||
|
fRatio += CALCULATE_RATIO((AudioManager.GetReflectionsDistance(REFLECTION_WEST) + AudioManager.GetReflectionsDistance(REFLECTION_EAST)) / 2.f, 4.0f, 1/3.f);
|
||||||
|
|
||||||
|
#undef CALCULATE_RATIO
|
||||||
|
#undef MIN_DIST
|
||||||
|
|
||||||
if ( normy == 0.0f )
|
fRatio = clamp(fRatio, 0.0f, 0.6f);
|
||||||
{
|
|
||||||
if ( normx == 0.0f )
|
|
||||||
{
|
|
||||||
if ( normz == 0.0f )
|
|
||||||
fRatio = 0.3f;
|
|
||||||
else
|
|
||||||
fRatio = 0.5f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fRatio = 0.3f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( normx == 0.0f )
|
|
||||||
{
|
|
||||||
if ( normz == 0.0f )
|
|
||||||
fRatio = 0.3f;
|
|
||||||
else
|
|
||||||
fRatio = 0.5f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( normz == 0.0f )
|
|
||||||
fRatio = 0.3f;
|
|
||||||
else
|
|
||||||
fRatio = (normy+normx+normz) / 3.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fRatio = clamp(fRatio, usingEAX3==1 ? 0.0f : 0.30f, 1.0f);
|
|
||||||
|
|
||||||
if ( fRatio == _fPrevEaxRatioDestination )
|
if ( fRatio == _fPrevEaxRatioDestination )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( usingEAX3 )
|
if ( usingEAX3 )
|
||||||
{
|
{
|
||||||
|
fRatio = Min(fRatio * 1.67f, 1.0f);
|
||||||
if ( EAX3ListenerInterpolate(&StartEAX3, &FinishEAX3, fRatio, &EAX3Params, false) )
|
if ( EAX3ListenerInterpolate(&StartEAX3, &FinishEAX3, fRatio, &EAX3Params, false) )
|
||||||
{
|
{
|
||||||
AIL_set_3D_provider_preference(opened_provider, "EAX all parameters", &EAX3Params);
|
AIL_set_3D_provider_preference(opened_provider, "EAX all parameters", &EAX3Params);
|
||||||
_fEffectsLevel = 1.0f - fRatio * 0.5f;
|
_fEffectsLevel = fRatio * 0.75f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( _usingMilesFast2D )
|
if ( _usingMilesFast2D )
|
||||||
_fEffectsLevel = (1.0f - fRatio) * 0.4f;
|
_fEffectsLevel = fRatio * 0.8f;
|
||||||
else
|
else
|
||||||
_fEffectsLevel = (1.0f - fRatio) * 0.7f;
|
_fEffectsLevel = fRatio * 0.22f;
|
||||||
}
|
}
|
||||||
|
_fEffectsLevel = Min(_fEffectsLevel, 1.0f);
|
||||||
|
|
||||||
_fPrevEaxRatioDestination = fRatio;
|
_fPrevEaxRatioDestination = fRatio;
|
||||||
|
|
||||||
|
@ -1870,10 +1792,11 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
|
||||||
nChannelVolume[nChannel] = vol;
|
nChannelVolume[nChannel] = vol;
|
||||||
|
|
||||||
// increase the volume for JB.MP3 and S4_BDBD.MP3
|
// increase the volume for JB.MP3 and S4_BDBD.MP3
|
||||||
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
|
if (MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE ) {
|
||||||
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_FINALE )
|
if (MusicManager.GetCurrentTrack() == STREAMED_SOUND_CUTSCENE_FINALE)
|
||||||
{
|
nChannelVolume[nChannel] = 0;
|
||||||
nChannelVolume[nChannel] >>= 2;
|
else
|
||||||
|
nChannelVolume[nChannel] >>= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( opened_samples[nChannel] )
|
if ( opened_samples[nChannel] )
|
||||||
|
@ -2123,7 +2046,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
|
||||||
|
|
||||||
char filepath[MAX_PATH];
|
char filepath[MAX_PATH];
|
||||||
|
|
||||||
strcpy(filepath, m_szCDRomRootPath);
|
strcpy(filepath, nFile < STREAMED_SOUND_MISSION_COMPLETED4 ? m_MP3FilesPath : (nFile < STREAMED_SOUND_MISSION_MOBR1 ? m_MiscomPath : m_WavFilesPath));
|
||||||
strcat(filepath, StreamedNameTable[nFile]);
|
strcat(filepath, StreamedNameTable[nFile]);
|
||||||
|
|
||||||
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
|
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
|
||||||
|
@ -2189,7 +2112,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
if(mp3 == NULL) {
|
if(mp3 == NULL) {
|
||||||
_bIsMp3Active = false;
|
_bIsMp3Active = false;
|
||||||
nFile = 0;
|
nFile = 0;
|
||||||
strcpy(filename, m_szCDRomRootPath);
|
strcpy(filename, m_MiscomPath);
|
||||||
strcat(filename, StreamedNameTable[nFile]);
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
|
|
||||||
mp3Stream[nStream] =
|
mp3Stream[nStream] =
|
||||||
|
@ -2239,15 +2162,14 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
if ( e == NULL )
|
if ( e == NULL )
|
||||||
{
|
{
|
||||||
nFile = 0;
|
nFile = 0;
|
||||||
strcpy(filename, m_szCDRomRootPath);
|
strcpy(filename, m_MiscomPath);
|
||||||
strcat(filename, StreamedNameTable[nFile]);
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
mp3Stream[nStream] =
|
mp3Stream[nStream] =
|
||||||
AIL_open_stream(DIG, filename, 0);
|
AIL_open_stream(DIG, filename, 0);
|
||||||
if(mp3Stream[nStream]) {
|
if(mp3Stream[nStream]) {
|
||||||
AIL_set_stream_loop_count(
|
AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||||
mp3Stream[nStream], 1);
|
nStreamLoopedFlag[nStream] = true;
|
||||||
AIL_set_stream_ms_position(
|
AIL_set_stream_ms_position(mp3Stream[nStream], position);
|
||||||
mp3Stream[nStream], position);
|
|
||||||
AIL_pause_stream(mp3Stream[nStream], 0);
|
AIL_pause_stream(mp3Stream[nStream], 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2285,13 +2207,14 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
nFile = 0;
|
nFile = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(filename, m_szCDRomRootPath);
|
strcpy(filename, m_MiscomPath);
|
||||||
strcat(filename, StreamedNameTable[nFile]);
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
|
|
||||||
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
|
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
|
||||||
if ( mp3Stream[nStream] )
|
if ( mp3Stream[nStream] )
|
||||||
{
|
{
|
||||||
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
|
AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1);
|
||||||
|
nStreamLoopedFlag[nStream] = true;
|
||||||
AIL_set_stream_ms_position(mp3Stream[nStream], position);
|
AIL_set_stream_ms_position(mp3Stream[nStream], position);
|
||||||
AIL_pause_stream(mp3Stream[nStream], 0);
|
AIL_pause_stream(mp3Stream[nStream], 0);
|
||||||
return true;
|
return true;
|
||||||
|
@ -2355,11 +2278,14 @@ void
|
||||||
cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream)
|
cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream)
|
||||||
{
|
{
|
||||||
uint8 vol = nVolume;
|
uint8 vol = nVolume;
|
||||||
|
float boostMult = 0.0f;
|
||||||
|
|
||||||
if ( m_bInitialised )
|
if ( m_bInitialised )
|
||||||
{
|
{
|
||||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
|
||||||
|
if ( MusicManager.GetRadioInCar() == USERTRACK && !MusicManager.CheckForMusicInterruptions() )
|
||||||
|
boostMult = m_nMP3BoostVolume / 64.f;
|
||||||
|
|
||||||
nStreamVolume[nStream] = vol;
|
nStreamVolume[nStream] = vol;
|
||||||
nStreamPan[nStream] = nPan;
|
nStreamPan[nStream] = nPan;
|
||||||
|
@ -2368,13 +2294,13 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect
|
||||||
{
|
{
|
||||||
if ( nEffectFlag )
|
if ( nEffectFlag )
|
||||||
{
|
{
|
||||||
if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel?
|
if ( nStream == 1 || nStream == 2 )
|
||||||
AIL_set_stream_volume(mp3Stream[nStream], 128*vol*m_nEffectsVolume >> 14);
|
AIL_set_stream_volume(mp3Stream[nStream], 128*vol*m_nEffectsVolume >> 14);
|
||||||
else
|
else
|
||||||
AIL_set_stream_volume(mp3Stream[nStream], m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14);
|
AIL_set_stream_volume(mp3Stream[nStream], m_nEffectsFadeVolume*vol*m_nEffectsVolume >> 14);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AIL_set_stream_volume(mp3Stream[nStream], m_nMusicFadeVolume*vol*m_nMusicVolume >> 14);
|
AIL_set_stream_volume(mp3Stream[nStream], (m_nMusicFadeVolume*vol*(uint32)(m_nMusicVolume * boostMult + m_nMusicVolume)) >> 14);
|
||||||
|
|
||||||
AIL_set_stream_pan(mp3Stream[nStream], nPan);
|
AIL_set_stream_pan(mp3Stream[nStream], nPan);
|
||||||
}
|
}
|
||||||
|
@ -2460,4 +2386,4 @@ cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel)
|
||||||
nStreamLoopedFlag[nChannel] = nLoopFlag;
|
nStreamLoopedFlag[nChannel] = nLoopFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,8 @@
|
||||||
#include "Curves.h"
|
#include "Curves.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
|
||||||
//--MIAMI: done
|
//--MIAMI: file done
|
||||||
|
|
||||||
void CAutoPilot::ModifySpeed(float speed)
|
void CAutoPilot::ModifySpeed(float speed)
|
||||||
{
|
{
|
||||||
m_fMaxTrafficSpeed = Max(0.01f, speed);
|
m_fMaxTrafficSpeed = Max(0.01f, speed);
|
||||||
|
@ -40,7 +41,6 @@ void CAutoPilot::ModifySpeed(float speed)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void CAutoPilot::RemoveOnePathNode()
|
void CAutoPilot::RemoveOnePathNode()
|
||||||
{
|
{
|
||||||
--m_nPathFindNodesCount;
|
--m_nPathFindNodesCount;
|
||||||
|
@ -49,7 +49,6 @@ void CAutoPilot::RemoveOnePathNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
//--MIAMI: TODO
|
|
||||||
void CAutoPilot::Save(uint8*& buf)
|
void CAutoPilot::Save(uint8*& buf)
|
||||||
{
|
{
|
||||||
WriteSaveBuf<int32>(buf, m_nCurrentRouteNode);
|
WriteSaveBuf<int32>(buf, m_nCurrentRouteNode);
|
||||||
|
@ -73,6 +72,9 @@ void CAutoPilot::Save(uint8*& buf)
|
||||||
WriteSaveBuf<uint32>(buf, m_nTimeTempAction);
|
WriteSaveBuf<uint32>(buf, m_nTimeTempAction);
|
||||||
WriteSaveBuf<float>(buf, m_fMaxTrafficSpeed);
|
WriteSaveBuf<float>(buf, m_fMaxTrafficSpeed);
|
||||||
WriteSaveBuf<uint8>(buf, m_nCruiseSpeed);
|
WriteSaveBuf<uint8>(buf, m_nCruiseSpeed);
|
||||||
|
WriteSaveBuf<uint8>(buf, m_nCruiseSpeedMultiplierType);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
WriteSaveBuf<float>(buf, m_fCruiseSpeedMultiplier);
|
||||||
uint8 flags = 0;
|
uint8 flags = 0;
|
||||||
if (m_bSlowedDownBecauseOfCars) flags |= BIT(0);
|
if (m_bSlowedDownBecauseOfCars) flags |= BIT(0);
|
||||||
if (m_bSlowedDownBecauseOfPeds) flags |= BIT(1);
|
if (m_bSlowedDownBecauseOfPeds) flags |= BIT(1);
|
||||||
|
@ -80,6 +82,7 @@ void CAutoPilot::Save(uint8*& buf)
|
||||||
if (m_bStayInFastLane) flags |= BIT(3);
|
if (m_bStayInFastLane) flags |= BIT(3);
|
||||||
if (m_bIgnorePathfinding) flags |= BIT(4);
|
if (m_bIgnorePathfinding) flags |= BIT(4);
|
||||||
WriteSaveBuf<uint8>(buf, flags);
|
WriteSaveBuf<uint8>(buf, flags);
|
||||||
|
WriteSaveBuf<uint8>(buf, m_nSwitchDistance);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.x);
|
WriteSaveBuf<float>(buf, m_vecDestinationCoors.x);
|
||||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.y);
|
WriteSaveBuf<float>(buf, m_vecDestinationCoors.y);
|
||||||
|
@ -89,7 +92,6 @@ void CAutoPilot::Save(uint8*& buf)
|
||||||
SkipSaveBuf(buf, 6);
|
SkipSaveBuf(buf, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: TODO
|
|
||||||
void CAutoPilot::Load(uint8*& buf)
|
void CAutoPilot::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
|
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
|
||||||
|
@ -113,12 +115,16 @@ void CAutoPilot::Load(uint8*& buf)
|
||||||
m_nTimeTempAction = ReadSaveBuf<uint32>(buf);
|
m_nTimeTempAction = ReadSaveBuf<uint32>(buf);
|
||||||
m_fMaxTrafficSpeed = ReadSaveBuf<float>(buf);
|
m_fMaxTrafficSpeed = ReadSaveBuf<float>(buf);
|
||||||
m_nCruiseSpeed = ReadSaveBuf<uint8>(buf);
|
m_nCruiseSpeed = ReadSaveBuf<uint8>(buf);
|
||||||
|
m_nCruiseSpeedMultiplierType = ReadSaveBuf<uint8>(buf);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
m_fCruiseSpeedMultiplier = ReadSaveBuf<float>(buf);
|
||||||
uint8 flags = ReadSaveBuf<uint8>(buf);
|
uint8 flags = ReadSaveBuf<uint8>(buf);
|
||||||
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
||||||
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
||||||
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
||||||
m_bStayInFastLane = !!(flags & BIT(3));
|
m_bStayInFastLane = !!(flags & BIT(3));
|
||||||
m_bIgnorePathfinding = !!(flags & BIT(4));
|
m_bIgnorePathfinding = !!(flags & BIT(4));
|
||||||
|
m_nSwitchDistance = ReadSaveBuf<uint8>(buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_vecDestinationCoors.x = ReadSaveBuf<float>(buf);
|
m_vecDestinationCoors.x = ReadSaveBuf<float>(buf);
|
||||||
m_vecDestinationCoors.y = ReadSaveBuf<float>(buf);
|
m_vecDestinationCoors.y = ReadSaveBuf<float>(buf);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
CEntity *CBridge::pLiftRoad;
|
CEntity *CBridge::pLiftRoad;
|
||||||
CEntity *CBridge::pLiftPart;
|
CEntity *CBridge::pLiftPart;
|
||||||
CEntity *CBridge::pWeight;
|
CEntity *CBridge::pWeight;
|
||||||
|
|
|
@ -292,7 +292,7 @@ CCarCtrl::GenerateOneRandomCar()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ThePaths.NewGenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
|
if (!ThePaths.GenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
|
||||||
preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId,
|
preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId,
|
||||||
&positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1))
|
&positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1))
|
||||||
return;
|
return;
|
||||||
|
@ -3228,7 +3228,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
|
||||||
int curNode, nextNode;
|
int curNode, nextNode;
|
||||||
float posBetweenNodes;
|
float posBetweenNodes;
|
||||||
while (!created && attempts < 5){
|
while (!created && attempts < 5){
|
||||||
if (ThePaths.NewGenerateCarCreationCoors(pPlayerPos.x, pPlayerPos.y, 0.707f, 0.707f,
|
if (ThePaths.GenerateCarCreationCoors(pPlayerPos.x, pPlayerPos.y, 0.707f, 0.707f,
|
||||||
120.0f, -1.0f, true, &spawnPos, &curNode, &nextNode, &posBetweenNodes, false)){
|
120.0f, -1.0f, true, &spawnPos, &curNode, &nextNode, &posBetweenNodes, false)){
|
||||||
int16 colliding[2];
|
int16 colliding[2];
|
||||||
if (!ThePaths.GetNode(curNode)->bWaterPath) {
|
if (!ThePaths.GetNode(curNode)->bWaterPath) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
#include "Population.h"
|
#include "Population.h"
|
||||||
|
#include "Replay.h"
|
||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
|
@ -14,9 +15,8 @@
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "GameLogic.h"
|
#include "GameLogic.h"
|
||||||
#ifdef FIX_BUGS
|
|
||||||
#include "Replay.h"
|
//--MIAMI: file done except TODO
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FRENZY_ANY_PED -1
|
#define FRENZY_ANY_PED -1
|
||||||
#define FRENZY_ANY_CAR -2
|
#define FRENZY_ANY_CAR -2
|
||||||
|
@ -27,7 +27,8 @@ int32 CDarkel::TimeOfFrenzyStart;
|
||||||
int32 CDarkel::WeaponType;
|
int32 CDarkel::WeaponType;
|
||||||
int32 CDarkel::AmmoInterruptedWeapon;
|
int32 CDarkel::AmmoInterruptedWeapon;
|
||||||
int32 CDarkel::KillsNeeded;
|
int32 CDarkel::KillsNeeded;
|
||||||
int8 CDarkel::InterruptedWeapon;
|
int32 CDarkel::InterruptedWeaponType;
|
||||||
|
int32 CDarkel::InterruptedWeaponSelected;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: Collect timer/kill counter RGBA colors on top like in Hud/Frontend.
|
* TODO: Collect timer/kill counter RGBA colors on top like in Hud/Frontend.
|
||||||
|
@ -61,14 +62,12 @@ CDarkel::CalcFade(uint32 time, uint32 start, uint32 end)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Screen positions taken from VC
|
|
||||||
void
|
void
|
||||||
CDarkel::DrawMessages()
|
CDarkel::DrawMessages()
|
||||||
{
|
{
|
||||||
#ifdef FIX_BUGS
|
|
||||||
if (CReplay::IsPlayingBack())
|
if (CReplay::IsPlayingBack())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
switch (Status) {
|
switch (Status) {
|
||||||
case KILLFRENZY_ONGOING:
|
case KILLFRENZY_ONGOING:
|
||||||
{
|
{
|
||||||
|
@ -77,8 +76,8 @@ CDarkel::DrawMessages()
|
||||||
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(30.0f));
|
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(30.0f));
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
|
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
|
||||||
if (CDarkel::bStandardSoundAndMessages) {
|
if (bStandardSoundAndMessages) {
|
||||||
if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
|
if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
|
||||||
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
|
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
|
@ -103,8 +102,8 @@ CDarkel::DrawMessages()
|
||||||
CFont::SetCentreOff();
|
CFont::SetCentreOff();
|
||||||
CFont::SetRightJustifyOn();
|
CFont::SetRightJustifyOn();
|
||||||
CFont::SetFontStyle(FONT_HEADING);
|
CFont::SetFontStyle(FONT_HEADING);
|
||||||
if (CDarkel::TimeLimit >= 0) {
|
if (TimeLimit >= 0) {
|
||||||
uint32 timeLeft = CDarkel::TimeLimit - (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart);
|
uint32 timeLeft = TimeLimit - (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart);
|
||||||
sprintf(gString, "%d:%02d", timeLeft / 60000, timeLeft % 60000 / 1000);
|
sprintf(gString, "%d:%02d", timeLeft / 60000, timeLeft % 60000 / 1000);
|
||||||
AsciiToUnicode(gString, gUString);
|
AsciiToUnicode(gString, gUString);
|
||||||
if (timeLeft > 4000 || CTimer::GetFrameCounter() & 1) {
|
if (timeLeft > 4000 || CTimer::GetFrameCounter() & 1) {
|
||||||
|
@ -114,7 +113,7 @@ CDarkel::DrawMessages()
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(108.0f), gUString);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(108.0f), gUString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(gString, "%d", (CDarkel::KillsNeeded >= 0 ? CDarkel::KillsNeeded : 0));
|
sprintf(gString, "%d", (KillsNeeded >= 0 ? KillsNeeded : 0));
|
||||||
AsciiToUnicode(gString, gUString);
|
AsciiToUnicode(gString, gUString);
|
||||||
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString);
|
||||||
|
@ -124,9 +123,9 @@ CDarkel::DrawMessages()
|
||||||
}
|
}
|
||||||
case KILLFRENZY_PASSED:
|
case KILLFRENZY_PASSED:
|
||||||
{
|
{
|
||||||
if (CDarkel::bStandardSoundAndMessages) {
|
if (bStandardSoundAndMessages) {
|
||||||
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
|
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
|
||||||
if (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart < 5000) {
|
if (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart < 5000) {
|
||||||
CFont::SetBackgroundOff();
|
CFont::SetBackgroundOff();
|
||||||
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
|
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
|
@ -186,7 +185,20 @@ CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegisteredKills[vehicle->GetModelIndex()]++;
|
RegisteredKills[vehicle->GetModelIndex()]++;
|
||||||
CStats::CarsExploded++;
|
switch (vehicle->GetVehicleAppearance()) {
|
||||||
|
case VEHICLE_APPEARANCE_CAR:
|
||||||
|
case VEHICLE_APPEARANCE_BIKE:
|
||||||
|
CStats::CarsExploded++;;
|
||||||
|
break;
|
||||||
|
case VEHICLE_APPEARANCE_HELI:
|
||||||
|
case VEHICLE_APPEARANCE_PLANE:
|
||||||
|
CStats::HelisDestroyed++;
|
||||||
|
break;
|
||||||
|
case VEHICLE_APPEARANCE_BOAT:
|
||||||
|
CStats::BoatsExploded++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -245,23 +257,7 @@ CDarkel::ResetOnPlayerDeath()
|
||||||
Status = KILLFRENZY_FAILED;
|
Status = KILLFRENZY_FAILED;
|
||||||
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
|
||||||
eWeaponType fixedWeapon;
|
DealWithWeaponChangeAtEndOfFrenzy();
|
||||||
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
|
|
||||||
fixedWeapon = WEAPONTYPE_UZI;
|
|
||||||
else
|
|
||||||
fixedWeapon = (eWeaponType)WeaponType;
|
|
||||||
|
|
||||||
CPlayerPed *player = FindPlayerPed();
|
|
||||||
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
|
||||||
player->m_nSelectedWepSlot = InterruptedWeapon;
|
|
||||||
player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FindPlayerVehicle()) {
|
|
||||||
player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId);
|
|
||||||
player->m_currentWeapon = player->m_nSelectedWepSlot;
|
|
||||||
player->MakeChangesForNewWeapon(player->m_currentWeapon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -298,16 +294,19 @@ CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 mode
|
||||||
|
|
||||||
CPlayerPed *player = FindPlayerPed();
|
CPlayerPed *player = FindPlayerPed();
|
||||||
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
||||||
InterruptedWeapon = player->m_currentWeapon;
|
InterruptedWeaponSelected = player->GetWeapon()->m_eWeaponType;
|
||||||
player->GiveWeapon(fixedWeapon, 0);
|
player->RemoveWeaponAnims(InterruptedWeaponSelected, -1000.0f);
|
||||||
|
InterruptedWeaponType = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_eWeaponType;
|
||||||
AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal;
|
AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal;
|
||||||
|
if (InterruptedWeaponType)
|
||||||
|
CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponType)->m_nModelId)->AddRef();
|
||||||
player->GiveWeapon(fixedWeapon, 30000);
|
player->GiveWeapon(fixedWeapon, 30000);
|
||||||
player->m_nSelectedWepSlot = player->GetWeaponSlot(fixedWeapon);
|
player->SetCurrentWeapon(fixedWeapon);
|
||||||
player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot);
|
player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot);
|
||||||
|
|
||||||
if (FindPlayerVehicle()) {
|
if (FindPlayerVehicle()) {
|
||||||
player->m_currentWeapon = player->m_nSelectedWepSlot;
|
player->SetCurrentWeapon(FindPlayerPed()->m_nSelectedWepSlot);
|
||||||
player->GetWeapon()->m_nAmmoInClip = Min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition);
|
player->SetAmmo(fixedWeapon, Min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition));
|
||||||
player->ClearWeaponTarget();
|
player->ClearWeaponTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,24 +342,7 @@ CDarkel::Update()
|
||||||
CPopulation::m_AllRandomPedsThisType = -1;
|
CPopulation::m_AllRandomPedsThisType = -1;
|
||||||
Status = KILLFRENZY_FAILED;
|
Status = KILLFRENZY_FAILED;
|
||||||
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
DealWithWeaponChangeAtEndOfFrenzy();
|
||||||
eWeaponType fixedWeapon;
|
|
||||||
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
|
|
||||||
fixedWeapon = WEAPONTYPE_UZI;
|
|
||||||
else
|
|
||||||
fixedWeapon = (eWeaponType)WeaponType;
|
|
||||||
|
|
||||||
CPlayerPed *player = FindPlayerPed();
|
|
||||||
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
|
||||||
player->m_nSelectedWepSlot = InterruptedWeapon;
|
|
||||||
player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FindPlayerVehicle()) {
|
|
||||||
player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId);
|
|
||||||
player->m_currentWeapon = player->m_nSelectedWepSlot;
|
|
||||||
player->MakeChangesForNewWeapon(player->m_currentWeapon);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bStandardSoundAndMessages)
|
if (bStandardSoundAndMessages)
|
||||||
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_FAILED, 0);
|
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_FAILED, 0);
|
||||||
|
@ -377,25 +359,50 @@ CDarkel::Update()
|
||||||
|
|
||||||
FindPlayerPed()->m_pWanted->SetWantedLevel(0);
|
FindPlayerPed()->m_pWanted->SetWantedLevel(0);
|
||||||
|
|
||||||
eWeaponType fixedWeapon;
|
DealWithWeaponChangeAtEndOfFrenzy();
|
||||||
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
|
|
||||||
fixedWeapon = WEAPONTYPE_UZI;
|
|
||||||
else
|
|
||||||
fixedWeapon = (eWeaponType)WeaponType;
|
|
||||||
|
|
||||||
CPlayerPed* player = FindPlayerPed();
|
|
||||||
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
|
||||||
player->m_nSelectedWepSlot = InterruptedWeapon;
|
|
||||||
player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FindPlayerVehicle()) {
|
|
||||||
player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId);
|
|
||||||
player->m_currentWeapon = player->m_nSelectedWepSlot;
|
|
||||||
player->MakeChangesForNewWeapon(player->m_currentWeapon);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bStandardSoundAndMessages)
|
if (bStandardSoundAndMessages)
|
||||||
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_PASSED, 0);
|
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_PASSED, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CDarkel::DealWithWeaponChangeAtEndOfFrenzy()
|
||||||
|
{
|
||||||
|
eWeaponType fixedWeapon;
|
||||||
|
if (WeaponType == WEAPONTYPE_UZI_DRIVEBY)
|
||||||
|
fixedWeapon = WEAPONTYPE_UZI;
|
||||||
|
else
|
||||||
|
fixedWeapon = (eWeaponType)WeaponType;
|
||||||
|
|
||||||
|
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS && InterruptedWeaponType)
|
||||||
|
CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponType)->m_nModelId)->RemoveRef();
|
||||||
|
|
||||||
|
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
||||||
|
int slot = CWeaponInfo::GetWeaponInfo(fixedWeapon)->m_nWeaponSlot;
|
||||||
|
FindPlayerPed()->RemoveWeaponModel(FindPlayerPed()->GetWeapon(slot).GetInfo()->m_nModelId);
|
||||||
|
FindPlayerPed()->GetWeapon(slot).m_eWeaponType = WEAPONTYPE_UNARMED;
|
||||||
|
FindPlayerPed()->GetWeapon(slot).m_nAmmoTotal = 0;
|
||||||
|
FindPlayerPed()->GetWeapon(slot).m_nAmmoInClip = 0;
|
||||||
|
FindPlayerPed()->GetWeapon(slot).m_eWeaponState = WEAPONSTATE_READY;
|
||||||
|
FindPlayerPed()->RemoveWeaponAnims(fixedWeapon, -1000.0f);
|
||||||
|
CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo(fixedWeapon)->m_nModelId)->RemoveRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
||||||
|
player->m_nSelectedWepSlot = CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponSelected)->m_nWeaponSlot;
|
||||||
|
player->GiveWeapon((eWeaponType)InterruptedWeaponType, AmmoInterruptedWeapon, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindPlayerVehicle()) {
|
||||||
|
player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId);
|
||||||
|
if (FindPlayerPed()->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType)
|
||||||
|
FindPlayerPed()->m_nSelectedWepSlot = WEAPONSLOT_SUBMACHINEGUN;
|
||||||
|
else
|
||||||
|
FindPlayerPed()->m_nSelectedWepSlot = WEAPONSLOT_UNARMED;
|
||||||
|
player->SetCurrentWeapon(FindPlayerPed()->m_nSelectedWepSlot);
|
||||||
|
player->MakeChangesForNewWeapon(player->m_currentWeapon);
|
||||||
|
//player->RemoveDriveByAnims(); // TODO(MIAMI)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ private:
|
||||||
static int32 WeaponType;
|
static int32 WeaponType;
|
||||||
static int32 AmmoInterruptedWeapon;
|
static int32 AmmoInterruptedWeapon;
|
||||||
static int32 KillsNeeded;
|
static int32 KillsNeeded;
|
||||||
static int8 InterruptedWeapon;
|
static int32 InterruptedWeaponType;
|
||||||
|
static int32 InterruptedWeaponSelected;
|
||||||
static bool bStandardSoundAndMessages;
|
static bool bStandardSoundAndMessages;
|
||||||
static bool bNeedHeadShot;
|
static bool bNeedHeadShot;
|
||||||
static bool bProperKillFrenzy;
|
static bool bProperKillFrenzy;
|
||||||
|
@ -49,5 +50,6 @@ public:
|
||||||
static void ResetOnPlayerDeath();
|
static void ResetOnPlayerDeath();
|
||||||
static void StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot);
|
static void StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot);
|
||||||
static void Update();
|
static void Update();
|
||||||
|
static void DealWithWeaponChangeAtEndOfFrenzy();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,9 +45,10 @@ CVector CGameLogic::ShortCutDropOffForMission;
|
||||||
float CGameLogic::ShortCutDropOffOrientationForMission;
|
float CGameLogic::ShortCutDropOffOrientationForMission;
|
||||||
bool CGameLogic::MissionDropOffReadyToBeUsed;
|
bool CGameLogic::MissionDropOffReadyToBeUsed;
|
||||||
|
|
||||||
//--MIAMI: file done except TODO
|
//--MIAMI: file done
|
||||||
|
|
||||||
#define SHORTCUT_TAXI_COST (9)
|
#define SHORTCUT_TAXI_COST (9)
|
||||||
|
#define TOTAL_BUSTED_AUDIO (28)
|
||||||
|
|
||||||
void
|
void
|
||||||
CGameLogic::InitAtStartOfGame()
|
CGameLogic::InitAtStartOfGame()
|
||||||
|
@ -196,7 +197,7 @@ CGameLogic::Update()
|
||||||
sprintf(name, pPlayerInfo.m_nCurrentBustedAudio >= 10 ? "bust_%d" : "bust_0%d", pPlayerInfo.m_nCurrentBustedAudio);
|
sprintf(name, pPlayerInfo.m_nCurrentBustedAudio >= 10 ? "bust_%d" : "bust_0%d", pPlayerInfo.m_nCurrentBustedAudio);
|
||||||
DMAudio.ClearMissionAudio(0);
|
DMAudio.ClearMissionAudio(0);
|
||||||
DMAudio.PreloadMissionAudio(0, name);
|
DMAudio.PreloadMissionAudio(0, name);
|
||||||
pPlayerInfo.m_nCurrentBustedAudio = pPlayerInfo.m_nCurrentBustedAudio % 28 + 1; // enum? const? TODO
|
pPlayerInfo.m_nCurrentBustedAudio = pPlayerInfo.m_nCurrentBustedAudio % TOTAL_BUSTED_AUDIO + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 4000 &&
|
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 4000 &&
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
#define CRUSHER_GARAGE_X1 (1135.5f)
|
#define CRUSHER_GARAGE_X1 (1135.5f)
|
||||||
#define CRUSHER_GARAGE_Y1 (57.0f)
|
#define CRUSHER_GARAGE_Y1 (57.0f)
|
||||||
#define CRUSHER_GARAGE_Z1 (-1.0f)
|
#define CRUSHER_GARAGE_Z1 (-1.0f)
|
||||||
|
@ -236,7 +238,6 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X
|
||||||
pGarage->m_nTimeToStartAction = 0;
|
pGarage->m_nTimeToStartAction = 0;
|
||||||
pGarage->field_2 = false;
|
pGarage->field_2 = false;
|
||||||
pGarage->m_nTargetModelIndex = targetId;
|
pGarage->m_nTargetModelIndex = targetId;
|
||||||
pGarage->field_96 = nil;
|
|
||||||
pGarage->m_bCollectedCarsState = 0;
|
pGarage->m_bCollectedCarsState = 0;
|
||||||
pGarage->m_bDeactivated = false;
|
pGarage->m_bDeactivated = false;
|
||||||
pGarage->m_bResprayHappened = false;
|
pGarage->m_bResprayHappened = false;
|
||||||
|
@ -2141,11 +2142,11 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(MIAMI)
|
|
||||||
void CGarages::Save(uint8 * buf, uint32 * size)
|
void CGarages::Save(uint8 * buf, uint32 * size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
//INITSAVEBUF
|
||||||
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
|
*size = 7876; // for some reason it's not actual size again
|
||||||
|
//*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
|
||||||
CloseHideOutGaragesBeforeSave();
|
CloseHideOutGaragesBeforeSave();
|
||||||
WriteSaveBuf(buf, NumGarages);
|
WriteSaveBuf(buf, NumGarages);
|
||||||
WriteSaveBuf(buf, (uint32)BombsAreFree);
|
WriteSaveBuf(buf, (uint32)BombsAreFree);
|
||||||
|
@ -2163,7 +2164,7 @@ INITSAVEBUF
|
||||||
}
|
}
|
||||||
for (int i = 0; i < NUM_GARAGES; i++)
|
for (int i = 0; i < NUM_GARAGES; i++)
|
||||||
WriteSaveBuf(buf, aGarages[i]);
|
WriteSaveBuf(buf, aGarages[i]);
|
||||||
VALIDATESAVEBUF(*size);
|
//VALIDATESAVEBUF(*size);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
|
const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
|
||||||
|
@ -2185,11 +2186,11 @@ const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(MIAMI)
|
|
||||||
void CGarages::Load(uint8* buf, uint32 size)
|
void CGarages::Load(uint8* buf, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
//INITSAVEBUF
|
||||||
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
|
assert(size = 7876);
|
||||||
|
//assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
|
||||||
CloseHideOutGaragesBeforeSave();
|
CloseHideOutGaragesBeforeSave();
|
||||||
NumGarages = ReadSaveBuf<uint32>(buf);
|
NumGarages = ReadSaveBuf<uint32>(buf);
|
||||||
BombsAreFree = ReadSaveBuf<uint32>(buf);
|
BombsAreFree = ReadSaveBuf<uint32>(buf);
|
||||||
|
@ -2210,7 +2211,6 @@ INITSAVEBUF
|
||||||
aGarages[i].m_pDoor1 = nil;
|
aGarages[i].m_pDoor1 = nil;
|
||||||
aGarages[i].m_pDoor2 = nil;
|
aGarages[i].m_pDoor2 = nil;
|
||||||
aGarages[i].m_pTarget = nil;
|
aGarages[i].m_pTarget = nil;
|
||||||
aGarages[i].field_96 = nil;
|
|
||||||
aGarages[i].m_bRecreateDoorOnNextRefresh = true;
|
aGarages[i].m_bRecreateDoorOnNextRefresh = true;
|
||||||
aGarages[i].RefreshDoorPointers(true);
|
aGarages[i].RefreshDoorPointers(true);
|
||||||
if (aGarages[i].m_eGarageType == GARAGE_CRUSHER)
|
if (aGarages[i].m_eGarageType == GARAGE_CRUSHER)
|
||||||
|
@ -2218,7 +2218,7 @@ INITSAVEBUF
|
||||||
else
|
else
|
||||||
aGarages[i].UpdateDoorsHeight();
|
aGarages[i].UpdateDoorsHeight();
|
||||||
}
|
}
|
||||||
VALIDATESAVEBUF(size);
|
//VALIDATESAVEBUF(size);
|
||||||
|
|
||||||
MessageEndTime = 0;
|
MessageEndTime = 0;
|
||||||
bCamShouldBeOutisde = false;
|
bCamShouldBeOutisde = false;
|
||||||
|
|
|
@ -132,7 +132,6 @@ class CGarage
|
||||||
uint32 m_nTimeToStartAction;
|
uint32 m_nTimeToStartAction;
|
||||||
uint8 m_bCollectedCarsState;
|
uint8 m_bCollectedCarsState;
|
||||||
CVehicle *m_pTarget;
|
CVehicle *m_pTarget;
|
||||||
void* field_96; // unused
|
|
||||||
CStoredCar m_sStoredCar; // not needed
|
CStoredCar m_sStoredCar; // not needed
|
||||||
|
|
||||||
void OpenThisGarage();
|
void OpenThisGarage();
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "Lines.h" // for debug
|
#include "Lines.h" // for debug
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done except mobile unused function
|
||||||
|
|
||||||
bool gbShowPedPaths;
|
bool gbShowPedPaths;
|
||||||
bool gbShowCarPaths;
|
bool gbShowCarPaths;
|
||||||
bool gbShowCarPathsLinks;
|
bool gbShowCarPathsLinks;
|
||||||
|
@ -226,7 +228,6 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
// Make sure all externals link TO an internal
|
// Make sure all externals link TO an internal
|
||||||
void
|
void
|
||||||
CPathInfoForObject::SwapConnectionsToBeRightWayRound(void)
|
CPathInfoForObject::SwapConnectionsToBeRightWayRound(void)
|
||||||
|
@ -246,7 +247,6 @@ CPathInfoForObject::SwapConnectionsToBeRightWayRound(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::Init(void)
|
CPathFind::Init(void)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +263,6 @@ CPathFind::Init(void)
|
||||||
m_pathNodes[i].distance = MAX_DIST;
|
m_pathNodes[i].distance = MAX_DIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
|
CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
|
||||||
{
|
{
|
||||||
|
@ -294,14 +293,12 @@ CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
|
||||||
NumDetachedCarNodeGroups = 0;
|
NumDetachedCarNodeGroups = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::RegisterMapObject(CTreadable *mapObject)
|
CPathFind::RegisterMapObject(CTreadable *mapObject)
|
||||||
{
|
{
|
||||||
m_mapObjects[m_numMapObjects++] = mapObject;
|
m_mapObjects[m_numMapObjects++] = mapObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, float width, bool crossing, uint8 spawnRate)
|
CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, float width, bool crossing, uint8 spawnRate)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +326,6 @@ CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x,
|
||||||
InfoForTilePeds[id*12].SwapConnectionsToBeRightWayRound();
|
InfoForTilePeds[id*12].SwapConnectionsToBeRightWayRound();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, float width, int8 numLeft, int8 numRight,
|
CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, float width, int8 numLeft, int8 numRight,
|
||||||
bool disabled, bool betweenLevels, uint8 speedLimit, bool roadBlock, bool waterPath, uint8 spawnRate)
|
bool disabled, bool betweenLevels, uint8 speedLimit, bool roadBlock, bool waterPath, uint8 spawnRate)
|
||||||
|
@ -358,7 +354,6 @@ CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x,
|
||||||
InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound();
|
InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::StoreDetachedNodeInfoPed(int32 node, int8 type, int32 next, float x, float y, float z, float width, bool crossing,
|
CPathFind::StoreDetachedNodeInfoPed(int32 node, int8 type, int32 next, float x, float y, float z, float width, bool crossing,
|
||||||
bool disabled, bool betweenLevels, uint8 spawnRate)
|
bool disabled, bool betweenLevels, uint8 spawnRate)
|
||||||
|
@ -392,7 +387,6 @@ CPathFind::StoreDetachedNodeInfoPed(int32 node, int8 type, int32 next, float x,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::StoreDetachedNodeInfoCar(int32 node, int8 type, int32 next, float x, float y, float z, float width, int8 numLeft, int8 numRight,
|
CPathFind::StoreDetachedNodeInfoCar(int32 node, int8 type, int32 next, float x, float y, float z, float width, int8 numLeft, int8 numRight,
|
||||||
bool disabled, bool betweenLevels, uint8 speedLimit, bool roadBlock, bool waterPath, uint8 spawnRate, bool onlySmallBoats)
|
bool disabled, bool betweenLevels, uint8 speedLimit, bool roadBlock, bool waterPath, uint8 spawnRate, bool onlySmallBoats)
|
||||||
|
@ -426,7 +420,6 @@ CPathFind::StoreDetachedNodeInfoCar(int32 node, int8 type, int32 next, float x,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::CalcNodeCoors(float x, float y, float z, int id, CVector *out)
|
CPathFind::CalcNodeCoors(float x, float y, float z, int id, CVector *out)
|
||||||
{
|
{
|
||||||
|
@ -437,7 +430,6 @@ CPathFind::CalcNodeCoors(float x, float y, float z, int id, CVector *out)
|
||||||
*out = m_mapObjects[id]->GetMatrix() * pos;
|
*out = m_mapObjects[id]->GetMatrix() * pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
bool
|
bool
|
||||||
CPathFind::LoadPathFindData(void)
|
CPathFind::LoadPathFindData(void)
|
||||||
{
|
{
|
||||||
|
@ -445,7 +437,6 @@ CPathFind::LoadPathFindData(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::PreparePathData(void)
|
CPathFind::PreparePathData(void)
|
||||||
{
|
{
|
||||||
|
@ -536,7 +527,6 @@ CPathFind::PreparePathData(void)
|
||||||
printf("Done with PreparePathData\n");
|
printf("Done with PreparePathData\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
/* String together connected nodes in a list by a flood fill algorithm */
|
/* String together connected nodes in a list by a flood fill algorithm */
|
||||||
void
|
void
|
||||||
CPathFind::CountFloodFillGroups(uint8 type)
|
CPathFind::CountFloodFillGroups(uint8 type)
|
||||||
|
@ -608,7 +598,6 @@ CPathFind::CountFloodFillGroups(uint8 type)
|
||||||
|
|
||||||
int32 TempListLength;
|
int32 TempListLength;
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo,
|
CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo,
|
||||||
float maxdist, CPathInfoForObject *detachednodes, int numDetached)
|
float maxdist, CPathInfoForObject *detachednodes, int numDetached)
|
||||||
|
@ -813,7 +802,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
||||||
m_carPathLinks[m_numCarPathLinks].dirY = tempnodes[j].dirY;
|
m_carPathLinks[m_numCarPathLinks].dirY = tempnodes[j].dirY;
|
||||||
m_carPathLinks[m_numCarPathLinks].x = tempnodes[j].pos.x*8.0f;
|
m_carPathLinks[m_numCarPathLinks].x = tempnodes[j].pos.x*8.0f;
|
||||||
m_carPathLinks[m_numCarPathLinks].y = tempnodes[j].pos.y*8.0f;
|
m_carPathLinks[m_numCarPathLinks].y = tempnodes[j].pos.y*8.0f;
|
||||||
m_carPathLinks[m_numCarPathLinks].flag1 = false;
|
m_carPathLinks[m_numCarPathLinks].trafficLightDirection = false;
|
||||||
m_carPathLinks[m_numCarPathLinks].width = tempnodes[j].width;
|
m_carPathLinks[m_numCarPathLinks].width = tempnodes[j].width;
|
||||||
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
||||||
m_carPathLinks[m_numCarPathLinks].numLeftLanes = tempnodes[j].numLeftLanes;
|
m_carPathLinks[m_numCarPathLinks].numLeftLanes = tempnodes[j].numLeftLanes;
|
||||||
|
@ -892,7 +881,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
||||||
m_carPathLinks[m_numCarPathLinks].dirY = dy*100.0f;
|
m_carPathLinks[m_numCarPathLinks].dirY = dy*100.0f;
|
||||||
m_carPathLinks[m_numCarPathLinks].x = posx*8.0f;
|
m_carPathLinks[m_numCarPathLinks].x = posx*8.0f;
|
||||||
m_carPathLinks[m_numCarPathLinks].y = posy*8.0f;
|
m_carPathLinks[m_numCarPathLinks].y = posy*8.0f;
|
||||||
m_carPathLinks[m_numCarPathLinks].flag1 = false;
|
m_carPathLinks[m_numCarPathLinks].trafficLightDirection = false;
|
||||||
m_carPathLinks[m_numCarPathLinks].width = width;
|
m_carPathLinks[m_numCarPathLinks].width = width;
|
||||||
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
||||||
m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1;
|
m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1;
|
||||||
|
@ -1028,7 +1017,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
||||||
delete[] mapObjIndices;
|
delete[] mapObjIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
float
|
float
|
||||||
CPathFind::CalcRoadDensity(float x, float y)
|
CPathFind::CalcRoadDensity(float x, float y)
|
||||||
{
|
{
|
||||||
|
@ -1051,7 +1039,6 @@ CPathFind::CalcRoadDensity(float x, float y)
|
||||||
return density/2500.0f;
|
return density/2500.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
bool
|
bool
|
||||||
CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2)
|
CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2)
|
||||||
{
|
{
|
||||||
|
@ -1062,7 +1049,6 @@ CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
bool
|
bool
|
||||||
CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2)
|
CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2)
|
||||||
{
|
{
|
||||||
|
@ -1073,7 +1059,6 @@ CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::AddNodeToList(CPathNode *node, int32 listId)
|
CPathFind::AddNodeToList(CPathNode *node, int32 listId)
|
||||||
{
|
{
|
||||||
|
@ -1086,7 +1071,6 @@ CPathFind::AddNodeToList(CPathNode *node, int32 listId)
|
||||||
node->distance = listId;
|
node->distance = listId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::RemoveNodeFromList(CPathNode *node)
|
CPathFind::RemoveNodeFromList(CPathNode *node)
|
||||||
{
|
{
|
||||||
|
@ -1095,7 +1079,6 @@ CPathFind::RemoveNodeFromList(CPathNode *node)
|
||||||
node->GetNext()->SetPrev(node->GetPrev());
|
node->GetNext()->SetPrev(node->GetPrev());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::RemoveBadStartNode(CVector pos, CPathNode **nodes, int16 *n)
|
CPathFind::RemoveBadStartNode(CVector pos, CPathNode **nodes, int16 *n)
|
||||||
{
|
{
|
||||||
|
@ -1123,7 +1106,6 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
|
CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
|
||||||
{
|
{
|
||||||
|
@ -1139,7 +1121,6 @@ CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::SwitchRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable)
|
CPathFind::SwitchRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable)
|
||||||
{
|
{
|
||||||
|
@ -1155,7 +1136,6 @@ CPathFind::SwitchRoadsOffInArea(float x1, float x2, float y1, float y2, float z1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::SwitchPedRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable)
|
CPathFind::SwitchPedRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable)
|
||||||
{
|
{
|
||||||
|
@ -1171,7 +1151,6 @@ CPathFind::SwitchPedRoadsOffInArea(float x1, float x2, float y1, float y2, float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: unused (still needed for script here)
|
|
||||||
void
|
void
|
||||||
CPathFind::SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float y2, float z2, float length, uint8 type, uint8 mode)
|
CPathFind::SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float y2, float z2, float length, uint8 type, uint8 mode)
|
||||||
{
|
{
|
||||||
|
@ -1223,7 +1202,6 @@ CPathFind::SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: unused (still needed for script here)
|
|
||||||
void
|
void
|
||||||
CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId)
|
CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId)
|
||||||
{
|
{
|
||||||
|
@ -1239,7 +1217,6 @@ CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: unused (still needed for script here)
|
|
||||||
void
|
void
|
||||||
CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
|
CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
|
||||||
{
|
{
|
||||||
|
@ -1254,7 +1231,6 @@ CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: unused (still needed for script here)
|
|
||||||
void
|
void
|
||||||
CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
|
CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
|
||||||
{
|
{
|
||||||
|
@ -1269,9 +1245,8 @@ CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
int32
|
int32
|
||||||
CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, bool ignoreFlagB4, bool bWaterPath)
|
CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, bool ignoreSelected, bool bWaterPath)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int firstNode, lastNode;
|
int firstNode, lastNode;
|
||||||
|
@ -1293,7 +1268,7 @@ CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bo
|
||||||
for(i = firstNode; i < lastNode; i++){
|
for(i = firstNode; i < lastNode; i++){
|
||||||
if(ignoreDisabled && m_pathNodes[i].bDisabled) continue;
|
if(ignoreDisabled && m_pathNodes[i].bDisabled) continue;
|
||||||
if(ignoreBetweenLevels && m_pathNodes[i].bBetweenLevels) continue;
|
if(ignoreBetweenLevels && m_pathNodes[i].bBetweenLevels) continue;
|
||||||
if(ignoreFlagB4 && m_pathNodes[i].flagB4) continue;
|
if(ignoreSelected && m_pathNodes[i].bSelected) continue;
|
||||||
if(bWaterPath != m_pathNodes[i].bWaterPath) continue;
|
if(bWaterPath != m_pathNodes[i].bWaterPath) continue;
|
||||||
dist = Abs(m_pathNodes[i].GetX() - coors.x) +
|
dist = Abs(m_pathNodes[i].GetX() - coors.x) +
|
||||||
Abs(m_pathNodes[i].GetY() - coors.y) +
|
Abs(m_pathNodes[i].GetY() - coors.y) +
|
||||||
|
@ -1306,7 +1281,6 @@ CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bo
|
||||||
return closestDist < distLimit ? closestNode : -1;
|
return closestDist < distLimit ? closestNode : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
int32
|
int32
|
||||||
CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY)
|
CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY)
|
||||||
{
|
{
|
||||||
|
@ -1345,7 +1319,102 @@ CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, floa
|
||||||
return closestNode;
|
return closestNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
void
|
||||||
|
CPathFind::FindNodePairClosestToCoors(CVector coors, uint8 type, int* node1, int* node2, float* angle, float minDist, float maxDist, bool ignoreDisabled, bool ignoreBetweenLevels, bool bWaterPath)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
int firstNode, lastNode, connectedNode;
|
||||||
|
float dist;
|
||||||
|
float closestDist = 10000.0f;
|
||||||
|
int closestNode = 0, closestConnectedNode = 0;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case PATH_CAR:
|
||||||
|
firstNode = 0;
|
||||||
|
lastNode = m_numCarPathNodes;
|
||||||
|
break;
|
||||||
|
case PATH_PED:
|
||||||
|
firstNode = m_numCarPathNodes;
|
||||||
|
lastNode = m_numPathNodes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = firstNode; i < lastNode; i++) {
|
||||||
|
if (ignoreDisabled && m_pathNodes[i].bDisabled) continue;
|
||||||
|
if (ignoreBetweenLevels && m_pathNodes[i].bBetweenLevels) continue;
|
||||||
|
if (bWaterPath != m_pathNodes[i].bWaterPath) continue;
|
||||||
|
dist = Abs(m_pathNodes[i].GetX() - coors.x) +
|
||||||
|
Abs(m_pathNodes[i].GetY() - coors.y) +
|
||||||
|
3.0f * Abs(m_pathNodes[i].GetZ() - coors.z);
|
||||||
|
if (dist < closestDist) {
|
||||||
|
for (j = 0; j < m_pathNodes[i].numLinks; j++) {
|
||||||
|
connectedNode = ConnectedNode(m_pathNodes[i].firstLink + j);
|
||||||
|
if (ignoreDisabled && m_pathNodes[connectedNode].bDisabled) continue;
|
||||||
|
if (ignoreBetweenLevels && m_pathNodes[connectedNode].bBetweenLevels) continue;
|
||||||
|
if (bWaterPath != m_pathNodes[connectedNode].bWaterPath) continue;
|
||||||
|
if ((m_pathNodes[connectedNode].GetPosition() - m_pathNodes[i].GetPosition()).Magnitude() > minDist) {
|
||||||
|
closestDist = dist;
|
||||||
|
closestNode = i;
|
||||||
|
closestConnectedNode = connectedNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (closestDist < maxDist) {
|
||||||
|
*node1 = closestNode;
|
||||||
|
*node2 = closestConnectedNode;
|
||||||
|
CVector dir(m_pathNodes[*node2].GetX() - m_pathNodes[*node1].GetX(), m_pathNodes[*node2].GetY() - m_pathNodes[*node1].GetY(), 0.0f);
|
||||||
|
dir.Normalise();
|
||||||
|
*angle = RADTODEG(Atan2(-dir.x, dir.y));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*node1 = -1;
|
||||||
|
*node2 = -1;
|
||||||
|
*angle = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32
|
||||||
|
CPathFind::FindNthNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, int N, bool bWaterPath)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int firstNode, lastNode;
|
||||||
|
switch (type) {
|
||||||
|
case PATH_CAR:
|
||||||
|
firstNode = 0;
|
||||||
|
lastNode = m_numCarPathNodes;
|
||||||
|
break;
|
||||||
|
case PATH_PED:
|
||||||
|
firstNode = m_numCarPathNodes;
|
||||||
|
lastNode = m_numPathNodes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (i = firstNode; i < lastNode; i++)
|
||||||
|
m_pathNodes[i].bSelected = false;
|
||||||
|
|
||||||
|
for (; N > 0; N--) {
|
||||||
|
i = FindNodeClosestToCoors(coors, type, distLimit, ignoreDisabled, ignoreBetweenLevels, true, bWaterPath);
|
||||||
|
if (i < 0)
|
||||||
|
return -1;
|
||||||
|
m_pathNodes[i].bSelected = true;
|
||||||
|
}
|
||||||
|
return FindNodeClosestToCoors(coors, type, distLimit, ignoreDisabled, ignoreBetweenLevels, true, bWaterPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector
|
||||||
|
CPathFind::FindNodeCoorsForScript(int32 id)
|
||||||
|
{
|
||||||
|
// the point is to return valid position in case there is a divider in the middle of the road
|
||||||
|
if (!m_pathNodes[id].HasDivider() || m_pathNodes[id].numLinks == 0)
|
||||||
|
return m_pathNodes[id].GetPosition();
|
||||||
|
CVector2D dir(m_pathNodes[ConnectedNode(m_pathNodes[id].firstLink)].GetX() - m_pathNodes[id].GetX(),
|
||||||
|
m_pathNodes[ConnectedNode(m_pathNodes[id].firstLink)].GetY() - m_pathNodes[id].GetY());
|
||||||
|
dir.Normalise();
|
||||||
|
if (dir.x < 0)
|
||||||
|
dir = -dir;
|
||||||
|
return m_pathNodes[id].GetPosition() + CVector(-dir.x, dir.y, 0.0f) * (LANE_WIDTH / 2 + m_pathNodes[id].GetDividerWidth());
|
||||||
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId)
|
CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId)
|
||||||
{
|
{
|
||||||
|
@ -1357,7 +1426,6 @@ CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId)
|
||||||
return RADTODEG(dir.Heading());
|
return RADTODEG(dir.Heading());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: unused (still needed for script here)
|
|
||||||
float
|
float
|
||||||
CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards)
|
CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards)
|
||||||
{
|
{
|
||||||
|
@ -1401,10 +1469,8 @@ CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, flo
|
||||||
return RADTODEG(dir.Heading());
|
return RADTODEG(dir.Heading());
|
||||||
}
|
}
|
||||||
|
|
||||||
// no "New" in MIAMI
|
|
||||||
//--MIAMI: TODO
|
|
||||||
bool
|
bool
|
||||||
CPathFind::NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled)
|
CPathFind::GenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int node1, node2;
|
int node1, node2;
|
||||||
|
@ -1457,67 +1523,83 @@ CPathFind::NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: TODO
|
|
||||||
bool
|
bool
|
||||||
CPathFind::GeneratePedCreationCoors(float x, float y, float minDist, float maxDist, float minDistOffScreen, float maxDistOffScreen, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, CMatrix *camMatrix)
|
CPathFind::GeneratePedCreationCoors(float x, float y, float minDist, float maxDist, float minDistOffScreen, float maxDistOffScreen, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, CMatrix *camMatrix)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int node1, node2;
|
int node1, node2;
|
||||||
|
float node1_dist, node2_dist;
|
||||||
|
static int32 node_cnt;
|
||||||
|
|
||||||
if(m_numPedPathNodes == 0)
|
if(m_numPedPathNodes == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for(i = 0; i < 400; i++){
|
for(i = 0; i < 230; i++){
|
||||||
node1 = m_numCarPathNodes + CGeneral::GetRandomNumber() % m_numPedPathNodes;
|
if (node_cnt++ >= m_numPedPathNodes)
|
||||||
if(DistanceSqr2D(m_pathNodes[node1].GetPosition(), x, y) < sq(maxDist+30.0f)){
|
node_cnt = 0;
|
||||||
if(m_pathNodes[node1].numLinks == 0)
|
node1 = node_cnt + m_numCarPathNodes;
|
||||||
continue;
|
node1_dist = Distance2D(m_pathNodes[node1].GetPosition(), x, y);
|
||||||
int link = m_pathNodes[node1].firstLink + CGeneral::GetRandomNumber() % m_pathNodes[node1].numLinks;
|
if(node1_dist < maxDist+30.0f){
|
||||||
if(ConnectionCrossesRoad(link))
|
if(m_pathNodes[node1].numLinks != 0)
|
||||||
continue;
|
break;
|
||||||
node2 = ConnectedNode(link);
|
}
|
||||||
if(m_pathNodes[node1].bDisabled || m_pathNodes[node2].bDisabled)
|
}
|
||||||
continue;
|
if (i >= 230)
|
||||||
|
return false;
|
||||||
|
|
||||||
float f2 = (CGeneral::GetRandomNumber()&0xFF)/256.0f;
|
for(i = 0; i < m_pathNodes[node1].numLinks; i++){
|
||||||
float f1 = 1.0f - f2;
|
int link = m_pathNodes[node1].firstLink + i;
|
||||||
*pPositionBetweenNodes = f2;
|
if(ConnectionCrossesRoad(link))
|
||||||
CVector pos = m_pathNodes[node1].GetPosition()*f1 + m_pathNodes[node2].GetPosition()*f2;
|
continue;
|
||||||
if(Distance2D(pos, x, y) < maxDist+20.0f){
|
node2 = ConnectedNode(link);
|
||||||
pos.x += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f;
|
if(m_pathNodes[node1].bDisabled || m_pathNodes[node2].bDisabled)
|
||||||
pos.y += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f;
|
continue;
|
||||||
float dist = Distance2D(pos, x, y);
|
node2_dist = Distance2D(m_pathNodes[node2].GetPosition(), x, y);
|
||||||
|
if ((node1_dist < maxDist || node2_dist < maxDist) && (node1_dist > minDistOffScreen || node2_dist > minDistOffScreen))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(i >= m_pathNodes[node1].numLinks)
|
||||||
|
return false;
|
||||||
|
|
||||||
bool visible;
|
for(i = 0; i < 5; i++){
|
||||||
if(camMatrix)
|
float f2 = (CGeneral::GetRandomNumber()&0xFF)/256.0f;
|
||||||
visible = TheCamera.IsSphereVisible(pos, 2.0f, camMatrix);
|
float f1 = 1.0f - f2;
|
||||||
else
|
*pPositionBetweenNodes = f2;
|
||||||
visible = TheCamera.IsSphereVisible(pos, 2.0f);
|
CVector pos = m_pathNodes[node1].GetPosition()*f1 + m_pathNodes[node2].GetPosition()*f2;
|
||||||
if(!visible){
|
if(Distance2D(pos, x, y) < maxDist+20.0f){
|
||||||
minDist = minDistOffScreen;
|
pos.x += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f;
|
||||||
maxDist = maxDistOffScreen;
|
pos.y += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f;
|
||||||
}
|
float dist = Distance2D(pos, x, y);
|
||||||
if(minDist < dist && dist < maxDist){
|
|
||||||
*pNode1 = node1;
|
|
||||||
*pNode2 = node2;
|
|
||||||
*pPosition = pos;
|
|
||||||
|
|
||||||
bool found;
|
bool visible;
|
||||||
float groundZ = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z+2.0f, &found);
|
if(camMatrix)
|
||||||
if(!found)
|
visible = TheCamera.IsSphereVisible(pos, 2.0f, camMatrix);
|
||||||
return false;
|
else
|
||||||
if(Abs(groundZ - pos.z) > 3.0f)
|
visible = TheCamera.IsSphereVisible(pos, 2.0f);
|
||||||
return false;
|
if(!visible){
|
||||||
pPosition->z = groundZ;
|
minDist = minDistOffScreen;
|
||||||
return true;
|
maxDist = maxDistOffScreen;
|
||||||
}
|
}
|
||||||
|
if(visible && (minDist < dist && dist < maxDist) ||
|
||||||
|
!visible && (minDistOffScreen < dist && dist < maxDistOffScreen)){
|
||||||
|
*pNode1 = node1;
|
||||||
|
*pNode2 = node2;
|
||||||
|
*pPosition = pos;
|
||||||
|
|
||||||
|
bool found;
|
||||||
|
float groundZ = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z+2.0f, &found);
|
||||||
|
if(!found)
|
||||||
|
return false;
|
||||||
|
if(Abs(groundZ - pos.z) > 3.0f)
|
||||||
|
return false;
|
||||||
|
pPosition->z = groundZ;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode, CPathNode **nextNode, uint8 curDir, uint8 *nextDir)
|
CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode, CPathNode **nextNode, uint8 curDir, uint8 *nextDir)
|
||||||
{
|
{
|
||||||
|
@ -1584,7 +1666,6 @@ CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode
|
||||||
|
|
||||||
static CPathNode *apNodesToBeCleared[6525];
|
static CPathNode *apNodesToBeCleared[6525];
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector target, CPathNode **nodes, int16 *pNumNodes, int16 maxNumNodes, CVehicle *vehicle, float *pDist, float distLimit, int32 targetNodeId)
|
CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector target, CPathNode **nodes, int16 *pNumNodes, int16 maxNumNodes, CVehicle *vehicle, float *pDist, float distLimit, int32 targetNodeId)
|
||||||
{
|
{
|
||||||
|
@ -1676,7 +1757,6 @@ static CPathNode *pNodeList[32];
|
||||||
static int16 DummyResult;
|
static int16 DummyResult;
|
||||||
static int16 DummyResult2;
|
static int16 DummyResult2;
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
bool
|
bool
|
||||||
CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
|
CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
|
||||||
{
|
{
|
||||||
|
@ -1692,7 +1772,6 @@ CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
|
||||||
return dist < 100.0f;
|
return dist < 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::Save(uint8 *buf, uint32 *size)
|
CPathFind::Save(uint8 *buf, uint32 *size)
|
||||||
{
|
{
|
||||||
|
@ -1714,7 +1793,6 @@ CPathFind::Save(uint8 *buf, uint32 *size)
|
||||||
buf[i/8 + n] &= ~(1 << i%8);
|
buf[i/8 + n] &= ~(1 << i%8);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::Load(uint8 *buf, uint32 size)
|
CPathFind::Load(uint8 *buf, uint32 size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,8 @@ public:
|
||||||
static void AddNodeToList(CPedPathNode *pNode, int16 index, CPedPathNode *pList);
|
static void AddNodeToList(CPedPathNode *pNode, int16 index, CPedPathNode *pList);
|
||||||
static void AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition);
|
static void AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition);
|
||||||
static void AddBlockadeSectorList(CPtrList& list, CPedPathNode(*pathNodes)[40], CVector *pPosition);
|
static void AddBlockadeSectorList(CPtrList& list, CPedPathNode(*pathNodes)[40], CVector *pPosition);
|
||||||
|
static void AddBuildingBlockade(CEntity*, CPedPathNode(*)[40], CVector*);
|
||||||
|
static void AddBuildingBlockadeSectorList(CPtrList&, CPedPathNode(*)[40], CVector*);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CPathNode
|
struct CPathNode
|
||||||
|
@ -74,7 +76,7 @@ struct CPathNode
|
||||||
|
|
||||||
uint8 bWaterPath : 1;
|
uint8 bWaterPath : 1;
|
||||||
uint8 bOnlySmallBoats : 1;
|
uint8 bOnlySmallBoats : 1;
|
||||||
uint8 flagB4 : 1; // where is this set?
|
uint8 bSelected : 1;
|
||||||
uint8 speedLimit : 2;
|
uint8 speedLimit : 2;
|
||||||
//uint8 flagB20 : 1;
|
//uint8 flagB20 : 1;
|
||||||
//uint8 flagB40 : 1;
|
//uint8 flagB40 : 1;
|
||||||
|
@ -115,7 +117,7 @@ struct CCarPathLink
|
||||||
int8 dirY;
|
int8 dirY;
|
||||||
int8 numLeftLanes : 3;
|
int8 numLeftLanes : 3;
|
||||||
int8 numRightLanes : 3;
|
int8 numRightLanes : 3;
|
||||||
uint8 flag1 : 1;
|
uint8 trafficLightDirection : 1;
|
||||||
uint8 trafficLightType : 2;
|
uint8 trafficLightType : 2;
|
||||||
uint8 bBridgeLights : 1; // at least in LCS...
|
uint8 bBridgeLights : 1; // at least in LCS...
|
||||||
int8 width;
|
int8 width;
|
||||||
|
@ -160,6 +162,7 @@ struct CPathInfoForObject
|
||||||
|
|
||||||
uint8 spawnRate : 4;
|
uint8 spawnRate : 4;
|
||||||
|
|
||||||
|
void CheckIntegrity(void);
|
||||||
void SwapConnectionsToBeRightWayRound(void);
|
void SwapConnectionsToBeRightWayRound(void);
|
||||||
};
|
};
|
||||||
extern CPathInfoForObject *InfoForTileCars;
|
extern CPathInfoForObject *InfoForTileCars;
|
||||||
|
@ -189,6 +192,14 @@ struct CTempNodeExternal // made up name
|
||||||
bool isCross;
|
bool isCross;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// from mobile
|
||||||
|
template<typename T>
|
||||||
|
class CRoute
|
||||||
|
{
|
||||||
|
T m_node[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class CPathFind
|
class CPathFind
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -242,12 +253,14 @@ public:
|
||||||
void MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId);
|
void MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId);
|
||||||
void MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2);
|
void MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2);
|
||||||
void PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2);
|
void PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2);
|
||||||
// TODO(MIAMI): check callers for new arguments
|
int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled = false, bool ignoreBetweenLevels = false, bool ignoreSelected = false, bool bWaterPath = false);
|
||||||
int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled = false, bool ignoreBetweenLevels = false, bool ignoreFlagB4 = false, bool bWaterPath = false);
|
|
||||||
int32 FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY);
|
int32 FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY);
|
||||||
|
void FindNodePairClosestToCoors(CVector coors, uint8 type, int* node1, int* node2, float* angle, float minDist, float maxDist, bool ignoreDisabled = false, bool ignoreBetweenLevels = false, bool bWaterPath = false);
|
||||||
|
int32 FindNthNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, int N, bool bWaterPath = false);
|
||||||
|
CVector FindNodeCoorsForScript(int32 id);
|
||||||
float FindNodeOrientationForCarPlacement(int32 nodeId);
|
float FindNodeOrientationForCarPlacement(int32 nodeId);
|
||||||
float FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards);
|
float FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards);
|
||||||
bool NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled = false);
|
bool GenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled = false);
|
||||||
bool GeneratePedCreationCoors(float x, float y, float minDist, float maxDist, float minDistOffScreen, float maxDistOffScreen, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, CMatrix *camMatrix);
|
bool GeneratePedCreationCoors(float x, float y, float minDist, float maxDist, float minDistOffScreen, float maxDistOffScreen, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, CMatrix *camMatrix);
|
||||||
void FindNextNodeWandering(uint8, CVector, CPathNode**, CPathNode**, uint8, uint8*);
|
void FindNextNodeWandering(uint8, CVector, CPathNode**, CPathNode**, uint8, uint8*);
|
||||||
void DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector target, CPathNode **nodes, int16 *numNodes, int16 maxNumNodes, CVehicle *vehicle, float *dist, float distLimit, int32 forcedTargetNode);
|
void DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector target, CPathNode **nodes, int16 *numNodes, int16 maxNumNodes, CVehicle *vehicle, float *dist, float distLimit, int32 forcedTargetNode);
|
||||||
|
@ -267,6 +280,16 @@ public:
|
||||||
void ConnectionSetTrafficLight(int id) { m_connections[id] |= 0x4000; }
|
void ConnectionSetTrafficLight(int id) { m_connections[id] |= 0x4000; }
|
||||||
|
|
||||||
void DisplayPathData(void);
|
void DisplayPathData(void);
|
||||||
|
|
||||||
|
// Following methods are present on mobile but are unused. TODO: implement them
|
||||||
|
void SavePathFindData(void);
|
||||||
|
void ComputeRoute(uint8, const CVector&, const CVector&, CRoute<CPathNode*>&);
|
||||||
|
void RecordNodesClosestToCoors(CVector, uint8, int, CPathNode**, float, bool, bool, bool);
|
||||||
|
void RecordNodesInCircle(const CVector&, float, uint8, int, CPathNode**, bool, bool, bool, bool);
|
||||||
|
void ArrangeOneNodeList(CPathInfoForObject*, int16);
|
||||||
|
void ArrangeNodes(int16);
|
||||||
|
void RegisterMarker(CVector*);
|
||||||
|
void Shutdown(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CPathFind ThePaths;
|
extern CPathFind ThePaths;
|
||||||
|
|
|
@ -122,11 +122,11 @@ CPickup::GiveUsAPickUpObject(int32 handle)
|
||||||
{
|
{
|
||||||
CObject *object;
|
CObject *object;
|
||||||
|
|
||||||
if (handle <= 0) object = new CObject(m_eModelIndex, false);
|
if (handle >= 0) {
|
||||||
else {
|
|
||||||
CPools::MakeSureSlotInObjectPoolIsEmpty(handle);
|
CPools::MakeSureSlotInObjectPoolIsEmpty(handle);
|
||||||
object = new(handle) CObject(m_eModelIndex, false);
|
object = new (handle) CObject(m_eModelIndex, false);
|
||||||
}
|
} else
|
||||||
|
object = new CObject(m_eModelIndex, false);
|
||||||
|
|
||||||
if (object == nil) return nil;
|
if (object == nil) return nil;
|
||||||
object->ObjectCreatedBy = MISSION_OBJECT;
|
object->ObjectCreatedBy = MISSION_OBJECT;
|
||||||
|
@ -729,7 +729,7 @@ CPickups::Update()
|
||||||
#ifdef CAMERA_PICKUP
|
#ifdef CAMERA_PICKUP
|
||||||
if ( bPickUpcamActivated ) // taken from PS2
|
if ( bPickUpcamActivated ) // taken from PS2
|
||||||
{
|
{
|
||||||
float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D();
|
float dist = Distance2D(StaticCamCoors, FindPlayerCoors());
|
||||||
float mult;
|
float mult;
|
||||||
if ( dist < 10.0f )
|
if ( dist < 10.0f )
|
||||||
mult = 1.0f - (dist / 10.0f );
|
mult = 1.0f - (dist / 10.0f );
|
||||||
|
@ -745,8 +745,7 @@ CPickups::Update()
|
||||||
TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT);
|
TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FindPlayerVehicle() != pPlayerVehicle
|
if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f
|
||||||
|| (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f
|
|
||||||
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
|
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
|
||||||
{
|
{
|
||||||
TheCamera.RestoreWithJumpCut();
|
TheCamera.RestoreWithJumpCut();
|
||||||
|
@ -836,7 +835,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
||||||
|
|
||||||
CObject *object = (CObject*)entity;
|
CObject *object = (CObject*)entity;
|
||||||
if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
|
if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
|
||||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
float dist = Distance2D(pos, TheCamera.GetPosition());
|
||||||
const float MAXDIST = 12.0f;
|
const float MAXDIST = 12.0f;
|
||||||
|
|
||||||
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
|
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
|
||||||
|
@ -879,7 +878,7 @@ void
|
||||||
CPickups::DoMineEffects(CEntity *entity)
|
CPickups::DoMineEffects(CEntity *entity)
|
||||||
{
|
{
|
||||||
const CVector &pos = entity->GetPosition();
|
const CVector &pos = entity->GetPosition();
|
||||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
float dist = Distance(pos, TheCamera.GetPosition());
|
||||||
const float MAXDIST = 20.0f;
|
const float MAXDIST = 20.0f;
|
||||||
|
|
||||||
if (dist < MAXDIST) {
|
if (dist < MAXDIST) {
|
||||||
|
@ -898,7 +897,7 @@ void
|
||||||
CPickups::DoMoneyEffects(CEntity *entity)
|
CPickups::DoMoneyEffects(CEntity *entity)
|
||||||
{
|
{
|
||||||
const CVector &pos = entity->GetPosition();
|
const CVector &pos = entity->GetPosition();
|
||||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
float dist = Distance(pos, TheCamera.GetPosition());
|
||||||
const float MAXDIST = 20.0f;
|
const float MAXDIST = 20.0f;
|
||||||
|
|
||||||
if (dist < MAXDIST) {
|
if (dist < MAXDIST) {
|
||||||
|
@ -917,7 +916,7 @@ void
|
||||||
CPickups::DoCollectableEffects(CEntity *entity)
|
CPickups::DoCollectableEffects(CEntity *entity)
|
||||||
{
|
{
|
||||||
const CVector &pos = entity->GetPosition();
|
const CVector &pos = entity->GetPosition();
|
||||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
float dist = Distance(pos, TheCamera.GetPosition());
|
||||||
const float MAXDIST = 14.0f;
|
const float MAXDIST = 14.0f;
|
||||||
|
|
||||||
if (dist < MAXDIST) {
|
if (dist < MAXDIST) {
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "VehicleModelInfo.h"
|
#include "VehicleModelInfo.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
uint16 CRecordDataForGame::RecordingState;
|
uint16 CRecordDataForGame::RecordingState;
|
||||||
|
|
||||||
void CRecordDataForGame::Init(void)
|
void CRecordDataForGame::Init(void)
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
#include "Fluff.h"
|
#include "Fluff.h"
|
||||||
#include "WaterCreatures.h"
|
#include "WaterCreatures.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done except TODO
|
||||||
|
|
||||||
uint8 CReplay::Mode;
|
uint8 CReplay::Mode;
|
||||||
CAddressInReplayBuffer CReplay::Record;
|
CAddressInReplayBuffer CReplay::Record;
|
||||||
CAddressInReplayBuffer CReplay::Playback;
|
CAddressInReplayBuffer CReplay::Playback;
|
||||||
|
@ -160,7 +162,6 @@ static void(*CBArray[])(CAnimBlendAssociation*, void*) =
|
||||||
&CPed::PedAnimShuffleCB, &CPed::DeleteSunbatheIdleAnimCB, &StartTalkingOnMobileCB, &FinishTalkingOnMobileCB
|
&CPed::PedAnimShuffleCB, &CPed::DeleteSunbatheIdleAnimCB, &StartTalkingOnMobileCB, &FinishTalkingOnMobileCB
|
||||||
};
|
};
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
|
static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < sizeof(CBArray) / sizeof(*CBArray); i++){
|
for (int i = 0; i < sizeof(CBArray) / sizeof(*CBArray); i++){
|
||||||
|
@ -171,13 +172,11 @@ static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
|
static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
|
||||||
{
|
{
|
||||||
return CBArray[id];
|
return CBArray[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying)
|
static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying)
|
||||||
{
|
{
|
||||||
if(vehicle->Damage.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){
|
if(vehicle->Damage.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){
|
||||||
|
@ -210,7 +209,6 @@ static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flyi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void PrintElementsInPtrList(void)
|
void PrintElementsInPtrList(void)
|
||||||
{
|
{
|
||||||
for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_GENERIC).first; node; node = node->next) {
|
for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_GENERIC).first; node; node = node->next) {
|
||||||
|
@ -218,7 +216,6 @@ void PrintElementsInPtrList(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::Init(void)
|
void CReplay::Init(void)
|
||||||
{
|
{
|
||||||
pBuf0 = nil;
|
pBuf0 = nil;
|
||||||
|
@ -261,20 +258,17 @@ void CReplay::Init(void)
|
||||||
MarkEverythingAsNew();
|
MarkEverythingAsNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::DisableReplays(void)
|
void CReplay::DisableReplays(void)
|
||||||
{
|
{
|
||||||
bReplayEnabled = false;
|
bReplayEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::EnableReplays(void)
|
void CReplay::EnableReplays(void)
|
||||||
{
|
{
|
||||||
bReplayEnabled = true;
|
bReplayEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayReplayFromHD(void);
|
void PlayReplayFromHD(void);
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::Update(void)
|
void CReplay::Update(void)
|
||||||
{
|
{
|
||||||
if (CCutsceneMgr::IsCutsceneProcessing() || CPad::GetPad(0)->ArePlayerControlsDisabled() || CScriptPaths::IsOneActive() || FrontEndMenuManager.GetIsMenuActive()) {
|
if (CCutsceneMgr::IsCutsceneProcessing() || CPad::GetPad(0)->ArePlayerControlsDisabled() || CScriptPaths::IsOneActive() || FrontEndMenuManager.GetIsMenuActive()) {
|
||||||
|
@ -309,7 +303,6 @@ void CReplay::Update(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done except TODO
|
|
||||||
void CReplay::RecordThisFrame(void)
|
void CReplay::RecordThisFrame(void)
|
||||||
{
|
{
|
||||||
uint32 memory_required = sizeof(tGeneralPacket) + sizeof(tClockPacket) + sizeof(tWeatherPacket) + sizeof(tTimerPacket) + sizeof(tMiscPacket);
|
uint32 memory_required = sizeof(tGeneralPacket) + sizeof(tClockPacket) + sizeof(tWeatherPacket) + sizeof(tTimerPacket) + sizeof(tMiscPacket);
|
||||||
|
@ -411,7 +404,6 @@ void CReplay::RecordThisFrame(void)
|
||||||
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::GoToNextBlock(void)
|
void CReplay::GoToNextBlock(void)
|
||||||
{
|
{
|
||||||
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
||||||
|
@ -424,7 +416,6 @@ void CReplay::GoToNextBlock(void)
|
||||||
MarkEverythingAsNew();
|
MarkEverythingAsNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CVector& vecDir, float fSize, const RwRGBA& color)
|
void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CVector& vecDir, float fSize, const RwRGBA& color)
|
||||||
{
|
{
|
||||||
if (Record.m_nOffset > REPLAYBUFFERSIZE - 16 - sizeof(tParticlePacket))
|
if (Record.m_nOffset > REPLAYBUFFERSIZE - 16 - sizeof(tParticlePacket))
|
||||||
|
@ -447,7 +438,6 @@ void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CV
|
||||||
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StorePedUpdate(CPed *ped, int id)
|
void CReplay::StorePedUpdate(CPed *ped, int id)
|
||||||
{
|
{
|
||||||
tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
|
tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
|
@ -467,7 +457,6 @@ void CReplay::StorePedUpdate(CPed *ped, int id)
|
||||||
Record.m_nOffset += sizeof(tPedUpdatePacket);
|
Record.m_nOffset += sizeof(tPedUpdatePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
||||||
{
|
{
|
||||||
CAnimBlendAssociation* second;
|
CAnimBlendAssociation* second;
|
||||||
|
@ -513,7 +502,6 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
|
void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++){
|
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++){
|
||||||
|
@ -571,7 +559,6 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer)
|
void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer)
|
||||||
{
|
{
|
||||||
tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
|
tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
|
||||||
|
@ -616,14 +603,12 @@ void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayB
|
||||||
buffer->m_nOffset += sizeof(tPedUpdatePacket);
|
buffer->m_nOffset += sizeof(tPedUpdatePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool HasAnimGroupLoaded(uint8 group)
|
bool HasAnimGroupLoaded(uint8 group)
|
||||||
{
|
{
|
||||||
CAnimBlendAssocGroup* pGroup = &CAnimManager::GetAnimAssocGroups()[group];
|
CAnimBlendAssocGroup* pGroup = &CAnimManager::GetAnimAssocGroups()[group];
|
||||||
return pGroup->animBlock && pGroup->animBlock->isLoaded;
|
return pGroup->animBlock && pGroup->animBlock->isLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
|
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
|
||||||
{
|
{
|
||||||
CAnimBlendAssociation* anim1;
|
CAnimBlendAssociation* anim1;
|
||||||
|
@ -667,7 +652,6 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
|
void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
|
||||||
{
|
{
|
||||||
CAnimBlendAssociation* assoc;
|
CAnimBlendAssociation* assoc;
|
||||||
|
@ -713,7 +697,6 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::PlaybackThisFrame(void)
|
void CReplay::PlaybackThisFrame(void)
|
||||||
{
|
{
|
||||||
static int FrameSloMo = 0;
|
static int FrameSloMo = 0;
|
||||||
|
@ -741,7 +724,6 @@ void CReplay::PlaybackThisFrame(void)
|
||||||
|
|
||||||
// next two functions are only found in mobile version
|
// next two functions are only found in mobile version
|
||||||
// most likely they were optimized out for being unused
|
// most likely they were optimized out for being unused
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::TriggerPlaybackLastCoupleOfSeconds(uint32 start, uint8 cam_mode, float cam_x, float cam_y, float cam_z, uint32 slomo)
|
void CReplay::TriggerPlaybackLastCoupleOfSeconds(uint32 start, uint8 cam_mode, float cam_x, float cam_y, float cam_z, uint32 slomo)
|
||||||
{
|
{
|
||||||
if (Mode != MODE_RECORD)
|
if (Mode != MODE_RECORD)
|
||||||
|
@ -753,7 +735,6 @@ void CReplay::TriggerPlaybackLastCoupleOfSeconds(uint32 start, uint8 cam_mode, f
|
||||||
Mode = MODE_RECORD;
|
Mode = MODE_RECORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool CReplay::FastForwardToTime(uint32 start)
|
bool CReplay::FastForwardToTime(uint32 start)
|
||||||
{
|
{
|
||||||
uint32 timer = 0;
|
uint32 timer = 0;
|
||||||
|
@ -763,7 +744,6 @@ bool CReplay::FastForwardToTime(uint32 start)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
|
void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
|
||||||
{
|
{
|
||||||
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
|
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
|
@ -804,7 +784,6 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
|
||||||
Record.m_nOffset += sizeof(tVehicleUpdatePacket);
|
Record.m_nOffset += sizeof(tVehicleUpdatePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id)
|
void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id)
|
||||||
{
|
{
|
||||||
CBike* bike = (CBike*)vehicle;
|
CBike* bike = (CBike*)vehicle;
|
||||||
|
@ -830,7 +809,6 @@ void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id)
|
||||||
Record.m_nOffset += sizeof(tBikeUpdatePacket);
|
Record.m_nOffset += sizeof(tBikeUpdatePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer)
|
void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer)
|
||||||
{
|
{
|
||||||
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
|
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
|
||||||
|
@ -904,7 +882,6 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
|
||||||
((CBoat*)vehicle)->m_fMovingSpeed = vp->skimmer_speed / 50.0f;
|
((CBoat*)vehicle)->m_fMovingSpeed = vp->skimmer_speed / 50.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddressInReplayBuffer* buffer)
|
void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddressInReplayBuffer* buffer)
|
||||||
{
|
{
|
||||||
CBike* bike = (CBike*)vehicle;
|
CBike* bike = (CBike*)vehicle;
|
||||||
|
@ -938,7 +915,6 @@ void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddress
|
||||||
CWorld::Add(vehicle);
|
CWorld::Add(vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer)
|
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer)
|
||||||
{
|
{
|
||||||
CBulletTraces::Init();
|
CBulletTraces::Init();
|
||||||
|
@ -1193,7 +1169,6 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::FinishPlayback(void)
|
void CReplay::FinishPlayback(void)
|
||||||
{
|
{
|
||||||
if (Mode != MODE_PLAYBACK)
|
if (Mode != MODE_PLAYBACK)
|
||||||
|
@ -1216,7 +1191,6 @@ void CReplay::FinishPlayback(void)
|
||||||
DMAudio.SetMusicFadeVol(127);
|
DMAudio.SetMusicFadeVol(127);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::EmptyReplayBuffer(void)
|
void CReplay::EmptyReplayBuffer(void)
|
||||||
{
|
{
|
||||||
if (Mode == MODE_PLAYBACK)
|
if (Mode == MODE_PLAYBACK)
|
||||||
|
@ -1232,7 +1206,6 @@ void CReplay::EmptyReplayBuffer(void)
|
||||||
MarkEverythingAsNew();
|
MarkEverythingAsNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessReplayCamera(void)
|
void CReplay::ProcessReplayCamera(void)
|
||||||
{
|
{
|
||||||
switch (CameraMode) {
|
switch (CameraMode) {
|
||||||
|
@ -1279,7 +1252,6 @@ void CReplay::ProcessReplayCamera(void)
|
||||||
|
|
||||||
extern CWeaponEffects gCrossHair;
|
extern CWeaponEffects gCrossHair;
|
||||||
|
|
||||||
// --MIAMI: Done except TODO
|
|
||||||
void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene)
|
void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene)
|
||||||
{
|
{
|
||||||
if (Mode != MODE_RECORD)
|
if (Mode != MODE_RECORD)
|
||||||
|
@ -1339,7 +1311,6 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
|
||||||
CDraw::SetFOV(70.0f);
|
CDraw::SetFOV(70.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StoreStuffInMem(void)
|
void CReplay::StoreStuffInMem(void)
|
||||||
{
|
{
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
|
@ -1426,7 +1397,6 @@ void CReplay::StoreStuffInMem(void)
|
||||||
CScriptPaths::Save_ForReplay();
|
CScriptPaths::Save_ForReplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::RestoreStuffFromMem(void)
|
void CReplay::RestoreStuffFromMem(void)
|
||||||
{
|
{
|
||||||
CPools::GetVehiclePool()->CopyBack(pBuf0, pBuf1);
|
CPools::GetVehiclePool()->CopyBack(pBuf0, pBuf1);
|
||||||
|
@ -1651,7 +1621,6 @@ void CReplay::RestoreStuffFromMem(void)
|
||||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::EmptyPedsAndVehiclePools(void)
|
void CReplay::EmptyPedsAndVehiclePools(void)
|
||||||
{
|
{
|
||||||
int i = CPools::GetVehiclePool()->GetSize();
|
int i = CPools::GetVehiclePool()->GetSize();
|
||||||
|
@ -1672,7 +1641,6 @@ void CReplay::EmptyPedsAndVehiclePools(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::EmptyAllPools(void)
|
void CReplay::EmptyAllPools(void)
|
||||||
{
|
{
|
||||||
EmptyPedsAndVehiclePools();
|
EmptyPedsAndVehiclePools();
|
||||||
|
@ -1694,7 +1662,6 @@ void CReplay::EmptyAllPools(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::MarkEverythingAsNew(void)
|
void CReplay::MarkEverythingAsNew(void)
|
||||||
{
|
{
|
||||||
int i = CPools::GetVehiclePool()->GetSize();
|
int i = CPools::GetVehiclePool()->GetSize();
|
||||||
|
@ -1744,7 +1711,6 @@ void CReplay::SaveReplayToHD(void)
|
||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void PlayReplayFromHD(void)
|
void PlayReplayFromHD(void)
|
||||||
{
|
{
|
||||||
CFileMgr::SetDirMyDocuments();
|
CFileMgr::SetDirMyDocuments();
|
||||||
|
@ -1777,7 +1743,6 @@ void PlayReplayFromHD(void)
|
||||||
CReplay::StreamAllNecessaryCarsAndPeds();
|
CReplay::StreamAllNecessaryCarsAndPeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
||||||
{
|
{
|
||||||
for (int slot = 0; slot < NUM_REPLAYBUFFERS; slot++) {
|
for (int slot = 0; slot < NUM_REPLAYBUFFERS; slot++) {
|
||||||
|
@ -1802,7 +1767,6 @@ void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::FindFirstFocusCoordinate(CVector *coord)
|
void CReplay::FindFirstFocusCoordinate(CVector *coord)
|
||||||
{
|
{
|
||||||
*coord = CVector(0.0f, 0.0f, 0.0f);
|
*coord = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
@ -1818,7 +1782,6 @@ void CReplay::FindFirstFocusCoordinate(CVector *coord)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool CReplay::ShouldStandardCameraBeProcessed(void)
|
bool CReplay::ShouldStandardCameraBeProcessed(void)
|
||||||
{
|
{
|
||||||
if (Mode != MODE_PLAYBACK)
|
if (Mode != MODE_PLAYBACK)
|
||||||
|
@ -1828,7 +1791,6 @@ bool CReplay::ShouldStandardCameraBeProcessed(void)
|
||||||
return FindPlayerVehicle() != nil;
|
return FindPlayerVehicle() != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessLookAroundCam(void)
|
void CReplay::ProcessLookAroundCam(void)
|
||||||
{
|
{
|
||||||
if (!bAllowLookAroundCam)
|
if (!bAllowLookAroundCam)
|
||||||
|
@ -1885,7 +1847,6 @@ void CReplay::ProcessLookAroundCam(void)
|
||||||
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
size_t CReplay::FindSizeOfPacket(uint8 type)
|
size_t CReplay::FindSizeOfPacket(uint8 type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -1907,7 +1868,6 @@ size_t CReplay::FindSizeOfPacket(uint8 type)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done (function didn't change since III and we already had it modified)
|
|
||||||
void CReplay::Display()
|
void CReplay::Display()
|
||||||
{
|
{
|
||||||
static int TimeCount = 0;
|
static int TimeCount = 0;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
uint8 CRestart::OverrideHospitalLevel;
|
uint8 CRestart::OverrideHospitalLevel;
|
||||||
uint8 CRestart::OverridePoliceStationLevel;
|
uint8 CRestart::OverridePoliceStationLevel;
|
||||||
bool CRestart::bFadeInAfterNextArrest;
|
bool CRestart::bFadeInAfterNextArrest;
|
||||||
|
|
|
@ -236,7 +236,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
|
||||||
tmp.GetPosition().z += fModelRadius - 0.6f;
|
tmp.GetPosition().z += fModelRadius - 0.6f;
|
||||||
pVehicle->m_matrix = tmp;
|
pVehicle->m_matrix = tmp;
|
||||||
pVehicle->PlaceOnRoadProperly();
|
pVehicle->PlaceOnRoadProperly();
|
||||||
pVehicle->bIsStatic = false;
|
pVehicle->SetIsStatic(false);
|
||||||
pVehicle->m_matrix.UpdateRW();
|
pVehicle->m_matrix.UpdateRW();
|
||||||
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include "WeaponInfo.h"
|
#include "WeaponInfo.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
bool CSceneEdit::m_bEditOn;
|
bool CSceneEdit::m_bEditOn;
|
||||||
int32 CSceneEdit::m_bCameraFollowActor;
|
int32 CSceneEdit::m_bCameraFollowActor;
|
||||||
bool CSceneEdit::m_bRecording;
|
bool CSceneEdit::m_bRecording;
|
||||||
|
@ -1070,7 +1072,7 @@ bool CSceneEdit::SelectWeapon(void)
|
||||||
}
|
}
|
||||||
if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) {
|
if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) {
|
||||||
if (++m_nWeaponType >= WEAPONTYPE_DETONATOR)
|
if (++m_nWeaponType >= WEAPONTYPE_DETONATOR)
|
||||||
m_nWeaponType = WEAPONTYPE_BASEBALLBAT;
|
m_nWeaponType = WEAPONTYPE_BRASSKNUCKLE;
|
||||||
pActors[m_nActor]->ClearWeapons();
|
pActors[m_nActor]->ClearWeapons();
|
||||||
pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
|
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]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId);
|
||||||
|
@ -1078,7 +1080,7 @@ bool CSceneEdit::SelectWeapon(void)
|
||||||
}
|
}
|
||||||
else if (CPad::GetPad(1)->GetRightShoulder1JustDown()){
|
else if (CPad::GetPad(1)->GetRightShoulder1JustDown()){
|
||||||
if (--m_nWeaponType <= WEAPONTYPE_UNARMED)
|
if (--m_nWeaponType <= WEAPONTYPE_UNARMED)
|
||||||
m_nWeaponType = WEAPONTYPE_GRENADE;
|
m_nWeaponType = WEAPONTYPE_MINIGUN;
|
||||||
pActors[m_nActor]->ClearWeapons();
|
pActors[m_nActor]->ClearWeapons();
|
||||||
pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
|
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]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId);
|
||||||
|
|
|
@ -1704,7 +1704,7 @@ static void PossiblyWakeThisEntity(CPhysical* pEntity, bool ifColLoaded = false)
|
||||||
return;
|
return;
|
||||||
if (!ifColLoaded || CColStore::HasCollisionLoaded(pEntity->GetPosition())) {
|
if (!ifColLoaded || CColStore::HasCollisionLoaded(pEntity->GetPosition())) {
|
||||||
pEntity->bIsStaticWaitingForCollision = false;
|
pEntity->bIsStaticWaitingForCollision = false;
|
||||||
if (!pEntity->IsStatic())
|
if (!pEntity->GetIsStatic())
|
||||||
pEntity->AddToMovingList();
|
pEntity->AddToMovingList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1826,7 +1826,7 @@ void CMissionCleanup::Process()
|
||||||
CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0;
|
CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0;
|
||||||
CPad::GetPad(0)->SetDrunkInputDelay(0);
|
CPad::GetPad(0)->SetDrunkInputDelay(0);
|
||||||
CWorld::Players[0].m_bDriveByAllowed = true;
|
CWorld::Players[0].m_bDriveByAllowed = true;
|
||||||
// DMAudio::ShutUpPlayerTalking(0); // TODO(Miami)
|
DMAudio.ShutUpPlayerTalking(0);
|
||||||
CVehicle::bDisableRemoteDetonation = false;
|
CVehicle::bDisableRemoteDetonation = false;
|
||||||
CVehicle::bDisableRemoteDetonationOnContact = false;
|
CVehicle::bDisableRemoteDetonationOnContact = false;
|
||||||
CGameLogic::ClearShortCut();
|
CGameLogic::ClearShortCut();
|
||||||
|
@ -2380,9 +2380,11 @@ void CTheScripts::Process()
|
||||||
case 4:
|
case 4:
|
||||||
AllowMissionReplay = 5;
|
AllowMissionReplay = 5;
|
||||||
RetryMission(0, 0);
|
RetryMission(0, 0);
|
||||||
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
AllowMissionReplay = 7;
|
AllowMissionReplay = 7;
|
||||||
TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500;
|
TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500;
|
||||||
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) {
|
if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) {
|
||||||
AllowMissionReplay = 0;
|
AllowMissionReplay = 0;
|
||||||
|
@ -3970,7 +3972,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
|
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||||
car->bIsStatic = false;
|
car->SetIsStatic(false);
|
||||||
/* Again weird usage of virtual functions. */
|
/* Again weird usage of virtual functions. */
|
||||||
if (car->IsBoat()) {
|
if (car->IsBoat()) {
|
||||||
car->Teleport(pos);
|
car->Teleport(pos);
|
||||||
|
@ -6371,7 +6373,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||||
}
|
}
|
||||||
case COMMAND_ADD_EXPLOSION:
|
case COMMAND_ADD_EXPLOSION:
|
||||||
CollectParameters(&m_nIp, 4);
|
CollectParameters(&m_nIp, 4);
|
||||||
CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0);
|
CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, true);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case COMMAND_IS_CAR_UPRIGHT:
|
case COMMAND_IS_CAR_UPRIGHT:
|
||||||
|
@ -7041,7 +7043,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
CCoronas::RegisterCorona((uintptr)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8],
|
CCoronas::RegisterCorona((uintptr)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8],
|
||||||
255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f); // TODO(MIAMI): more params
|
255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_DRAW_LIGHT:
|
case COMMAND_DRAW_LIGHT:
|
||||||
|
@ -7496,7 +7498,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
||||||
CVector pos = *(CVector*)&ScriptParams[0];
|
CVector pos = *(CVector*)&ScriptParams[0];
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f)];
|
CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f, true)];
|
||||||
*(CVector*)&ScriptParams[0] = pNode->GetPosition();
|
*(CVector*)&ScriptParams[0] = pNode->GetPosition();
|
||||||
StoreParameters(&m_nIp, 3);
|
StoreParameters(&m_nIp, 3);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -7507,8 +7509,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
||||||
CVector pos = *(CVector*)&ScriptParams[0];
|
CVector pos = *(CVector*)&ScriptParams[0];
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f)];
|
*(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true));
|
||||||
*(CVector*)&ScriptParams[0] = pNode->GetPosition();
|
|
||||||
StoreParameters(&m_nIp, 3);
|
StoreParameters(&m_nIp, 3);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -8977,7 +8978,6 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
char zone[KEY_LENGTH_IN_SCRIPT];
|
char zone[KEY_LENGTH_IN_SCRIPT];
|
||||||
CTheScripts::ReadTextLabelFromScript(&m_nIp, zone);
|
CTheScripts::ReadTextLabelFromScript(&m_nIp, zone);
|
||||||
// TODO(MIAMI): just getting this to compile with new argument
|
|
||||||
int zone_id = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT);
|
int zone_id = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT);
|
||||||
if (zone_id != -1)
|
if (zone_id != -1)
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||||
|
@ -9648,13 +9648,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
script_assert(pObject);
|
script_assert(pObject);
|
||||||
if (ScriptParams[1]) {
|
if (ScriptParams[1]) {
|
||||||
if (pObject->bIsStatic) {
|
if (pObject->bIsStatic) {
|
||||||
pObject->bIsStatic = false;
|
pObject->SetIsStatic(false);
|
||||||
pObject->AddToMovingList();
|
pObject->AddToMovingList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!pObject->bIsStatic) {
|
if (!pObject->bIsStatic) {
|
||||||
pObject->bIsStatic = true;
|
pObject->SetIsStatic(true);
|
||||||
pObject->RemoveFromMovingList();
|
pObject->RemoveFromMovingList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10343,8 +10343,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
int node = ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true);
|
int node = ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true);
|
||||||
// TODO(MIAMI): replace GetPosition with FindNodeCoorsForScript
|
*(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(node);
|
||||||
*(CVector*)&ScriptParams[0] = ThePaths.m_pathNodes[node].GetPosition();
|
|
||||||
*(float*)&ScriptParams[3] = ThePaths.FindNodeOrientationForCarPlacement(node);
|
*(float*)&ScriptParams[3] = ThePaths.FindNodeOrientationForCarPlacement(node);
|
||||||
StoreParameters(&m_nIp, 4);
|
StoreParameters(&m_nIp, 4);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -11203,7 +11202,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||||
return 0;
|
return 0;
|
||||||
*/
|
*/
|
||||||
case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED:
|
case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED:
|
||||||
UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3 || CVehicle::bHoverCheat || CVehicle::bCheat8); // TODO(MIAMI): more cheats!
|
UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3 || CVehicle::bHoverCheat || CVehicle::bCheat8 || CVehicle::bCheat9);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS:
|
case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS:
|
||||||
{
|
{
|
||||||
|
@ -12283,10 +12282,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
||||||
case COMMAND_GET_CLOSEST_STRAIGHT_ROAD:
|
case COMMAND_GET_CLOSEST_STRAIGHT_ROAD:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 5);
|
CollectParameters(&m_nIp, 5);
|
||||||
debug("GET_CLOSEST_STRAIGHT_ROAD not implemented!\n");
|
int node1, node2;
|
||||||
for (int i = 0; i < 7; i++)
|
float angle;
|
||||||
ScriptParams[i] = 0;
|
ThePaths.FindNodePairClosestToCoors(*(CVector*)&ScriptParams[0], PATH_CAR, &node1, &node2, &angle,
|
||||||
StoreParameters(&m_nIp, 7); // TODO(MIAMI)
|
*(float*)&ScriptParams[3], *(float*)&ScriptParams[4], true, true);
|
||||||
|
if (node1 == -1) {
|
||||||
|
for (int i = 0; i < 7; i++)
|
||||||
|
ScriptParams[i] = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(node1);
|
||||||
|
*(CVector*)&ScriptParams[3] = ThePaths.FindNodeCoorsForScript(node2);
|
||||||
|
*(float*)&ScriptParams[6] = angle;
|
||||||
|
}
|
||||||
|
StoreParameters(&m_nIp, 7);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_CAR_FORWARD_SPEED:
|
case COMMAND_SET_CAR_FORWARD_SPEED:
|
||||||
|
@ -12460,9 +12469,11 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
||||||
case COMMAND_GET_NTH_CLOSEST_CAR_NODE:
|
case COMMAND_GET_NTH_CLOSEST_CAR_NODE:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 4);
|
CollectParameters(&m_nIp, 4);
|
||||||
debug("GET_NTH_CLOSEST_CAR_NODE is not implemented\n"); // TODO(MIAMI)
|
CVector pos = *(CVector*)&ScriptParams[0];
|
||||||
ScriptParams[0] = 0;
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
StoreParameters(&m_nIp, 1);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
|
*(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNthNodeClosestToCoors(pos, 0, 999999.9f, true, true, ScriptParams[3] - 1));
|
||||||
|
StoreParameters(&m_nIp, 3);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//case COMMAND_GET_NTH_CLOSEST_CHAR_NODE:
|
//case COMMAND_GET_NTH_CLOSEST_CHAR_NODE:
|
||||||
|
@ -13251,7 +13262,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
||||||
case COMMAND_SET_TONIGHTS_EVENT:
|
case COMMAND_SET_TONIGHTS_EVENT:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
debug("skipping SET_TONIGHTS_EVENT\n"); // TODO(MIAMI)
|
CScrollBar::TonightsEvent = ScriptParams[0];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_CLEAR_CHAR_LAST_DAMAGE_ENTITY:
|
case COMMAND_CLEAR_CHAR_LAST_DAMAGE_ENTITY:
|
||||||
|
@ -13415,9 +13426,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
||||||
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
||||||
script_assert(pPed);
|
script_assert(pPed);
|
||||||
if (pPed->bInVehicle) {
|
if (pPed->bInVehicle) {
|
||||||
if (pPed->GetWeapon(5).m_eWeaponType) { // TODO(MIAMI): enum
|
if (pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType) {
|
||||||
if (pPed->GetWeapon(5).m_nAmmoTotal < ScriptParams[1])
|
if (pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_nAmmoTotal < ScriptParams[1])
|
||||||
pPed->SetAmmo(pPed->GetWeapon(5).m_eWeaponType, ScriptParams[1]);
|
pPed->SetAmmo(pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType, ScriptParams[1]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pPed->GiveWeapon(WEAPONTYPE_UZI, ScriptParams[1], true);
|
pPed->GiveWeapon(WEAPONTYPE_UZI, ScriptParams[1], true);
|
||||||
|
@ -13439,7 +13450,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
||||||
case COMMAND_ADD_EXPLOSION_NO_SOUND:
|
case COMMAND_ADD_EXPLOSION_NO_SOUND:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 4);
|
CollectParameters(&m_nIp, 4);
|
||||||
CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0); // TODO(MIAMI): last arg is 0
|
CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_OBJECT_AREA_VISIBLE:
|
case COMMAND_SET_OBJECT_AREA_VISIBLE:
|
||||||
|
@ -13715,7 +13726,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
|
||||||
pVehicle->bDontLoadCollision = true;
|
pVehicle->bDontLoadCollision = true;
|
||||||
if (pVehicle->bIsStaticWaitingForCollision) {
|
if (pVehicle->bIsStaticWaitingForCollision) {
|
||||||
pVehicle->bIsStaticWaitingForCollision = false;
|
pVehicle->bIsStaticWaitingForCollision = false;
|
||||||
if (!pVehicle->IsStatic())
|
if (!pVehicle->GetIsStatic())
|
||||||
pVehicle->AddToMovingList();
|
pVehicle->AddToMovingList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13738,7 +13749,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
|
||||||
pPed->bDontLoadCollision = true;
|
pPed->bDontLoadCollision = true;
|
||||||
if (pPed->bIsStaticWaitingForCollision) {
|
if (pPed->bIsStaticWaitingForCollision) {
|
||||||
pPed->bIsStaticWaitingForCollision = false;
|
pPed->bIsStaticWaitingForCollision = false;
|
||||||
if (!pPed->IsStatic())
|
if (!pPed->GetIsStatic())
|
||||||
pPed->AddToMovingList();
|
pPed->AddToMovingList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,8 +288,8 @@ class CTheScripts
|
||||||
static uint16 ScriptsUpdated;
|
static uint16 ScriptsUpdated;
|
||||||
static uint32 LastMissionPassedTime;
|
static uint32 LastMissionPassedTime;
|
||||||
static uint16 NumberOfExclusiveMissionScripts;
|
static uint16 NumberOfExclusiveMissionScripts;
|
||||||
static bool bPlayerIsInTheStatium;
|
|
||||||
public:
|
public:
|
||||||
|
static bool bPlayerIsInTheStatium;
|
||||||
static uint8 RiotIntensity;
|
static uint8 RiotIntensity;
|
||||||
static bool bPlayerHasMetDebbieHarry;
|
static bool bPlayerHasMetDebbieHarry;
|
||||||
public:
|
public:
|
||||||
|
@ -562,4 +562,4 @@ void RetryMission(int, int);
|
||||||
|
|
||||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||||
extern int scriptToLoad;
|
extern int scriptToLoad;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
// TODO: figure out the meaning of this
|
//--MIAMI: file done
|
||||||
enum { SOME_FLAG = 0x80 };
|
|
||||||
|
|
||||||
bool CTrafficLights::bGreenLightsCheat;
|
bool CTrafficLights::bGreenLightsCheat;
|
||||||
|
|
||||||
|
@ -28,113 +27,286 @@ CTrafficLights::DisplayActualLight(CEntity *ent)
|
||||||
|
|
||||||
int phase;
|
int phase;
|
||||||
if(FindTrafficLightType(ent) == 1)
|
if(FindTrafficLightType(ent) == 1)
|
||||||
phase = LightForCars1();
|
phase = LightForCars1_Visual();
|
||||||
else
|
else
|
||||||
phase = LightForCars2();
|
phase = LightForCars2_Visual();
|
||||||
|
|
||||||
int i;
|
int i, m = ent->GetModelIndex();
|
||||||
CBaseModelInfo *mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
|
if (MI_TRAFFICLIGHTS == m) {
|
||||||
float x = mi->Get2dEffect(0)->pos.x;
|
CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
|
||||||
float yMin = mi->Get2dEffect(0)->pos.y;
|
float x = mi->Get2dEffect(0)->pos.x;
|
||||||
float yMax = mi->Get2dEffect(0)->pos.y;
|
float yMin = mi->Get2dEffect(0)->pos.y;
|
||||||
float zMin = mi->Get2dEffect(0)->pos.z;
|
float yMax = mi->Get2dEffect(0)->pos.y;
|
||||||
float zMax = mi->Get2dEffect(0)->pos.z;
|
float zMin = mi->Get2dEffect(0)->pos.z;
|
||||||
for(i = 1; i < 6; i++){
|
float zMax = mi->Get2dEffect(0)->pos.z;
|
||||||
assert(mi->Get2dEffect(i));
|
for (i = 1; i < 6; i++) {
|
||||||
yMin = Min(yMin, mi->Get2dEffect(i)->pos.y);
|
assert(mi->Get2dEffect(i));
|
||||||
yMax = Max(yMax, mi->Get2dEffect(i)->pos.y);
|
yMin = Min(yMin, mi->Get2dEffect(i)->pos.y);
|
||||||
zMin = Min(zMin, mi->Get2dEffect(i)->pos.z);
|
yMax = Max(yMax, mi->Get2dEffect(i)->pos.y);
|
||||||
zMax = Max(zMax, mi->Get2dEffect(i)->pos.z);
|
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:
|
||||||
|
r = 255;
|
||||||
|
g = 0;
|
||||||
|
pos1 = ent->GetMatrix() * CVector(x, yMax, zMax);
|
||||||
|
pos2 = ent->GetMatrix() * CVector(x, yMin, zMax);
|
||||||
|
id = 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
r = 0;
|
||||||
|
g = 0;
|
||||||
|
pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin + zMax) / 2.0f);
|
||||||
|
pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin + zMax) / 2.0f);
|
||||||
|
id = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CWeather::TrafficLightBrightness > 0.5f)
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (CWeather::TrafficLightBrightness > 0.05f)
|
||||||
|
CShadows::StoreStaticShadow((uintptr)ent,
|
||||||
|
SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1,
|
||||||
|
8.0f, 0.0f, 0.0f, -8.0f, 128,
|
||||||
|
r * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
|
g * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
|
0 * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 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);
|
||||||
}
|
}
|
||||||
|
else if (MI_TRAFFICLIGHTS_VERTICAL == m) {
|
||||||
|
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;
|
CVector pos1;
|
||||||
uint8 r, g;
|
uint8 r, g;
|
||||||
int id;
|
int id;
|
||||||
switch(phase){
|
switch (phase) {
|
||||||
case CAR_LIGHTS_GREEN:
|
case CAR_LIGHTS_GREEN:
|
||||||
r = 0;
|
r = 0;
|
||||||
g = 255;
|
g = 255;
|
||||||
pos1 = ent->GetMatrix() * CVector(x, yMax, zMin);
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos;
|
||||||
pos2 = ent->GetMatrix() * CVector(x, yMin, zMin);
|
id = 0;
|
||||||
id = 0;
|
break;
|
||||||
break;
|
case CAR_LIGHTS_YELLOW:
|
||||||
case CAR_LIGHTS_YELLOW:
|
r = 255;
|
||||||
r = 255;
|
g = 128;
|
||||||
g = 128;
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos;
|
||||||
pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin+zMax)/2.0f);
|
id = 1;
|
||||||
pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin+zMax)/2.0f);
|
break;
|
||||||
id = 1;
|
case CAR_LIGHTS_RED:
|
||||||
break;
|
r = 255;
|
||||||
case CAR_LIGHTS_RED:
|
g = 0;
|
||||||
default:
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(0)->pos;
|
||||||
r = 255;
|
id = 2;
|
||||||
g = 0;
|
break;
|
||||||
pos1 = ent->GetMatrix() * CVector(x, yMax, zMax);
|
default:
|
||||||
pos2 = ent->GetMatrix() * CVector(x, yMin, zMax);
|
r = 0;
|
||||||
id = 2;
|
g = 0;
|
||||||
break;
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos;
|
||||||
|
id = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
||||||
|
|
||||||
|
if (CWeather::TrafficLightBrightness > 0.5f)
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (CWeather::TrafficLightBrightness > 0.05f)
|
||||||
|
CShadows::StoreStaticShadow((uintptr)ent,
|
||||||
|
SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1,
|
||||||
|
8.0f, 0.0f, 0.0f, -8.0f, 128,
|
||||||
|
r * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
|
g * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
|
0 * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 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 if (MI_TRAFFICLIGHTS_MIAMI == m || MI_TRAFFICLIGHTS_TWOVERTICAL == m) {
|
||||||
|
CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
|
||||||
|
CVector pos1, pos2;
|
||||||
|
uint8 r, g;
|
||||||
|
int id;
|
||||||
|
if (MI_TRAFFICLIGHTS_MIAMI == m) {
|
||||||
|
switch (phase) {
|
||||||
|
case CAR_LIGHTS_GREEN:
|
||||||
|
r = 0;
|
||||||
|
g = 255;
|
||||||
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(4)->pos;
|
||||||
|
pos2 = ent->GetMatrix() * mi->Get2dEffect(5)->pos;
|
||||||
|
id = 0;
|
||||||
|
break;
|
||||||
|
case CAR_LIGHTS_YELLOW:
|
||||||
|
r = 255;
|
||||||
|
g = 128;
|
||||||
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos;
|
||||||
|
pos2 = ent->GetMatrix() * mi->Get2dEffect(3)->pos;
|
||||||
|
id = 1;
|
||||||
|
break;
|
||||||
|
case CAR_LIGHTS_RED:
|
||||||
|
r = 255;
|
||||||
|
g = 0;
|
||||||
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(0)->pos;
|
||||||
|
pos2 = ent->GetMatrix() * mi->Get2dEffect(1)->pos;
|
||||||
|
id = 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
r = 0;
|
||||||
|
g = 0;
|
||||||
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos;
|
||||||
|
pos2 = ent->GetMatrix() * mi->Get2dEffect(3)->pos;
|
||||||
|
id = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (phase) {
|
||||||
|
case CAR_LIGHTS_GREEN:
|
||||||
|
r = 0;
|
||||||
|
g = 255;
|
||||||
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos;
|
||||||
|
pos2 = ent->GetMatrix() * mi->Get2dEffect(5)->pos;
|
||||||
|
id = 0;
|
||||||
|
break;
|
||||||
|
case CAR_LIGHTS_YELLOW:
|
||||||
|
r = 255;
|
||||||
|
g = 128;
|
||||||
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos;
|
||||||
|
pos2 = ent->GetMatrix() * mi->Get2dEffect(4)->pos;
|
||||||
|
id = 1;
|
||||||
|
break;
|
||||||
|
case CAR_LIGHTS_RED:
|
||||||
|
r = 255;
|
||||||
|
g = 0;
|
||||||
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(0)->pos;
|
||||||
|
pos2 = ent->GetMatrix() * mi->Get2dEffect(3)->pos;
|
||||||
|
id = 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
r = 0;
|
||||||
|
g = 0;
|
||||||
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos;
|
||||||
|
pos2 = ent->GetMatrix() * mi->Get2dEffect(4)->pos;
|
||||||
|
id = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(CClock::GetHours() > 19 || CClock::GetHours() < 6 || CWeather::Foggyness > 0.05f)
|
CVector pos = (pos1 + pos2) / 2;
|
||||||
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
if (id >= 0) {
|
||||||
pos1, CVector(0.0f, 0.0f, 0.0f), 8.0f,
|
CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
||||||
r/255.0f, g/255.0f, 0/255.0f, CPointLights::FOG_NORMAL, true);
|
CBrightLights::RegisterOne(pos2, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
||||||
|
}
|
||||||
|
|
||||||
CShadows::StoreStaticShadow((uintptr)ent,
|
if (CWeather::TrafficLightBrightness > 0.5f)
|
||||||
SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1,
|
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
||||||
8.0f, 0.0f, 0.0f, -8.0f, 128,
|
pos, CVector(0.0f, 0.0f, 0.0f), 8.0f,
|
||||||
r*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
|
r / 255.0f, g / 255.0f, 0 / 255.0f, CPointLights::FOG_NORMAL, true);
|
||||||
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)
|
if (CWeather::TrafficLightBrightness > 0.05f)
|
||||||
CCoronas::RegisterCorona((uintptr)ent + id,
|
CShadows::StoreStaticShadow((uintptr)ent,
|
||||||
r*CTimeCycle::GetSpriteBrightness()*0.7f,
|
SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos,
|
||||||
g*CTimeCycle::GetSpriteBrightness()*0.7f,
|
8.0f, 0.0f, 0.0f, -8.0f, 128,
|
||||||
0*CTimeCycle::GetSpriteBrightness()*0.7f,
|
r * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
255,
|
g * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
pos1, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f,
|
0 * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
12.0f, 1.0f, 40.0f, false, 0.0f);
|
||||||
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);
|
if (id >= 0) {
|
||||||
CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
if (DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f)
|
||||||
|
CCoronas::RegisterCorona((uintptr)ent + id,
|
||||||
/*
|
r * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
static const float top = -0.127f;
|
g * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
static const float bot = -0.539f;
|
0 * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
static const float mid = bot + (top-bot)/3.0f;
|
255,
|
||||||
static const float left = 1.256f;
|
pos1, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f,
|
||||||
static const float right = 0.706f;
|
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
||||||
phase = CTrafficLights::LightForPeds();
|
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||||
if(phase == PED_LIGHTS_DONT_WALK){
|
else
|
||||||
CVector p0(2.7f, right, top);
|
CCoronas::RegisterCorona((uintptr)ent + id,
|
||||||
CVector p1(2.7f, left, top);
|
r * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
CVector p2(2.7f, right, mid);
|
g * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
CVector p3(2.7f, left, mid);
|
0 * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3,
|
255,
|
||||||
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
|
pos2, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f,
|
||||||
SHINYTEXT_WALK, 255, 0, 0, 60.0f);
|
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
||||||
}else if(phase == PED_LIGHTS_WALK || CTimer::GetTimeInMilliseconds() & 0x100){
|
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
bool DoesLineSegmentIntersect(float l1x1, float l1y1, float l1x2, float l1y2, float l2x1, float l2y1, float l2x2, float l2y2)
|
||||||
|
{
|
||||||
|
return ((l2y2 - l1y1) * (l1x2 - l1x1) + (l1x1 - l2x2) * (l1y2 - l1y1)) *
|
||||||
|
((l2y1 - l1y1) * (l1x2 - l1x1) + (l1x1 - l2x1) * (l1y2 - l1y1)) <= 0.0f &&
|
||||||
|
((l1y2 - l2y1) * (l2x2 - l2x1) + (l2y2 - l2y1) * (l2x1 - l1x2)) *
|
||||||
|
((l1y1 - l2y1) * (l2x2 - l2x1) + (l2y2 - l2y1) * (l2x1 - l1x1)) <= 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -152,33 +324,28 @@ CTrafficLights::ScanForLightsOnMap(void)
|
||||||
if (!IsTrafficLight(light->GetModelIndex()))
|
if (!IsTrafficLight(light->GetModelIndex()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
CVector pos1 = light->GetMatrix() * CVector(17.0f, 0.0f, 0.0f);
|
||||||
|
CVector pos2 = light->GetMatrix() * CVector(-15.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
// Check cars
|
// Check cars
|
||||||
for(i = 0; i < ThePaths.m_numCarPathLinks; i++){
|
for(i = 0; i < ThePaths.m_numCarPathNodes; i++){
|
||||||
CVector2D dist = ThePaths.m_carPathLinks[i].GetPosition() - light->GetPosition();
|
if ((ThePaths.m_pathNodes[i].GetPosition() - pos1).MagnitudeSqr() >= SQR(100.0f))
|
||||||
float dotY = Abs(DotProduct2D(dist, light->GetForward())); // forward is direction of car light
|
continue;
|
||||||
float dotX = DotProduct2D(dist, light->GetRight()); // towards base of light
|
for (j = 0; j < ThePaths.m_pathNodes[i].numLinks; j++){
|
||||||
// it has to be on the correct side of the node and also not very far away
|
int con = ThePaths.ConnectedNode(ThePaths.m_pathNodes[i].firstLink + j);
|
||||||
if(dotX < 0.0f && dotX > -15.0f && dotY < 3.0f){
|
if (i < con) {
|
||||||
float dz = ThePaths.m_pathNodes[ThePaths.m_carPathLinks[i].pathNodeIndex].GetZ() -
|
CVector i_pos = ThePaths.m_pathNodes[i].GetPosition();
|
||||||
light->GetPosition().z;
|
CVector con_pos = ThePaths.m_pathNodes[con].GetPosition();
|
||||||
if(dz < 15.0f){
|
if (Abs(pos1.z - (i_pos.z + con_pos.z) / 2) < 10.0f &&
|
||||||
ThePaths.m_carPathLinks[i].trafficLightType = FindTrafficLightType(light);
|
DoesLineSegmentIntersect(pos1.x, pos1.y, pos2.x, pos2.y, i_pos.x, i_pos.y, con_pos.x, con_pos.y)) {
|
||||||
// Find two neighbour nodes of this one
|
//debug("Setting up light: nodes %f %f %f - %f %f %f, light %f %f %f - %f %f %f\n", i_pos.x, i_pos.y, i_pos.z, con_pos.x, con_pos.y, con_pos.z, pos1.x, pos1.y, pos1.z, pos2.x, pos2.y, pos2.z);
|
||||||
int n1 = -1;
|
int link = ThePaths.m_carPathConnections[ThePaths.m_pathNodes[i].firstLink + j];
|
||||||
int n2 = -1;
|
ThePaths.m_carPathLinks[link].trafficLightType = FindTrafficLightType(light);
|
||||||
for(j = 0; j < ThePaths.m_numPathNodes; j++)
|
if (ThePaths.m_pathNodes[i].numLinks > ThePaths.m_pathNodes[con].numLinks)
|
||||||
for(l = 0; l < ThePaths.m_pathNodes[j].numLinks; l++)
|
con = i;
|
||||||
if(ThePaths.m_carPathConnections[ThePaths.m_pathNodes[j].firstLink + l] == i){
|
if (ThePaths.m_carPathLinks[link].pathNodeIndex != con)
|
||||||
if(n1 == -1)
|
ThePaths.m_carPathLinks[link].trafficLightDirection = true;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,15 +376,18 @@ bool
|
||||||
CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
||||||
{
|
{
|
||||||
int node, type;
|
int node, type;
|
||||||
|
bool direction;
|
||||||
|
|
||||||
node = vehicle->AutoPilot.m_nNextPathNodeInfo;
|
node = vehicle->AutoPilot.m_nNextPathNodeInfo;
|
||||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||||
|
direction = ThePaths.m_carPathLinks[node].trafficLightDirection;
|
||||||
|
|
||||||
if(type){
|
if(type){
|
||||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) &&
|
if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) &&
|
||||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode))
|
(!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode))
|
||||||
if(alwaysStop ||
|
if(alwaysStop ||
|
||||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
type == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
||||||
ThePaths.m_carPathLinks[node].GetDirection());
|
ThePaths.m_carPathLinks[node].GetDirection());
|
||||||
if(vehicle->AutoPilot.m_nNextDirection == -1){
|
if(vehicle->AutoPilot.m_nNextDirection == -1){
|
||||||
|
@ -232,12 +402,13 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
||||||
|
|
||||||
node = vehicle->AutoPilot.m_nCurrentPathNodeInfo;
|
node = vehicle->AutoPilot.m_nCurrentPathNodeInfo;
|
||||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||||
|
direction = ThePaths.m_carPathLinks[node].trafficLightDirection;
|
||||||
if(type){
|
if(type){
|
||||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) &&
|
if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) &&
|
||||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode))
|
(!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode))
|
||||||
if(alwaysStop ||
|
if(alwaysStop ||
|
||||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
type == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
||||||
ThePaths.m_carPathLinks[node].GetDirection());
|
ThePaths.m_carPathLinks[node].GetDirection());
|
||||||
if(vehicle->AutoPilot.m_nCurrentDirection == -1){
|
if(vehicle->AutoPilot.m_nCurrentDirection == -1){
|
||||||
|
@ -253,12 +424,13 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
||||||
if(vehicle->GetStatus() == STATUS_PHYSICS){
|
if(vehicle->GetStatus() == STATUS_PHYSICS){
|
||||||
node = vehicle->AutoPilot.m_nPreviousPathNodeInfo;
|
node = vehicle->AutoPilot.m_nPreviousPathNodeInfo;
|
||||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||||
|
direction = ThePaths.m_carPathLinks[node].trafficLightDirection;
|
||||||
if(type){
|
if(type){
|
||||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) &&
|
if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) &&
|
||||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode))
|
(!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode))
|
||||||
if(alwaysStop ||
|
if(alwaysStop ||
|
||||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
type == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
||||||
ThePaths.m_carPathLinks[node].GetDirection());
|
ThePaths.m_carPathLinks[node].GetDirection());
|
||||||
if(vehicle->AutoPilot.m_nPreviousDirection == -1){
|
if(vehicle->AutoPilot.m_nPreviousDirection == -1){
|
||||||
|
@ -348,3 +520,19 @@ CTrafficLights::LightForCars2(void)
|
||||||
else
|
else
|
||||||
return CAR_LIGHTS_RED;
|
return CAR_LIGHTS_RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8
|
||||||
|
CTrafficLights::LightForCars1_Visual(void)
|
||||||
|
{
|
||||||
|
if (CWeather::Wind <= 1.1f)
|
||||||
|
return LightForCars1();
|
||||||
|
return (CTimer::GetTimeInMilliseconds() & 0x400 ? CAR_LIGHTS_NONE : CAR_LIGHTS_YELLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8
|
||||||
|
CTrafficLights::LightForCars2_Visual(void)
|
||||||
|
{
|
||||||
|
if (CWeather::Wind <= 1.1f)
|
||||||
|
return LightForCars2();
|
||||||
|
return (CTimer::GetTimeInMilliseconds() & 0x400 ? CAR_LIGHTS_NONE : CAR_LIGHTS_YELLOW);
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ enum {
|
||||||
|
|
||||||
CAR_LIGHTS_GREEN = 0,
|
CAR_LIGHTS_GREEN = 0,
|
||||||
CAR_LIGHTS_YELLOW,
|
CAR_LIGHTS_YELLOW,
|
||||||
CAR_LIGHTS_RED
|
CAR_LIGHTS_RED,
|
||||||
|
CAR_LIGHTS_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTrafficLights
|
class CTrafficLights
|
||||||
|
@ -24,6 +25,8 @@ public:
|
||||||
static uint8 LightForPeds(void);
|
static uint8 LightForPeds(void);
|
||||||
static uint8 LightForCars1(void);
|
static uint8 LightForCars1(void);
|
||||||
static uint8 LightForCars2(void);
|
static uint8 LightForCars2(void);
|
||||||
|
static uint8 LightForCars1_Visual(void);
|
||||||
|
static uint8 LightForCars2_Visual(void);
|
||||||
static bool ShouldCarStopForLight(CVehicle*, bool);
|
static bool ShouldCarStopForLight(CVehicle*, bool);
|
||||||
static bool ShouldCarStopForBridge(CVehicle*);
|
static bool ShouldCarStopForBridge(CVehicle*);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4247,7 +4247,7 @@ CCam::GetLookFromLampPostPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, C
|
||||||
CWorld::FindObjectsInRange(TargetCoors, 30.0f, true, &NumObjects, 15, Objects, false, false, false, true, true);
|
CWorld::FindObjectsInRange(TargetCoors, 30.0f, true, &NumObjects, 15, Objects, false, false, false, true, true);
|
||||||
float NearestDist = 10000.0f;
|
float NearestDist = 10000.0f;
|
||||||
for(i = 0; i < NumObjects; i++){
|
for(i = 0; i < NumObjects; i++){
|
||||||
if(Objects[i]->IsStatic() && Objects[i]->GetUp().z > 0.9f && IsLampPost(Objects[i]->GetModelIndex())){
|
if(Objects[i]->GetIsStatic() && Objects[i]->GetUp().z > 0.9f && IsLampPost(Objects[i]->GetModelIndex())){
|
||||||
float Dist = (Objects[i]->GetPosition() - TargetCoors).Magnitude2D();
|
float Dist = (Objects[i]->GetPosition() - TargetCoors).Magnitude2D();
|
||||||
if(Abs(ARRESTCAM_LAMP_BEST_DIST - Dist) < NearestDist){
|
if(Abs(ARRESTCAM_LAMP_BEST_DIST - Dist) < NearestDist){
|
||||||
CVector TestStart = Objects[i]->GetColModel()->boundingBox.max;
|
CVector TestStart = Objects[i]->GetColModel()->boundingBox.max;
|
||||||
|
|
|
@ -240,9 +240,8 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
|
||||||
CdReadInfo *pChannel = &gpReadInfo[channel];
|
CdReadInfo *pChannel = &gpReadInfo[channel];
|
||||||
ASSERT( pChannel != nil );
|
ASSERT( pChannel != nil );
|
||||||
|
|
||||||
|
|
||||||
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
|
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
|
||||||
if (pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
|
if (pChannel->hFile == hImage - 1 && pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
|
||||||
return STREAM_SUCCESS;
|
return STREAM_SUCCESS;
|
||||||
|
|
||||||
flushStream[channel] = 1;
|
flushStream[channel] = 1;
|
||||||
|
@ -293,7 +292,6 @@ CdStreamGetStatus(int32 channel)
|
||||||
if ( pChannel->nStatus != STREAM_NONE )
|
if ( pChannel->nStatus != STREAM_NONE )
|
||||||
{
|
{
|
||||||
int32 status = pChannel->nStatus;
|
int32 status = pChannel->nStatus;
|
||||||
|
|
||||||
pChannel->nStatus = STREAM_NONE;
|
pChannel->nStatus = STREAM_NONE;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -322,15 +320,16 @@ CdStreamSync(int32 channel)
|
||||||
pthread_kill(pChannel->pChannelThread, SIGUSR1);
|
pthread_kill(pChannel->pChannelThread, SIGUSR1);
|
||||||
if (pChannel->bReading) {
|
if (pChannel->bReading) {
|
||||||
pChannel->bLocked = true;
|
pChannel->bLocked = true;
|
||||||
sem_wait(pChannel->pDoneSemaphore);
|
while (pChannel->bLocked)
|
||||||
|
sem_wait(pChannel->pDoneSemaphore);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pChannel->nSectorsToRead = 0;
|
pChannel->nSectorsToRead = 0;
|
||||||
if (pChannel->bReading) {
|
if (pChannel->bReading) {
|
||||||
pChannel->bLocked = true;
|
pChannel->bLocked = true;
|
||||||
pthread_kill(_gCdStreamThread, SIGUSR1);
|
pthread_kill(_gCdStreamThread, SIGUSR1);
|
||||||
sem_wait(pChannel->pDoneSemaphore);
|
while (pChannel->bLocked)
|
||||||
|
sem_wait(pChannel->pDoneSemaphore);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pChannel->bReading = false;
|
pChannel->bReading = false;
|
||||||
|
@ -341,8 +340,8 @@ CdStreamSync(int32 channel)
|
||||||
if ( pChannel->nSectorsToRead != 0 )
|
if ( pChannel->nSectorsToRead != 0 )
|
||||||
{
|
{
|
||||||
pChannel->bLocked = true;
|
pChannel->bLocked = true;
|
||||||
|
while (pChannel->bLocked)
|
||||||
sem_wait(pChannel->pDoneSemaphore);
|
sem_wait(pChannel->pDoneSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
pChannel->bReading = false;
|
pChannel->bReading = false;
|
||||||
|
@ -443,9 +442,9 @@ void *CdStreamThread(void *param)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pChannel->nSectorsToRead = 0;
|
pChannel->nSectorsToRead = 0;
|
||||||
|
|
||||||
if ( pChannel->bLocked )
|
if ( pChannel->bLocked )
|
||||||
{
|
{
|
||||||
|
pChannel->bLocked = 0;
|
||||||
sem_post(pChannel->pDoneSemaphore);
|
sem_post(pChannel->pDoneSemaphore);
|
||||||
}
|
}
|
||||||
pChannel->bReading = false;
|
pChannel->bReading = false;
|
||||||
|
|
|
@ -406,8 +406,8 @@ CFireManager::ExtinguishPointWithWater(CVector point, float range)
|
||||||
CFire *fireToExtinguish = &m_aFires[fireI];
|
CFire *fireToExtinguish = &m_aFires[fireI];
|
||||||
fireToExtinguish->m_fWaterExtinguishCountdown -= 0.012f * CTimer::GetTimeStep();
|
fireToExtinguish->m_fWaterExtinguishCountdown -= 0.012f * CTimer::GetTimeStep();
|
||||||
CVector steamPos = fireToExtinguish->m_vecPos +
|
CVector steamPos = fireToExtinguish->m_vecPos +
|
||||||
CVector((CGeneral::GetRandomNumber() - 128) * 31.f / 200.f,
|
CVector((CGeneral::GetRandomNumber() - 128) * 3.1f / 200.f,
|
||||||
(CGeneral::GetRandomNumber() - 128) * 31.f / 200.f,
|
(CGeneral::GetRandomNumber() - 128) * 3.1f / 200.f,
|
||||||
CGeneral::GetRandomNumber() / 200.f);
|
CGeneral::GetRandomNumber() / 200.f);
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, steamPos, CVector(0.f, 0.f, 0.2f), nil, 0.5f);
|
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, steamPos, CVector(0.f, 0.f, 0.2f), nil, 0.5f);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "Messages.h"
|
#include "Messages.h"
|
||||||
#include "FileLoader.h"
|
#include "FileLoader.h"
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
|
#include "sampman.h"
|
||||||
|
|
||||||
// TODO(Miami): Remove that!! That was my map implementation for III, instead use MAP_ENHACEMENTS on some places
|
// TODO(Miami): Remove that!! That was my map implementation for III, instead use MAP_ENHACEMENTS on some places
|
||||||
#define CUSTOM_MAP
|
#define CUSTOM_MAP
|
||||||
|
@ -376,8 +377,7 @@ CMenuManager::CMenuManager()
|
||||||
m_bShowMouse = true;
|
m_bShowMouse = true;
|
||||||
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
|
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
|
||||||
|
|
||||||
// TODO(Miami)
|
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||||
// DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
|
||||||
m_bMenuActive = false;
|
m_bMenuActive = false;
|
||||||
m_bActivateSaveMenu = false;
|
m_bActivateSaveMenu = false;
|
||||||
m_bWantToLoad = false;
|
m_bWantToLoad = false;
|
||||||
|
@ -426,9 +426,7 @@ CMenuManager::Initialise(void)
|
||||||
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
||||||
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
||||||
m_PrefsRadioStation = DMAudio.GetRadioInCar();
|
m_PrefsRadioStation = DMAudio.GetRadioInCar();
|
||||||
|
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||||
// TODO(Miami)
|
|
||||||
// DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
|
||||||
if (DMAudio.IsMP3RadioChannelAvailable()) {
|
if (DMAudio.IsMP3RadioChannelAvailable()) {
|
||||||
if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > USERTRACK)
|
if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > USERTRACK)
|
||||||
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
|
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
|
||||||
|
@ -570,6 +568,7 @@ CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
|
||||||
m_nMousePosY > y1 && m_nMousePosY < y2;
|
m_nMousePosY > y1 && m_nMousePosY < y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --MIAMI: Done
|
||||||
void
|
void
|
||||||
CMenuManager::CheckSliderMovement(int value)
|
CMenuManager::CheckSliderMovement(int value)
|
||||||
{
|
{
|
||||||
|
@ -587,14 +586,27 @@ CMenuManager::CheckSliderMovement(int value)
|
||||||
CRenderer::ms_lodDistScale = m_PrefsLOD;
|
CRenderer::ms_lodDistScale = m_PrefsLOD;
|
||||||
break;
|
break;
|
||||||
case MENUACTION_MUSICVOLUME:
|
case MENUACTION_MUSICVOLUME:
|
||||||
m_PrefsMusicVolume += value * (128/32);
|
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
||||||
m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 65);
|
m_PrefsMusicVolume += value * (128 / 32);
|
||||||
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 65);
|
||||||
|
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MENUACTION_SFXVOLUME:
|
case MENUACTION_SFXVOLUME:
|
||||||
m_PrefsSfxVolume += value * (128/32);
|
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
||||||
m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 65);
|
m_PrefsSfxVolume += value * (128 / 32);
|
||||||
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 65);
|
||||||
|
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MENUACTION_MP3VOLUMEBOOST:
|
||||||
|
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
||||||
|
if (DMAudio.IsMP3RadioChannelAvailable()) {
|
||||||
|
m_PrefsMP3BoostVolume += value * (128 / 32);
|
||||||
|
m_PrefsMP3BoostVolume = clamp(m_PrefsMP3BoostVolume, 0, 65);
|
||||||
|
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MENUACTION_MOUSESENS:
|
case MENUACTION_MOUSESENS:
|
||||||
TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ???
|
TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ???
|
||||||
|
@ -1065,20 +1077,17 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
|
||||||
else if (m_nPrefsAudio3DProviderIndex == -1)
|
else if (m_nPrefsAudio3DProviderIndex == -1)
|
||||||
rightText = TheText.Get("FEA_ADP");
|
rightText = TheText.Get("FEA_ADP");
|
||||||
else {
|
else {
|
||||||
char* provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
|
char *rawProvider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
|
||||||
if (provider != NULL) {
|
AsciiToUnicode(rawProvider, unicodeTemp);
|
||||||
if (!strcmp(strupr(provider), "DIRECTSOUND3D HARDWARE SUPPORT")) {
|
char *provider = UnicodeToAscii(unicodeTemp); // genius
|
||||||
strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
|
strupr(provider);
|
||||||
}
|
if (!strcmp(provider, "DIRECTSOUND3D HARDWARE SUPPORT")) {
|
||||||
else if (!strcmp(strupr(provider), "DIRECTSOUND3D SOFTWARE EMULATION")) {
|
strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
|
||||||
strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
|
} else if (!strcmp(provider, "DIRECTSOUND3D SOFTWARE EMULATION")) {
|
||||||
}
|
strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
|
||||||
AsciiToUnicode(provider, unicodeTemp);
|
|
||||||
rightText = unicodeTemp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rightText = TheText.Get("not defined");
|
|
||||||
}
|
}
|
||||||
|
AsciiToUnicode(provider, unicodeTemp);
|
||||||
|
rightText = unicodeTemp;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENUACTION_SPEAKERCONF: {
|
case MENUACTION_SPEAKERCONF: {
|
||||||
|
@ -4007,6 +4016,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
|
||||||
if (selectedProvider != NO_AUDIO_PROVIDER) {
|
if (selectedProvider != NO_AUDIO_PROVIDER) {
|
||||||
if (selectedProvider == -1)
|
if (selectedProvider == -1)
|
||||||
selectedProvider = m_nPrefsAudio3DProviderIndex = DMAudio.AutoDetect3DProviders();
|
selectedProvider = m_nPrefsAudio3DProviderIndex = DMAudio.AutoDetect3DProviders();
|
||||||
|
|
||||||
m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex);
|
m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex);
|
||||||
if (selectedProvider != m_nPrefsAudio3DProviderIndex) {
|
if (selectedProvider != m_nPrefsAudio3DProviderIndex) {
|
||||||
SetHelperText(5);
|
SetHelperText(5);
|
||||||
|
@ -4039,7 +4049,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
|
||||||
m_PrefsMP3BoostVolume = 0;
|
m_PrefsMP3BoostVolume = 0;
|
||||||
m_PrefsStereoMono = 1;
|
m_PrefsStereoMono = 1;
|
||||||
m_PrefsSpeakers = 0;
|
m_PrefsSpeakers = 0;
|
||||||
// DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume); // TODO(Miami)
|
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
|
||||||
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
|
||||||
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
|
||||||
DMAudio.SetRadioInCar(m_PrefsRadioStation);
|
DMAudio.SetRadioInCar(m_PrefsRadioStation);
|
||||||
|
@ -4180,11 +4190,36 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case MENUACTION_AUDIOHW:
|
case MENUACTION_AUDIOHW:
|
||||||
// TODO(Miami): What are the extra things in here??
|
|
||||||
|
|
||||||
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
|
||||||
m_nPrefsAudio3DProviderIndex += changeAmount;
|
m_nPrefsAudio3DProviderIndex += changeAmount;
|
||||||
m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1);
|
|
||||||
|
bool checkIfForbidden = true;
|
||||||
|
while (checkIfForbidden) {
|
||||||
|
checkIfForbidden = false;
|
||||||
|
|
||||||
|
if (m_nPrefsAudio3DProviderIndex < -1)
|
||||||
|
m_nPrefsAudio3DProviderIndex = DMAudio.GetNum3DProvidersAvailable() - 1;
|
||||||
|
else if (m_nPrefsAudio3DProviderIndex > DMAudio.GetNum3DProvidersAvailable() - 1)
|
||||||
|
m_nPrefsAudio3DProviderIndex = -1;
|
||||||
|
|
||||||
|
// what a retarded move...
|
||||||
|
if (m_nPrefsAudio3DProviderIndex != -1) {
|
||||||
|
char* provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
|
||||||
|
strupr(provider);
|
||||||
|
if (!strcmp(provider, "MILES FAST 2D POSITIONAL AUDIO")) {
|
||||||
|
m_nPrefsAudio3DProviderIndex += changeAmount;
|
||||||
|
checkIfForbidden = true;
|
||||||
|
|
||||||
|
} else if (!strcmp(provider, "AUREAL A3D 2.0 (TM)")) {
|
||||||
|
m_nPrefsAudio3DProviderIndex += changeAmount;
|
||||||
|
checkIfForbidden = true;
|
||||||
|
|
||||||
|
} else if (!strcmp(provider, "AUREAL A3D INTERACTIVE (TM)")) {
|
||||||
|
m_nPrefsAudio3DProviderIndex += changeAmount;
|
||||||
|
checkIfForbidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENUACTION_SPEAKERCONF:
|
case MENUACTION_SPEAKERCONF:
|
||||||
|
@ -4543,19 +4578,13 @@ CMenuManager::UnloadTextures()
|
||||||
CUserDisplay::PlaceName.ProcessAfterFrontEndShutDown();
|
CUserDisplay::PlaceName.ProcessAfterFrontEndShutDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --MIAMI: Done
|
||||||
void
|
void
|
||||||
CMenuManager::WaitForUserCD()
|
CMenuManager::WaitForUserCD()
|
||||||
{
|
{
|
||||||
CSprite2d *splash;
|
CSprite2d *splash;
|
||||||
char *splashscreen = nil;
|
char *splashscreen = nil;
|
||||||
|
|
||||||
#if (!(defined RANDOMSPLASH) && !(defined GTA3_1_1_PATCH))
|
|
||||||
if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
|
|
||||||
splashscreen = "mainsc2";
|
|
||||||
else
|
|
||||||
splashscreen = "mainsc1";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
splash = LoadSplash(splashscreen);
|
splash = LoadSplash(splashscreen);
|
||||||
|
|
||||||
if (RsGlobal.quit)
|
if (RsGlobal.quit)
|
||||||
|
@ -4707,6 +4736,53 @@ CMenuManager::PrintMap(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
CRadar::DrawBlips();
|
CRadar::DrawBlips();
|
||||||
|
if (m_PrefsShowLegends) {
|
||||||
|
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(40.0f));
|
||||||
|
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(84.0f));
|
||||||
|
CFont::SetBackGroundOnlyTextOff();
|
||||||
|
CFont::SetColor(CRGBA(255, 150, 225, FadeIn(255)));
|
||||||
|
CFont::SetDropShadowPosition(2);
|
||||||
|
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
|
||||||
|
CFont::SetCentreOn();
|
||||||
|
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
|
||||||
|
CFont::SetScale(SCREEN_SCALE_X(0.65f), SCREEN_SCALE_Y(0.95f));
|
||||||
|
|
||||||
|
int secondColumnStart = (CRadar::MapLegendCounter - 1) / 2;
|
||||||
|
int boxBottom = MENU_Y(100.0f);
|
||||||
|
|
||||||
|
// + 3, because we want 19*3 px padding
|
||||||
|
for (int i = 0; i < secondColumnStart + 3; i++) {
|
||||||
|
boxBottom += MENU_Y(19.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(95.0f), MENU_Y(100.0f), MENU_X_LEFT_ALIGNED(555.f), boxBottom),
|
||||||
|
CRGBA(0, 0, 0, FadeIn(190)));
|
||||||
|
|
||||||
|
CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), MENU_Y(102.0f), TheText.Get("FE_MLG"));
|
||||||
|
CFont::SetRightJustifyOff();
|
||||||
|
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
|
||||||
|
if (m_PrefsLanguage == LANGUAGE_AMERICAN)
|
||||||
|
CFont::SetScale(SCREEN_SCALE_X(0.55f), SCREEN_SCALE_Y(0.55f));
|
||||||
|
else
|
||||||
|
CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.55f));
|
||||||
|
|
||||||
|
CFont::SetColor(CRGBA(225, 225, 225, FadeIn(255)));
|
||||||
|
CFont::SetDropShadowPosition(0);
|
||||||
|
|
||||||
|
int y = MENU_Y(127.0f);
|
||||||
|
int x = MENU_X_LEFT_ALIGNED(160.0f);
|
||||||
|
|
||||||
|
for (int16 i = 0; i < CRadar::MapLegendCounter; i++) {
|
||||||
|
CRadar::DrawLegend(x, y, CRadar::MapLegendList[i]);
|
||||||
|
|
||||||
|
if (i == secondColumnStart) {
|
||||||
|
x = MENU_X_LEFT_ALIGNED(350.0f);
|
||||||
|
y = MENU_Y(127.0f);
|
||||||
|
} else {
|
||||||
|
y += MENU_Y(19.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CUSTOM_MAP
|
#ifdef CUSTOM_MAP
|
||||||
CVector2D mapPoint;
|
CVector2D mapPoint;
|
||||||
|
@ -4785,7 +4861,7 @@ CMenuManager::PrintMap(void)
|
||||||
#endif
|
#endif
|
||||||
m_bMenuMapActive = false;
|
m_bMenuMapActive = false;
|
||||||
|
|
||||||
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(5.0f));
|
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(10.0f));
|
||||||
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(10.0f));
|
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(10.0f));
|
||||||
DisplayHelperText("FEH_MPH");
|
DisplayHelperText("FEH_MPH");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
|
|
||||||
|
#include "Bike.h"
|
||||||
#include "Boat.h"
|
#include "Boat.h"
|
||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
|
@ -13,6 +14,8 @@
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
CCPtrNodePool *CPools::ms_pPtrNodePool;
|
CCPtrNodePool *CPools::ms_pPtrNodePool;
|
||||||
CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
|
CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
|
||||||
CPedPool *CPools::ms_pPedPool;
|
CPedPool *CPools::ms_pPedPool;
|
||||||
|
@ -24,7 +27,6 @@ CDummyPool *CPools::ms_pDummyPool;
|
||||||
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
|
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
|
||||||
CColModelPool *CPools::ms_pColModelPool;
|
CColModelPool *CPools::ms_pColModelPool;
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPools::Initialise(void)
|
CPools::Initialise(void)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +42,6 @@ CPools::Initialise(void)
|
||||||
ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
|
ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPools::ShutDown(void)
|
CPools::ShutDown(void)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +120,8 @@ void CPools::LoadVehiclePool(uint8* buf, uint32 size)
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
int nNumCars = ReadSaveBuf<int>(buf);
|
int nNumCars = ReadSaveBuf<int>(buf);
|
||||||
int nNumBoats = ReadSaveBuf<int>(buf);
|
int nNumBoats = ReadSaveBuf<int>(buf);
|
||||||
for (int i = 0; i < nNumCars + nNumBoats; i++) {
|
int nNumBikes = ReadSaveBuf<int>(buf);
|
||||||
|
for (int i = 0; i < nNumCars + nNumBoats + nNumBikes; i++) {
|
||||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
uint32 type = ReadSaveBuf<uint32>(buf);
|
||||||
int16 model = ReadSaveBuf<int16>(buf);
|
int16 model = ReadSaveBuf<int16>(buf);
|
||||||
CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
|
CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
|
||||||
|
@ -131,13 +133,15 @@ INITSAVEBUF
|
||||||
pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE);
|
pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE);
|
||||||
else if (type == VEHICLE_TYPE_CAR)
|
else if (type == VEHICLE_TYPE_CAR)
|
||||||
pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE);
|
pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE);
|
||||||
|
else if (type == VEHICLE_TYPE_BIKE)
|
||||||
|
pVehicle = new(slot) CBike(model, RANDOM_VEHICLE);
|
||||||
else
|
else
|
||||||
assert(0);
|
assert(0);
|
||||||
--CCarCtrl::NumRandomCars;
|
--CCarCtrl::NumRandomCars;
|
||||||
pVehicle->Load(buf);
|
pVehicle->Load(buf);
|
||||||
CWorld::Add(pVehicle);
|
CWorld::Add(pVehicle);
|
||||||
#else
|
#else
|
||||||
char* vbuf = new char[Max(CAutomobile::nSaveStructSize, CBoat::nSaveStructSize)];
|
char* vbuf = new char[Max(CBike::nSaveStructSize, Max(CAutomobile::nSaveStructSize, CBoat::nSaveStructSize))];
|
||||||
if (type == VEHICLE_TYPE_BOAT) {
|
if (type == VEHICLE_TYPE_BOAT) {
|
||||||
memcpy(vbuf, buf, sizeof(CBoat));
|
memcpy(vbuf, buf, sizeof(CBoat));
|
||||||
SkipSaveBuf(buf, sizeof(CBoat));
|
SkipSaveBuf(buf, sizeof(CBoat));
|
||||||
|
@ -156,6 +160,17 @@ INITSAVEBUF
|
||||||
pAutomobile->Damage = ((CAutomobile*)vbuf)->Damage;
|
pAutomobile->Damage = ((CAutomobile*)vbuf)->Damage;
|
||||||
pAutomobile->SetupDamageAfterLoad();
|
pAutomobile->SetupDamageAfterLoad();
|
||||||
}
|
}
|
||||||
|
else if (type == VEHICLE_TYPE_BIKE) {
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
memcpy(vbuf, buf, sizeof(CBike));
|
||||||
|
#else
|
||||||
|
memcpy(vbuf, buf, sizeof(CAutomobile));
|
||||||
|
#endif
|
||||||
|
SkipSaveBuf(buf, sizeof(CBike));
|
||||||
|
CBike* pBike = new(slot) CBike(model, RANDOM_VEHICLE);
|
||||||
|
pVehicle = pBike;
|
||||||
|
--CCarCtrl::NumRandomCars;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
assert(0);
|
assert(0);
|
||||||
CVehicle* pBufferVehicle = (CVehicle*)vbuf;
|
CVehicle* pBufferVehicle = (CVehicle*)vbuf;
|
||||||
|
@ -193,6 +208,7 @@ INITSAVEBUF
|
||||||
(pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
|
(pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
|
||||||
(pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
|
(pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
|
||||||
pVehicle->AutoPilot = pBufferVehicle->AutoPilot;
|
pVehicle->AutoPilot = pBufferVehicle->AutoPilot;
|
||||||
|
CCarCtrl::UpdateCarCount(pVehicle, false);
|
||||||
CWorld::Add(pVehicle);
|
CWorld::Add(pVehicle);
|
||||||
delete[] vbuf;
|
delete[] vbuf;
|
||||||
#endif
|
#endif
|
||||||
|
@ -205,6 +221,7 @@ void CPools::SaveVehiclePool(uint8* buf, uint32* size)
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
int nNumCars = 0;
|
int nNumCars = 0;
|
||||||
int nNumBoats = 0;
|
int nNumBoats = 0;
|
||||||
|
int nNumBikes = 0;
|
||||||
int nPoolSize = GetVehiclePool()->GetSize();
|
int nPoolSize = GetVehiclePool()->GetSize();
|
||||||
for (int i = 0; i < nPoolSize; i++) {
|
for (int i = 0; i < nPoolSize; i++) {
|
||||||
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
||||||
|
@ -226,19 +243,25 @@ INITSAVEBUF
|
||||||
++nNumCars;
|
++nNumCars;
|
||||||
if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
|
if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
|
||||||
++nNumBoats;
|
++nNumBoats;
|
||||||
|
if (pVehicle->IsBike() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
|
||||||
|
++nNumBoats;
|
||||||
#else
|
#else
|
||||||
if (!pVehicle->pDriver && !bHasPassenger) {
|
if (!pVehicle->pDriver && !bHasPassenger) {
|
||||||
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
||||||
++nNumCars;
|
++nNumCars;
|
||||||
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
||||||
++nNumBoats;
|
++nNumBoats;
|
||||||
|
if (pVehicle->IsBike() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
||||||
|
++nNumBoats;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
|
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
|
||||||
nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBoat::nSaveStructSize) + sizeof(int);
|
nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBoat::nSaveStructSize) + sizeof(int) +
|
||||||
|
nNumBikes * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBike::nSaveStructSize) + sizeof(int);
|
||||||
WriteSaveBuf(buf, nNumCars);
|
WriteSaveBuf(buf, nNumCars);
|
||||||
WriteSaveBuf(buf, nNumBoats);
|
WriteSaveBuf(buf, nNumBoats);
|
||||||
|
WriteSaveBuf(buf, nNumBikes);
|
||||||
for (int i = 0; i < nPoolSize; i++) {
|
for (int i = 0; i < nPoolSize; i++) {
|
||||||
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
||||||
if (!pVehicle)
|
if (!pVehicle)
|
||||||
|
@ -258,9 +281,9 @@ INITSAVEBUF
|
||||||
#endif
|
#endif
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
|
if ((pVehicle->IsCar() || pVehicle->IsBoat() || pVehicle->IsBike()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
|
||||||
#else
|
#else
|
||||||
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
if ((pVehicle->IsCar() || pVehicle->IsBoat() || pVehicle->IsBike()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
||||||
#endif
|
#endif
|
||||||
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
|
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
|
||||||
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
|
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
|
||||||
|
@ -290,6 +313,17 @@ INITSAVEBUF
|
||||||
memcpy(buf, pVehicle, sizeof(CBoat));
|
memcpy(buf, pVehicle, sizeof(CBoat));
|
||||||
SkipSaveBuf(buf, sizeof(CBoat));
|
SkipSaveBuf(buf, sizeof(CBoat));
|
||||||
}
|
}
|
||||||
|
#ifdef MISSION_REPLAY
|
||||||
|
if (pVehicle->IsBike() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
|
||||||
|
#else
|
||||||
|
if (pVehicle->IsBike() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
||||||
|
#endif
|
||||||
|
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
|
||||||
|
WriteSaveBuf(buf, pVehicle->GetModelIndex());
|
||||||
|
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
|
||||||
|
memcpy(buf, pVehicle, sizeof(CBike));
|
||||||
|
SkipSaveBuf(buf, sizeof(CBike));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,8 +345,9 @@ INITSAVEBUF
|
||||||
++nObjects;
|
++nObjects;
|
||||||
}
|
}
|
||||||
*size = nObjects * (sizeof(int16) + sizeof(int) + sizeof(CCompressedMatrix) +
|
*size = nObjects * (sizeof(int16) + sizeof(int) + sizeof(CCompressedMatrix) +
|
||||||
sizeof(float) + sizeof(CCompressedMatrix) + sizeof(int8) + 7 * sizeof(bool) + sizeof(float) +
|
sizeof(float) + sizeof(CCompressedMatrix) + sizeof(int8) + 7 * sizeof(bool) + sizeof(int16) +
|
||||||
sizeof(int8) + sizeof(int8) + sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
|
+ sizeof(int8) * 2 + sizeof(float) + sizeof(int8) + sizeof(int8) +
|
||||||
|
sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
|
||||||
CopyToBuf(buf, nObjects);
|
CopyToBuf(buf, nObjects);
|
||||||
for (int i = 0; i < nPoolSize; i++) {
|
for (int i = 0; i < nPoolSize; i++) {
|
||||||
CObject* pObject = GetObjectPool()->GetSlot(i);
|
CObject* pObject = GetObjectPool()->GetSlot(i);
|
||||||
|
@ -343,6 +378,9 @@ INITSAVEBUF
|
||||||
CopyToBuf(buf, bGlassBroken);
|
CopyToBuf(buf, bGlassBroken);
|
||||||
CopyToBuf(buf, bHasBeenDamaged);
|
CopyToBuf(buf, bHasBeenDamaged);
|
||||||
CopyToBuf(buf, bUseVehicleColours);
|
CopyToBuf(buf, bUseVehicleColours);
|
||||||
|
CopyToBuf(buf, pObject->m_nCostValue);
|
||||||
|
CopyToBuf(buf, pObject->m_nBonusValue);
|
||||||
|
SkipSaveBuf(buf, 1);
|
||||||
CopyToBuf(buf, pObject->m_fCollisionDamageMultiplier);
|
CopyToBuf(buf, pObject->m_fCollisionDamageMultiplier);
|
||||||
CopyToBuf(buf, pObject->m_nCollisionDamageEffect);
|
CopyToBuf(buf, pObject->m_nCollisionDamageEffect);
|
||||||
CopyToBuf(buf, pObject->m_nSpecialCollisionResponseCases);
|
CopyToBuf(buf, pObject->m_nSpecialCollisionResponseCases);
|
||||||
|
@ -392,6 +430,9 @@ INITSAVEBUF
|
||||||
pBufferObject->bHasBeenDamaged = bitFlag;
|
pBufferObject->bHasBeenDamaged = bitFlag;
|
||||||
CopyFromBuf(buf, bitFlag);
|
CopyFromBuf(buf, bitFlag);
|
||||||
pBufferObject->bUseVehicleColours = bitFlag;
|
pBufferObject->bUseVehicleColours = bitFlag;
|
||||||
|
CopyFromBuf(buf, pBufferObject->m_nCostValue);
|
||||||
|
CopyFromBuf(buf, pBufferObject->m_nBonusValue);
|
||||||
|
SkipSaveBuf(buf, 1);
|
||||||
CopyFromBuf(buf, pBufferObject->m_fCollisionDamageMultiplier);
|
CopyFromBuf(buf, pBufferObject->m_fCollisionDamageMultiplier);
|
||||||
CopyFromBuf(buf, pBufferObject->m_nCollisionDamageEffect);
|
CopyFromBuf(buf, pBufferObject->m_nCollisionDamageEffect);
|
||||||
CopyFromBuf(buf, pBufferObject->m_nSpecialCollisionResponseCases);
|
CopyFromBuf(buf, pBufferObject->m_nSpecialCollisionResponseCases);
|
||||||
|
@ -426,6 +467,8 @@ INITSAVEBUF
|
||||||
(pObject->GetAddressOfEntityProperties())[1] = (pBufferObject->GetAddressOfEntityProperties())[1];
|
(pObject->GetAddressOfEntityProperties())[1] = (pBufferObject->GetAddressOfEntityProperties())[1];
|
||||||
#endif
|
#endif
|
||||||
pObject->bHasCollided = false;
|
pObject->bHasCollided = false;
|
||||||
|
pObject->m_nCostValue = pBufferObject->m_nCostValue;
|
||||||
|
pObject->m_nBonusValue = pBufferObject->m_nBonusValue;
|
||||||
CWorld::Add(pObject);
|
CWorld::Add(pObject);
|
||||||
delete[] obuf;
|
delete[] obuf;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -96,6 +96,17 @@ enum eRadarSprite
|
||||||
RADAR_SPRITE_COUNT
|
RADAR_SPRITE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
RADAR_TRACE_RED,
|
||||||
|
RADAR_TRACE_GREEN,
|
||||||
|
RADAR_TRACE_LIGHT_BLUE,
|
||||||
|
RADAR_TRACE_GRAY,
|
||||||
|
RADAR_TRACE_YELLOW,
|
||||||
|
RADAR_TRACE_MAGENTA,
|
||||||
|
RADAR_TRACE_CYAN
|
||||||
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
BLIP_MODE_TRIANGULAR_UP = 0,
|
BLIP_MODE_TRIANGULAR_UP = 0,
|
||||||
|
@ -108,17 +119,39 @@ struct sRadarTrace
|
||||||
uint32 m_nColor;
|
uint32 m_nColor;
|
||||||
uint32 m_eBlipType; // eBlipType
|
uint32 m_eBlipType; // eBlipType
|
||||||
int32 m_nEntityHandle;
|
int32 m_nEntityHandle;
|
||||||
|
CVector m_vec2DPos;
|
||||||
|
CVector m_vecPos;
|
||||||
|
uint16 m_BlipIndex;
|
||||||
|
bool m_bDim;
|
||||||
|
bool m_bInUse;
|
||||||
|
bool m_bShortRange;
|
||||||
|
bool m_unused;
|
||||||
|
float m_Radius;
|
||||||
|
int16 m_wScale;
|
||||||
|
uint16 m_eBlipDisplay; // eBlipDisplay
|
||||||
|
uint16 m_eRadarSprite; // eRadarSprite
|
||||||
|
};
|
||||||
|
|
||||||
|
// Either that was a thing while saving/loading blips, or they added sizes of each field one by one. I want to do the former.
|
||||||
|
#pragma pack(push,1)
|
||||||
|
struct sRadarTraceSave
|
||||||
|
{
|
||||||
|
uint32 m_nColor;
|
||||||
|
float m_Radius;
|
||||||
|
uint32 m_eBlipType; // eBlipType
|
||||||
|
int32 m_nEntityHandle;
|
||||||
CVector2D m_vec2DPos;
|
CVector2D m_vec2DPos;
|
||||||
CVector m_vecPos;
|
CVector m_vecPos;
|
||||||
uint16 m_BlipIndex;
|
uint16 m_BlipIndex;
|
||||||
bool m_bDim;
|
bool m_bDim;
|
||||||
bool m_bInUse;
|
bool m_bInUse;
|
||||||
bool m_bShortRange;
|
bool m_bShortRange;
|
||||||
float m_Radius;
|
bool m_unused;
|
||||||
int16 m_wScale;
|
int16 m_wScale;
|
||||||
uint16 m_eBlipDisplay; // eBlipDisplay
|
uint16 m_eBlipDisplay; // eBlipDisplay
|
||||||
uint16 m_eRadarSprite; // eRadarSprite
|
uint16 m_eRadarSprite; // eRadarSprite
|
||||||
};
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
// Values for screen space
|
// Values for screen space
|
||||||
#define RADAR_LEFT (40.0f)
|
#define RADAR_LEFT (40.0f)
|
||||||
|
@ -176,7 +209,7 @@ public:
|
||||||
static CRGBA ArrowBlipColour1;
|
static CRGBA ArrowBlipColour1;
|
||||||
static CRGBA ArrowBlipColour2;
|
static CRGBA ArrowBlipColour2;
|
||||||
static int16 MapLegendList[NUM_MAP_LEGENDS];
|
static int16 MapLegendList[NUM_MAP_LEGENDS];
|
||||||
static uint16 MapLegendCounter;
|
static int16 MapLegendCounter;
|
||||||
|
|
||||||
#ifdef MAP_ENHANCEMENTS
|
#ifdef MAP_ENHANCEMENTS
|
||||||
static int TargetMarkerId;
|
static int TargetMarkerId;
|
||||||
|
@ -215,9 +248,9 @@ public:
|
||||||
static void RemoveRadarSections();
|
static void RemoveRadarSections();
|
||||||
static void SaveAllRadarBlips(uint8*, uint32*);
|
static void SaveAllRadarBlips(uint8*, uint32*);
|
||||||
static void SetBlipSprite(int32 i, int32 icon);
|
static void SetBlipSprite(int32 i, int32 icon);
|
||||||
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
|
static int32 SetCoordBlip(eBlipType type, CVector pos, uint32, eBlipDisplay);
|
||||||
static int32 SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay);
|
static int32 SetEntityBlip(eBlipType type, int32, uint32, eBlipDisplay);
|
||||||
static int32 SetShortRangeCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
|
static int32 SetShortRangeCoordBlip(eBlipType type, CVector pos, uint32, eBlipDisplay);
|
||||||
static void SetRadarMarkerState(int32 i, bool flag);
|
static void SetRadarMarkerState(int32 i, bool flag);
|
||||||
static void ShowRadarMarker(CVector pos, uint32 color, float radius);
|
static void ShowRadarMarker(CVector pos, uint32 color, float radius);
|
||||||
static void ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha);
|
static void ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha);
|
||||||
|
@ -229,7 +262,8 @@ public:
|
||||||
static void TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in);
|
static void TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in);
|
||||||
static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in);
|
static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in);
|
||||||
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
|
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
|
||||||
|
|
||||||
// no in CRadar in the game:
|
|
||||||
static void CalculateCachedSinCos();
|
static void CalculateCachedSinCos();
|
||||||
|
static void DrawEntityBlip(int32 blipId);
|
||||||
|
static void DrawCoordBlip(int32 blipId);
|
||||||
|
static void DrawLegend(int32, int32, int32);
|
||||||
};
|
};
|
||||||
|
|
|
@ -903,7 +903,7 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
mi = CModelInfo::GetModelInfo(modelId);
|
mi = CModelInfo::GetModelInfo(modelId);
|
||||||
if(!CGeneral::faststrcmp("CSPlay", modelName)){
|
if(strncasecmp("CSPlay", modelName, 6) == 0){
|
||||||
char *curname = CModelInfo::GetModelInfo(MI_PLAYER)->GetName();
|
char *curname = CModelInfo::GetModelInfo(MI_PLAYER)->GetName();
|
||||||
for(int i = 0; CSnames[i][0]; i++){
|
for(int i = 0; CSnames[i][0]; i++){
|
||||||
if(strcasecmp(curname, IGnames[i]) == 0){
|
if(strcasecmp(curname, IGnames[i]) == 0){
|
||||||
|
|
|
@ -79,7 +79,7 @@ CWorld::Add(CEntity *ent)
|
||||||
|
|
||||||
if(ent->IsBuilding() || ent->IsDummy()) return;
|
if(ent->IsBuilding() || ent->IsDummy()) return;
|
||||||
|
|
||||||
if(!ent->IsStatic()) ((CPhysical *)ent)->AddToMovingList();
|
if(!ent->GetIsStatic()) ((CPhysical *)ent)->AddToMovingList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -94,7 +94,7 @@ CWorld::Remove(CEntity *ent)
|
||||||
|
|
||||||
if(ent->IsBuilding() || ent->IsDummy()) return;
|
if(ent->IsBuilding() || ent->IsDummy()) return;
|
||||||
|
|
||||||
if(!ent->IsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
|
if(!ent->GetIsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1962,7 +1962,7 @@ CWorld::Process(void)
|
||||||
RemoveEntityInsteadOfProcessingIt(movingEnt);
|
RemoveEntityInsteadOfProcessingIt(movingEnt);
|
||||||
} else {
|
} else {
|
||||||
movingEnt->ProcessControl();
|
movingEnt->ProcessControl();
|
||||||
if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
|
if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bForceProcessControl = true;
|
bForceProcessControl = true;
|
||||||
|
@ -1973,7 +1973,7 @@ CWorld::Process(void)
|
||||||
RemoveEntityInsteadOfProcessingIt(movingEnt);
|
RemoveEntityInsteadOfProcessingIt(movingEnt);
|
||||||
} else {
|
} else {
|
||||||
movingEnt->ProcessControl();
|
movingEnt->ProcessControl();
|
||||||
if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
|
if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2133,13 +2133,13 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
|
||||||
CObject *pObject = (CObject *)pEntity;
|
CObject *pObject = (CObject *)pEntity;
|
||||||
CVehicle *pVehicle = (CVehicle *)pEntity;
|
CVehicle *pVehicle = (CVehicle *)pEntity;
|
||||||
if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
|
if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
|
||||||
if(pEntity->IsStatic()) {
|
if(pEntity->GetIsStatic()) {
|
||||||
if(pEntity->IsObject()) {
|
if(pEntity->IsObject()) {
|
||||||
if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
|
if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
|
||||||
if (IsGlass(pObject->GetModelIndex())) {
|
if (IsGlass(pObject->GetModelIndex())) {
|
||||||
CGlass::WindowRespondsToExplosion(pObject, position);
|
CGlass::WindowRespondsToExplosion(pObject, position);
|
||||||
} else {
|
} else {
|
||||||
pObject->bIsStatic = false;
|
pObject->SetIsStatic(false);
|
||||||
pObject->AddToMovingList();
|
pObject->AddToMovingList();
|
||||||
int16 modelId = pEntity->GetModelIndex();
|
int16 modelId = pEntity->GetModelIndex();
|
||||||
if(modelId != MI_FIRE_HYDRANT ||
|
if(modelId != MI_FIRE_HYDRANT ||
|
||||||
|
@ -2157,18 +2157,18 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(pEntity->IsStatic()) {
|
if(pEntity->GetIsStatic()) {
|
||||||
float fDamageMultiplier =
|
float fDamageMultiplier =
|
||||||
(fRadius - fMagnitude) * 2.0f / fRadius;
|
(fRadius - fMagnitude) * 2.0f / fRadius;
|
||||||
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
|
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
|
||||||
pObject->ObjectDamage(fDamage);
|
pObject->ObjectDamage(fDamage);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pEntity->bIsStatic = false;
|
pEntity->SetIsStatic(false);
|
||||||
pEntity->AddToMovingList();
|
pEntity->AddToMovingList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!pEntity->IsStatic()) {
|
if(!pEntity->GetIsStatic()) {
|
||||||
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
|
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
|
||||||
CVector vecForceDir =
|
CVector vecForceDir =
|
||||||
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /
|
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /
|
||||||
|
|
|
@ -633,14 +633,17 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#define CZONE_SAVE_SIZE (sizeof(char)*8+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(float)+sizeof(eZoneType)+sizeof(eLevelName)+sizeof(int16)+sizeof(int16)+sizeof(int32)+sizeof(int32)+sizeof(int32))
|
||||||
|
|
||||||
*size = SAVE_HEADER_SIZE
|
*size = SAVE_HEADER_SIZE
|
||||||
+ sizeof(m_CurrLevel) + sizeof(FindIndex)
|
+ sizeof(m_CurrLevel) + sizeof(FindIndex)
|
||||||
+ sizeof(int16) // padding
|
+ sizeof(int16) // padding
|
||||||
+ sizeof(NavigationZoneArray) + sizeof(InfoZoneArray) + sizeof(ZoneInfoArray)
|
+ CZONE_SAVE_SIZE * ARRAY_SIZE(NavigationZoneArray) + CZONE_SAVE_SIZE * ARRAY_SIZE(InfoZoneArray) + sizeof(ZoneInfoArray)
|
||||||
+ sizeof(TotalNumberOfNavigationZones) + sizeof(TotalNumberOfInfoZones) + sizeof(TotalNumberOfZoneInfos)
|
+ sizeof(TotalNumberOfNavigationZones) + sizeof(TotalNumberOfInfoZones) + sizeof(TotalNumberOfZoneInfos)
|
||||||
+ sizeof(int16) // padding
|
+ sizeof(int16) // padding
|
||||||
+ sizeof(MapZoneArray) + sizeof(AudioZoneArray)
|
+ CZONE_SAVE_SIZE * ARRAY_SIZE(MapZoneArray) + sizeof(AudioZoneArray)
|
||||||
+ sizeof(TotalNumberOfMapZones) + sizeof(NumberOfAudioZones);
|
+ sizeof(TotalNumberOfMapZones) + sizeof(NumberOfAudioZones);
|
||||||
|
#undef CZONE_SAVE_SIZE
|
||||||
|
|
||||||
uint32 length = 0;
|
uint32 length = 0;
|
||||||
WriteSaveHeaderWithLength(buffer, length, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
|
WriteSaveHeaderWithLength(buffer, length, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
|
||||||
|
|
|
@ -172,7 +172,6 @@ enum Config {
|
||||||
# define RANDOMSPLASH
|
# define RANDOMSPLASH
|
||||||
# define VU_COLLISION
|
# define VU_COLLISION
|
||||||
#elif defined GTA_PC
|
#elif defined GTA_PC
|
||||||
# define GTA3_1_1_PATCH
|
|
||||||
//# define GTA3_STEAM_PATCH
|
//# define GTA3_STEAM_PATCH
|
||||||
//# define GTAVC_JP_PATCH
|
//# define GTAVC_JP_PATCH
|
||||||
# ifdef GTA_PS2_STUFF
|
# ifdef GTA_PS2_STUFF
|
||||||
|
@ -263,7 +262,6 @@ enum Config {
|
||||||
|
|
||||||
// Hud, frontend and radar
|
// Hud, frontend and radar
|
||||||
//#define BETA_SLIDING_TEXT
|
//#define BETA_SLIDING_TEXT
|
||||||
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
|
|
||||||
#define PC_MENU
|
#define PC_MENU
|
||||||
|
|
||||||
#ifndef PC_MENU
|
#ifndef PC_MENU
|
||||||
|
@ -315,9 +313,7 @@ enum Config {
|
||||||
#define FREE_CAM // Rotating cam
|
#define FREE_CAM // Rotating cam
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
#ifndef AUDIO_OAL // is not working yet for openal
|
|
||||||
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||||
#endif
|
|
||||||
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
|
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,8 @@ public:
|
||||||
eEntityStatus GetStatus() const { return (eEntityStatus)m_status; }
|
eEntityStatus GetStatus() const { return (eEntityStatus)m_status; }
|
||||||
void SetStatus(eEntityStatus status) { m_status = status; }
|
void SetStatus(eEntityStatus status) { m_status = status; }
|
||||||
CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); }
|
CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); }
|
||||||
bool IsStatic(void) { return bIsStatic || bIsStaticWaitingForCollision; }
|
bool GetIsStatic(void) const { return bIsStatic || bIsStaticWaitingForCollision; }
|
||||||
|
void SetIsStatic(bool state) { bIsStatic = state; }
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
void SaveEntityFlags(uint8*& buf);
|
void SaveEntityFlags(uint8*& buf);
|
||||||
void LoadEntityFlags(uint8*& buf);
|
void LoadEntityFlags(uint8*& buf);
|
||||||
|
|
|
@ -344,7 +344,7 @@ CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
|
||||||
AddCollisionRecord(ent);
|
AddCollisionRecord(ent);
|
||||||
if(!ent->IsBuilding()) // Can't this catch dummies too?
|
if(!ent->IsBuilding()) // Can't this catch dummies too?
|
||||||
((CPhysical*)ent)->AddCollisionRecord(this);
|
((CPhysical*)ent)->AddCollisionRecord(this);
|
||||||
if(ent->IsBuilding() || ent->IsStatic())
|
if(ent->IsBuilding() || ent->GetIsStatic())
|
||||||
this->bHasHitWall = true;
|
this->bHasHitWall = true;
|
||||||
}
|
}
|
||||||
return numSpheres;
|
return numSpheres;
|
||||||
|
@ -380,7 +380,7 @@ CPhysical::ProcessControl(void)
|
||||||
m_nStaticFrames++;
|
m_nStaticFrames++;
|
||||||
if(m_nStaticFrames > 10){
|
if(m_nStaticFrames > 10){
|
||||||
m_nStaticFrames = 10;
|
m_nStaticFrames = 10;
|
||||||
bIsStatic = true;
|
SetIsStatic(true);
|
||||||
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||||
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||||
m_vecMoveFriction = m_vecMoveSpeed;
|
m_vecMoveFriction = m_vecMoveSpeed;
|
||||||
|
@ -614,7 +614,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||||
}
|
}
|
||||||
|
|
||||||
float speedA, speedB;
|
float speedA, speedB;
|
||||||
if(B->IsStatic() && !foo){
|
if(B->GetIsStatic() && !foo){
|
||||||
if(A->bPedPhysics){
|
if(A->bPedPhysics){
|
||||||
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
|
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
|
||||||
if(speedA < 0.0f){
|
if(speedA < 0.0f){
|
||||||
|
@ -625,7 +625,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||||
if(IsGlass(B->GetModelIndex()))
|
if(IsGlass(B->GetModelIndex()))
|
||||||
CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false);
|
CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false);
|
||||||
else if(!B->bInfiniteMass){
|
else if(!B->bInfiniteMass){
|
||||||
B->bIsStatic = false;
|
B->SetIsStatic(false);
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nHavocLevel += 2;
|
CWorld::Players[CWorld::PlayerInFocus].m_nHavocLevel += 2;
|
||||||
CStats::PropertyDestroyed += CGeneral::GetRandomNumberInRange(30, 60);
|
CStats::PropertyDestroyed += CGeneral::GetRandomNumberInRange(30, 60);
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}else if(!B->bInfiniteMass)
|
}else if(!B->bInfiniteMass)
|
||||||
B->bIsStatic = false;
|
B->SetIsStatic(false);
|
||||||
|
|
||||||
if(B->bInfiniteMass){
|
if(B->bInfiniteMass){
|
||||||
impulseA = -speedA * A->m_fMass;
|
impulseA = -speedA * A->m_fMass;
|
||||||
|
@ -675,7 +675,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||||
if(IsGlass(B->GetModelIndex()))
|
if(IsGlass(B->GetModelIndex()))
|
||||||
CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false);
|
CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false);
|
||||||
else
|
else
|
||||||
B->bIsStatic = false;
|
B->SetIsStatic(false);
|
||||||
int16 model = B->GetModelIndex();
|
int16 model = B->GetModelIndex();
|
||||||
if(model == MI_FIRE_HYDRANT && !Bobj->bHasBeenDamaged){
|
if(model == MI_FIRE_HYDRANT && !Bobj->bHasBeenDamaged){
|
||||||
CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, B->GetPosition() - CVector(0.0f, 0.0f, 0.5f), true);
|
CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, B->GetPosition() - CVector(0.0f, 0.0f, 0.5f), true);
|
||||||
|
@ -699,11 +699,11 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}else if(!B->bInfiniteMass)
|
}else if(!B->bInfiniteMass)
|
||||||
B->bIsStatic = false;
|
B->SetIsStatic(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(B->IsStatic())
|
if(B->GetIsStatic())
|
||||||
return false;
|
return false;
|
||||||
if(!B->bInfiniteMass && !B->m_phy_flagA08)
|
if(!B->bInfiniteMass && !B->m_phy_flagA08)
|
||||||
B->AddToMovingList();
|
B->AddToMovingList();
|
||||||
|
@ -1231,7 +1231,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||||
canshift = true;
|
canshift = true;
|
||||||
else
|
else
|
||||||
canshift = A->IsPed() &&
|
canshift = A->IsPed() &&
|
||||||
B->IsObject() && B->IsStatic() && !Bobj->bHasBeenDamaged;
|
B->IsObject() && B->GetIsStatic() && !Bobj->bHasBeenDamaged;
|
||||||
if(B == A ||
|
if(B == A ||
|
||||||
B->m_scanCode == CWorld::GetCurrentScanCode() ||
|
B->m_scanCode == CWorld::GetCurrentScanCode() ||
|
||||||
!B->bUsesCollision ||
|
!B->bUsesCollision ||
|
||||||
|
@ -1255,7 +1255,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||||
CObject *Aobj = (CObject*)A;
|
CObject *Aobj = (CObject*)A;
|
||||||
if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
|
if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
|
||||||
!Aobj->bHasBeenDamaged &&
|
!Aobj->bHasBeenDamaged &&
|
||||||
Aobj->IsStatic()){
|
Aobj->GetIsStatic()){
|
||||||
if(Aobj->m_pCollidingEntity == B)
|
if(Aobj->m_pCollidingEntity == B)
|
||||||
Aobj->m_pCollidingEntity = nil;
|
Aobj->m_pCollidingEntity = nil;
|
||||||
}else if(Aobj->m_pCollidingEntity != B){
|
}else if(Aobj->m_pCollidingEntity != B){
|
||||||
|
@ -1272,7 +1272,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||||
CObject *Bobj = (CObject*)B;
|
CObject *Bobj = (CObject*)B;
|
||||||
if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
|
if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
|
||||||
!Bobj->bHasBeenDamaged &&
|
!Bobj->bHasBeenDamaged &&
|
||||||
Bobj->IsStatic()){
|
Bobj->GetIsStatic()){
|
||||||
if(Bobj->m_pCollidingEntity == A)
|
if(Bobj->m_pCollidingEntity == A)
|
||||||
Bobj->m_pCollidingEntity = nil;
|
Bobj->m_pCollidingEntity = nil;
|
||||||
}else if(Bobj->m_pCollidingEntity != A){
|
}else if(Bobj->m_pCollidingEntity != A){
|
||||||
|
@ -1595,7 +1595,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
||||||
skipCollision = true;
|
skipCollision = true;
|
||||||
else if(Aobj->ObjectCreatedBy == TEMP_OBJECT ||
|
else if(Aobj->ObjectCreatedBy == TEMP_OBJECT ||
|
||||||
Aobj->bHasBeenDamaged ||
|
Aobj->bHasBeenDamaged ||
|
||||||
!Aobj->IsStatic()){
|
!Aobj->GetIsStatic()){
|
||||||
if(Aobj->m_pCollidingEntity == B)
|
if(Aobj->m_pCollidingEntity == B)
|
||||||
skipCollision = true;
|
skipCollision = true;
|
||||||
else if(Aobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){
|
else if(Aobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){
|
||||||
|
@ -1614,7 +1614,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
||||||
skipCollision = true;
|
skipCollision = true;
|
||||||
else if(Bobj->ObjectCreatedBy == TEMP_OBJECT ||
|
else if(Bobj->ObjectCreatedBy == TEMP_OBJECT ||
|
||||||
Bobj->bHasBeenDamaged ||
|
Bobj->bHasBeenDamaged ||
|
||||||
!Bobj->IsStatic()){
|
!Bobj->GetIsStatic()){
|
||||||
if(Bobj->m_pCollidingEntity == A)
|
if(Bobj->m_pCollidingEntity == A)
|
||||||
skipCollision = true;
|
skipCollision = true;
|
||||||
else if(Bobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){
|
else if(Bobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){
|
||||||
|
|
|
@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
|
||||||
return (v2 - v1).Magnitude();
|
return (v2 - v1).Magnitude();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline float
|
||||||
|
Distance2D(const CVector &v1, const CVector &v2)
|
||||||
|
{
|
||||||
|
float x = v2.x - v1.x;
|
||||||
|
float y = v2.y - v1.y;
|
||||||
|
return Sqrt(x*x + y*y);
|
||||||
|
}
|
||||||
|
|
||||||
class CMatrix;
|
class CMatrix;
|
||||||
|
|
||||||
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
|
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
|
||||||
|
|
|
@ -53,6 +53,9 @@ public:
|
||||||
CVector2D operator/(float t) const {
|
CVector2D operator/(float t) const {
|
||||||
return CVector2D(x/t, y/t);
|
return CVector2D(x/t, y/t);
|
||||||
}
|
}
|
||||||
|
CVector2D operator-() const {
|
||||||
|
return CVector2D(-x, -y);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline float
|
inline float
|
||||||
|
|
|
@ -98,7 +98,7 @@ CObject::ProcessControl(void)
|
||||||
CPhysical::ProcessControl();
|
CPhysical::ProcessControl();
|
||||||
if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
|
if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
|
||||||
bIsInWater = true;
|
bIsInWater = true;
|
||||||
bIsStatic = false;
|
SetIsStatic(false);
|
||||||
ApplyMoveForce(impulse);
|
ApplyMoveForce(impulse);
|
||||||
ApplyTurnForce(impulse, point);
|
ApplyTurnForce(impulse, point);
|
||||||
float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
|
float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
|
||||||
|
@ -197,7 +197,7 @@ CObject::ObjectDamage(float amount)
|
||||||
case DAMAGE_EFFECT_SMASH_COMPLETELY:
|
case DAMAGE_EFFECT_SMASH_COMPLETELY:
|
||||||
bIsVisible = false;
|
bIsVisible = false;
|
||||||
bUsesCollision = false;
|
bUsesCollision = false;
|
||||||
bIsStatic = true;
|
SetIsStatic(true);
|
||||||
bExplosionProof = true;
|
bExplosionProof = true;
|
||||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
|
@ -209,7 +209,7 @@ CObject::ObjectDamage(float amount)
|
||||||
else {
|
else {
|
||||||
bIsVisible = false;
|
bIsVisible = false;
|
||||||
bUsesCollision = false;
|
bUsesCollision = false;
|
||||||
bIsStatic = true;
|
SetIsStatic(true);
|
||||||
bExplosionProof = true;
|
bExplosionProof = true;
|
||||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
|
@ -218,7 +218,7 @@ CObject::ObjectDamage(float amount)
|
||||||
case DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY: {
|
case DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY: {
|
||||||
bIsVisible = false;
|
bIsVisible = false;
|
||||||
bUsesCollision = false;
|
bUsesCollision = false;
|
||||||
bIsStatic = true;
|
SetIsStatic(true);
|
||||||
bExplosionProof = true;
|
bExplosionProof = true;
|
||||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
|
@ -241,7 +241,7 @@ CObject::ObjectDamage(float amount)
|
||||||
case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
|
case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
|
||||||
bIsVisible = false;
|
bIsVisible = false;
|
||||||
bUsesCollision = false;
|
bUsesCollision = false;
|
||||||
bIsStatic = true;
|
SetIsStatic(true);
|
||||||
bExplosionProof = true;
|
bExplosionProof = true;
|
||||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
|
@ -264,7 +264,7 @@ CObject::ObjectDamage(float amount)
|
||||||
case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
|
case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
|
||||||
bIsVisible = false;
|
bIsVisible = false;
|
||||||
bUsesCollision = false;
|
bUsesCollision = false;
|
||||||
bIsStatic = true;
|
SetIsStatic(true);
|
||||||
bExplosionProof = true;
|
bExplosionProof = true;
|
||||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
|
@ -289,7 +289,7 @@ CObject::ObjectDamage(float amount)
|
||||||
case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
|
case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
|
||||||
bIsVisible = false;
|
bIsVisible = false;
|
||||||
bUsesCollision = false;
|
bUsesCollision = false;
|
||||||
bIsStatic = true;
|
SetIsStatic(true);
|
||||||
bExplosionProof = true;
|
bExplosionProof = true;
|
||||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
|
@ -329,7 +329,7 @@ CObject::Init(void)
|
||||||
CObjectData::SetObjectData(GetModelIndex(), *this);
|
CObjectData::SetObjectData(GetModelIndex(), *this);
|
||||||
m_nEndOfLifeTime = 0;
|
m_nEndOfLifeTime = 0;
|
||||||
ObjectCreatedBy = GAME_OBJECT;
|
ObjectCreatedBy = GAME_OBJECT;
|
||||||
bIsStatic = true;
|
SetIsStatic(true);
|
||||||
bIsPickup = false;
|
bIsPickup = false;
|
||||||
bPickupObjWithMessage = false;
|
bPickupObjWithMessage = false;
|
||||||
bOutOfStock = false;
|
bOutOfStock = false;
|
||||||
|
|
|
@ -70,7 +70,8 @@ public:
|
||||||
uint8 bUseVehicleColours : 1;
|
uint8 bUseVehicleColours : 1;
|
||||||
uint8 bIsWeapon : 1;
|
uint8 bIsWeapon : 1;
|
||||||
uint8 bIsStreetLight : 1;
|
uint8 bIsStreetLight : 1;
|
||||||
int8 m_nBonusValue;
|
int8 m_nBonusValue;
|
||||||
|
uint16 m_nCostValue;
|
||||||
float m_fCollisionDamageMultiplier;
|
float m_fCollisionDamageMultiplier;
|
||||||
uint8 m_nCollisionDamageEffect;
|
uint8 m_nCollisionDamageEffect;
|
||||||
uint8 m_nSpecialCollisionResponseCases;
|
uint8 m_nSpecialCollisionResponseCases;
|
||||||
|
|
|
@ -425,7 +425,7 @@ void CCivilianPed::FindNearbyAttractorsSectorList(CPtrList& list, float& minDist
|
||||||
{
|
{
|
||||||
for (CPtrNode* pNode = list.first; pNode != nil; pNode = pNode->next) {
|
for (CPtrNode* pNode = list.first; pNode != nil; pNode = pNode->next) {
|
||||||
CEntity* pEntity = (CEntity*)pNode->item;
|
CEntity* pEntity = (CEntity*)pNode->item;
|
||||||
if (pEntity->IsObject() && (!pEntity->IsStatic() || ((CObject*)pEntity)->bHasBeenDamaged))
|
if (pEntity->IsObject() && (!pEntity->GetIsStatic() || ((CObject*)pEntity)->bHasBeenDamaged))
|
||||||
continue;
|
continue;
|
||||||
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
|
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
|
||||||
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
|
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
|
||||||
|
|
162
src/peds/Ped.cpp
162
src/peds/Ped.cpp
|
@ -15403,17 +15403,17 @@ CPed::ProcessObjective(void)
|
||||||
CVector distance = m_nextRoutePointPos - GetPosition();
|
CVector distance = m_nextRoutePointPos - GetPosition();
|
||||||
distance.z = 0.0f;
|
distance.z = 0.0f;
|
||||||
if (m_objective == OBJECTIVE_GOTO_SHELTER_ON_FOOT) {
|
if (m_objective == OBJECTIVE_GOTO_SHELTER_ON_FOOT) {
|
||||||
if (m_nMoveState == PEDMOVE_SPRINT && distance.Magnitude() < SQR(2.0f)) {
|
if (m_nMoveState == PEDMOVE_RUN && distance.MagnitudeSqr() < SQR(2.0f)) {
|
||||||
SetMoveState(PEDMOVE_WALK);
|
SetMoveState(PEDMOVE_WALK);
|
||||||
bIsRunning = false;
|
bIsRunning = false;
|
||||||
}
|
}
|
||||||
else if (CWeather::Rain < 0.2f && m_attractor) {
|
if (CWeather::Rain < 0.2f && m_attractor) {
|
||||||
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
|
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_objective == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT) {
|
else if (m_objective == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT) {
|
||||||
if (m_nMoveState == PEDMOVE_SPRINT && distance.Magnitude() < SQR(4.0f)) {
|
if (m_nMoveState == PEDMOVE_RUN && distance.MagnitudeSqr() < SQR(4.0f)) {
|
||||||
SetMoveState(PEDMOVE_WALK);
|
SetMoveState(PEDMOVE_WALK);
|
||||||
bIsRunning = false;
|
bIsRunning = false;
|
||||||
}
|
}
|
||||||
|
@ -15439,8 +15439,10 @@ CPed::ProcessObjective(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sq(m_distanceToCountSeekDone) < distance.MagnitudeSqr()) {
|
if (sq(m_distanceToCountSeekDone) < distance.MagnitudeSqr()) {
|
||||||
if (CTimer::GetTimeInMilliseconds() > m_nPedStateTimer || GetPedState() != PED_SEEK_POS)
|
if (CTimer::GetTimeInMilliseconds() > m_nPedStateTimer || GetPedState() != PED_SEEK_POS) {
|
||||||
|
m_vecSeekPos = m_nextRoutePointPos;
|
||||||
SetSeek(m_vecSeekPos, m_distanceToCountSeekDone);
|
SetSeek(m_vecSeekPos, m_distanceToCountSeekDone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!bReachedAttractorHeadingTarget) {
|
if (!bReachedAttractorHeadingTarget) {
|
||||||
|
@ -15510,6 +15512,10 @@ CPed::ProcessObjective(void)
|
||||||
SetObjective(OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN);
|
SetObjective(OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
m_prevObjective = OBJECTIVE_NONE;
|
||||||
|
SetObjective(OBJECTIVE_WAIT_ON_FOOT);
|
||||||
|
m_objectiveTimer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15693,11 +15699,11 @@ CPed::ProcessObjective(void)
|
||||||
}
|
}
|
||||||
if (!pVan->m_bSirenOrAlarm) {
|
if (!pVan->m_bSirenOrAlarm) {
|
||||||
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
|
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
|
||||||
return; // ???
|
return; // Why?
|
||||||
}
|
}
|
||||||
if (pVan->GetStatus() == STATUS_WRECKED) {
|
if (pVan->GetStatus() == STATUS_WRECKED) {
|
||||||
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
|
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
|
||||||
return; // ???
|
return; // Why?
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -16422,11 +16428,11 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|
||||||
if (!collidingEnt->IsBuilding())
|
if (!collidingEnt->IsBuilding())
|
||||||
((CPhysical*)collidingEnt)->AddCollisionRecord(this);
|
((CPhysical*)collidingEnt)->AddCollisionRecord(this);
|
||||||
|
|
||||||
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->IsStatic())) {
|
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic())) {
|
||||||
bHasHitWall = true;
|
bHasHitWall = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
|
if (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic()) {
|
||||||
if (bWasStanding) {
|
if (bWasStanding) {
|
||||||
CVector sphereNormal;
|
CVector sphereNormal;
|
||||||
float normalLength;
|
float normalLength;
|
||||||
|
@ -17003,72 +17009,69 @@ CPed::ProcessBuoyancy(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float speedMult = 0.0f;
|
}
|
||||||
if (buoyancyImpulse.z / m_fMass > GRAVITY * CTimer::GetTimeStep()
|
float speedMult = 0.0f;
|
||||||
|| mod_Buoyancy.m_waterlevel > GetPosition().z) {
|
if (buoyancyImpulse.z / m_fMass > GRAVITY * CTimer::GetTimeStep()
|
||||||
|
|| mod_Buoyancy.m_waterlevel > GetPosition().z + 0.6f) {
|
||||||
|
speedMult = pow(0.9f, CTimer::GetTimeStep());
|
||||||
|
m_vecMoveSpeed.x *= speedMult;
|
||||||
|
m_vecMoveSpeed.y *= speedMult;
|
||||||
|
m_vecMoveSpeed.z *= speedMult;
|
||||||
|
bIsStanding = false;
|
||||||
|
bIsDrowning = true;
|
||||||
|
InflictDamage(nil, WEAPONTYPE_DROWNING, 3.0f * CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
|
||||||
|
}
|
||||||
|
if (buoyancyImpulse.z / m_fMass > GRAVITY * 0.25f * CTimer::GetTimeStep()) {
|
||||||
|
if (speedMult == 0.0f) {
|
||||||
speedMult = pow(0.9f, CTimer::GetTimeStep());
|
speedMult = pow(0.9f, CTimer::GetTimeStep());
|
||||||
m_vecMoveSpeed.x *= speedMult;
|
|
||||||
m_vecMoveSpeed.y *= speedMult;
|
|
||||||
m_vecMoveSpeed.z *= speedMult;
|
|
||||||
bIsStanding = false;
|
|
||||||
bIsDrowning = true;
|
|
||||||
InflictDamage(nil, WEAPONTYPE_DROWNING, 3.0f * CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
|
|
||||||
}
|
}
|
||||||
if (buoyancyImpulse.z / m_fMass > GRAVITY * 0.25f * CTimer::GetTimeStep()) {
|
m_vecMoveSpeed.x *= speedMult;
|
||||||
if (speedMult == 0.0f) {
|
m_vecMoveSpeed.y *= speedMult;
|
||||||
speedMult = pow(0.9f, CTimer::GetTimeStep());
|
if (m_vecMoveSpeed.z >= -0.1f) {
|
||||||
}
|
if (m_vecMoveSpeed.z < -0.04f)
|
||||||
m_vecMoveSpeed.x *= speedMult;
|
m_vecMoveSpeed.z = -0.02f;
|
||||||
m_vecMoveSpeed.y *= speedMult;
|
} else {
|
||||||
if (m_vecMoveSpeed.z >= -0.1f) {
|
m_vecMoveSpeed.z = -0.01f;
|
||||||
if (m_vecMoveSpeed.z < -0.04f)
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_SPLASH, 0.0f);
|
||||||
m_vecMoveSpeed.z = -0.02f;
|
CVector aBitForward = 2.2f * m_vecMoveSpeed + GetPosition();
|
||||||
} else {
|
float level = 0.0f;
|
||||||
m_vecMoveSpeed.z = -0.01f;
|
if (CWaterLevel::GetWaterLevel(aBitForward, &level, false))
|
||||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_SPLASH, 0.0f);
|
aBitForward.z = level;
|
||||||
CVector aBitForward = 2.2f * m_vecMoveSpeed + GetPosition();
|
|
||||||
float level = 0.0f;
|
|
||||||
if (CWaterLevel::GetWaterLevel(aBitForward, &level, false))
|
|
||||||
aBitForward.z = level;
|
|
||||||
|
|
||||||
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, aBitForward, CVector(0.0f, 0.0f, 0.1f), 0.0f, 200, color, true);
|
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, aBitForward, CVector(0.0f, 0.0f, 0.1f), 0.0f, 200, color, true);
|
||||||
nGenerateRaindrops = CTimer::GetTimeInMilliseconds() + 80;
|
nGenerateRaindrops = CTimer::GetTimeInMilliseconds() + 80;
|
||||||
nGenerateWaterCircles = CTimer::GetTimeInMilliseconds() + 100;
|
nGenerateWaterCircles = CTimer::GetTimeInMilliseconds() + 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nGenerateWaterCircles && CTimer::GetTimeInMilliseconds() >= nGenerateWaterCircles) {
|
||||||
|
CVector pos = GetPosition();
|
||||||
|
float level = 0.0f;
|
||||||
|
if (CWaterLevel::GetWaterLevel(pos, &level, false))
|
||||||
|
pos.z = level;
|
||||||
|
|
||||||
|
if (pos.z != 0.0f) {
|
||||||
|
nGenerateWaterCircles = 0;
|
||||||
|
for(int i = 0; i < 4; i++) {
|
||||||
|
pos.x += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
|
||||||
|
pos.y += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
|
||||||
|
CParticle::AddParticle(PARTICLE_RAIN_SPLASH_BIGGROW, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, color, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
return;
|
if (nGenerateRaindrops && CTimer::GetTimeInMilliseconds() >= nGenerateRaindrops) {
|
||||||
|
CVector pos = GetPosition();
|
||||||
|
float level = 0.0f;
|
||||||
|
if (CWaterLevel::GetWaterLevel(pos, &level, false))
|
||||||
|
pos.z = level;
|
||||||
|
|
||||||
|
if (pos.z >= 0.0f) {
|
||||||
|
pos.z += 0.25f;
|
||||||
|
nGenerateRaindrops = 0;
|
||||||
|
CParticleObject::AddObject(POBJECT_SPLASHES_AROUND, pos, CVector(0.0f, 0.0f, 0.0f), 4.5f, 1500, CRGBA(0,0,0,0), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
bTouchingWater = false;
|
bTouchingWater = false;
|
||||||
|
|
||||||
if (nGenerateWaterCircles && CTimer::GetTimeInMilliseconds() >= nGenerateWaterCircles) {
|
|
||||||
CVector pos = GetPosition();
|
|
||||||
float level = 0.0f;
|
|
||||||
if (CWaterLevel::GetWaterLevel(pos, &level, false))
|
|
||||||
pos.z = level;
|
|
||||||
|
|
||||||
if (pos.z != 0.0f) {
|
|
||||||
nGenerateWaterCircles = 0;
|
|
||||||
for(int i = 0; i < 4; i++) {
|
|
||||||
pos.x += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
|
|
||||||
pos.y += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
|
|
||||||
CParticle::AddParticle(PARTICLE_RAIN_SPLASH_BIGGROW, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, color, 0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nGenerateRaindrops && CTimer::GetTimeInMilliseconds() >= nGenerateRaindrops) {
|
|
||||||
CVector pos = GetPosition();
|
|
||||||
float level = 0.0f;
|
|
||||||
if (CWaterLevel::GetWaterLevel(pos, &level, false))
|
|
||||||
pos.z = level;
|
|
||||||
|
|
||||||
if (pos.z >= 0.0f) {
|
|
||||||
pos.z += 0.25f;
|
|
||||||
nGenerateRaindrops = 0;
|
|
||||||
CParticleObject::AddObject(POBJECT_SPLASHES_AROUND, pos, CVector(0.0f, 0.0f, 0.0f), 4.5f, 1500, CRGBA(0,0,0,0), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
// --MIAMI: Done
|
||||||
|
@ -18411,7 +18414,7 @@ CPed::SeekCar(void)
|
||||||
{
|
{
|
||||||
m_fRotationCur = m_fRotationDest;
|
m_fRotationCur = m_fRotationDest;
|
||||||
if (!bVehEnterDoorIsBlocked) {
|
if (!bVehEnterDoorIsBlocked) {
|
||||||
vehToSeek->bIsStatic = false;
|
vehToSeek->SetIsStatic(false);
|
||||||
if (m_objective == OBJECTIVE_SOLICIT_VEHICLE) {
|
if (m_objective == OBJECTIVE_SOLICIT_VEHICLE) {
|
||||||
SetSolicit(1000);
|
SetSolicit(1000);
|
||||||
} else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) {
|
} else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) {
|
||||||
|
@ -20037,15 +20040,13 @@ CPed::Save(uint8*& buf)
|
||||||
CopyToBuf(buf, GetPosition().z);
|
CopyToBuf(buf, GetPosition().z);
|
||||||
SkipSaveBuf(buf, 288);
|
SkipSaveBuf(buf, 288);
|
||||||
CopyToBuf(buf, CharCreatedBy);
|
CopyToBuf(buf, CharCreatedBy);
|
||||||
SkipSaveBuf(buf, 351);
|
SkipSaveBuf(buf, 499);
|
||||||
CopyToBuf(buf, m_fHealth);
|
CopyToBuf(buf, m_fHealth);
|
||||||
CopyToBuf(buf, m_fArmour);
|
CopyToBuf(buf, m_fArmour);
|
||||||
SkipSaveBuf(buf, 148);
|
SkipSaveBuf(buf, 172);
|
||||||
for (int i = 0; i < 13; i++) // has to be hardcoded
|
for (int i = 0; i < 10; i++) // has to be hardcoded
|
||||||
m_weapons[i].Save(buf);
|
m_weapons[i].Save(buf);
|
||||||
SkipSaveBuf(buf, 5);
|
SkipSaveBuf(buf, 252);
|
||||||
CopyToBuf(buf, m_maxWeaponTypeAllowed);
|
|
||||||
SkipSaveBuf(buf, 162);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -20057,16 +20058,15 @@ CPed::Load(uint8*& buf)
|
||||||
CopyFromBuf(buf, GetMatrix().GetPosition().z);
|
CopyFromBuf(buf, GetMatrix().GetPosition().z);
|
||||||
SkipSaveBuf(buf, 288);
|
SkipSaveBuf(buf, 288);
|
||||||
CopyFromBuf(buf, CharCreatedBy);
|
CopyFromBuf(buf, CharCreatedBy);
|
||||||
SkipSaveBuf(buf, 351);
|
SkipSaveBuf(buf, 499);
|
||||||
CopyFromBuf(buf, m_fHealth);
|
CopyFromBuf(buf, m_fHealth);
|
||||||
CopyFromBuf(buf, m_fArmour);
|
CopyFromBuf(buf, m_fArmour);
|
||||||
SkipSaveBuf(buf, 148);
|
SkipSaveBuf(buf, 172);
|
||||||
|
m_currentWeapon = WEAPONTYPE_UNARMED;
|
||||||
|
|
||||||
CWeapon bufWeapon;
|
CWeapon bufWeapon;
|
||||||
for (int i = 0; i < 13; i++) { // has to be hardcoded
|
for (int i = 0; i < 10; i++) { // has to be hardcoded
|
||||||
bufWeapon.Load(buf);
|
bufWeapon.Load(buf);
|
||||||
if (i >= 10)
|
|
||||||
continue; // tmp hack before we fix save/load
|
|
||||||
|
|
||||||
if (bufWeapon.m_eWeaponType != WEAPONTYPE_UNARMED) {
|
if (bufWeapon.m_eWeaponType != WEAPONTYPE_UNARMED) {
|
||||||
int modelId = CWeaponInfo::GetWeaponInfo(bufWeapon.m_eWeaponType)->m_nModelId;
|
int modelId = CWeaponInfo::GetWeaponInfo(bufWeapon.m_eWeaponType)->m_nModelId;
|
||||||
|
@ -20081,9 +20081,7 @@ CPed::Load(uint8*& buf)
|
||||||
GiveWeapon(bufWeapon.m_eWeaponType, bufWeapon.m_nAmmoTotal);
|
GiveWeapon(bufWeapon.m_eWeaponType, bufWeapon.m_nAmmoTotal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SkipSaveBuf(buf, 5);
|
SkipSaveBuf(buf, 252);
|
||||||
CopyFromBuf(buf, m_maxWeaponTypeAllowed);
|
|
||||||
SkipSaveBuf(buf, 162);
|
|
||||||
}
|
}
|
||||||
#undef CopyFromBuf
|
#undef CopyFromBuf
|
||||||
#undef CopyToBuf
|
#undef CopyToBuf
|
||||||
|
|
|
@ -135,8 +135,10 @@ void CPedAttractorManager::RemoveIceCreamVanEffects(C2dEffect* pEffect)
|
||||||
if (vVehicleToEffect.empty())
|
if (vVehicleToEffect.empty())
|
||||||
return;
|
return;
|
||||||
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend();) {
|
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend();) {
|
||||||
if (assoc->GetVehicle() != pVehicle)
|
if (assoc->GetVehicle() != pVehicle) {
|
||||||
return;
|
assoc++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
uint32 total = 0;
|
uint32 total = 0;
|
||||||
for (uint32 j = 0; j < NUM_ATTRACTORS_FOR_ICECREAM_VAN; j++) {
|
for (uint32 j = 0; j < NUM_ATTRACTORS_FOR_ICECREAM_VAN; j++) {
|
||||||
if (FindAssociatedAttractor(assoc->GetEffect(j), vIceCreamAttractors))
|
if (FindAssociatedAttractor(assoc->GetEffect(j), vIceCreamAttractors))
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
const uint32 CPlayerPed::nSaveStructSize =
|
const uint32 CPlayerPed::nSaveStructSize =
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
1520;
|
1752;
|
||||||
#else
|
#else
|
||||||
sizeof(CPlayerPed);
|
sizeof(CPlayerPed);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1935,7 +1935,7 @@ CPlayerPed::Save(uint8*& buf)
|
||||||
CopyToBuf(buf, m_nTargettableObjects[1]);
|
CopyToBuf(buf, m_nTargettableObjects[1]);
|
||||||
CopyToBuf(buf, m_nTargettableObjects[2]);
|
CopyToBuf(buf, m_nTargettableObjects[2]);
|
||||||
CopyToBuf(buf, m_nTargettableObjects[3]);
|
CopyToBuf(buf, m_nTargettableObjects[3]);
|
||||||
SkipSaveBuf(buf, 116);
|
SkipSaveBuf(buf, 164);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1949,7 +1949,7 @@ CPlayerPed::Load(uint8*& buf)
|
||||||
CopyFromBuf(buf, m_nTargettableObjects[1]);
|
CopyFromBuf(buf, m_nTargettableObjects[1]);
|
||||||
CopyFromBuf(buf, m_nTargettableObjects[2]);
|
CopyFromBuf(buf, m_nTargettableObjects[2]);
|
||||||
CopyFromBuf(buf, m_nTargettableObjects[3]);
|
CopyFromBuf(buf, m_nTargettableObjects[3]);
|
||||||
SkipSaveBuf(buf, 116);
|
SkipSaveBuf(buf, 164);
|
||||||
}
|
}
|
||||||
#undef CopyFromBuf
|
#undef CopyFromBuf
|
||||||
#undef CopyToBuf
|
#undef CopyToBuf
|
||||||
|
|
|
@ -945,7 +945,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
|
||||||
if (IsGlass(obj->GetModelIndex()) && !mi->m_isArtistGlass) {
|
if (IsGlass(obj->GetModelIndex()) && !mi->m_isArtistGlass) {
|
||||||
obj->bIsVisible = false;
|
obj->bIsVisible = false;
|
||||||
} else if (obj->GetModelIndex() == MI_BUOY) {
|
} else if (obj->GetModelIndex() == MI_BUOY) {
|
||||||
obj->bIsStatic = false;
|
obj->SetIsStatic(false);
|
||||||
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
|
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
|
||||||
obj->bTouchingWater = true;
|
obj->bTouchingWater = true;
|
||||||
obj->AddToMovingList();
|
obj->AddToMovingList();
|
||||||
|
|
|
@ -88,14 +88,10 @@ public:
|
||||||
if(type == EFFECT_LIGHT){
|
if(type == EFFECT_LIGHT){
|
||||||
if(light.corona)
|
if(light.corona)
|
||||||
RwTextureDestroy(light.corona);
|
RwTextureDestroy(light.corona);
|
||||||
#ifdef GTA3_1_1_PATCH
|
|
||||||
light.corona = nil;
|
light.corona = nil;
|
||||||
#endif
|
|
||||||
if(light.shadow)
|
if(light.shadow)
|
||||||
RwTextureDestroy(light.shadow);
|
RwTextureDestroy(light.shadow);
|
||||||
#ifdef GTA3_1_1_PATCH
|
|
||||||
light.shadow = nil;
|
light.shadow = nil;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -386,6 +386,8 @@ CMovingThing CMovingThings::StartCloseList;
|
||||||
CMovingThing CMovingThings::EndCloseList;
|
CMovingThing CMovingThings::EndCloseList;
|
||||||
int16 CMovingThings::Num;
|
int16 CMovingThings::Num;
|
||||||
CMovingThing CMovingThings::aMovingThings[NUMMOVINGTHINGS];
|
CMovingThing CMovingThings::aMovingThings[NUMMOVINGTHINGS];
|
||||||
|
|
||||||
|
int32 CScrollBar::TonightsEvent;
|
||||||
|
|
||||||
void CMovingThings::Init()
|
void CMovingThings::Init()
|
||||||
{
|
{
|
||||||
|
@ -1603,7 +1605,7 @@ void CScriptPath::Update(void) {
|
||||||
|
|
||||||
void CScriptPath::Clear(void) {
|
void CScriptPath::Clear(void) {
|
||||||
if (m_pNode)
|
if (m_pNode)
|
||||||
delete m_pNode;
|
delete[] m_pNode;
|
||||||
m_pNode = nil;
|
m_pNode = nil;
|
||||||
m_numNodes = 0;
|
m_numNodes = 0;
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
|
|
|
@ -169,6 +169,9 @@ private:
|
||||||
uint8 m_uBlue;
|
uint8 m_uBlue;
|
||||||
float m_fScale;
|
float m_fScale;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static int TonightsEvent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetVisibility(bool visible) { m_bVisible = visible; }
|
void SetVisibility(bool visible) { m_bVisible = visible; }
|
||||||
bool IsVisible() { return m_bVisible; }
|
bool IsVisible() { return m_bVisible; }
|
||||||
|
|
|
@ -393,9 +393,9 @@ void
|
||||||
CGlass::AskForObjectToBeRenderedInGlass(CEntity *entity)
|
CGlass::AskForObjectToBeRenderedInGlass(CEntity *entity)
|
||||||
{
|
{
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
if ( NumGlassEntities < NUM_GLASSPANES )
|
if ( NumGlassEntities < NUM_GLASSENTITIES )
|
||||||
#else
|
#else
|
||||||
if ( NumGlassEntities < NUM_GLASSPANES-1 )
|
if ( NumGlassEntities < NUM_GLASSENTITIES-1 )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
apEntitiesToBeRendered[NumGlassEntities++] = entity;
|
apEntitiesToBeRendered[NumGlassEntities++] = entity;
|
||||||
|
|
|
@ -583,7 +583,7 @@ void CHud::Draw()
|
||||||
|
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint);
|
||||||
|
|
||||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) {
|
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) {
|
||||||
// CFont::SetColor(ARMOUR_COLOR);
|
// CFont::SetColor(ARMOUR_COLOR);
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f + 52.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f + 52.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,7 +306,7 @@ CMotionBlurStreaks::Update(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < NUMMBLURSTREAKS; i++)
|
for(i = 0; i < NUMMBLURSTREAKS; i++)
|
||||||
if(aStreaks[i].m_id)
|
if(aStreaks[i].m_id != 0)
|
||||||
aStreaks[i].Update();
|
aStreaks[i].Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ CMotionBlurStreaks::Render(void)
|
||||||
bool setRenderStates = false;
|
bool setRenderStates = false;
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < NUMMBLURSTREAKS; i++)
|
for(i = 0; i < NUMMBLURSTREAKS; i++)
|
||||||
if(aStreaks[i].m_id != nil){
|
if(aStreaks[i].m_id != 0){
|
||||||
if(!setRenderStates){
|
if(!setRenderStates){
|
||||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
|
@ -1150,8 +1150,8 @@ CBrightLights::Render(void)
|
||||||
|
|
||||||
case BRIGHTLIGHT_SIREN:
|
case BRIGHTLIGHT_SIREN:
|
||||||
for(j = 0; j < 6; j++){
|
for(j = 0; j < 6; j++){
|
||||||
pos = SirenLightsSide[j]*TheCamera.GetRight() +
|
pos = SirenLightsSide[j] * TheCamera.GetRight() +
|
||||||
SirenLightsUp[j]* TheCamera.GetUp() +
|
SirenLightsUp[j] * TheCamera.GetUp() +
|
||||||
aBrightLights[i].m_pos;
|
aBrightLights[i].m_pos;
|
||||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+j], r, g, b, a);
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+j], r, g, b, a);
|
||||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+j], pos.x, pos.y, pos.z);
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+j], pos.x, pos.y, pos.z);
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
#include "Fire.h"
|
#include "Fire.h"
|
||||||
#include "WaterLevel.h"
|
#include "WaterLevel.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
#include "Particle.h"
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
#define WATERCANNONVERTS 4
|
#define WATERCANNONVERTS 4
|
||||||
#define WATERCANNONINDEXES 12
|
#define WATERCANNONINDEXES 12
|
||||||
|
@ -64,7 +67,7 @@ void CWaterCannon::Update_OncePerFrame(int16 index)
|
||||||
|
|
||||||
if (CTimer::GetTimeInMilliseconds() > m_nTimeCreated + WATERCANNON_LIFETIME )
|
if (CTimer::GetTimeInMilliseconds() > m_nTimeCreated + WATERCANNON_LIFETIME )
|
||||||
{
|
{
|
||||||
m_nCur = (m_nCur + 1) % -NUM_SEGMENTPOINTS;
|
m_nCur = (m_nCur + 1) % NUM_SEGMENTPOINTS;
|
||||||
m_abUsed[m_nCur] = false;
|
m_abUsed[m_nCur] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +131,7 @@ void CWaterCannon::Render(void)
|
||||||
RwIm3DVertexSetV(&WaterCannonVertices[2], v);
|
RwIm3DVertexSetV(&WaterCannonVertices[2], v);
|
||||||
RwIm3DVertexSetV(&WaterCannonVertices[3], v);
|
RwIm3DVertexSetV(&WaterCannonVertices[3], v);
|
||||||
|
|
||||||
int16 pointA = m_nCur % -NUM_SEGMENTPOINTS;
|
int16 pointA = m_nCur % NUM_SEGMENTPOINTS;
|
||||||
|
|
||||||
int16 pointB = pointA - 1;
|
int16 pointB = pointA - 1;
|
||||||
if ( (pointA - 1) < 0 )
|
if ( (pointA - 1) < 0 )
|
||||||
|
@ -235,11 +238,16 @@ void CWaterCannon::PushPeds(void)
|
||||||
ped->m_vecMoveSpeed.x = (0.6f * m_avecVelocity[j].x + ped->m_vecMoveSpeed.x) * 0.5f;
|
ped->m_vecMoveSpeed.x = (0.6f * m_avecVelocity[j].x + ped->m_vecMoveSpeed.x) * 0.5f;
|
||||||
ped->m_vecMoveSpeed.y = (0.6f * m_avecVelocity[j].y + ped->m_vecMoveSpeed.y) * 0.5f;
|
ped->m_vecMoveSpeed.y = (0.6f * m_avecVelocity[j].y + ped->m_vecMoveSpeed.y) * 0.5f;
|
||||||
|
|
||||||
ped->SetFall(2000, AnimationId(ANIM_KO_SKID_FRONT + localDir), 0);
|
float pedSpeed2D = ped->m_vecMoveSpeed.Magnitude2D();
|
||||||
|
|
||||||
CFire *fire = ped->m_pFire;
|
if ( pedSpeed2D > 0.2f ) {
|
||||||
if ( fire )
|
ped->m_vecMoveSpeed.x *= (0.2f / pedSpeed2D);
|
||||||
fire->Extinguish();
|
ped->m_vecMoveSpeed.y *= (0.2f / pedSpeed2D);
|
||||||
|
}
|
||||||
|
ped->SetFall(2000, (AnimationId)(localDir + ANIM_KO_SKID_FRONT), 0);
|
||||||
|
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, ped->GetPosition(), ped->m_vecMoveSpeed * 0.3f, 0, 0.5f);
|
||||||
|
CParticle::AddParticle(PARTICLE_CAR_SPLASH, ped->GetPosition(), ped->m_vecMoveSpeed * -0.3f + CVector(0.f, 0.f, 0.5f), 0, 0.5f,
|
||||||
|
CGeneral::GetRandomNumberInRange(0.f, 10.f), CGeneral::GetRandomNumberInRange(0.f, 90.f), 1);
|
||||||
|
|
||||||
j = NUM_SEGMENTPOINTS;
|
j = NUM_SEGMENTPOINTS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,12 +534,13 @@ CameraSize(RwCamera * camera, RwRect * rect,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BUG: game just changes camera raster's sizes, but this is a hack
|
if (( origSize.w != rect->w ) || ( origSize.h != rect->h ))
|
||||||
if (( origSize.w != rect->w ) && ( origSize.h != rect->h ))
|
|
||||||
{
|
{
|
||||||
RwRaster *raster;
|
RwRaster *raster;
|
||||||
RwRaster *zRaster;
|
RwRaster *zRaster;
|
||||||
|
|
||||||
|
// BUG: game just changes camera raster's sizes, but this is a hack
|
||||||
|
#ifdef FIX_BUGS
|
||||||
/*
|
/*
|
||||||
* Destroy rasters...
|
* Destroy rasters...
|
||||||
*/
|
*/
|
||||||
|
@ -597,6 +598,13 @@ CameraSize(RwCamera * camera, RwRect * rect,
|
||||||
RwCameraSetRaster(camera, raster);
|
RwCameraSetRaster(camera, raster);
|
||||||
RwCameraSetZRaster(camera, zRaster);
|
RwCameraSetZRaster(camera, zRaster);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
raster = RwCameraGetRaster(camera);
|
||||||
|
zRaster = RwCameraGetZRaster(camera);
|
||||||
|
|
||||||
|
raster->width = zRaster->width = rect->w;
|
||||||
|
raster->height = zRaster->height = rect->h;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out the view window */
|
/* Figure out the view window */
|
||||||
|
|
|
@ -41,8 +41,10 @@
|
||||||
#include "Timecycle.h"
|
#include "Timecycle.h"
|
||||||
#include "Fluff.h"
|
#include "Fluff.h"
|
||||||
|
|
||||||
#define BLOCK_COUNT 20
|
// --MIAMI: file done
|
||||||
#define SIZE_OF_SIMPLEVARS 0xFC
|
|
||||||
|
#define BLOCK_COUNT 22
|
||||||
|
#define SIZE_OF_SIMPLEVARS 0xE4
|
||||||
|
|
||||||
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
|
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
|
||||||
|
|
||||||
|
@ -60,7 +62,6 @@ int CheckSum;
|
||||||
eLevelName m_LevelToLoad;
|
eLevelName m_LevelToLoad;
|
||||||
char SaveFileNameJustSaved[260];
|
char SaveFileNameJustSaved[260];
|
||||||
int Slots[SLOT_COUNT];
|
int Slots[SLOT_COUNT];
|
||||||
CDate CompileDateAndTime;
|
|
||||||
|
|
||||||
bool b_FoundRecentSavedGameWantToLoad;
|
bool b_FoundRecentSavedGameWantToLoad;
|
||||||
bool JustLoadedDontFadeInYet;
|
bool JustLoadedDontFadeInYet;
|
||||||
|
@ -112,13 +113,14 @@ do {\
|
||||||
buf += size;\
|
buf += size;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define WriteSaveDataBlock(save_func)\
|
#define WriteSaveDataBlock(save_func, msg)\
|
||||||
do {\
|
do {\
|
||||||
size = 0;\
|
size = 0;\
|
||||||
buf = work_buff;\
|
buf = work_buff;\
|
||||||
reserved = 0;\
|
reserved = 0;\
|
||||||
MakeSpaceForSizeInBufferPointer(presize, buf, postsize);\
|
MakeSpaceForSizeInBufferPointer(presize, buf, postsize);\
|
||||||
save_func(buf, &size);\
|
save_func(buf, &size);\
|
||||||
|
debug(msg"== %i \n", size);\
|
||||||
CopySizeAndPreparePointer(presize, buf, postsize, reserved, size);\
|
CopySizeAndPreparePointer(presize, buf, postsize, reserved, size);\
|
||||||
if (!PcSaveHelper.PcClassSaveRoutine(file, work_buff, buf - work_buff))\
|
if (!PcSaveHelper.PcClassSaveRoutine(file, work_buff, buf - work_buff))\
|
||||||
return false;\
|
return false;\
|
||||||
|
@ -145,9 +147,10 @@ GenericSave(int file)
|
||||||
reserved = 0;
|
reserved = 0;
|
||||||
|
|
||||||
// Save simple vars
|
// Save simple vars
|
||||||
lastMissionPassed = TheText.Get(CStats::LastMissionPassedName);
|
lastMissionPassed = TheText.Get(CStats::LastMissionPassedName[0] ? CStats::LastMissionPassedName : "ITBEG");
|
||||||
if (lastMissionPassed[0] != '\0') {
|
if (lastMissionPassed[0] != '\0') {
|
||||||
AsciiToUnicode("...'", suffix);
|
AsciiToUnicode("...'", suffix);
|
||||||
|
suffix[3] = L'\0';
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
// fix buffer overflow
|
// fix buffer overflow
|
||||||
int len = UnicodeStrlen(lastMissionPassed);
|
int len = UnicodeStrlen(lastMissionPassed);
|
||||||
|
@ -194,12 +197,6 @@ GenericSave(int file)
|
||||||
WriteDataToBufferPointer(buf, CWeather::NewWeatherType);
|
WriteDataToBufferPointer(buf, CWeather::NewWeatherType);
|
||||||
WriteDataToBufferPointer(buf, CWeather::ForcedWeatherType);
|
WriteDataToBufferPointer(buf, CWeather::ForcedWeatherType);
|
||||||
WriteDataToBufferPointer(buf, CWeather::InterpolationValue);
|
WriteDataToBufferPointer(buf, CWeather::InterpolationValue);
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nSecond);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nMinute);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nHour);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nDay);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nMonth);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nYear);
|
|
||||||
WriteDataToBufferPointer(buf, CWeather::WeatherTypeInList);
|
WriteDataToBufferPointer(buf, CWeather::WeatherTypeInList);
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
// converted to float for compatibility with original format
|
// converted to float for compatibility with original format
|
||||||
|
@ -227,6 +224,7 @@ GenericSave(int file)
|
||||||
buf += 4;
|
buf += 4;
|
||||||
postsize = buf;
|
postsize = buf;
|
||||||
CTheScripts::SaveAllScripts(buf, &size);
|
CTheScripts::SaveAllScripts(buf, &size);
|
||||||
|
debug("ScriptSize== %i \n", size);
|
||||||
CopySizeAndPreparePointer(presize, buf, postsize, reserved, size);
|
CopySizeAndPreparePointer(presize, buf, postsize, reserved, size);
|
||||||
if (!PcSaveHelper.PcClassSaveRoutine(file, work_buff, buf - work_buff))
|
if (!PcSaveHelper.PcClassSaveRoutine(file, work_buff, buf - work_buff))
|
||||||
return false;
|
return false;
|
||||||
|
@ -234,28 +232,28 @@ GenericSave(int file)
|
||||||
totalSize = buf - work_buff;
|
totalSize = buf - work_buff;
|
||||||
|
|
||||||
// Save the rest
|
// Save the rest
|
||||||
WriteSaveDataBlock(CPools::SavePedPool);
|
WriteSaveDataBlock(CPools::SavePedPool, "PedPoolSize");
|
||||||
WriteSaveDataBlock(CGarages::Save);
|
WriteSaveDataBlock(CGarages::Save, "GaragesSize");
|
||||||
WriteSaveDataBlock(CGameLogic::Save);
|
WriteSaveDataBlock(CGameLogic::Save, "GameLogicSize");
|
||||||
WriteSaveDataBlock(CPools::SaveVehiclePool);
|
WriteSaveDataBlock(CPools::SaveVehiclePool, "VehPoolSize");
|
||||||
WriteSaveDataBlock(CPools::SaveObjectPool);
|
WriteSaveDataBlock(CPools::SaveObjectPool, "ObjectPoolSize");
|
||||||
WriteSaveDataBlock(ThePaths.Save);
|
WriteSaveDataBlock(ThePaths.Save, "ThePathsSize");
|
||||||
WriteSaveDataBlock(CCranes::Save);
|
WriteSaveDataBlock(CCranes::Save, "CranesSize");
|
||||||
WriteSaveDataBlock(CPickups::Save);
|
WriteSaveDataBlock(CPickups::Save, "PickUpsSize");
|
||||||
WriteSaveDataBlock(gPhoneInfo.Save);
|
WriteSaveDataBlock(gPhoneInfo.Save, "PhoneInfoSize");
|
||||||
WriteSaveDataBlock(CRestart::SaveAllRestartPoints);
|
WriteSaveDataBlock(CRestart::SaveAllRestartPoints, "RestartPointsBufferSize");
|
||||||
WriteSaveDataBlock(CRadar::SaveAllRadarBlips);
|
WriteSaveDataBlock(CRadar::SaveAllRadarBlips, "RadarBlipsBufferSize");
|
||||||
WriteSaveDataBlock(CTheZones::SaveAllZones);
|
WriteSaveDataBlock(CTheZones::SaveAllZones, "AllZonesBufferSize");
|
||||||
WriteSaveDataBlock(CGangs::SaveAllGangData);
|
WriteSaveDataBlock(CGangs::SaveAllGangData, "AllGangDataSize");
|
||||||
WriteSaveDataBlock(CTheCarGenerators::SaveAllCarGenerators);
|
WriteSaveDataBlock(CTheCarGenerators::SaveAllCarGenerators, "AllCarGeneratorsSize");
|
||||||
WriteSaveDataBlock(CParticleObject::SaveParticle);
|
WriteSaveDataBlock(CParticleObject::SaveParticle, "ParticlesSize");
|
||||||
WriteSaveDataBlock(cAudioScriptObject::SaveAllAudioScriptObjects);
|
WriteSaveDataBlock(cAudioScriptObject::SaveAllAudioScriptObjects, "AllAudioScriptObjectsSize");
|
||||||
WriteSaveDataBlock(CScriptPaths::Save);
|
WriteSaveDataBlock(CScriptPaths::Save, "ScriptPathsSize");
|
||||||
WriteSaveDataBlock(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo);
|
WriteSaveDataBlock(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo, "PlayerInfoSize");
|
||||||
WriteSaveDataBlock(CStats::SaveStats);
|
WriteSaveDataBlock(CStats::SaveStats, "StatsSize");
|
||||||
WriteSaveDataBlock(CSetPieces::Save);
|
WriteSaveDataBlock(CSetPieces::Save, "SetPiecesSize");
|
||||||
WriteSaveDataBlock(CStreaming::MemoryCardSave);
|
WriteSaveDataBlock(CStreaming::MemoryCardSave, "StreamingSize");
|
||||||
WriteSaveDataBlock(CPedType::Save);
|
WriteSaveDataBlock(CPedType::Save, "PedTypeSize");
|
||||||
|
|
||||||
// Write padding
|
// Write padding
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
@ -331,12 +329,6 @@ GenericLoad()
|
||||||
ReadDataFromBufferPointer(buf, CWeather::NewWeatherType);
|
ReadDataFromBufferPointer(buf, CWeather::NewWeatherType);
|
||||||
ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType);
|
ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType);
|
||||||
ReadDataFromBufferPointer(buf, CWeather::InterpolationValue);
|
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, CWeather::WeatherTypeInList);
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
// converted to float for compatibility with original format
|
// converted to float for compatibility with original format
|
||||||
|
@ -470,8 +462,13 @@ CloseFile(int32 file)
|
||||||
void
|
void
|
||||||
DoGameSpecificStuffAfterSucessLoad()
|
DoGameSpecificStuffAfterSucessLoad()
|
||||||
{
|
{
|
||||||
|
CCollision::SortOutCollisionAfterLoad();
|
||||||
|
CStreaming::LoadSceneCollision(TheCamera.GetPosition());
|
||||||
|
CStreaming::LoadScene(TheCamera.GetPosition());
|
||||||
|
CGame::TidyUpMemory(true, false);
|
||||||
StillToFadeOut = true;
|
StillToFadeOut = true;
|
||||||
JustLoadedDontFadeInYet = true;
|
JustLoadedDontFadeInYet = true;
|
||||||
|
TheCamera.Fade(0.0f, 0);
|
||||||
CTheScripts::Process();
|
CTheScripts::Process();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ bool CheckDataNotCorrupt(int32 slot, char *name);
|
||||||
bool RestoreForStartLoad();
|
bool RestoreForStartLoad();
|
||||||
int align4bytes(int32 size);
|
int align4bytes(int32 size);
|
||||||
|
|
||||||
extern class CDate CompileDateAndTime;
|
|
||||||
|
|
||||||
extern char DefaultPCSaveFileName[260];
|
extern char DefaultPCSaveFileName[260];
|
||||||
extern char ValidSaveName[260];
|
extern char ValidSaveName[260];
|
||||||
extern char LoadFileName[256];
|
extern char LoadFileName[256];
|
||||||
|
|
|
@ -27,13 +27,28 @@ void GetLocalTime_CP(SYSTEMTIME *out) {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
||||||
char newpathname[32];
|
char newpathname[32];
|
||||||
|
|
||||||
strncpy(newpathname, pathname, 32);
|
strncpy(newpathname, pathname, 32);
|
||||||
char* path = strtok(newpathname, "\\*");
|
char* path = strtok(newpathname, "*");
|
||||||
|
|
||||||
|
// Case-sensitivity and backslashes...
|
||||||
|
char *real = casepath(path);
|
||||||
|
if (real) {
|
||||||
|
real[strlen(real)] = '*';
|
||||||
|
char *extension = strtok(NULL, "*");
|
||||||
|
if (extension)
|
||||||
|
strcat(real, extension);
|
||||||
|
|
||||||
|
strncpy(newpathname, real, 32);
|
||||||
|
free(real);
|
||||||
|
path = strtok(newpathname, "*");
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
|
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
|
||||||
|
|
||||||
// Both w/ extension and w/o extension is ok
|
// Both w/ extension and w/o extension is ok
|
||||||
if (strlen(path) + 2 != strlen(pathname))
|
if (strlen(path) + 1 != strlen(pathname))
|
||||||
strncpy(firstfile->extension, strtok(NULL, "\\*"), sizeof(firstfile->extension));
|
strncpy(firstfile->extension, strtok(NULL, "*"), sizeof(firstfile->extension));
|
||||||
else
|
else
|
||||||
strncpy(firstfile->extension, "", sizeof(firstfile->extension));
|
strncpy(firstfile->extension, "", sizeof(firstfile->extension));
|
||||||
|
|
||||||
|
@ -52,8 +67,8 @@ bool FindNextFile(HANDLE d, WIN32_FIND_DATA* finddata) {
|
||||||
while ((file = readdir((DIR*)d)) != NULL) {
|
while ((file = readdir((DIR*)d)) != NULL) {
|
||||||
|
|
||||||
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
|
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
|
||||||
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG) &&
|
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG || file->d_type == DT_LNK) &&
|
||||||
(extensionLen == 0 || strncmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
(extensionLen == 0 || strncasecmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
||||||
|
|
||||||
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
|
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
|
||||||
realpath(relativepath, path);
|
realpath(relativepath, path);
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#define MAX_SUBSYSTEMS (16)
|
#define MAX_SUBSYSTEMS (16)
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
rw::EngineOpenParams openParams;
|
rw::EngineOpenParams openParams;
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ const char *_psGetUserFilesFolder()
|
||||||
&KeycbData) == ERROR_SUCCESS )
|
&KeycbData) == ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
strcat(szUserFiles, "\\GTA3 User Files");
|
strcat(szUserFiles, "\\GTA Vice City User Files");
|
||||||
_psCreateFolder(szUserFiles);
|
_psCreateFolder(szUserFiles);
|
||||||
return szUserFiles;
|
return szUserFiles;
|
||||||
}
|
}
|
||||||
|
@ -386,10 +387,6 @@ psInitialize(void)
|
||||||
|
|
||||||
InitialiseLanguage();
|
InitialiseLanguage();
|
||||||
|
|
||||||
#ifndef GTA3_1_1_PATCH
|
|
||||||
FrontEndMenuManager.LoadSettings();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gGameState = GS_START_UP;
|
gGameState = GS_START_UP;
|
||||||
|
@ -422,7 +419,7 @@ psInitialize(void)
|
||||||
}
|
}
|
||||||
else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
|
else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
|
||||||
{
|
{
|
||||||
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion == 1 )
|
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion != 0 )
|
||||||
{
|
{
|
||||||
debug("Operating System is Win98\n");
|
debug("Operating System is Win98\n");
|
||||||
_dwOperatingSystemVersion = OS_WIN98;
|
_dwOperatingSystemVersion = OS_WIN98;
|
||||||
|
@ -439,13 +436,9 @@ psInitialize(void)
|
||||||
|
|
||||||
|
|
||||||
#ifndef PS2_MENU
|
#ifndef PS2_MENU
|
||||||
|
|
||||||
#ifdef GTA3_1_1_PATCH
|
|
||||||
FrontEndMenuManager.LoadSettings();
|
FrontEndMenuManager.LoadSettings();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
MEMORYSTATUS memstats;
|
MEMORYSTATUS memstats;
|
||||||
|
@ -867,7 +860,8 @@ bool IsThisJoystickBlacklisted(int i)
|
||||||
|
|
||||||
const char* joyname = glfwGetJoystickName(i);
|
const char* joyname = glfwGetJoystickName(i);
|
||||||
|
|
||||||
if (strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
|
if (gSelectedJoystickName[0] != '\0' &&
|
||||||
|
strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1250,14 +1244,17 @@ void resizeCB(GLFWwindow* window, int width, int height) {
|
||||||
* memory things don't work.
|
* memory things don't work.
|
||||||
*/
|
*/
|
||||||
/* redraw window */
|
/* redraw window */
|
||||||
if (RwInitialised && (gGameState == GS_PLAYING_GAME
|
|
||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
|| gGameState == GS_ANIMVIEWER
|
if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER))
|
||||||
#endif
|
|
||||||
))
|
|
||||||
{
|
{
|
||||||
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void*)TRUE);
|
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (RwInitialised && gGameState == GS_PLAYING_GAME)
|
||||||
|
{
|
||||||
|
RsEventHandler(rsIDLE, (void *)TRUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (RwInitialised && height > 0 && width > 0) {
|
if (RwInitialised && height > 0 && width > 0) {
|
||||||
RwRect r;
|
RwRect r;
|
||||||
|
@ -1765,6 +1762,7 @@ main(int argc, char *argv[])
|
||||||
printf("Into TheGame!!!\n");
|
printf("Into TheGame!!!\n");
|
||||||
#else
|
#else
|
||||||
LoadingScreen(nil, nil, "loadsc0");
|
LoadingScreen(nil, nil, "loadsc0");
|
||||||
|
// LoadingScreen(nil, nil, "loadsc0"); // duplicate
|
||||||
#endif
|
#endif
|
||||||
if ( !CGame::InitialiseOnceAfterRW() )
|
if ( !CGame::InitialiseOnceAfterRW() )
|
||||||
RsGlobal.quit = TRUE;
|
RsGlobal.quit = TRUE;
|
||||||
|
@ -1781,6 +1779,7 @@ main(int argc, char *argv[])
|
||||||
case GS_INIT_FRONTEND:
|
case GS_INIT_FRONTEND:
|
||||||
{
|
{
|
||||||
LoadingScreen(nil, nil, "loadsc0");
|
LoadingScreen(nil, nil, "loadsc0");
|
||||||
|
// LoadingScreen(nil, nil, "loadsc0"); // duplicate
|
||||||
|
|
||||||
FrontEndMenuManager.m_bGameNotLoaded = true;
|
FrontEndMenuManager.m_bGameNotLoaded = true;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "skeleton.h"
|
#include "skeleton.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
static RwBool DefaultVideoMode = TRUE;
|
static RwBool DefaultVideoMode = TRUE;
|
||||||
|
|
||||||
|
@ -371,8 +371,8 @@ RsRwInitialize(void *displayID)
|
||||||
|
|
||||||
psNativeTextureSupport();
|
psNativeTextureSupport();
|
||||||
|
|
||||||
|
RwTextureSetAutoMipmapping(TRUE);
|
||||||
RwTextureSetMipmapping(FALSE);
|
RwTextureSetMipmapping(FALSE);
|
||||||
RwTextureSetAutoMipmapping(FALSE);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#define IDEXIT 1002
|
#define IDEXIT 1002
|
||||||
#define IDC_SELECTDEVICE 1005
|
#define IDC_SELECTDEVICE 1005
|
||||||
|
|
||||||
#define IDI_MAIN_ICON 1042
|
#define IDI_MAIN_ICON 100
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
#define MAX_SUBSYSTEMS (16)
|
#define MAX_SUBSYSTEMS (16)
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
static RwBool ForegroundApp = TRUE;
|
static RwBool ForegroundApp = TRUE;
|
||||||
|
|
||||||
|
@ -189,7 +190,7 @@ const char *_psGetUserFilesFolder()
|
||||||
&KeycbData) == ERROR_SUCCESS )
|
&KeycbData) == ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
strcat(szUserFiles, "\\GTA3 User Files");
|
strcat(szUserFiles, "\\GTA Vice City User Files");
|
||||||
_psCreateFolder(szUserFiles);
|
_psCreateFolder(szUserFiles);
|
||||||
return szUserFiles;
|
return szUserFiles;
|
||||||
}
|
}
|
||||||
|
@ -650,10 +651,6 @@ psInitialize(void)
|
||||||
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
|
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
|
||||||
|
|
||||||
InitialiseLanguage();
|
InitialiseLanguage();
|
||||||
#ifndef GTA3_1_1_PATCH
|
|
||||||
FrontEndMenuManager.LoadSettings();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gGameState = GS_START_UP;
|
gGameState = GS_START_UP;
|
||||||
|
@ -688,7 +685,7 @@ psInitialize(void)
|
||||||
}
|
}
|
||||||
else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
|
else if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
|
||||||
{
|
{
|
||||||
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion == 1 )
|
if ( verInfo.dwMajorVersion > 4 || verInfo.dwMajorVersion == 4 && verInfo.dwMinorVersion != 0 )
|
||||||
{
|
{
|
||||||
debug("Operating System is Win98\n");
|
debug("Operating System is Win98\n");
|
||||||
_dwOperatingSystemVersion = OS_WIN98;
|
_dwOperatingSystemVersion = OS_WIN98;
|
||||||
|
@ -701,11 +698,7 @@ psInitialize(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PS2_MENU
|
#ifndef PS2_MENU
|
||||||
|
|
||||||
#ifdef GTA3_1_1_PATCH
|
|
||||||
FrontEndMenuManager.LoadSettings();
|
FrontEndMenuManager.LoadSettings();
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dwDXVersion = GetDXVersion();
|
dwDXVersion = GetDXVersion();
|
||||||
|
@ -945,8 +938,7 @@ void HandleGraphEvent(void)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
|
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -1016,10 +1008,17 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
/* redraw window */
|
/* redraw window */
|
||||||
|
#ifndef MASTER
|
||||||
if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER))
|
if (RwInitialised && (gGameState == GS_PLAYING_GAME || gGameState == GS_ANIMVIEWER))
|
||||||
{
|
{
|
||||||
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
|
RsEventHandler((gGameState == GS_PLAYING_GAME ? rsIDLE : rsANIMVIEWER), (void *)TRUE);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (RwInitialised && gGameState == GS_PLAYING_GAME)
|
||||||
|
{
|
||||||
|
RsEventHandler(rsIDLE, (void *)TRUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Manually resize window */
|
/* Manually resize window */
|
||||||
rect.left = rect.top = 0;
|
rect.left = rect.top = 0;
|
||||||
|
@ -1327,7 +1326,7 @@ InitApplication(HANDLE instance)
|
||||||
windowClass.cbClsExtra = 0;
|
windowClass.cbClsExtra = 0;
|
||||||
windowClass.cbWndExtra = 0;
|
windowClass.cbWndExtra = 0;
|
||||||
windowClass.hInstance = (HINSTANCE)instance;
|
windowClass.hInstance = (HINSTANCE)instance;
|
||||||
windowClass.hIcon = nil;
|
windowClass.hIcon = LoadIcon((HINSTANCE)instance, (LPCSTR)IDI_MAIN_ICON);
|
||||||
windowClass.hCursor = LoadCursor(nil, IDC_ARROW);
|
windowClass.hCursor = LoadCursor(nil, IDC_ARROW);
|
||||||
windowClass.hbrBackground = nil;
|
windowClass.hbrBackground = nil;
|
||||||
windowClass.lpszMenuName = NULL;
|
windowClass.lpszMenuName = NULL;
|
||||||
|
@ -1382,17 +1381,17 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
|
||||||
#endif
|
#endif
|
||||||
if ( mode.Width == width && mode.Height == height && mode.Format == format )
|
if ( mode.Width == width && mode.Height == height && mode.Format == format )
|
||||||
{
|
{
|
||||||
if ( mode.RefreshRate == 0 )
|
if ( mode.RefreshRate == 0 ) {
|
||||||
|
d3d->Release();
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 )
|
if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 )
|
||||||
refreshRate = mode.RefreshRate;
|
refreshRate = mode.RefreshRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
d3d->Release();
|
d3d->Release();
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( refreshRate == -1 )
|
if ( refreshRate == -1 )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -2255,6 +2254,8 @@ WinMain(HINSTANCE instance,
|
||||||
|
|
||||||
if ( startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0 )
|
if ( startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0 )
|
||||||
++gGameState;
|
++gGameState;
|
||||||
|
else if ( CPad::GetPad(0)->NewState.CheckForInput() )
|
||||||
|
++gGameState;
|
||||||
else if ( CPad::GetPad(0)->GetLeftMouseJustDown() )
|
else if ( CPad::GetPad(0)->GetLeftMouseJustDown() )
|
||||||
++gGameState;
|
++gGameState;
|
||||||
else if ( CPad::GetPad(0)->GetEnterJustDown() )
|
else if ( CPad::GetPad(0)->GetEnterJustDown() )
|
||||||
|
@ -2292,6 +2293,8 @@ WinMain(HINSTANCE instance,
|
||||||
|
|
||||||
if ( startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0 )
|
if ( startupDeactivate || ControlsManager.GetJoyButtonJustDown() != 0 )
|
||||||
++gGameState;
|
++gGameState;
|
||||||
|
else if ( CPad::GetPad(0)->NewState.CheckForInput() )
|
||||||
|
++gGameState;
|
||||||
else if ( CPad::GetPad(0)->GetLeftMouseJustDown() )
|
else if ( CPad::GetPad(0)->GetLeftMouseJustDown() )
|
||||||
++gGameState;
|
++gGameState;
|
||||||
else if ( CPad::GetPad(0)->GetEnterJustDown() )
|
else if ( CPad::GetPad(0)->GetEnterJustDown() )
|
||||||
|
@ -2328,6 +2331,7 @@ WinMain(HINSTANCE instance,
|
||||||
printf("Into TheGame!!!\n");
|
printf("Into TheGame!!!\n");
|
||||||
#else
|
#else
|
||||||
LoadingScreen(nil, nil, "loadsc0");
|
LoadingScreen(nil, nil, "loadsc0");
|
||||||
|
// LoadingScreen(nil, nil, "loadsc0"); // duplicate
|
||||||
#endif
|
#endif
|
||||||
if ( !CGame::InitialiseOnceAfterRW() )
|
if ( !CGame::InitialiseOnceAfterRW() )
|
||||||
RsGlobal.quit = TRUE;
|
RsGlobal.quit = TRUE;
|
||||||
|
@ -2345,6 +2349,7 @@ WinMain(HINSTANCE instance,
|
||||||
case GS_INIT_FRONTEND:
|
case GS_INIT_FRONTEND:
|
||||||
{
|
{
|
||||||
LoadingScreen(nil, nil, "loadsc0");
|
LoadingScreen(nil, nil, "loadsc0");
|
||||||
|
// LoadingScreen(nil, nil, "loadsc0"); // duplicate
|
||||||
|
|
||||||
FrontEndMenuManager.m_bGameNotLoaded = true;
|
FrontEndMenuManager.m_bGameNotLoaded = true;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
|
@ -59,7 +59,7 @@ bool CAutomobile::m_sAllTaxiLights;
|
||||||
|
|
||||||
const uint32 CAutomobile::nSaveStructSize =
|
const uint32 CAutomobile::nSaveStructSize =
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
1448;
|
1500;
|
||||||
#else
|
#else
|
||||||
sizeof(CAutomobile);
|
sizeof(CAutomobile);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4635,7 +4635,6 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
|
||||||
case ANIM_CAR_ROLLDOOR_LOW:
|
case ANIM_CAR_ROLLDOOR_LOW:
|
||||||
ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f);
|
ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f);
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
case ANIM_CAR_GETOUT_LHS:
|
case ANIM_CAR_GETOUT_LHS:
|
||||||
case ANIM_CAR_GETOUT_LOW_LHS:
|
case ANIM_CAR_GETOUT_LOW_LHS:
|
||||||
case ANIM_CAR_GETOUT_RHS:
|
case ANIM_CAR_GETOUT_RHS:
|
||||||
|
@ -4649,6 +4648,7 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
|
||||||
case ANIM_CAR_PULLOUT_RHS:
|
case ANIM_CAR_PULLOUT_RHS:
|
||||||
case ANIM_CAR_PULLOUT_LOW_RHS:
|
case ANIM_CAR_PULLOUT_LOW_RHS:
|
||||||
OpenDoor(component, door, 1.0f);
|
OpenDoor(component, door, 1.0f);
|
||||||
|
break;
|
||||||
case ANIM_COACH_OPEN_L:
|
case ANIM_COACH_OPEN_L:
|
||||||
case ANIM_COACH_OPEN_R:
|
case ANIM_COACH_OPEN_R:
|
||||||
ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f);
|
ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f);
|
||||||
|
@ -5349,7 +5349,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
|
||||||
obj->m_fElasticity = 0.1f;
|
obj->m_fElasticity = 0.1f;
|
||||||
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
|
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
|
||||||
obj->ObjectCreatedBy = TEMP_OBJECT;
|
obj->ObjectCreatedBy = TEMP_OBJECT;
|
||||||
obj->bIsStatic = false;
|
obj->SetIsStatic(false);
|
||||||
obj->bIsPickup = false;
|
obj->bIsPickup = false;
|
||||||
obj->bUseVehicleColours = true;
|
obj->bUseVehicleColours = true;
|
||||||
obj->m_colour1 = m_currentColour1;
|
obj->m_colour1 = m_currentColour1;
|
||||||
|
@ -5713,7 +5713,7 @@ CAutomobile::Save(uint8*& buf)
|
||||||
{
|
{
|
||||||
CVehicle::Save(buf);
|
CVehicle::Save(buf);
|
||||||
WriteSaveBuf<CDamageManager>(buf, Damage);
|
WriteSaveBuf<CDamageManager>(buf, Damage);
|
||||||
SkipSaveBuf(buf, 800 - sizeof(CDamageManager));
|
SkipSaveBuf(buf, 1500 - 672 - sizeof(CDamageManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -5721,7 +5721,7 @@ CAutomobile::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
CVehicle::Load(buf);
|
CVehicle::Load(buf);
|
||||||
Damage = ReadSaveBuf<CDamageManager>(buf);
|
Damage = ReadSaveBuf<CDamageManager>(buf);
|
||||||
SkipSaveBuf(buf, 800 - sizeof(CDamageManager));
|
SkipSaveBuf(buf, 1500 - 672 - sizeof(CDamageManager));
|
||||||
SetupDamageAfterLoad();
|
SetupDamageAfterLoad();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,6 +39,14 @@
|
||||||
|
|
||||||
//--MIAMI: file done
|
//--MIAMI: file done
|
||||||
|
|
||||||
|
const uint32 CBike::nSaveStructSize =
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
1260;
|
||||||
|
#else
|
||||||
|
sizeof(CBoat);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// TODO: maybe put this somewhere else
|
// TODO: maybe put this somewhere else
|
||||||
inline void
|
inline void
|
||||||
GetRelativeMatrix(RwMatrix *mat, RwFrame *frm, RwFrame *end)
|
GetRelativeMatrix(RwMatrix *mat, RwFrame *frm, RwFrame *end)
|
||||||
|
@ -2922,3 +2930,19 @@ CBike::ReduceHornCounter(void)
|
||||||
if(m_nCarHornTimer != 0)
|
if(m_nCarHornTimer != 0)
|
||||||
m_nCarHornTimer--;
|
m_nCarHornTimer--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
void
|
||||||
|
CBike::Save(uint8*& buf)
|
||||||
|
{
|
||||||
|
CVehicle::Save(buf);
|
||||||
|
SkipSaveBuf(buf, 1260 - 672);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CBike::Load(uint8*& buf)
|
||||||
|
{
|
||||||
|
CVehicle::Load(buf);
|
||||||
|
SkipSaveBuf(buf, 1260 - 672);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -132,6 +132,12 @@ public:
|
||||||
void Fix(void);
|
void Fix(void);
|
||||||
void SetupModelNodes(void);
|
void SetupModelNodes(void);
|
||||||
void ReduceHornCounter(void);
|
void ReduceHornCounter(void);
|
||||||
|
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
virtual void Save(uint8*& buf);
|
||||||
|
virtual void Load(uint8*& buf);
|
||||||
|
#endif
|
||||||
|
static const uint32 nSaveStructSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
// These functions and function names are made up
|
// These functions and function names are made up
|
||||||
|
|
|
@ -43,7 +43,7 @@ CBoat *CBoat::apFrameWakeGeneratingBoats[4];
|
||||||
|
|
||||||
const uint32 CBoat::nSaveStructSize =
|
const uint32 CBoat::nSaveStructSize =
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
1156;
|
1216;
|
||||||
#else
|
#else
|
||||||
sizeof(CBoat);
|
sizeof(CBoat);
|
||||||
#endif
|
#endif
|
||||||
|
@ -893,7 +893,7 @@ CBoat::BlowUpCar(CEntity *culprit)
|
||||||
obj->m_fElasticity = 0.1f;
|
obj->m_fElasticity = 0.1f;
|
||||||
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
|
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
|
||||||
obj->ObjectCreatedBy = TEMP_OBJECT;
|
obj->ObjectCreatedBy = TEMP_OBJECT;
|
||||||
obj->bIsStatic = false;
|
obj->SetIsStatic(false);
|
||||||
obj->bIsPickup = false;
|
obj->bIsPickup = false;
|
||||||
|
|
||||||
// life time
|
// life time
|
||||||
|
@ -1449,13 +1449,13 @@ void
|
||||||
CBoat::Save(uint8*& buf)
|
CBoat::Save(uint8*& buf)
|
||||||
{
|
{
|
||||||
CVehicle::Save(buf);
|
CVehicle::Save(buf);
|
||||||
SkipSaveBuf(buf, 1156 - 648);
|
SkipSaveBuf(buf, 1216 - 672);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CBoat::Load(uint8*& buf)
|
CBoat::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
CVehicle::Load(buf);
|
CVehicle::Load(buf);
|
||||||
SkipSaveBuf(buf, 1156 - 648);
|
SkipSaveBuf(buf, 1216 - 672);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -91,7 +91,7 @@ void CCarGenerator::DoInternalProcessing()
|
||||||
pVehicle = pBoat;
|
pVehicle = pBoat;
|
||||||
if (pos.z <= -100.0f)
|
if (pos.z <= -100.0f)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
pBoat->bExtendedRange = false;
|
pBoat->bExtendedRange = true;
|
||||||
}else{
|
}else{
|
||||||
bool groundFound;
|
bool groundFound;
|
||||||
pos = m_vecPos;
|
pos = m_vecPos;
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
// --MIAMI: file done
|
||||||
|
|
||||||
#define MAX_DISTANCE_TO_FIND_CRANE (10.0f)
|
#define MAX_DISTANCE_TO_FIND_CRANE (10.0f)
|
||||||
#define CRANE_UPDATE_RADIUS (300.0f)
|
#define CRANE_UPDATE_RADIUS (300.0f)
|
||||||
#define CRANE_MOVEMENT_PROCESSING_RADIUS (150.0f)
|
#define CRANE_MOVEMENT_PROCESSING_RADIUS (150.0f)
|
||||||
|
@ -259,7 +261,6 @@ void CCrane::Update(void)
|
||||||
m_pVehiclePickedUp->bUsesCollision = false;
|
m_pVehiclePickedUp->bUsesCollision = false;
|
||||||
if (m_bIsCrusher)
|
if (m_bIsCrusher)
|
||||||
m_pVehiclePickedUp->bCollisionProof = true;
|
m_pVehiclePickedUp->bCollisionProof = true;
|
||||||
DMAudio.PlayOneShot(m_nAudioEntity, SOUND_CRANE_PICKUP, 0.0f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,8 +440,6 @@ bool CCrane::DoesCranePickUpThisCarType(uint32 mi)
|
||||||
mi != MI_TRASH &&
|
mi != MI_TRASH &&
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
mi != MI_COACH &&
|
mi != MI_COACH &&
|
||||||
#else
|
|
||||||
mi != MI_BLISTA &&
|
|
||||||
#endif
|
#endif
|
||||||
mi != MI_SECURICA &&
|
mi != MI_SECURICA &&
|
||||||
mi != MI_BUS &&
|
mi != MI_BUS &&
|
||||||
|
@ -657,11 +656,6 @@ void CCranes::Load(uint8* buf, uint32 size)
|
||||||
if (pCrane->m_pVehiclePickedUp != nil)
|
if (pCrane->m_pVehiclePickedUp != nil)
|
||||||
pCrane->m_pVehiclePickedUp = CPools::GetVehiclePool()->GetSlot((uintptr)pCrane->m_pVehiclePickedUp - 1);
|
pCrane->m_pVehiclePickedUp = CPools::GetVehiclePool()->GetSlot((uintptr)pCrane->m_pVehiclePickedUp - 1);
|
||||||
}
|
}
|
||||||
/*for (int i = 0; i < NUM_CRANES; i++) {
|
|
||||||
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);
|
VALIDATESAVEBUF(size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ public:
|
||||||
};
|
};
|
||||||
CBuilding *m_pCraneEntity;
|
CBuilding *m_pCraneEntity;
|
||||||
CObject *m_pHook;
|
CObject *m_pHook;
|
||||||
int32 m_nAudioEntity;
|
|
||||||
float m_fPickupX1;
|
float m_fPickupX1;
|
||||||
float m_fPickupX2;
|
float m_fPickupX2;
|
||||||
float m_fPickupY1;
|
float m_fPickupY1;
|
||||||
|
|
|
@ -671,7 +671,7 @@ CHeli::SpawnFlyingComponent(int32 component)
|
||||||
obj->m_fElasticity = 0.1f;
|
obj->m_fElasticity = 0.1f;
|
||||||
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
|
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
|
||||||
obj->ObjectCreatedBy = TEMP_OBJECT;
|
obj->ObjectCreatedBy = TEMP_OBJECT;
|
||||||
obj->bIsStatic = false;
|
obj->SetIsStatic(false);
|
||||||
obj->bIsPickup = false;
|
obj->bIsPickup = false;
|
||||||
|
|
||||||
// life time
|
// life time
|
||||||
|
|
|
@ -2367,15 +2367,15 @@ CVehicle::Save(uint8*& buf)
|
||||||
WriteSaveBuf<float>(buf, GetPosition().z);
|
WriteSaveBuf<float>(buf, GetPosition().z);
|
||||||
SkipSaveBuf(buf, 16);
|
SkipSaveBuf(buf, 16);
|
||||||
SaveEntityFlags(buf);
|
SaveEntityFlags(buf);
|
||||||
SkipSaveBuf(buf, 212);
|
SkipSaveBuf(buf, 208);
|
||||||
AutoPilot.Save(buf);
|
AutoPilot.Save(buf);
|
||||||
WriteSaveBuf<int8>(buf, m_currentColour1);
|
WriteSaveBuf<int8>(buf, m_currentColour1);
|
||||||
WriteSaveBuf<int8>(buf, m_currentColour2);
|
WriteSaveBuf<int8>(buf, m_currentColour2);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
WriteSaveBuf<int16>(buf, m_nAlarmState);
|
WriteSaveBuf<int16>(buf, m_nAlarmState);
|
||||||
SkipSaveBuf(buf, 43);
|
SkipSaveBuf(buf, 42);
|
||||||
WriteSaveBuf<uint8>(buf, m_nNumMaxPassengers);
|
WriteSaveBuf<uint8>(buf, m_nNumMaxPassengers);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 3);
|
||||||
WriteSaveBuf<float>(buf, field_1D0[0]);
|
WriteSaveBuf<float>(buf, field_1D0[0]);
|
||||||
WriteSaveBuf<float>(buf, field_1D0[1]);
|
WriteSaveBuf<float>(buf, field_1D0[1]);
|
||||||
WriteSaveBuf<float>(buf, field_1D0[2]);
|
WriteSaveBuf<float>(buf, field_1D0[2]);
|
||||||
|
@ -2398,13 +2398,13 @@ CVehicle::Save(uint8*& buf)
|
||||||
WriteSaveBuf<uint8>(buf, m_nCurrentGear);
|
WriteSaveBuf<uint8>(buf, m_nCurrentGear);
|
||||||
SkipSaveBuf(buf, 3);
|
SkipSaveBuf(buf, 3);
|
||||||
WriteSaveBuf<float>(buf, m_fChangeGearTime);
|
WriteSaveBuf<float>(buf, m_fChangeGearTime);
|
||||||
SkipSaveBuf(buf, 4);
|
SkipSaveBuf(buf, 12);
|
||||||
WriteSaveBuf<uint32>(buf, m_nTimeOfDeath);
|
WriteSaveBuf<uint32>(buf, m_nTimeOfDeath);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
WriteSaveBuf<int16>(buf, m_nBombTimer);
|
WriteSaveBuf<int16>(buf, m_nBombTimer);
|
||||||
SkipSaveBuf(buf, 12);
|
SkipSaveBuf(buf, 12);
|
||||||
WriteSaveBuf<int8>(buf, m_nDoorLock);
|
WriteSaveBuf<int8>(buf, m_nDoorLock);
|
||||||
SkipSaveBuf(buf, 99);
|
SkipSaveBuf(buf, 111);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2430,15 +2430,15 @@ CVehicle::Load(uint8*& buf)
|
||||||
m_matrix = tmp;
|
m_matrix = tmp;
|
||||||
SkipSaveBuf(buf, 16);
|
SkipSaveBuf(buf, 16);
|
||||||
LoadEntityFlags(buf);
|
LoadEntityFlags(buf);
|
||||||
SkipSaveBuf(buf, 212);
|
SkipSaveBuf(buf, 208);
|
||||||
AutoPilot.Load(buf);
|
AutoPilot.Load(buf);
|
||||||
m_currentColour1 = ReadSaveBuf<int8>(buf);
|
m_currentColour1 = ReadSaveBuf<int8>(buf);
|
||||||
m_currentColour2 = ReadSaveBuf<int8>(buf);
|
m_currentColour2 = ReadSaveBuf<int8>(buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_nAlarmState = ReadSaveBuf<int16>(buf);
|
m_nAlarmState = ReadSaveBuf<int16>(buf);
|
||||||
SkipSaveBuf(buf, 43);
|
SkipSaveBuf(buf, 42);
|
||||||
m_nNumMaxPassengers = ReadSaveBuf<int8>(buf);
|
m_nNumMaxPassengers = ReadSaveBuf<int8>(buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 3);
|
||||||
field_1D0[0] = ReadSaveBuf<float>(buf);
|
field_1D0[0] = ReadSaveBuf<float>(buf);
|
||||||
field_1D0[1] = ReadSaveBuf<float>(buf);
|
field_1D0[1] = ReadSaveBuf<float>(buf);
|
||||||
field_1D0[2] = ReadSaveBuf<float>(buf);
|
field_1D0[2] = ReadSaveBuf<float>(buf);
|
||||||
|
@ -2460,13 +2460,13 @@ CVehicle::Load(uint8*& buf)
|
||||||
m_nCurrentGear = ReadSaveBuf<uint8>(buf);
|
m_nCurrentGear = ReadSaveBuf<uint8>(buf);
|
||||||
SkipSaveBuf(buf, 3);
|
SkipSaveBuf(buf, 3);
|
||||||
m_fChangeGearTime = ReadSaveBuf<float>(buf);
|
m_fChangeGearTime = ReadSaveBuf<float>(buf);
|
||||||
SkipSaveBuf(buf, 4);
|
SkipSaveBuf(buf, 12);
|
||||||
m_nTimeOfDeath = ReadSaveBuf<uint32>(buf);
|
m_nTimeOfDeath = ReadSaveBuf<uint32>(buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_nBombTimer = ReadSaveBuf<int16>(buf);
|
m_nBombTimer = ReadSaveBuf<int16>(buf);
|
||||||
SkipSaveBuf(buf, 12);
|
SkipSaveBuf(buf, 12);
|
||||||
m_nDoorLock = (eCarLock)ReadSaveBuf<int8>(buf);
|
m_nDoorLock = (eCarLock)ReadSaveBuf<int8>(buf);
|
||||||
SkipSaveBuf(buf, 99);
|
SkipSaveBuf(buf, 111);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -205,13 +205,13 @@ void CBulletInfo::Update(void)
|
||||||
if (pHitEntity->IsObject()) {
|
if (pHitEntity->IsObject()) {
|
||||||
CObject *pHitObject = (CObject*)pHitEntity;
|
CObject *pHitObject = (CObject*)pHitEntity;
|
||||||
if ( !pHitObject->bInfiniteMass && pHitObject->m_fCollisionDamageMultiplier < 99.9f) {
|
if ( !pHitObject->bInfiniteMass && pHitObject->m_fCollisionDamageMultiplier < 99.9f) {
|
||||||
bool notStatic = !pHitObject->IsStatic();
|
bool notStatic = !pHitObject->GetIsStatic();
|
||||||
if (notStatic && pHitObject->m_fUprootLimit <= 0.0f) {
|
if (notStatic && pHitObject->m_fUprootLimit <= 0.0f) {
|
||||||
pHitObject->bIsStatic = false;
|
pHitObject->bIsStatic = false;
|
||||||
pHitObject->AddToMovingList();
|
pHitObject->AddToMovingList();
|
||||||
}
|
}
|
||||||
|
|
||||||
notStatic = !pHitObject->IsStatic();
|
notStatic = !pHitObject->GetIsStatic();
|
||||||
if (!notStatic) {
|
if (!notStatic) {
|
||||||
CVector moveForce = point.normal * -BULLET_HIT_FORCE;
|
CVector moveForce = point.normal * -BULLET_HIT_FORCE;
|
||||||
pHitObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
|
pHitObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
|
||||||
|
|
|
@ -1526,14 +1526,14 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
||||||
|
|
||||||
if ( !victimObject->bInfiniteMass && victimObject->m_fCollisionDamageMultiplier < 99.9f)
|
if ( !victimObject->bInfiniteMass && victimObject->m_fCollisionDamageMultiplier < 99.9f)
|
||||||
{
|
{
|
||||||
bool notStatic = !victimObject->IsStatic();
|
bool notStatic = !victimObject->GetIsStatic();
|
||||||
if (notStatic && victimObject->m_fUprootLimit <= 0.0f)
|
if (notStatic && victimObject->m_fUprootLimit <= 0.0f)
|
||||||
{
|
{
|
||||||
victimObject->bIsStatic = false;
|
victimObject->SetIsStatic(false);
|
||||||
victimObject->AddToMovingList();
|
victimObject->AddToMovingList();
|
||||||
}
|
}
|
||||||
|
|
||||||
notStatic = !victimObject->IsStatic();
|
notStatic = !victimObject->GetIsStatic();
|
||||||
if (!notStatic)
|
if (!notStatic)
|
||||||
{
|
{
|
||||||
CVector moveForce = point->normal * -4.0f;
|
CVector moveForce = point->normal * -4.0f;
|
||||||
|
@ -1922,14 +1922,14 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
||||||
|
|
||||||
if ( !victimObject->bInfiniteMass )
|
if ( !victimObject->bInfiniteMass )
|
||||||
{
|
{
|
||||||
bool notStatic = !victimObject->IsStatic();
|
bool notStatic = !victimObject->GetIsStatic();
|
||||||
if ( notStatic && victimObject->m_fUprootLimit <= 0.0f )
|
if ( notStatic && victimObject->m_fUprootLimit <= 0.0f )
|
||||||
{
|
{
|
||||||
victimObject->bIsStatic = false;
|
victimObject->SetIsStatic(false);
|
||||||
victimObject->AddToMovingList();
|
victimObject->AddToMovingList();
|
||||||
}
|
}
|
||||||
|
|
||||||
notStatic = !victimObject->IsStatic();
|
notStatic = !victimObject->GetIsStatic();
|
||||||
if ( !notStatic )
|
if ( !notStatic )
|
||||||
{
|
{
|
||||||
CVector moveForce = point.normal*-5.0f;
|
CVector moveForce = point.normal*-5.0f;
|
||||||
|
@ -3149,9 +3149,9 @@ CWeapon::BlowUpExplosiveThings(CEntity *thing)
|
||||||
object->m_vecMoveSpeed.x += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
|
object->m_vecMoveSpeed.x += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
|
||||||
object->m_vecMoveSpeed.y += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
|
object->m_vecMoveSpeed.y += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
|
||||||
|
|
||||||
if ( object->IsStatic())
|
if ( object->GetIsStatic())
|
||||||
{
|
{
|
||||||
object->bIsStatic = false;
|
object->SetIsStatic(false);
|
||||||
object->AddToMovingList();
|
object->AddToMovingList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,17 @@ enum eWeaponType
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TOTAL_WEAPON_SLOTS = 10,
|
WEAPONSLOT_UNARMED = 0,
|
||||||
|
WEAPONSLOT_MELEE,
|
||||||
|
WEAPONSLOT_PROJECTILE,
|
||||||
|
WEAPONSLOT_HANDGUN,
|
||||||
|
WEAPONSLOT_SHOTGUN,
|
||||||
|
WEAPONSLOT_SUBMACHINEGUN,
|
||||||
|
WEAPONSLOT_RIFLE,
|
||||||
|
WEAPONSLOT_HEAVY,
|
||||||
|
WEAPONSLOT_SNIPER,
|
||||||
|
WEAPONSLOT_OTHER,
|
||||||
|
TOTAL_WEAPON_SLOTS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eWeaponFire {
|
enum eWeaponFire {
|
||||||
|
|
2
vendor/librw
vendored
2
vendor/librw
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 30b77b0b32b4113b5dce2b67813ce9b85d1e1e57
|
Subproject commit edc77742c512b85ad35544b2cfbe3f359dc75805
|
Loading…
Reference in a new issue