sync with upstream

This commit is contained in:
Nikolay Korolev 2020-05-07 16:59:40 +03:00
commit 5780b4503e
38 changed files with 638 additions and 479 deletions

2
librw

@ -1 +1 @@
Subproject commit bdbc92d86eef28344e01c992d55a9c4f43629f84 Subproject commit 661feeabf4a4f0a8b0bee23b53ba557a14352d00

View File

@ -117,58 +117,54 @@ cAudioManager::GetCollisionRatio(float a, float b, float c, float d) const
} }
uint32 uint32
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision) cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
{ {
uint8 surface1 = audioCollision->m_bSurface1; uint8 surface1 = audioCollision.m_bSurface1;
uint8 surface2 = audioCollision->m_bSurface2; uint8 surface2 = audioCollision.m_bSurface2;
int32 vol; int32 vol;
float ratio; float ratio;
if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE || if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
surface2 == SURFACE_HEDGE) { surface2 == SURFACE_HEDGE) {
ratio = GetCollisionRatio(audioCollision->m_fIntensity2, 0.0001f, 0.09f, 0.0899f); ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_RAIN; m_sQueueSample.m_nSampleIndex = SFX_RAIN;
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000; m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
vol = 50.f * ratio; vol = 50.f * ratio;
} else if(surface1 == SURFACE_PUDDLE || surface2 == SURFACE_PUDDLE) {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
vol = 30.f * ratio;
} else if(surface1 == SURFACE_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK ||
surface2 == SURFACE_DIRTTRACK || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
vol = 50.f * ratio;
} else if(surface1 == SURFACE_FLESH || surface2 == SURFACE_FLESH) {
return 0;
} else { } else {
if(surface1 == SURFACE_PUDDLE || surface2 == SURFACE_PUDDLE) { ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
ratio = GetCollisionRatio(audioCollision->m_fIntensity2, 0.0001f, 0.09f, 0.0899f); m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000; vol = 40.f * ratio;
vol = 30.f * ratio;
} else {
if(surface1 == SURFACE_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK ||
surface2 == SURFACE_DIRTTRACK || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
ratio = GetCollisionRatio(audioCollision->m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
vol = 50.f * ratio;
} else {
if(surface1 == SURFACE_FLESH || surface2 == SURFACE_FLESH) { return 0; }
ratio = GetCollisionRatio(audioCollision->m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
vol = 40.f * ratio;
}
}
} }
if(audioCollision->m_nBaseVolume < 2) vol = audioCollision->m_nBaseVolume * vol / 2; if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
return vol; return vol;
} }
void void
cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter) cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
{ {
if(col->m_fIntensity2 > 0.0016f) { if(col.m_fIntensity2 > 0.0016f) {
uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col); uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
if(emittingVol) { if(emittingVol) {
m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance); m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
m_sQueueSample.m_nVolume = m_sQueueSample.m_nVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance); ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_nVolume) { if(m_sQueueSample.m_nVolume) {
m_sQueueSample.m_nCounter = counter; m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col->m_vecPosition; m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_nReleasingVolumeModificator = 7;
@ -189,22 +185,43 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
} }
} }
} }
static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
SFX_COL_TARMAC_1,
SFX_COL_GRASS_1,
SFX_COL_GRAVEL_1,
SFX_COL_MUD_1,
SFX_COL_TARMAC_1,
SFX_COL_CAR_1,
SFX_COL_GRASS_1,
SFX_COL_SCAFFOLD_POLE_1,
SFX_COL_GARAGE_DOOR_1,
SFX_COL_CAR_PANEL_1,
SFX_COL_THICK_METAL_PLATE_1,
SFX_COL_SCAFFOLD_POLE_1,
SFX_COL_LAMP_POST_1,
SFX_COL_HYDRANT_1,
SFX_COL_HYDRANT_1,
SFX_COL_METAL_CHAIN_FENCE_1,
SFX_COL_PED_1,
SFX_COL_SAND_1,
SFX_SPLASH_1,
SFX_COL_WOOD_CRATES_1,
SFX_COL_WOOD_BENCH_1,
SFX_COL_WOOD_SOLID_1,
SFX_COL_GRASS_1,
SFX_COL_GRASS_1,
SFX_COL_VEG_1,
SFX_COL_TARMAC_1,
SFX_COL_CONTAINER_1,
SFX_COL_NEWS_VENDOR_1,
SFX_TYRE_BUMP,
SFX_COL_CARDBOARD_1,
SFX_COL_TARMAC_1,
SFX_COL_GATE};
void void
cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col) cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
{ {
static const int32 gOneShotCol[] = {
SFX_COL_TARMAC_1, SFX_COL_TARMAC_1, SFX_COL_GRASS_1,
SFX_COL_GRAVEL_1, SFX_COL_MUD_1, SFX_COL_TARMAC_1,
SFX_COL_CAR_1, SFX_COL_GRASS_1, SFX_COL_SCAFFOLD_POLE_1,
SFX_COL_GARAGE_DOOR_1, SFX_COL_CAR_PANEL_1, SFX_COL_THICK_METAL_PLATE_1,
SFX_COL_SCAFFOLD_POLE_1, SFX_COL_LAMP_POST_1, SFX_COL_HYDRANT_1,
SFX_COL_HYDRANT_1, SFX_COL_METAL_CHAIN_FENCE_1, SFX_COL_PED_1,
SFX_COL_SAND_1, SFX_SPLASH_1, SFX_COL_WOOD_CRATES_1,
SFX_COL_WOOD_BENCH_1, SFX_COL_WOOD_SOLID_1, SFX_COL_GRASS_1,
SFX_COL_GRASS_1, SFX_COL_VEG_1, SFX_COL_TARMAC_1,
SFX_COL_CONTAINER_1, SFX_COL_NEWS_VENDOR_1, SFX_TYRE_BUMP,
SFX_COL_CARDBOARD_1, SFX_COL_TARMAC_1, SFX_COL_GATE};
int16 s1; int16 s1;
int16 s2; int16 s2;
@ -216,21 +233,21 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
for(int32 i = 0; i < 2; i++) { for(int32 i = 0; i < 2; i++) {
if(i) { if(i) {
s1 = col->m_bSurface2; s1 = col.m_bSurface2;
s2 = col->m_bSurface1; s2 = col.m_bSurface1;
} else { } else {
s1 = col->m_bSurface1; s1 = col.m_bSurface1;
s2 = col->m_bSurface2; s2 = col.m_bSurface2;
} }
ratio = GetCollisionOneShotRatio(s1, col->m_fIntensity1); ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1);
if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio = 0.25f * ratio; if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio /= 4.0f;
if(s1 == SURFACE_METAL6 && ratio < 0.6f) { if(s1 == SURFACE_METAL6 && ratio < 0.6f) {
s1 = SURFACE_BILLBOARD; s1 = SURFACE_BILLBOARD;
ratio = Min(1.f, 2.f * ratio); ratio = Min(1.f, 2.f * ratio);
} }
emittingVol = 40.f * ratio; emittingVol = 40.f * ratio;
if(emittingVol) { if(emittingVol) {
m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance); m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
m_sQueueSample.m_nVolume = m_sQueueSample.m_nVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance); ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_nVolume) { if(m_sQueueSample.m_nVolume) {
@ -288,7 +305,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
m_sQueueSample.m_nCounter = counter++; m_sQueueSample.m_nCounter = counter++;
if(counter >= 255) counter = 28; if(counter >= 255) counter = 28;
m_sQueueSample.m_vecPos = col->m_vecPosition; m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 11; m_sQueueSample.m_nReleasingVolumeModificator = 11;
@ -311,13 +328,13 @@ void
cAudioManager::ServiceCollisions() cAudioManager::ServiceCollisions()
{ {
int i, j; int i, j;
bool someArr1[NUMAUDIOCOLLISIONS]; bool abRepeatedCollision1[NUMAUDIOCOLLISIONS];
bool someArr2[NUMAUDIOCOLLISIONS]; bool abRepeatedCollision2[NUMAUDIOCOLLISIONS];
m_sQueueSample.m_nEntityIndex = m_nCollisionEntity; m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++) for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
someArr1[i] = someArr2[i] = false; abRepeatedCollision1[i] = abRepeatedCollision2[i] = false;
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) { for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) { for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
@ -327,17 +344,17 @@ cAudioManager::ServiceCollisions()
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1) && (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2) && (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
) { ) {
someArr1[index] = true; abRepeatedCollision1[index] = true;
someArr2[j] = true; abRepeatedCollision2[j] = true;
m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume; m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
SetUpLoopingCollisionSound(&m_sCollisionManager.m_asCollisions1[index], j); SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
break; break;
} }
} }
} }
for (i = 0; i < NUMAUDIOCOLLISIONS; i++) { for (i = 0; i < NUMAUDIOCOLLISIONS; i++) {
if (!someArr2[i]) { if (!abRepeatedCollision2[i]) {
m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil; m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil; m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT; m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
@ -351,9 +368,9 @@ cAudioManager::ServiceCollisions()
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) { for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
int index = m_sCollisionManager.m_bIndicesTable[i]; int index = m_sCollisionManager.m_bIndicesTable[i];
if (!someArr1[index]) { if (!abRepeatedCollision1[index]) {
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) { for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
if (someArr2[j]) { if (!abRepeatedCollision2[j]) {
m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1; m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1;
m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1; m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1;
m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2; m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2;
@ -362,8 +379,8 @@ cAudioManager::ServiceCollisions()
break; break;
} }
} }
SetUpOneShotCollisionSound(&m_sCollisionManager.m_asCollisions1[index]); SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
SetUpLoopingCollisionSound(&m_sCollisionManager.m_asCollisions1[index], j); SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
} }
} }
@ -393,7 +410,7 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface
v2 = entity2->GetPosition(); v2 = entity2->GetPosition();
} }
CVector pos = (v1 + v2) * 0.5f; CVector pos = (v1 + v2) * 0.5f;
distSquared = GetDistanceSquared(&pos); distSquared = GetDistanceSquared(pos);
if(distSquared < SQR(CollisionSoundIntensity)) { if(distSquared < SQR(CollisionSoundIntensity)) {
m_sCollisionManager.m_sQueue.m_pEntity1 = entity1; m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
m_sCollisionManager.m_sQueue.m_pEntity2 = entity2; m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;

View File

@ -100,13 +100,13 @@ enum eVehicleModel {
LINERUN, LINERUN,
PEREN, PEREN,
SENTINEL, SENTINEL,
PATRIOT, RIO,
FIRETRUK, FIRETRUK,
TRASH, TRASH,
STRETCH, STRETCH,
MANANA, MANANA,
INFERNUS, INFERNUS,
BLISTA, VOODOO,
PONY, PONY,
MULE, MULE,
CHEETAH, CHEETAH,
@ -115,11 +115,11 @@ enum eVehicleModel {
MOONBEAM, MOONBEAM,
ESPERANT, ESPERANT,
TAXI, TAXI,
KURUMA, WASHING,
BOBCAT, BOBCAT,
MRWHOOP, MRWHOOP,
BFINJECT, BFINJECT,
CORPSE, HUNTER,
POLICE, POLICE,
ENFORCER, ENFORCER,
SECURICA, SECURICA,
@ -128,42 +128,83 @@ enum eVehicleModel {
BUS, BUS,
RHINO, RHINO,
BARRACKS, BARRACKS,
TRAIN, CUBAN,
CHOPPER, CHOPPER,
DODO, ANGEL,
COACH, COACH,
CABBIE, CABBIE,
STALLION, STALLION,
RUMPO, RUMPO,
RCBANDIT, RCBANDIT,
BELLYUP, ROMERO,
MRWONGS, PACKER,
MAFIA, SENTXS,
YARDIE, ADMIRAL,
YAKUZA, SQUALO,
DIABLOS, SEASPAR,
COLUMB, PIZZABOY,
HOODS, GANGBUR,
AIRTRAIN, AIRTRAIN,
DEADDODO, DEADDODO,
SPEEDER, SPEEDER,
REEFER, REEFER,
PANLANT, TROPIC,
FLATBED, FLATBED,
YANKEE, YANKEE,
ESCAPE, CADDY,
BORGNINE, ZEBRA,
TOYZ, TOPFUN,
GHOST, SKIMMER,
CAR151, PCJ600,
CAR152, FAGGIO,
CAR153, FREEWAY,
CAR154, RCBARON,
CAR155, RCRAIDER,
CAR156, GLENDALE,
CAR157, OCEANIC,
CAR158, SANCHEZ,
CAR159, SPARROW,
PATRIOT,
LOVEFIST,
COASTG,
DINGHY,
HERMES,
SABRE,
SABRETUR,
PHEONIX,
WALTON,
REGINA,
COMET,
DELUXO,
BURRITO,
SPAND,
MARQUIS,
BAGGAGE,
KAUFMAN,
MAVERICK,
VCNMAV,
RANCHER,
FBIRANCH,
VIRGO,
GREENWOO,
JETMAX,
HOTRING,
SANDKING,
BLISTAC,
POLMAV,
BOXVILLE,
BENSON,
MESA,
RCGOBLIN,
HOTRINA,
HOTRINB,
BLOODRA,
BLOODRB,
VICECHEE,
// HACK so this compiles
// TODO(MIAMI): check it out
DODO = -1
}; };
enum PLAY_STATUS : uint8 { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING = 1, PLAY_STATUS_FINISHED = 2 }; enum PLAY_STATUS : uint8 { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING = 1, PLAY_STATUS_FINISHED = 2 };
@ -2951,10 +2992,10 @@ cAudioManager::GetCurrent3DProviderIndex() const
} }
float float
cAudioManager::GetDistanceSquared(CVector *v) const cAudioManager::GetDistanceSquared(const CVector &v) const
{ {
const CVector &c = TheCamera.GetPosition(); const CVector &c = TheCamera.GetPosition();
return sq(v->x - c.x) + sq(v->y - c.y) + sq((v->z - c.z) * 0.2f); return sq(v.x - c.x) + sq(v.y - c.y) + sq((v.z - c.z) * 0.2f);
} }
int32 int32
@ -3625,14 +3666,14 @@ cAudioManager::ProcessActiveQueues()
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE; m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
} }
} }
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; ++i) { for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; ++i) {
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]]; tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) { if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
if (sample.m_nCounter > 255 && sample.m_nLoopCount && sample.m_nLoopsRemaining) { if (sample.m_nCounter > 255 && sample.m_nLoopCount && sample.m_nLoopsRemaining) {
--sample.m_nLoopsRemaining; --sample.m_nLoopsRemaining;
sample.m_nReleasingVolumeDivider = 1; sample.m_nReleasingVolumeDivider = 1;
} else { } else {
for (int32 j = 0; j < m_nActiveSamples; ++j) { for (uint8 j = 0; j < m_nActiveSamples; ++j) {
if (!m_asActiveSamples[j].m_bIsProcessed) { if (!m_asActiveSamples[j].m_bIsProcessed) {
if (sample.m_nLoopCount) { if (sample.m_nLoopCount) {
v28 = sample.m_nFrequency / m_nTimeSpent; v28 = sample.m_nFrequency / m_nTimeSpent;
@ -3747,7 +3788,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound)
default: default:
return; return;
} }
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
@ -3970,7 +4011,7 @@ cAudioManager::ProcessBridge()
if (CBridge::pLiftRoad) { if (CBridge::pLiftRoad) {
m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition(); m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition();
dist = GetDistanceSquared(&m_sQueueSample.m_vecPos); dist = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (dist < 202500.0f) { if (dist < 202500.0f) {
CalculateDistance(distCalculated, dist); CalculateDistance(distCalculated, dist);
switch (CBridge::State) { switch (CBridge::State) {
@ -4206,7 +4247,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound)
default: default:
return; return;
} }
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
rand = m_anRandomTable[0] % 90 + 30; rand = m_anRandomTable[0] % 90 + 30;
@ -4246,7 +4287,7 @@ cAudioManager::ProcessCrane()
if (crane->m_nCraneStatus == CCrane::ACTIVATED) { if (crane->m_nCraneStatus == CCrane::ACTIVATED) {
if (crane->m_nCraneState != CCrane::IDLE) { if (crane->m_nCraneState != CCrane::IDLE) {
m_sQueueSample.m_vecPos = crane->m_pCraneEntity->GetPosition(); m_sQueueSample.m_vecPos = crane->m_pCraneEntity->GetPosition();
distSquared = GetDistanceSquared(&this->m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(intensity)) { if (distSquared < SQR(intensity)) {
CalculateDistance(distCalculated, distSquared); CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance);
@ -4306,7 +4347,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound)
default: default:
return; return;
} }
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
rand = m_anRandomTable[0] % 60 + 40; rand = m_anRandomTable[0] % 60 + 40;
@ -4510,7 +4551,7 @@ cAudioManager::ProcessExplosions(int32 explosion)
} }
pos = CExplosion::GetExplosionPosition(i); pos = CExplosion::GetExplosionPosition(i);
m_sQueueSample.m_vecPos = *pos; m_sQueueSample.m_vecPos = *pos;
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
@ -4541,7 +4582,7 @@ cAudioManager::ProcessFireHydrant()
static const int intensity = 35; static const int intensity = 35;
m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition(); m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition();
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(intensity)) { if (distSquared < SQR(intensity)) {
CalculateDistance(distCalculated, distSquared); CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance);
@ -4611,7 +4652,7 @@ void cAudioManager::ProcessFires(int32)
m_sQueueSample.m_nReleasingVolumeModificator = 8; m_sQueueSample.m_nReleasingVolumeModificator = 8;
} }
m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos; m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos;
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
@ -4875,7 +4916,7 @@ cAudioManager::ProcessGarages()
continue; continue;
m_sQueueSample.m_vecPos = entity->GetPosition(); m_sQueueSample.m_vecPos = entity->GetPosition();
distCalculated = false; distCalculated = false;
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < 6400.f) { if (distSquared < 6400.f) {
state = CGarages::aGarages[i].m_eGarageState; state = CGarages::aGarages[i].m_eGarageState;
if (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { if (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) {
@ -5021,7 +5062,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound)
default: default:
return; return;
} }
dist = GetDistanceSquared(&m_sQueueSample.m_vecPos); dist = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (dist < SQR(m_sQueueSample.m_fSoundIntensity)) { if (dist < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(dist); m_sQueueSample.m_fDistance = Sqrt(dist);
rand = m_anRandomTable[0] % 30 + 40; rand = m_anRandomTable[0] % 30 + 40;
@ -5173,7 +5214,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound)
default: default:
return; return;
} }
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
@ -5804,7 +5845,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound)
return; return;
} }
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
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);
@ -5914,7 +5955,7 @@ cAudioManager::ProcessMissionAudio()
if (m_sMissionAudio.m_bPredefinedProperties) { if (m_sMissionAudio.m_bPredefinedProperties) {
SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1); SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1);
} else { } else {
distSquared = GetDistanceSquared(&m_sMissionAudio.m_vecPos); distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos);
if (distSquared >= 2500.f) { if (distSquared >= 2500.f) {
emittingVol = 0; emittingVol = 0;
pan = 63; pan = 63;
@ -6017,14 +6058,14 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L: case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L:
male.m_pPed = nil; male.m_pPed = nil;
male.m_bDistanceCalculated = false; male.m_bDistanceCalculated = false;
male.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos); male.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
SetupPedComments(&male, SOUND_INJURED_PED_MALE_OUCH); SetupPedComments(&male, SOUND_INJURED_PED_MALE_OUCH);
return; return;
case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S: case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S:
case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L: case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L:
female.m_pPed = nil; female.m_pPed = nil;
female.m_bDistanceCalculated = false; female.m_bDistanceCalculated = false;
female.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos); female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
SetupPedComments(&female, SOUND_INJURED_PED_FEMALE); SetupPedComments(&female, SOUND_INJURED_PED_FEMALE);
return; return;
case SCRIPT_SOUND_GATE_START_CLUNK: case SCRIPT_SOUND_GATE_START_CLUNK:
@ -6186,7 +6227,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSpeedMultiplier = 0.0f;
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
emittingVolume = m_anRandomTable[2] % 20 + 30; emittingVolume = m_anRandomTable[2] % 20 + 30;
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
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);
@ -6231,7 +6272,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
return; return;
} }
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
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);
@ -6261,7 +6302,7 @@ cAudioManager::ProcessPed(CPhysical *ped)
// params.m_bDistanceCalculated = false; // params.m_bDistanceCalculated = false;
params.m_pPed = (CPed *)ped; params.m_pPed = (CPed *)ped;
params.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos); params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (ped->GetModelIndex() == MI_FATMALE02) if (ped->GetModelIndex() == MI_FATMALE02)
ProcessPedHeadphones(&params); ProcessPedHeadphones(&params);
ProcessPedOneShots(&params); ProcessPedOneShots(&params);
@ -7103,7 +7144,8 @@ struct tVehicleSampleData {
uint8 m_bDoorType; uint8 m_bDoorType;
}; };
const tVehicleSampleData aVehicleSettings[70] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1}, // TODO(MIAMI): this is bogus. get the real data in here!
const tVehicleSampleData aVehicleSettings[110] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, 0}, {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, 1}, {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, 1},
{SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 2}, {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 2},
@ -7172,6 +7214,46 @@ const tVehicleSampleData aVehicleSettings[70] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0},
{SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}}; {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}};
void void
@ -7458,7 +7540,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound)
default: default:
return; return;
} }
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
if (m_FrameCounter & 1) if (m_FrameCounter & 1)
@ -7545,7 +7627,7 @@ cAudioManager::ProcessPornCinema(uint8 sound)
default: default:
return; return;
} }
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) {
@ -7622,7 +7704,7 @@ cAudioManager::ProcessProjectiles()
m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3;
m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition(); m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition();
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
@ -7762,7 +7844,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound)
default: default:
return; return;
} }
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
@ -7835,7 +7917,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound)
default: default:
return; return;
} }
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
@ -7980,7 +8062,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
m_sQueueSample.m_vecPos = veh->GetPosition(); m_sQueueSample.m_vecPos = veh->GetPosition();
params.m_bDistanceCalculated = false; params.m_bDistanceCalculated = false;
params.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos); params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
params.m_pVehicle = veh; params.m_pVehicle = veh;
params.m_pTransmission = nil; params.m_pTransmission = nil;
params.m_nIndex = 0; params.m_nIndex = 0;
@ -7989,7 +8071,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
if (handling) if (handling)
params.m_pTransmission = &handling->Transmission; params.m_pTransmission = &handling->Transmission;
params.m_nIndex = veh->GetModelIndex() - 90; params.m_nIndex = veh->GetModelIndex() - MI_FIRST_VEHICLE;
if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE) if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE)
velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f; velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f;
else else
@ -8990,7 +9072,7 @@ void cAudioManager::ProcessWaterCannon(int32)
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 < SOUND_INTENSITY) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
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);
@ -9136,7 +9218,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound)
default: default:
return; return;
} }
distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_fDistance = Sqrt(distSquared);
m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);

View File

@ -317,7 +317,7 @@ public:
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
float GetCollisionOneShotRatio(int32 a, float b) const; float GetCollisionOneShotRatio(int32 a, float b) const;
float GetCollisionRatio(float a, float b, float c, float d) const; float GetCollisionRatio(float a, float b, float c, float d) const;
float GetDistanceSquared(CVector *v) const; float GetDistanceSquared(const CVector &v) const;
int32 GetJumboTaxiFreq() const; int32 GetJumboTaxiFreq() const;
bool GetMissionAudioLoadingStatus() const; bool GetMissionAudioLoadingStatus() const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const; int8 GetMissionScriptPoliceAudioPlayingStatus() const;
@ -438,15 +438,15 @@ public:
void SetEffectsFadeVolume(uint8 volume) const; void SetEffectsFadeVolume(uint8 volume) const;
void SetEffectsMasterVolume(uint8 volume) const; void SetEffectsMasterVolume(uint8 volume) const;
void SetEntityStatus(int32 id, uint8 status); void SetEntityStatus(int32 id, uint8 status);
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision); uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
void SetMissionAudioLocation(float x, float y, float z); void SetMissionAudioLocation(float x, float y, float z);
void SetMissionScriptPoliceAudio(int32 sfx) const; void SetMissionScriptPoliceAudio(int32 sfx) const;
void SetMonoMode(uint8); // todo (mobile) void SetMonoMode(uint8); // todo (mobile)
void SetMusicFadeVolume(uint8 volume) const; void SetMusicFadeVolume(uint8 volume) const;
void SetMusicMasterVolume(uint8 volume) const; void SetMusicMasterVolume(uint8 volume) const;
void SetSpeakerConfig(int32 conf) const; void SetSpeakerConfig(int32 conf) const;
void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter); void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
void SetUpOneShotCollisionSound(cAudioCollision *col); void SetUpOneShotCollisionSound(const cAudioCollision &col);
bool SetupCrimeReport(); bool SetupCrimeReport();
bool SetupJumboEngineSound(uint8 vol, int32 freq); bool SetupJumboEngineSound(uint8 vol, int32 freq);
bool SetupJumboFlySound(uint8 emittingVol); bool SetupJumboFlySound(uint8 emittingVol);
@ -468,6 +468,8 @@ public:
// only used in pc // only used in pc
void AdjustSamplesVolume(); void AdjustSamplesVolume();
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
void DebugShit();
}; };
//dstatic_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error"); //dstatic_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");

View File

@ -66,7 +66,8 @@ cMusicManager::PlayerInCar()
case MI_TRAIN: case MI_TRAIN:
case MI_SPEEDER: case MI_SPEEDER:
case MI_REEFER: case MI_REEFER:
case MI_GHOST: return false; // case MI_GHOST:
return false;
default: return true; default: return true;
} }
} }

View File

@ -541,39 +541,41 @@ cAudioManager::SetupSuspectLastSeenReport()
color_pre_modifier = gCarColourTable[color1][0]; color_pre_modifier = gCarColourTable[color1][0];
color_post_modifier = gCarColourTable[color1][2]; color_post_modifier = gCarColourTable[color1][2];
switch (veh->GetModelIndex()) { switch (veh->GetModelIndex()) {
// TODO(MIAMI): just making this compile
#ifdef FIX_BUGS #ifdef FIX_BUGS
case MI_COLUMB: // case MI_COLUMB:
main_color = SFX_POLICE_RADIO_BLUE; // main_color = SFX_POLICE_RADIO_BLUE;
color_pre_modifier = color_post_modifier = TOTAL_AUDIO_SAMPLES; // color_pre_modifier = color_post_modifier = TOTAL_AUDIO_SAMPLES;
#endif #endif
case MI_LANDSTAL: case MI_LANDSTAL:
case MI_BLISTA: sample = SFX_POLICE_RADIO_CRUISER; break; // case MI_BLISTA:
sample = SFX_POLICE_RADIO_CRUISER; break;
#ifdef FIX_BUGS #ifdef FIX_BUGS
case MI_YARDIE: // case MI_YARDIE:
color_pre_modifier = TOTAL_AUDIO_SAMPLES; // color_pre_modifier = TOTAL_AUDIO_SAMPLES;
main_color = SFX_POLICE_RADIO_RED; // main_color = SFX_POLICE_RADIO_RED;
color_post_modifier = SFX_POLICE_RADIO_YELLOW; // color_post_modifier = SFX_POLICE_RADIO_YELLOW;
sample = SFX_POLICE_RADIO_CONVERTIBLE; break; // sample = SFX_POLICE_RADIO_CONVERTIBLE; break;
case MI_DIABLOS: // case MI_DIABLOS:
main_color = SFX_POLICE_RADIO_BLACK; // main_color = SFX_POLICE_RADIO_BLACK;
#endif #endif
case MI_IDAHO: case MI_IDAHO:
case MI_STALLION: sample = SFX_POLICE_RADIO_CONVERTIBLE; break; case MI_STALLION: sample = SFX_POLICE_RADIO_CONVERTIBLE; break;
#ifdef FIX_BUGS #ifdef FIX_BUGS
case MI_YAKUZA: // case MI_YAKUZA:
color_pre_modifier = TOTAL_AUDIO_SAMPLES; // color_pre_modifier = TOTAL_AUDIO_SAMPLES;
main_color = SFX_POLICE_RADIO_SILVER; // main_color = SFX_POLICE_RADIO_SILVER;
color_post_modifier = SFX_POLICE_RADIO_RED; // color_post_modifier = SFX_POLICE_RADIO_RED;
#endif #endif
case MI_STINGER: case MI_STINGER:
case MI_INFERNUS: case MI_INFERNUS:
case MI_CHEETAH: case MI_CHEETAH:
case MI_BANSHEE: sample = SFX_POLICE_RADIO_SPORTS_CAR; break; case MI_BANSHEE: sample = SFX_POLICE_RADIO_SPORTS_CAR; break;
#ifdef FIX_BUGS #ifdef FIX_BUGS
case MI_MAFIA: // case MI_MAFIA:
color_pre_modifier = color_post_modifier = TOTAL_AUDIO_SAMPLES; // color_pre_modifier = color_post_modifier = TOTAL_AUDIO_SAMPLES;
main_color = SFX_POLICE_RADIO_GREY; // main_color = SFX_POLICE_RADIO_GREY;
case MI_KURUMA: case MI_WASHING:
#endif #endif
case MI_PEREN: case MI_PEREN:
case MI_SENTINEL: case MI_SENTINEL:
@ -588,21 +590,18 @@ cAudioManager::SetupSuspectLastSeenReport()
case MI_TRASH: case MI_TRASH:
case MI_BARRACKS: sample = SFX_POLICE_RADIO_TRUCK; break; case MI_BARRACKS: sample = SFX_POLICE_RADIO_TRUCK; break;
case MI_STRETCH: sample = SFX_POLICE_RADIO_LIMO; break; case MI_STRETCH: sample = SFX_POLICE_RADIO_LIMO; break;
#ifdef FIX_BUGS
case MI_CORPSE:
#endif
case MI_MANANA: case MI_MANANA:
case MI_ESPERANT: sample = SFX_POLICE_RADIO_2_DOOR; break; case MI_ESPERANT: sample = SFX_POLICE_RADIO_2_DOOR; break;
#ifdef FIX_BUGS #ifdef FIX_BUGS
case MI_HOODS: // case MI_HOODS:
color_pre_modifier = TOTAL_AUDIO_SAMPLES; // color_pre_modifier = TOTAL_AUDIO_SAMPLES;
main_color = SFX_POLICE_RADIO_BLUE; // main_color = SFX_POLICE_RADIO_BLUE;
color_post_modifier = SFX_POLICE_RADIO_GREEN; // color_post_modifier = SFX_POLICE_RADIO_GREEN;
case MI_BELLYUP: // case MI_BELLYUP:
case MI_YANKEE: case MI_YANKEE:
case MI_TOYZ: case MI_TOPFUN:
case MI_MRWONGS: // case MI_MRWONGS:
case MI_PANLANT: // case MI_PANLANT:
#endif #endif
case MI_PONY: case MI_PONY:
case MI_MULE: case MI_MULE:
@ -613,7 +612,8 @@ cAudioManager::SetupSuspectLastSeenReport()
case MI_AMBULAN: sample = SFX_POLICE_RADIO_AMBULANCE; break; case MI_AMBULAN: sample = SFX_POLICE_RADIO_AMBULANCE; break;
case MI_TAXI: case MI_TAXI:
case MI_CABBIE: case MI_CABBIE:
case MI_BORGNINE: sample = SFX_POLICE_RADIO_TAXI; break; case MI_ZEBRA: sample = SFX_POLICE_RADIO_TAXI; break;
case MI_KAUFMAN: sample = SFX_POLICE_RADIO_TAXI; break;
case MI_MRWHOOP: case MI_MRWHOOP:
sample = SFX_POLICE_RADIO_ICE_CREAM_VAN; sample = SFX_POLICE_RADIO_ICE_CREAM_VAN;
break; break;
@ -622,7 +622,7 @@ cAudioManager::SetupSuspectLastSeenReport()
#ifdef FIX_BUGS #ifdef FIX_BUGS
case MI_SPEEDER: case MI_SPEEDER:
case MI_REEFER: case MI_REEFER:
case MI_GHOST: // case MI_GHOST:
#endif #endif
case MI_PREDATOR: sample = SFX_POLICE_RADIO_BOAT; break; case MI_PREDATOR: sample = SFX_POLICE_RADIO_BOAT; break;
case MI_BUS: case MI_BUS:

View File

@ -329,9 +329,14 @@ CCarCtrl::GenerateOneRandomCar()
case RICH: case RICH:
case EXEC: case EXEC:
case WORKER: case WORKER:
case SPECIAL:
case BIG: case BIG:
case TAXI: case TAXI:
// TODO(MIAMI): check this
case MOPED:
case MOTORBIKE:
case LEISUREBOAT:
case WORKERBOAT:
//
case MAFIA: case MAFIA:
case TRIAD: case TRIAD:
case DIABLO: case DIABLO:
@ -522,7 +527,12 @@ CCarCtrl::GenerateOneRandomCar()
case RICH: case RICH:
case EXEC: case EXEC:
case WORKER: case WORKER:
case SPECIAL: // TODO(MIAMI): check this
case MOPED:
case MOTORBIKE:
case LEISUREBOAT:
case WORKERBOAT:
//
case BIG: case BIG:
case TAXI: case TAXI:
case MAFIA: case MAFIA:
@ -602,16 +612,17 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) {
int32 model = -1; int32 model = -1;
while (model == -1 || !CStreaming::HasModelLoaded(model)){ while (model == -1 || !CStreaming::HasModelLoaded(model)){
int rnd = CGeneral::GetRandomNumberInRange(0, 1000); int rnd = CGeneral::GetRandomNumberInRange(0, 1000);
// TODO(MIAMI): new car classes
if (rnd < pZone->carThreshold[0]) if (rnd < pZone->carThreshold[0])
model = CCarCtrl::ChooseCarModel((*pClass = POOR)); model = CCarCtrl::ChooseCarModel((*pClass = NORMAL));
else if (rnd < pZone->carThreshold[1]) else if (rnd < pZone->carThreshold[1])
model = CCarCtrl::ChooseCarModel((*pClass = RICH)); model = CCarCtrl::ChooseCarModel((*pClass = POOR));
else if (rnd < pZone->carThreshold[2]) else if (rnd < pZone->carThreshold[2])
model = CCarCtrl::ChooseCarModel((*pClass = EXEC)); model = CCarCtrl::ChooseCarModel((*pClass = RICH));
else if (rnd < pZone->carThreshold[3]) else if (rnd < pZone->carThreshold[3])
model = CCarCtrl::ChooseCarModel((*pClass = WORKER)); model = CCarCtrl::ChooseCarModel((*pClass = EXEC));
else if (rnd < pZone->carThreshold[4]) else if (rnd < pZone->carThreshold[4])
model = CCarCtrl::ChooseCarModel((*pClass = SPECIAL)); model = CCarCtrl::ChooseCarModel((*pClass = WORKER));
else if (rnd < pZone->carThreshold[5]) else if (rnd < pZone->carThreshold[5])
model = CCarCtrl::ChooseCarModel((*pClass = BIG)); model = CCarCtrl::ChooseCarModel((*pClass = BIG));
else if (rnd < pZone->copThreshold) else if (rnd < pZone->copThreshold)
@ -649,7 +660,12 @@ CCarCtrl::ChooseCarModel(int32 vehclass)
case RICH: case RICH:
case EXEC: case EXEC:
case WORKER: case WORKER:
case SPECIAL: // TODO(MIAMI): check this
case MOPED:
case MOTORBIKE:
case LEISUREBOAT:
case WORKERBOAT:
//
case BIG: case BIG:
case TAXI: case TAXI:
{ {

View File

@ -23,14 +23,19 @@ enum{
class CCarCtrl class CCarCtrl
{ {
public:
enum eCarClass { enum eCarClass {
POOR = 0, NORMAL = 0,
POOR,
RICH, RICH,
EXEC, EXEC,
WORKER, WORKER,
SPECIAL,
BIG, BIG,
TAXI, TAXI,
MOPED,
MOTORBIKE,
LEISUREBOAT,
WORKERBOAT,
TOTAL_CUSTOM_CLASSES, TOTAL_CUSTOM_CLASSES,
MAFIA, MAFIA,
TRIAD, TRIAD,
@ -53,7 +58,7 @@ class CCarCtrl
CLASS20, CLASS20,
COPS_BOAT COPS_BOAT
}; };
public:
static void SwitchVehicleToRealPhysics(CVehicle*); static void SwitchVehicleToRealPhysics(CVehicle*);
static void AddToCarArray(int32 id, int32 vehclass); static void AddToCarArray(int32 id, int32 vehclass);
static void UpdateCarCount(CVehicle*, bool); static void UpdateCarCount(CVehicle*, bool);

View File

@ -106,8 +106,9 @@
const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLLECTCARS_CARS] = const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLLECTCARS_CARS] =
{ {
{ MI_SECURICA, MI_MOONBEAM, MI_COACH, MI_FLATBED, MI_LINERUN, MI_TRASH, MI_PATRIOT, MI_MRWHOOP, MI_BLISTA, MI_MULE, MI_YANKEE, MI_BOBCAT, MI_DODO, MI_BUS, MI_RUMPO, MI_PONY }, // TODO(MIAMI): bogus
{ MI_SENTINEL, MI_CHEETAH, MI_BANSHEE, MI_IDAHO, MI_INFERNUS, MI_TAXI, MI_KURUMA, MI_STRETCH, MI_PEREN, MI_STINGER, MI_MANANA, MI_LANDSTAL, MI_STALLION, MI_BFINJECT, MI_CABBIE, MI_ESPERANT }, { MI_SECURICA, MI_MOONBEAM, MI_COACH, MI_FLATBED, MI_LINERUN, MI_TRASH, MI_PATRIOT, MI_MRWHOOP, MI_BLISTAC, MI_MULE, MI_YANKEE, MI_BOBCAT, MI_DODO, MI_BUS, MI_RUMPO, MI_PONY },
{ MI_SENTINEL, MI_CHEETAH, MI_BANSHEE, MI_IDAHO, MI_INFERNUS, MI_TAXI, MI_WASHING, MI_STRETCH, MI_PEREN, MI_STINGER, MI_MANANA, MI_LANDSTAL, MI_STALLION, MI_BFINJECT, MI_CABBIE, MI_ESPERANT },
{ MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO } { MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }
}; };
@ -1612,8 +1613,6 @@ bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id)
bool CGarage::DoesCraigNeedThisCar(int32 mi) bool CGarage::DoesCraigNeedThisCar(int32 mi)
{ {
if (mi == MI_CORPSE)
mi = MI_MANANA;
int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType);
for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) { for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) {
if (mi == gaCarsToCollectInCraigsGarages[ct][i]) if (mi == gaCarsToCollectInCraigsGarages[ct][i])
@ -1624,8 +1623,6 @@ bool CGarage::DoesCraigNeedThisCar(int32 mi)
bool CGarage::HasCraigCollectedThisCar(int32 mi) bool CGarage::HasCraigCollectedThisCar(int32 mi)
{ {
if (mi == MI_CORPSE)
mi = MI_MANANA;
int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType);
for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) { for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) {
if (mi == gaCarsToCollectInCraigsGarages[ct][i]) if (mi == gaCarsToCollectInCraigsGarages[ct][i])
@ -1636,8 +1633,6 @@ bool CGarage::HasCraigCollectedThisCar(int32 mi)
bool CGarage::MarkThisCarAsCollectedForCraig(int32 mi) bool CGarage::MarkThisCarAsCollectedForCraig(int32 mi)
{ {
if (mi == MI_CORPSE)
mi = MI_MANANA;
int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType);
int index; int index;
for (index = 0; index < TOTAL_COLLECTCARS_CARS; index++) { for (index = 0; index < TOTAL_COLLECTCARS_CARS; index++) {

View File

@ -835,13 +835,14 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
CStreaming::RequestModel(mi, 0); CStreaming::RequestModel(mi, 0);
} }
else { else {
// TODO(MIAMI): don't hardcode model indices
if (mi == MI_DEADDODO || mi == MI_AIRTRAIN) { if (mi == MI_DEADDODO || mi == MI_AIRTRAIN) {
new_v = new(vp->index << 8) CPlane(mi, 2); new_v = new(vp->index << 8) CPlane(mi, 2);
} }
else if (mi == MI_TRAIN) { else if (mi == MI_TRAIN) {
new_v = new(vp->index << 8) CTrain(mi, 2); new_v = new(vp->index << 8) CTrain(mi, 2);
} }
else if (mi == MI_CHOPPER || mi == MI_ESCAPE) { else if (mi == MI_CHOPPER) {
new_v = new(vp->index << 8) CHeli(mi, 2); new_v = new(vp->index << 8) CHeli(mi, 2);
} }
else if (CModelInfo::IsBoatModel(mi)){ else if (CModelInfo::IsBoatModel(mi)){

View File

@ -82,8 +82,8 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
if (copType == COP_STREET) if (copType == COP_STREET)
pCopPed->SetCurrentWeapon(WEAPONTYPE_COLT45); pCopPed->SetCurrentWeapon(WEAPONTYPE_COLT45);
CPedPlacement::FindZCoorForPed(&posForZ); CPedPlacement::FindZCoorForPed(&posForZ);
pCopPed->m_matrix.GetPosition() = posForZ; pCopPed->SetPosition(posForZ);
CVector vecSavedPos = pCopPed->m_matrix.GetPosition(); CVector vecSavedPos = pCopPed->GetPosition();
pCopPed->m_matrix.SetRotate(0.0f, 0.0f, -HALFPI); pCopPed->m_matrix.SetRotate(0.0f, 0.0f, -HALFPI);
pCopPed->m_matrix.GetPosition() += vecSavedPos; pCopPed->m_matrix.GetPosition() += vecSavedPos;
pCopPed->m_bIsDisabledCop = true; pCopPed->m_bIsDisabledCop = true;
@ -137,8 +137,8 @@ CRoadBlocks::GenerateRoadBlocks(void)
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f; float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
int16 radius = (int16)(fMapObjectRadius / fModelRadius); int16 radius = (int16)(fMapObjectRadius / fModelRadius);
if (radius > 0 && radius < 6) { if (radius > 0 && radius < 6) {
CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->m_matrix.GetPosition(); CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition();
float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->m_matrix.GetUp()); float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward());
float fOffset = 0.5f * fModelRadius * (float)(radius - 1); float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
for (int16 i = 0; i < radius; i++) { for (int16 i = 0; i < radius; i++) {
uint8 nRoadblockType = fDotProduct < 0.0f; uint8 nRoadblockType = fDotProduct < 0.0f;
@ -178,7 +178,7 @@ CRoadBlocks::GenerateRoadBlocks(void)
pVehicle->bExtendedRange = true; pVehicle->bExtendedRange = true;
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1) if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
pVehicle->m_bSirenOrAlarm = true; pVehicle->m_bSirenOrAlarm = true;
if (pVehicle->m_matrix.GetForward().z > 0.94f) { if (pVehicle->GetForward().z > 0.94f) {
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0); CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
CWorld::Add(pVehicle); CWorld::Add(pVehicle);
pVehicle->bCreateRoadBlockPeds = true; pVehicle->bCreateRoadBlockPeds = true;

View File

@ -5346,8 +5346,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); assert(pVehicle);
int mi = pVehicle->GetModelIndex(); UpdateCompareFlag(pVehicle->IsTaxi());
UpdateCompareFlag(mi == MI_TAXI || mi == MI_CABBIE || mi == MI_BORGNINE);
return 0; return 0;
} }
case COMMAND_UNLOAD_SPECIAL_CHARACTER: case COMMAND_UNLOAD_SPECIAL_CHARACTER:
@ -8159,7 +8158,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_FBICAR: case MI_FBICAR:
case MI_MRWHOOP: case MI_MRWHOOP:
case MI_BFINJECT: case MI_BFINJECT:
case MI_CORPSE: // case MI_CORPSE:
case MI_POLICE: case MI_POLICE:
case MI_ENFORCER: case MI_ENFORCER:
case MI_SECURICA: case MI_SECURICA:
@ -8172,27 +8171,27 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_DODO: case MI_DODO:
case MI_COACH: case MI_COACH:
case MI_RCBANDIT: case MI_RCBANDIT:
case MI_BELLYUP: // case MI_BELLYUP:
case MI_MRWONGS: // case MI_MRWONGS:
case MI_MAFIA: // case MI_MAFIA:
case MI_YARDIE: case MI_VOODOO:
case MI_YAKUZA: // case MI_YAKUZA:
case MI_DIABLOS: // case MI_DIABLOS:
case MI_COLUMB: // case MI_COLUMB:
case MI_HOODS: // case MI_HOODS:
case MI_AIRTRAIN: case MI_AIRTRAIN:
case MI_DEADDODO: case MI_DEADDODO:
case MI_SPEEDER: case MI_SPEEDER:
case MI_REEFER: case MI_REEFER:
case MI_PANLANT: // case MI_PANLANT:
case MI_FLATBED: case MI_FLATBED:
case MI_YANKEE: case MI_YANKEE:
case MI_ESCAPE: // case MI_ESCAPE:
case MI_BORGNINE: case MI_ZEBRA:
case MI_TOYZ: case MI_TOPFUN:
case MI_GHOST: // case MI_GHOST:
case MI_MIAMI_RCBARON: case MI_RCBARON:
case MI_MIAMI_RCRAIDER: case MI_RCRAIDER:
model = -1; model = -1;
break; break;
case MI_IDAHO: case MI_IDAHO:
@ -8202,13 +8201,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case MI_PATRIOT: case MI_PATRIOT:
case MI_MANANA: case MI_MANANA:
case MI_INFERNUS: case MI_INFERNUS:
case MI_BLISTA: // case MI_BLISTA:
case MI_PONY: case MI_PONY:
case MI_CHEETAH: case MI_CHEETAH:
case MI_MOONBEAM: case MI_MOONBEAM:
case MI_ESPERANT: case MI_ESPERANT:
case MI_TAXI: case MI_TAXI:
case MI_KURUMA: case MI_WASHING:
case MI_BOBCAT: case MI_BOBCAT:
case MI_BANSHEE: case MI_BANSHEE:
case MI_CABBIE: case MI_CABBIE:

View File

@ -4907,7 +4907,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
bool correctAlpha = true; bool correctAlpha = true;
// if (SA checks if we aren't in work car, why?) { // if (SA checks if we aren't in work car, why?) {
if (!isCar || car->GetModelIndex() != MI_YARDIE) { if (!isCar || car->GetModelIndex() != MI_VOODOO) {
correctAlpha = false; correctAlpha = false;
} }
else { else {

View File

@ -781,21 +781,22 @@ CFileLoader::LoadVehicleObject(const char *line)
{ {
int id; int id;
char model[24], txd[24]; char model[24], txd[24];
char type[8], handlingId[16], gamename[32], vehclass[12]; char type[8], handlingId[16], gamename[32], anims[16], vehclass[12];
uint32 frequency, comprules; uint32 frequency, comprules;
int32 level, misc; int32 level, misc;
float wheelScale; float wheelScale;
CVehicleModelInfo *mi; CVehicleModelInfo *mi;
char *p; char *p;
sscanf(line, "%d %s %s %s %s %s %s %d %d %x %d %f", sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f",
&id, model, txd, &id, model, txd,
type, handlingId, gamename, vehclass, type, handlingId, gamename, anims, vehclass,
&frequency, &level, &comprules, &misc, &wheelScale); &frequency, &level, &comprules, &misc, &wheelScale);
mi = CModelInfo::AddVehicleModel(id); mi = CModelInfo::AddVehicleModel(id);
mi->SetName(model); mi->SetName(model);
mi->SetTexDictionary(txd); mi->SetTexDictionary(txd);
// TODO(MIAMI): anims
for(p = gamename; *p; p++) for(p = gamename; *p; p++)
if(*p == '_') *p = ' '; if(*p == '_') *p = ' ';
strncpy(mi->m_gameName, gamename, 32); strncpy(mi->m_gameName, gamename, 32);
@ -826,34 +827,52 @@ CFileLoader::LoadVehicleObject(const char *line)
mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId); mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId);
// Well this is kinda dumb.... // Well this is kinda dumb....
if(strncmp(vehclass, "poorfamily", 11) == 0){ if(strncmp(vehclass, "normal", 7) == 0){
mi->m_vehicleClass = VEHICLE_CLASS_POOR; mi->m_vehicleClass = CCarCtrl::NORMAL;
while(frequency-- > 0) while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_POOR); CCarCtrl::AddToCarArray(id, CCarCtrl::NORMAL);
}else if(strncmp(vehclass, "poorfamily", 11) == 0){
mi->m_vehicleClass = CCarCtrl::POOR;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::POOR);
}else if(strncmp(vehclass, "richfamily", 11) == 0){ }else if(strncmp(vehclass, "richfamily", 11) == 0){
mi->m_vehicleClass = VEHICLE_CLASS_RICH; mi->m_vehicleClass = CCarCtrl::RICH;
while(frequency-- > 0) while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_RICH); CCarCtrl::AddToCarArray(id, CCarCtrl::RICH);
}else if(strncmp(vehclass, "executive", 10) == 0){ }else if(strncmp(vehclass, "executive", 10) == 0){
mi->m_vehicleClass = VEHICLE_CLASS_EXECUTIVE; mi->m_vehicleClass = CCarCtrl::EXEC;
while(frequency-- > 0) while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_EXECUTIVE); CCarCtrl::AddToCarArray(id, CCarCtrl::EXEC);
}else if(strncmp(vehclass, "worker", 7) == 0){ }else if(strncmp(vehclass, "worker", 7) == 0){
mi->m_vehicleClass = VEHICLE_CLASS_WORKER; mi->m_vehicleClass = CCarCtrl::WORKER;
while(frequency-- > 0) while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_WORKER); CCarCtrl::AddToCarArray(id, CCarCtrl::WORKER);
}else if(strncmp(vehclass, "special", 8) == 0){
mi->m_vehicleClass = VEHICLE_CLASS_SPECIAL;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_SPECIAL);
}else if(strncmp(vehclass, "big", 4) == 0){ }else if(strncmp(vehclass, "big", 4) == 0){
mi->m_vehicleClass = VEHICLE_CLASS_BIG; mi->m_vehicleClass = CCarCtrl::BIG;
while(frequency-- > 0) while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_BIG); CCarCtrl::AddToCarArray(id, CCarCtrl::BIG);
}else if(strncmp(vehclass, "taxi", 5) == 0){ }else if(strncmp(vehclass, "taxi", 5) == 0){
mi->m_vehicleClass = VEHICLE_CLASS_TAXI; mi->m_vehicleClass = CCarCtrl::TAXI;
while(frequency-- > 0) while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_TAXI); CCarCtrl::AddToCarArray(id, CCarCtrl::TAXI);
}else if(strncmp(vehclass, "moped", 6) == 0){
mi->m_vehicleClass = CCarCtrl::MOPED;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::MOPED);
}else if(strncmp(vehclass, "motorbike", 10) == 0){
mi->m_vehicleClass = CCarCtrl::MOTORBIKE;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::MOTORBIKE);
}else if(strncmp(vehclass, "leisureboat", 12) == 0){
mi->m_vehicleClass = CCarCtrl::LEISUREBOAT;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::LEISUREBOAT);
}else if(strncmp(vehclass, "workerboat", 11) == 0){
mi->m_vehicleClass = CCarCtrl::WORKERBOAT;
while(frequency-- > 0)
CCarCtrl::AddToCarArray(id, CCarCtrl::WORKERBOAT);
}else if(strncmp(vehclass, "ignore", 11) == 0){
mi->m_vehicleClass = -1;
} }
} }

View File

@ -354,7 +354,7 @@ CPlayerInfo::Process(void)
bool startTaxiTimer = true; bool startTaxiTimer = true;
if (m_bUnusedTaxiThing && m_pPed->bInVehicle) { if (m_bUnusedTaxiThing && m_pPed->bInVehicle) {
CVehicle *veh = m_pPed->m_pMyVehicle; CVehicle *veh = m_pPed->m_pMyVehicle;
if ((veh->GetModelIndex() == MI_TAXI || veh->GetModelIndex() == MI_CABBIE || veh->GetModelIndex() == MI_BORGNINE) if (veh->IsTaxi()
&& veh->pDriver == m_pPed && veh->m_nNumPassengers != 0) { && veh->pDriver == m_pPed && veh->m_nNumPassengers != 0) {
for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) { for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) {
timePassed -= 1000; timePassed -= 1000;

View File

@ -1285,8 +1285,11 @@ CStreaming::StreamVehiclesAndPeds(void)
else if(ms_numVehiclesLoaded <= desiredNumVehiclesLoaded){ else if(ms_numVehiclesLoaded <= desiredNumVehiclesLoaded){
for(i = 1; i <= 10; i++){ for(i = 1; i <= 10; i++){
model = CCarCtrl::ChooseCarModel(modelQualityClass); model = CCarCtrl::ChooseCarModel(modelQualityClass);
// TODO(MIAMI): check this
if(model < 0)
continue;
modelQualityClass++; modelQualityClass++;
if(modelQualityClass >= NUM_VEHICLE_CLASSES) if(modelQualityClass >= CCarCtrl::TOTAL_CUSTOM_CLASSES)
modelQualityClass = 0; modelQualityClass = 0;
// check if we want to load this model // check if we want to load this model
@ -1374,6 +1377,10 @@ CStreaming::StreamZoneModels(const CVector &pos)
ms_loadedGangs &= ~bit; ms_loadedGangs &= ~bit;
} }
// TODO(MIAMI): check this
if(CGangs::GetGangInfo(i)->m_nVehicleMI < 0)
continue;
if(gangCarsToLoad & bit && (ms_loadedGangCars & bit) == 0){ if(gangCarsToLoad & bit && (ms_loadedGangCars & bit) == 0){
RequestModel(CGangs::GetGangInfo(i)->m_nVehicleMI, STREAMFLAGS_DONT_REMOVE); RequestModel(CGangs::GetGangInfo(i)->m_nVehicleMI, STREAMFLAGS_DONT_REMOVE);
}else if((gangCarsToLoad & bit) == 0 && ms_loadedGangCars & bit){ }else if((gangCarsToLoad & bit) == 0 && ms_loadedGangCars & bit){

View File

@ -61,7 +61,7 @@ enum Config {
// Cull zones // Cull zones
NUMATTRIBZONES = 704, NUMATTRIBZONES = 704,
NUMHANDLINGS = 57, NUMHANDLINGS = 106,
PATHNODESIZE = 4500, PATHNODESIZE = 4500,

View File

@ -193,11 +193,17 @@ ResetCamStatics(void)
} }
static const char *carnames[] = { static const char *carnames[] = {
"landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", "manana", "infernus", "blista", "pony", "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "rio", "firetruk", "trash", "stretch", "manana",
"mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "kuruma", "bobcat", "mrwhoop", "bfinject", "corpse", "police", "enforcer", "infernus", "voodoo", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "washing",
"securica", "banshee", "predator", "bus", "rhino", "barracks", "train", "chopper", "dodo", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "bobcat", "mrwhoop", "bfinject", "hunter", "police", "enforcer", "securica", "banshee", "predator", "bus",
"bellyup", "mrwongs", "mafia", "yardie", "yakuza", "diablos", "columb", "hoods", "airtrain", "deaddodo", "speeder", "reefer", "panlant", "flatbed", "rhino", "barracks", "cuban", "chopper", "angel", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "romero",
"yankee", "escape", "borgnine", "toyz", "ghost", "packer", "sentxs", "admiral", "squalo", "seaspar", "pizzaboy", "gangbur", "airtrain", "deaddodo", "speeder",
"reefer", "tropic", "flatbed", "yankee", "caddy", "zebra", "topfun", "skimmer", "pcj600", "faggio", "freeway",
"rcbaron", "rcraider", "glendale", "oceanic", "sanchez", "sparrow", "patriot", "lovefist", "coastg", "dinghy",
"hermes", "sabre", "sabretur", "pheonix", "walton", "regina", "comet", "deluxo", "burrito", "spand", "marquis",
"baggage", "kaufman", "maverick", "vcnmav", "rancher", "fbiranch", "virgo", "greenwoo", "jetmax", "hotring",
"sandking", "blistac", "polmav", "boxville", "benson", "mesa", "rcgoblin", "hotrina", "hotrinb",
"bloodra", "bloodrb", "vicechee"
}; };
static std::list<CTweakVar *> TweakVarsList; static std::list<CTweakVar *> TweakVarsList;
@ -292,14 +298,12 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat); DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat);
static int spawnCarId = MI_LANDSTAL; static int spawnCarId = MI_LANDSTAL;
e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_GHOST, carnames); e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_VICECHEE, carnames);
DebugMenuEntrySetWrap(e, true); DebugMenuEntrySetWrap(e, true);
DebugMenuAddCmd("Spawn", "Spawn Car", [](){ DebugMenuAddCmd("Spawn", "Spawn Car", [](){
if(spawnCarId == MI_TRAIN || if(spawnCarId == MI_CHOPPER ||
spawnCarId == MI_CHOPPER ||
spawnCarId == MI_AIRTRAIN || spawnCarId == MI_AIRTRAIN ||
spawnCarId == MI_DEADDODO || spawnCarId == MI_DEADDODO)
spawnCarId == MI_ESCAPE)
return; return;
SpawnCar(spawnCarId); SpawnCar(spawnCarId);
}); });
@ -311,13 +315,13 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); }); DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); });
DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); }); DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); });
DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); }); DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); });
DebugMenuAddCmd("Spawn", "Spawn Kuruma", [](){ SpawnCar(MI_KURUMA); }); DebugMenuAddCmd("Spawn", "Spawn Washington", [](){ SpawnCar(MI_WASHING); });
DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); }); DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); });
DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); }); DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); });
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); }); DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); }); DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); }); DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); });
DebugMenuAddCmd("Spawn", "Spawn Yardie", [](){ SpawnCar(MI_YARDIE); }); DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); });
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); }); DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); }); DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); }); DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });

View File

@ -317,8 +317,8 @@ int32
CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
{ {
int32 numSpheres = CCollision::ProcessColModels( int32 numSpheres = CCollision::ProcessColModels(
GetMatrix(), *CModelInfo::GetModelInfo(GetModelIndex())->GetColModel(), GetMatrix(), *GetColModel(),
ent->GetMatrix(), *CModelInfo::GetModelInfo(ent->GetModelIndex())->GetColModel(), ent->GetMatrix(), *ent->GetColModel(),
colpoints, colpoints,
nil, nil); // No Lines allowed! nil, nil); // No Lines allowed!
if(numSpheres > 0){ if(numSpheres > 0){
@ -1528,7 +1528,8 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
if(A->GetModelIndex() == MI_RCBANDIT) if(A->GetModelIndex() == MI_RCBANDIT)
adhesion *= 0.2f; adhesion *= 0.2f;
else if(IsBoatModel(A->GetModelIndex())){ // TODO(MIAMI): check this
else if(A->IsVehicle() && ((CVehicle*)A)->IsBoat()){
if(aColPoints[i].normal.z > 0.6f){ if(aColPoints[i].normal.z > 0.6f){
if(CSurfaceTable::GetAdhesionGroup(aColPoints[i].surfaceB) == ADHESIVE_LOOSE) if(CSurfaceTable::GetAdhesionGroup(aColPoints[i].surfaceB) == ADHESIVE_LOOSE)
adhesion *= 3.0f; adhesion *= 3.0f;

View File

@ -756,6 +756,7 @@ RwCamera *RwCameraForAllClumpsNotInFrustum(RwCamera *camera, RwInt32 numClumps,
RwBool RpMatFXPluginAttach( void ) { registerMatFXPlugin(); return true; } RwBool RpMatFXPluginAttach( void ) { registerMatFXPlugin(); return true; }
RpAtomic *RpMatFXAtomicEnableEffects( RpAtomic *atomic ) { MatFX::enableEffects(atomic); return atomic; } RpAtomic *RpMatFXAtomicEnableEffects( RpAtomic *atomic ) { MatFX::enableEffects(atomic); return atomic; }
RpMatFXMaterialFlags RpMatFXMaterialGetEffects( const RpMaterial *material ){ return (RpMatFXMaterialFlags)MatFX::getEffects(material); }
RpMaterial *RpMatFXMaterialSetEffects( RpMaterial *material, RpMatFXMaterialFlags flags ) { MatFX::setEffects(material, (uint32)flags); return material; } RpMaterial *RpMatFXMaterialSetEffects( RpMaterial *material, RpMatFXMaterialFlags flags ) { MatFX::setEffects(material, (uint32)flags); return material; }
RpMaterial *RpMatFXMaterialSetupEnvMap( RpMaterial *material, RwTexture *texture, RwFrame *frame, RwBool useFrameBufferAlpha, RwReal coef ) { RpMaterial *RpMatFXMaterialSetupEnvMap( RpMaterial *material, RwTexture *texture, RwFrame *frame, RwBool useFrameBufferAlpha, RwReal coef ) {
MatFX *mfx = MatFX::get(material); MatFX *mfx = MatFX::get(material);
@ -764,8 +765,23 @@ RpMaterial *RpMatFXMaterialSetupEnvMap( RpMaterial *material, RwTexture *texture
mfx->setEnvCoefficient(coef); mfx->setEnvCoefficient(coef);
return material; return material;
} }
RpMaterial *RpMatFXMaterialSetEnvMapFrame( RpMaterial *material, RwFrame *frame )
{
MatFX *mfx = MatFX::get(material);
mfx->setEnvFrame(frame);
return material;
}
RpMaterial *RpMatFXMaterialSetEnvMapCoefficient( RpMaterial *material, RwReal coef )
{
MatFX *mfx = MatFX::get(material);
mfx->setEnvCoefficient(coef);
return material;
}
RwReal RpMatFXMaterialGetEnvMapCoefficient( const RpMaterial *material )
{
MatFX *mfx = MatFX::get(material);
return mfx->getEnvCoefficient();
}

View File

@ -257,19 +257,20 @@ enum
MI_BUSKER4, MI_BUSKER4,
// three more peds possible // three more peds possible
MI_LANDSTAL = 130, MI_FIRST_VEHICLE = 130,
MI_LANDSTAL = MI_FIRST_VEHICLE,
MI_IDAHO, MI_IDAHO,
MI_STINGER, MI_STINGER,
MI_LINERUN, MI_LINERUN,
MI_PEREN, MI_PEREN,
MI_SENTINEL, MI_SENTINEL,
MI_PATRIOT, MI_RIO,
MI_FIRETRUCK, MI_FIRETRUCK,
MI_TRASH, MI_TRASH,
MI_STRETCH, MI_STRETCH,
MI_MANANA, MI_MANANA,
MI_INFERNUS, MI_INFERNUS,
MI_BLISTA, MI_VOODOO,
MI_PONY, MI_PONY,
MI_MULE, MI_MULE,
MI_CHEETAH, MI_CHEETAH,
@ -278,11 +279,11 @@ enum
MI_MOONBEAM, MI_MOONBEAM,
MI_ESPERANT, MI_ESPERANT,
MI_TAXI, MI_TAXI,
MI_KURUMA, MI_WASHING,
MI_BOBCAT, MI_BOBCAT,
MI_MRWHOOP, MI_MRWHOOP,
MI_BFINJECT, MI_BFINJECT,
MI_CORPSE, MI_HUNTER,
MI_POLICE, MI_POLICE,
MI_ENFORCER, MI_ENFORCER,
MI_SECURICA, MI_SECURICA,
@ -291,38 +292,82 @@ enum
MI_BUS, MI_BUS,
MI_RHINO, MI_RHINO,
MI_BARRACKS, MI_BARRACKS,
MI_TRAIN, MI_CUBAN,
MI_CHOPPER, MI_CHOPPER,
MI_DODO, MI_ANGEL,
MI_COACH, MI_COACH,
MI_CABBIE, MI_CABBIE,
MI_STALLION, MI_STALLION,
MI_RUMPO, MI_RUMPO,
MI_RCBANDIT, MI_RCBANDIT,
MI_BELLYUP, MI_ROMERO,
MI_MRWONGS, MI_PACKER,
MI_MAFIA, MI_SENTXS,
MI_YARDIE, MI_ADMIRAL,
MI_YAKUZA, MI_SQUALO,
MI_DIABLOS, MI_SEASPAR,
MI_COLUMB , MI_PIZZABOY,
MI_HOODS, MI_GANGBUR,
MI_AIRTRAIN, MI_AIRTRAIN,
MI_DEADDODO, MI_DEADDODO,
MI_SPEEDER, MI_SPEEDER,
MI_REEFER, MI_REEFER,
MI_PANLANT, MI_TROPIC,
MI_FLATBED, MI_FLATBED,
MI_YANKEE, MI_YANKEE,
MI_ESCAPE, MI_CADDY,
MI_BORGNINE, MI_ZEBRA,
MI_TOYZ, MI_TOPFUN,
MI_GHOST, MI_SKIMMER,
MI_PCJ600,
// leftovers on PC MI_FAGGIO,
MI_MIAMI_RCBARON = 194, MI_FREEWAY,
MI_MIAMI_RCRAIDER = 195, MI_RCBARON,
MI_MIAMI_SPARROW = 199, MI_RCRAIDER,
MI_GLENDALE,
MI_OCEANIC,
MI_SANCHEZ,
MI_SPARROW,
MI_PATRIOT,
MI_LOVEFIST,
MI_COASTG,
MI_DINGHY,
MI_HERMES,
MI_SABRE,
MI_SABRETUR,
MI_PHEONIX,
MI_WALTON,
MI_REGINA,
MI_COMET,
MI_DELUXO,
MI_BURRITO,
MI_SPAND,
MI_MARQUIS,
MI_BAGGAGE,
MI_KAUFMAN,
MI_MAVERICK,
MI_VCNMAV,
MI_RANCHER,
MI_FBIRANCH,
MI_VIRGO,
MI_GREENWOO,
MI_JETMAX,
MI_HOTRING,
MI_SANDKING,
MI_BLISTAC,
MI_POLMAV,
MI_BOXVILLE,
MI_BENSON,
MI_MESA,
MI_RCGOBLIN,
MI_HOTRINA,
MI_HOTRINB,
MI_BLOODRA,
MI_BLOODRB,
MI_VICECHEE,
// HACK
MI_TRAIN = -1,
MI_DODO = -2,
MI_GRENADE = 258, MI_GRENADE = 258,
MI_AK47, MI_AK47,
@ -393,6 +438,7 @@ IsBodyPart(int16 id)
} }
// This is bad and should perhaps not be used // This is bad and should perhaps not be used
/*
inline bool inline bool
IsBoatModel(int16 id) IsBoatModel(int16 id)
{ {
@ -401,6 +447,7 @@ IsBoatModel(int16 id)
id == MI_SPEEDER || id == MI_SPEEDER ||
id == MI_GHOST; id == MI_GHOST;
} }
*/
inline bool inline bool
IsPedModel(int16 id) IsPedModel(int16 id)

View File

@ -21,7 +21,6 @@
int8 CVehicleModelInfo::ms_compsToUse[2] = { -2, -2 }; int8 CVehicleModelInfo::ms_compsToUse[2] = { -2, -2 };
int8 CVehicleModelInfo::ms_compsUsed[2]; int8 CVehicleModelInfo::ms_compsUsed[2];
RwTexture *CVehicleModelInfo::ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS];
RwRGBA CVehicleModelInfo::ms_vehicleColourTable[256]; RwRGBA CVehicleModelInfo::ms_vehicleColourTable[256];
RwTexture *CVehicleModelInfo::ms_colourTextureTable[256]; RwTexture *CVehicleModelInfo::ms_colourTextureTable[256];
@ -752,35 +751,26 @@ void
CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2) CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2)
{ {
RwRGBA col, *colp; RwRGBA col, *colp;
RwTexture *coltex;
RpMaterial **matp; RpMaterial **matp;
if(c1 != m_currentColour1){ if(c1 != m_currentColour1){
col = ms_vehicleColourTable[c1]; col = ms_vehicleColourTable[c1];
coltex = ms_colourTextureTable[c1];
for(matp = m_materials1; *matp; matp++){ for(matp = m_materials1; *matp; matp++){
if(RpMaterialGetTexture(*matp) && RwTextureGetName(RpMaterialGetTexture(*matp))[0] != '@'){ colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const
colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const colp->red = col.red;
colp->red = col.red; colp->green = col.green;
colp->green = col.green; colp->blue = col.blue;
colp->blue = col.blue;
}else
RpMaterialSetTexture(*matp, coltex);
} }
m_currentColour1 = c1; m_currentColour1 = c1;
} }
if(c2 != m_currentColour2){ if(c2 != m_currentColour2){
col = ms_vehicleColourTable[c2]; col = ms_vehicleColourTable[c2];
coltex = ms_colourTextureTable[c2];
for(matp = m_materials2; *matp; matp++){ for(matp = m_materials2; *matp; matp++){
if(RpMaterialGetTexture(*matp) && RwTextureGetName(RpMaterialGetTexture(*matp))[0] != '@'){ colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const
colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const colp->red = col.red;
colp->red = col.red; colp->green = col.green;
colp->green = col.green; colp->blue = col.blue;
colp->blue = col.blue;
}else
RpMaterialSetTexture(*matp, coltex);
} }
m_currentColour2 = c2; m_currentColour2 = c2;
} }
@ -925,7 +915,6 @@ CVehicleModelInfo::LoadVehicleColours(void)
ms_vehicleColourTable[numCols].green = g; ms_vehicleColourTable[numCols].green = g;
ms_vehicleColourTable[numCols].blue = b; ms_vehicleColourTable[numCols].blue = b;
ms_vehicleColourTable[numCols].alpha = 0xFF; ms_vehicleColourTable[numCols].alpha = 0xFF;
ms_colourTextureTable[numCols] = CreateCarColourTexture(r, g, b);
numCols++; numCols++;
}else if(section == CARS){ }else if(section == CARS){
n = sscanf(&line[start], // BUG: games doesn't add start n = sscanf(&line[start], // BUG: games doesn't add start
@ -960,38 +949,33 @@ CVehicleModelInfo::DeleteVehicleColourTextures(void)
for(i = 0; i < 256; i++){ for(i = 0; i < 256; i++){
if(ms_colourTextureTable[i]){ if(ms_colourTextureTable[i]){
RwTextureDestroy(ms_colourTextureTable[i]); RwTextureDestroy(ms_colourTextureTable[i]);
#ifdef GTA3_1_1_PATCH
ms_colourTextureTable[i] = nil; ms_colourTextureTable[i] = nil;
#endif
} }
} }
} }
RpMaterial* RpMaterial*
CVehicleModelInfo::HasSpecularMaterialCB(RpMaterial *material, void *data) CVehicleModelInfo::GetMatFXEffectMaterialCB(RpMaterial *material, void *data)
{ {
if(RpMaterialGetSurfaceProperties(material)->specular <= 0.0f) if(RpMatFXMaterialGetEffects(material) == rpMATFXEFFECTNULL)
return material; return material;
*(bool*)data = true; *(int*)data = RpMatFXMaterialGetEffects(material);
return nil; return nil;
} }
RpMaterial* RpMaterial*
CVehicleModelInfo::SetEnvironmentMapCB(RpMaterial *material, void *data) CVehicleModelInfo::SetDefaultEnvironmentMapCB(RpMaterial *material, void *data)
{ {
float spec; if(RpMatFXMaterialGetEffects(material) == rpMATFXEFFECTENVMAP){
RpMatFXMaterialSetEnvMapFrame(material, pMatFxIdentityFrame);
spec = RpMaterialGetSurfaceProperties(material)->specular;
if(spec <= 0.0f)
RpMatFXMaterialSetEffects(material, rpMATFXEFFECTNULL);
else{
if(RpMaterialGetTexture(material) == nil) if(RpMaterialGetTexture(material) == nil)
RpMaterialSetTexture(material, gpWhiteTexture); RpMaterialSetTexture(material, gpWhiteTexture);
RpMatFXMaterialSetEffects(material, rpMATFXEFFECTENVMAP); RpMatFXMaterialSetEffects(material, rpMATFXEFFECTENVMAP);
#ifndef PS2_MATFX #ifndef PS2_MATFX
spec *= 0.5f; // Tone down a bit for PC float coef = RpMatFXMaterialGetEnvMapCoefficient(material);
coef *= 0.25f; // Tone down a bit for PC
RpMatFXMaterialSetEnvMapCoefficient(material, coef);
#endif #endif
RpMatFXMaterialSetupEnvMap(material, (RwTexture*)data, pMatFxIdentityFrame, false, spec);
} }
return material; return material;
} }
@ -999,17 +983,15 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpMaterial *material, void *data)
RpAtomic* RpAtomic*
CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data) CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data)
{ {
bool hasSpec; int fx;
RpGeometry *geo; RpGeometry *geo;
geo = RpAtomicGetGeometry(atomic); geo = RpAtomicGetGeometry(atomic);
hasSpec = 0; fx = 0;
RpGeometryForAllMaterials(geo, HasSpecularMaterialCB, &hasSpec); RpGeometryForAllMaterials(geo, GetMatFXEffectMaterialCB, &fx);
if(hasSpec){ if(fx != rpMATFXEFFECTNULL){
RpGeometryForAllMaterials(geo, SetEnvironmentMapCB, data);
RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) | rpGEOMETRYMODULATEMATERIALCOLOR);
RpMatFXAtomicEnableEffects(atomic); RpMatFXAtomicEnableEffects(atomic);
// PS2 sets of PS2Manager lighting CB here RpGeometryForAllMaterials(geo, SetDefaultEnvironmentMapCB, data);
} }
return atomic; return atomic;
} }
@ -1021,44 +1003,29 @@ CVehicleModelInfo::SetEnvironmentMap(void)
int32 i; int32 i;
if(pMatFxIdentityFrame == nil){ if(pMatFxIdentityFrame == nil){
RwV3d axis = { 1.0f, 0.0f, 0.0f };
pMatFxIdentityFrame = RwFrameCreate(); pMatFxIdentityFrame = RwFrameCreate();
RwMatrixSetIdentity(RwFrameGetMatrix(pMatFxIdentityFrame)); RwMatrixRotate(RwFrameGetMatrix(pMatFxIdentityFrame), &axis, 60.0f, rwCOMBINEREPLACE);
RwFrameUpdateObjects(pMatFxIdentityFrame); RwFrameUpdateObjects(pMatFxIdentityFrame);
RwFrameGetLTM(pMatFxIdentityFrame); RwFrameGetLTM(pMatFxIdentityFrame);
} }
if(m_envMap != ms_pEnvironmentMaps[0]){ RpClumpForAllAtomics(m_clump, SetEnvironmentMapCB, nil);
m_envMap = ms_pEnvironmentMaps[0]; if(m_wheelId != -1){
RpClumpForAllAtomics(m_clump, SetEnvironmentMapCB, m_envMap); wheelmi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(m_wheelId);
if(m_wheelId != -1){ for(i = 0; i < wheelmi->m_numAtomics; i++)
wheelmi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(m_wheelId); SetEnvironmentMapCB(wheelmi->m_atomics[i], nil);
for(i = 0; i < wheelmi->m_numAtomics; i++)
SetEnvironmentMapCB(wheelmi->m_atomics[i], m_envMap);
}
} }
} }
void void
CVehicleModelInfo::LoadEnvironmentMaps(void) CVehicleModelInfo::LoadEnvironmentMaps(void)
{ {
const char *texnames[] = {
"reflection01", // only one used
"reflection02",
"reflection03",
"reflection04",
"reflection05",
"reflection06",
};
int32 txdslot; int32 txdslot;
int32 i;
txdslot = CTxdStore::FindTxdSlot("particle"); txdslot = CTxdStore::FindTxdSlot("particle");
CTxdStore::PushCurrentTxd(); CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(txdslot); CTxdStore::SetCurrentTxd(txdslot);
for(i = 0; i < NUM_VEHICLE_ENVMAPS; i++){
ms_pEnvironmentMaps[i] = RwTextureRead(texnames[i], nil);
RwTextureSetFilterMode(ms_pEnvironmentMaps[i], rwFILTERLINEAR);
}
if(gpWhiteTexture == nil){ if(gpWhiteTexture == nil){
gpWhiteTexture = RwTextureRead("white", nil); gpWhiteTexture = RwTextureRead("white", nil);
RwTextureGetName(gpWhiteTexture)[0] = '@'; RwTextureGetName(gpWhiteTexture)[0] = '@';
@ -1070,14 +1037,8 @@ CVehicleModelInfo::LoadEnvironmentMaps(void)
void void
CVehicleModelInfo::ShutdownEnvironmentMaps(void) CVehicleModelInfo::ShutdownEnvironmentMaps(void)
{ {
int32 i;
// ignoring "initialised" as that's a PS2 thing only
RwTextureDestroy(gpWhiteTexture); RwTextureDestroy(gpWhiteTexture);
gpWhiteTexture = nil; gpWhiteTexture = nil;
for(i = 0; i < NUM_VEHICLE_ENVMAPS; i++)
if(ms_pEnvironmentMaps[i])
RwTextureDestroy(ms_pEnvironmentMaps[i]);
RwFrameDestroy(pMatFxIdentityFrame); RwFrameDestroy(pMatFxIdentityFrame);
pMatFxIdentityFrame = nil; pMatFxIdentityFrame = nil;
} }

View File

@ -6,7 +6,6 @@ enum {
NUM_FIRST_MATERIALS = 26, NUM_FIRST_MATERIALS = 26,
NUM_SECOND_MATERIALS = 26, NUM_SECOND_MATERIALS = 26,
NUM_VEHICLE_COLOURS = 8, NUM_VEHICLE_COLOURS = 8,
NUM_VEHICLE_ENVMAPS = 1
}; };
enum { enum {
@ -35,17 +34,6 @@ enum eVehicleType {
NUM_VEHICLE_TYPES NUM_VEHICLE_TYPES
}; };
enum {
VEHICLE_CLASS_POOR,
VEHICLE_CLASS_RICH,
VEHICLE_CLASS_EXECUTIVE,
VEHICLE_CLASS_WORKER,
VEHICLE_CLASS_SPECIAL,
VEHICLE_CLASS_BIG,
VEHICLE_CLASS_TAXI,
NUM_VEHICLE_CLASSES
};
enum { enum {
NUM_VEHICLE_POSITIONS = 10 NUM_VEHICLE_POSITIONS = 10
}; };
@ -83,7 +71,6 @@ public:
static int8 ms_compsToUse[2]; static int8 ms_compsToUse[2];
static int8 ms_compsUsed[2]; static int8 ms_compsUsed[2];
static RwTexture *ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS];
static RwRGBA ms_vehicleColourTable[256]; static RwRGBA ms_vehicleColourTable[256];
static RwTexture *ms_colourTextureTable[256]; static RwTexture *ms_colourTextureTable[256];
static RwObjectNameIdAssocation *ms_vehicleDescs[NUM_VEHICLE_TYPES]; static RwObjectNameIdAssocation *ms_vehicleDescs[NUM_VEHICLE_TYPES];
@ -125,8 +112,8 @@ public:
static void DeleteVehicleColourTextures(void); static void DeleteVehicleColourTextures(void);
static RpAtomic *SetEnvironmentMapCB(RpAtomic *atomic, void *data); static RpAtomic *SetEnvironmentMapCB(RpAtomic *atomic, void *data);
static RpMaterial *SetEnvironmentMapCB(RpMaterial *material, void *data); static RpMaterial *SetDefaultEnvironmentMapCB(RpMaterial *material, void *data);
static RpMaterial *HasSpecularMaterialCB(RpMaterial *material, void *data); static RpMaterial *GetMatFXEffectMaterialCB(RpMaterial *material, void *data);
void SetEnvironmentMap(void); void SetEnvironmentMap(void);
static void LoadEnvironmentMaps(void); static void LoadEnvironmentMaps(void);
static void ShutdownEnvironmentMaps(void); static void ShutdownEnvironmentMaps(void);

View File

@ -15,13 +15,13 @@ CGangInfo::CGangInfo() :
void CGangs::Initialise(void) void CGangs::Initialise(void)
{ {
Gang[GANG_MAFIA].m_nVehicleMI = MI_MAFIA; Gang[GANG_MAFIA].m_nVehicleMI = -1;
Gang[GANG_TRIAD].m_nVehicleMI = MI_BELLYUP; Gang[GANG_TRIAD].m_nVehicleMI = -1;
Gang[GANG_DIABLOS].m_nVehicleMI = MI_DIABLOS; Gang[GANG_DIABLOS].m_nVehicleMI = -1;
Gang[GANG_YAKUZA].m_nVehicleMI = MI_YAKUZA; Gang[GANG_YAKUZA].m_nVehicleMI = -1;
Gang[GANG_YARDIE].m_nVehicleMI = MI_YARDIE; Gang[GANG_YARDIE].m_nVehicleMI = -1;
Gang[GANG_COLUMB].m_nVehicleMI = MI_COLUMB; Gang[GANG_COLUMB].m_nVehicleMI = -1;
Gang[GANG_HOODS].m_nVehicleMI = MI_HOODS; Gang[GANG_HOODS].m_nVehicleMI = -1;
Gang[GANG_7].m_nVehicleMI = -1; Gang[GANG_7].m_nVehicleMI = -1;
Gang[GANG_8].m_nVehicleMI = -1; Gang[GANG_8].m_nVehicleMI = -1;
#ifdef FIX_BUGS #ifdef FIX_BUGS

View File

@ -11976,7 +11976,7 @@ CPed::RegisterThreatWithGangPeds(CEntity *attacker)
} }
if (attackerPed && attackerPed->IsPlayer() && (attackerPed->m_nPedState == PED_CARJACK || attackerPed->bInVehicle)) { if (attackerPed && attackerPed->IsPlayer() && (attackerPed->m_nPedState == PED_CARJACK || attackerPed->bInVehicle)) {
if (!attackerPed->m_pMyVehicle || attackerPed->m_pMyVehicle->GetModelIndex() != MI_TOYZ) { if (!attackerPed->m_pMyVehicle || attackerPed->m_pMyVehicle->GetModelIndex() != MI_TOPFUN) {
int16 lastVehicle; int16 lastVehicle;
CEntity *vehicles[8]; CEntity *vehicles[8];
CWorld::FindObjectsInRange(GetPosition(), 30.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false); CWorld::FindObjectsInRange(GetPosition(), 30.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
@ -15670,7 +15670,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
} else { } else {
if (veh->GetUp().z > -0.8f) { if (veh->GetUp().z > -0.8f) {
bool addDoorSmoke = false; bool addDoorSmoke = false;
if (veh->GetModelIndex() == MI_YARDIE) if (veh->GetModelIndex() == MI_VOODOO)
addDoorSmoke = true; addDoorSmoke = true;
switch (m_vehEnterType) { switch (m_vehEnterType) {

View File

@ -749,7 +749,8 @@ CPopulation::AddPedInCar(CVehicle* car)
break; break;
case MI_TAXI: case MI_TAXI:
case MI_CABBIE: case MI_CABBIE:
case MI_BORGNINE: case MI_ZEBRA:
case MI_KAUFMAN:
if (CGeneral::GetRandomTrueFalse()) { if (CGeneral::GetRandomTrueFalse()) {
pedType = PEDTYPE_CIVMALE; pedType = PEDTYPE_CIVMALE;
preferredModel = MI_TAXI_D; preferredModel = MI_TAXI_D;

View File

@ -105,6 +105,7 @@ void CMovingThings::Init()
EndCloseList.m_pPrev = &CMovingThings::StartCloseList; EndCloseList.m_pPrev = &CMovingThings::StartCloseList;
Num = 0; Num = 0;
#ifndef MIAMI // something is still used here actually
// Initialize scroll bars // Initialize scroll bars
aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0f, 0.5f, 0.5f, 255, 128, 0, 0.3f); aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0f, 0.5f, 0.5f, 255, 128, 0, 0.3f);
aScrollBars[1].Init(CVector( 772.0f, 164.0f, -9.5f ), SCROLL_TRAFFIC, 0.0f, 0.5f, 0.25f, 128, 255, 0, 0.3f); aScrollBars[1].Init(CVector( 772.0f, 164.0f, -9.5f ), SCROLL_TRAFFIC, 0.0f, 0.5f, 0.25f, 128, 255, 0, 0.3f);
@ -137,6 +138,7 @@ void CMovingThings::Init()
CVector(58.145f - sz.y * 0.05f - sz.x * 0.3f, -1079.268f + sz.x * 0.05f - sz.y * 0.3f, 32.803f), CVector(58.145f - sz.y * 0.05f - sz.x * 0.3f, -1079.268f + sz.x * 0.05f - sz.y * 0.3f, 32.803f),
-sz.x, -sz.y, 0, 255, 0, 100.0f, 0.8f -sz.x, -sz.y, 0, 255, 0, 100.0f, 0.8f
); );
#endif
} }
void CMovingThings::Shutdown() void CMovingThings::Shutdown()

View File

@ -11,8 +11,6 @@ CSkidmark CSkidmarks::aSkidmarks[NUMSKIDMARKS];
RwImVertexIndex SkidmarkIndexList[SKIDMARK_LENGTH * 6]; RwImVertexIndex SkidmarkIndexList[SKIDMARK_LENGTH * 6];
RwIm3DVertex SkidmarkVertices[SKIDMARK_LENGTH * 2]; RwIm3DVertex SkidmarkVertices[SKIDMARK_LENGTH * 2];
RwTexture *gpSkidTex; RwTexture *gpSkidTex;
RwTexture *gpSkidBloodTex;
RwTexture *gpSkidMudTex;
void void
CSkidmarks::Init(void) CSkidmarks::Init(void)
@ -22,8 +20,6 @@ CSkidmarks::Init(void)
slot = CTxdStore::FindTxdSlot("particle"); slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::SetCurrentTxd(slot); CTxdStore::SetCurrentTxd(slot);
gpSkidTex = RwTextureRead("particleskid", nil); gpSkidTex = RwTextureRead("particleskid", nil);
gpSkidBloodTex = RwTextureRead("particleskidblood", nil);
gpSkidMudTex = RwTextureRead("particleskidmud", nil);
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
for(i = 0; i < NUMSKIDMARKS; i++){ for(i = 0; i < NUMSKIDMARKS; i++){
@ -54,17 +50,7 @@ void
CSkidmarks::Shutdown(void) CSkidmarks::Shutdown(void)
{ {
RwTextureDestroy(gpSkidTex); RwTextureDestroy(gpSkidTex);
#ifdef GTA3_1_1_PATCH
gpSkidTex = nil; gpSkidTex = nil;
#endif
RwTextureDestroy(gpSkidBloodTex);
#ifdef GTA3_1_1_PATCH
gpSkidBloodTex = nil;
#endif
RwTextureDestroy(gpSkidMudTex);
#ifdef GTA3_1_1_PATCH
gpSkidMudTex = nil;
#endif
} }
void void
@ -116,33 +102,23 @@ void
CSkidmarks::Render(void) CSkidmarks::Render(void)
{ {
int i, j; int i, j;
RwTexture *lastTex = nil;
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSkidTex));
for(i = 0; i < NUMSKIDMARKS; i++){ for(i = 0; i < NUMSKIDMARKS; i++){
if(aSkidmarks[i].m_state == 0 || aSkidmarks[i].m_last < 1) if(aSkidmarks[i].m_state == 0 || aSkidmarks[i].m_last < 1)
continue; continue;
if(aSkidmarks[i].m_isBloody){ CRGBA color(0, 0, 0, 255);
if(lastTex != gpSkidBloodTex){ // TODO(MIAMI): we have a type field here actually (0-3)
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSkidBloodTex)); if(aSkidmarks[i].m_isBloody) // TODO: type 3
lastTex = gpSkidBloodTex; color = CRGBA(132, 34, 11, 255);
} else if(aSkidmarks[i].m_isMuddy) // TODO: type 1
}else if(aSkidmarks[i].m_isMuddy){ color = CRGBA(90, 62, 9, 255);
if(lastTex != gpSkidMudTex){
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSkidMudTex));
lastTex = gpSkidMudTex;
}
}else{
if(lastTex != gpSkidTex){
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSkidTex));
lastTex = gpSkidTex;
}
}
uint32 fade, alpha; uint32 fade, alpha;
if(aSkidmarks[i].m_state == 1 || CTimer::GetTimeInMilliseconds() < aSkidmarks[i].m_fadeStart) if(aSkidmarks[i].m_state == 1 || CTimer::GetTimeInMilliseconds() < aSkidmarks[i].m_fadeStart)
@ -158,9 +134,9 @@ CSkidmarks::Render(void)
CVector p1 = aSkidmarks[i].m_pos[j] + aSkidmarks[i].m_side[j]; CVector p1 = aSkidmarks[i].m_pos[j] + aSkidmarks[i].m_side[j];
CVector p2 = aSkidmarks[i].m_pos[j] - aSkidmarks[i].m_side[j]; CVector p2 = aSkidmarks[i].m_pos[j] - aSkidmarks[i].m_side[j];
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+0], 255, 255, 255, alpha); RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+0], color.red, color.green, color.blue, alpha);
RwIm3DVertexSetPos(&SkidmarkVertices[j*2+0], p1.x, p1.y, p1.z+0.1f); RwIm3DVertexSetPos(&SkidmarkVertices[j*2+0], p1.x, p1.y, p1.z+0.1f);
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+1], 255, 255, 255, alpha); RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+1], color.red, color.green, color.blue, alpha);
RwIm3DVertexSetPos(&SkidmarkVertices[j*2+1], p2.x, p2.y, p2.z+0.1f); RwIm3DVertexSetPos(&SkidmarkVertices[j*2+1], p2.x, p2.y, p2.z+0.1f);
} }

View File

@ -173,6 +173,11 @@ public:
static int GetFogBlue(void) { return m_nCurrentFogColourBlue; } static int GetFogBlue(void) { return m_nCurrentFogColourBlue; }
static int GetFogReduction(void) { return m_FogReduction; } static int GetFogReduction(void) { return m_FogReduction; }
static int GetWaterRed(void) { return m_fCurrentWaterRed; }
static int GetWaterGreen(void) { return m_fCurrentWaterGreen; }
static int GetWaterBlue(void) { return m_fCurrentWaterBlue; }
static int GetWaterAlpha(void) { return m_fCurrentWaterAlpha; }
static void Initialise(void); static void Initialise(void);
static void Update(void); static void Update(void);
static CVector &GetSunPosition(void) { return m_VectorToSun[m_CurrentStoredValue]; } static CVector &GetSunPosition(void) { return m_VectorToSun[m_CurrentStoredValue]; }

View File

@ -36,9 +36,6 @@ RpAtomic *CWaterLevel::ms_pWavyAtomic;
RpGeometry *CWaterLevel::apGeomArray[8]; RpGeometry *CWaterLevel::apGeomArray[8];
int16 CWaterLevel::nGeomUsed; int16 CWaterLevel::nGeomUsed;
//RwTexture *gpWaterTex;
//RwRaster *gpWaterRaster;
RwTexture *gpWaterTex; RwTexture *gpWaterTex;
RwRaster *gpWaterRaster; RwRaster *gpWaterRaster;
@ -84,7 +81,7 @@ CWaterLevel::Initialise(char *pWaterDat)
CTxdStore::SetCurrentTxd(slot); CTxdStore::SetCurrentTxd(slot);
if ( gpWaterTex == NULL ) if ( gpWaterTex == NULL )
gpWaterTex = RwTextureRead("water_old", NULL); gpWaterTex = RwTextureRead("waterclear256", NULL);
gpWaterRaster = RwTextureGetRaster(gpWaterTex); gpWaterRaster = RwTextureGetRaster(gpWaterTex);
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
@ -365,9 +362,9 @@ CWaterLevel::RenderWater()
RwRGBA color = { 0, 0, 0, 255 }; RwRGBA color = { 0, 0, 0, 255 };
color.red = uint32((CTimeCycle::GetDirectionalRed() * 0.5f + CTimeCycle::GetAmbientRed() ) * 255.0f); color.red = CTimeCycle::GetWaterRed();
color.green = uint32((CTimeCycle::GetDirectionalGreen() * 0.5f + CTimeCycle::GetAmbientGreen()) * 255.0f); color.green = CTimeCycle::GetWaterGreen();
color.blue = uint32((CTimeCycle::GetDirectionalBlue() * 0.5f + CTimeCycle::GetAmbientBlue() ) * 255.0f); color.blue = CTimeCycle::GetWaterBlue();
TempBufferVerticesStored = 0; TempBufferVerticesStored = 0;
TempBufferIndicesStored = 0; TempBufferIndicesStored = 0;

View File

@ -1884,13 +1884,11 @@ WinMain(HINSTANCE instance,
StaticPatcher::Apply(); StaticPatcher::Apply();
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE);
/*
// TODO: make this an option somewhere // TODO: make this an option somewhere
AllocConsole(); AllocConsole();
freopen("CONIN$", "r", stdin); freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr); freopen("CONOUT$", "w", stderr);
*/
/* /*
* Initialize the platform independent data. * Initialize the platform independent data.

View File

@ -195,7 +195,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
CMatrix mat2(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LF])); CMatrix mat2(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LF]));
mat1.GetPosition() += CVector(mat2.GetPosition().x + 0.1f, 0.0f, mat2.GetPosition().z); mat1.GetPosition() += CVector(mat2.GetPosition().x + 0.1f, 0.0f, mat2.GetPosition().z);
mat1.UpdateRW(); mat1.UpdateRW();
}else if(GetModelIndex() == MI_MIAMI_SPARROW || GetModelIndex() == MI_MIAMI_RCRAIDER){ }else if(GetModelIndex() == MI_SPARROW || GetModelIndex() == MI_RCRAIDER){
RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LF]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LF]), 0);
RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_RF]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_RF]), 0);
RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LB]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LB]), 0);
@ -490,8 +490,7 @@ CAutomobile::ProcessControl(void)
TankControl(); TankControl();
BlowUpCarsInPath(); BlowUpCarsInPath();
break; break;
case MI_YARDIE: case MI_VOODOO:
// beta also had esperanto here it seems
HydraulicControl(); HydraulicControl();
break; break;
default: default:
@ -673,9 +672,9 @@ CAutomobile::ProcessControl(void)
acceleration /= m_fForceMultiplier; acceleration /= m_fForceMultiplier;
// unused // unused
if(GetModelIndex() == MI_MIAMI_RCBARON || if(GetModelIndex() == MI_RCBARON ||
GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_RCRAIDER ||
GetModelIndex() == MI_MIAMI_SPARROW) GetModelIndex() == MI_SPARROW)
acceleration = 0.0f; acceleration = 0.0f;
brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep(); brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep();
@ -1001,7 +1000,7 @@ CAutomobile::ProcessControl(void)
m_bSirenOrAlarm = !m_bSirenOrAlarm; m_bSirenOrAlarm = !m_bSirenOrAlarm;
}else }else
m_nCarHornTimer = 0; m_nCarHornTimer = 0;
}else if(GetModelIndex() != MI_YARDIE && !CVehicle::bCheat3){ }else if(GetModelIndex() != MI_VOODOO && !CVehicle::bCheat3){
if(Pads[0].GetHorn()) if(Pads[0].GetHorn())
m_nCarHornTimer = 1; m_nCarHornTimer = 1;
else else
@ -1012,7 +1011,7 @@ CAutomobile::ProcessControl(void)
// Flying // Flying
if(GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PHYSICS){ if(GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PHYSICS){
if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW) if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_SPARROW)
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f); m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f);
}else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) && }else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){ m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
@ -1022,9 +1021,9 @@ CAutomobile::ProcessControl(void)
else else
#endif #endif
FlyingControl(FLIGHT_MODEL_DODO); FlyingControl(FLIGHT_MODEL_DODO);
}else if(GetModelIndex() == MI_MIAMI_RCBARON){ }else if(GetModelIndex() == MI_RCBARON){
FlyingControl(FLIGHT_MODEL_RCPLANE); FlyingControl(FLIGHT_MODEL_RCPLANE);
}else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){ }else if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_SPARROW || bAllCarCheat){
#ifdef ALLCARSHELI_CHEAT #ifdef ALLCARSHELI_CHEAT
if (bAllCarCheat) if (bAllCarCheat)
FlyingControl(FLIGHT_MODEL_HELI); FlyingControl(FLIGHT_MODEL_HELI);
@ -1591,7 +1590,8 @@ CAutomobile::PreRender(void)
case MI_TAXI: case MI_TAXI:
case MI_CABBIE: case MI_CABBIE:
case MI_BORGNINE: case MI_ZEBRA:
case MI_KAUFMAN:
if(bTaxiLight){ if(bTaxiLight){
CVector pos = GetPosition() + GetUp()*0.95f; CVector pos = GetPosition() + GetUp()*0.95f;
CCoronas::RegisterCorona((uintptr)this + 21, CCoronas::RegisterCorona((uintptr)this + 21,

View File

@ -287,8 +287,8 @@ CBoat::ProcessControl(void)
AddWakePoint(GetPosition()); AddWakePoint(GetPosition());
float steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward()); float steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward());
if (GetModelIndex() == MI_GHOST) // if (GetModelIndex() == MI_GHOST)
steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f; // steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f;
if(steerFactor < 0.0f) steerFactor = 0.0f; if(steerFactor < 0.0f) steerFactor = 0.0f;
CVector propeller(0.0f, -pHandling->Dimension.y*m_fPropellerY, -pHandling->Dimension.z*m_fPropellerZ); CVector propeller(0.0f, -pHandling->Dimension.y*m_fPropellerY, -pHandling->Dimension.z*m_fPropellerZ);

View File

@ -21,7 +21,6 @@ const char VehicleNames[NUMHANDLINGS][14] = {
"STRETCH", "STRETCH",
"MANANA", "MANANA",
"INFERNUS", "INFERNUS",
"BLISTA",
"PONY", "PONY",
"MULE", "MULE",
"CHEETAH", "CHEETAH",
@ -38,7 +37,6 @@ const char VehicleNames[NUMHANDLINGS][14] = {
"ENFORCER", "ENFORCER",
"SECURICA", "SECURICA",
"BANSHEE", "BANSHEE",
"PREDATOR",
"BUS", "BUS",
"RHINO", "RHINO",
"BARRACKS", "BARRACKS",
@ -50,22 +48,73 @@ const char VehicleNames[NUMHANDLINGS][14] = {
"STALLION", "STALLION",
"RUMPO", "RUMPO",
"RCBANDIT", "RCBANDIT",
"BELLYUP",
"MRWONGS",
"MAFIA", "MAFIA",
"YARDIE",
"YAKUZA",
"DIABLOS",
"COLUMB",
"HOODS",
"AIRTRAIN", "AIRTRAIN",
"DEADDODO", "DEADDODO",
"SPEEDER",
"REEFER",
"PANLANT",
"FLATBED", "FLATBED",
"YANKEE", "YANKEE",
"BORGNINE" "GOLFCART",
"VOODOO",
"WASHING",
"CUBAN",
"ROMERO",
"PACKER",
"ADMIRAL",
"GANGBUR",
"ZEBRA",
"TOPFUN",
"GLENDALE",
"OCEANIC",
"HERMES",
"SABRE1",
"SABRETUR",
"PHEONIX",
"WALTON",
"REGINA",
"COMET",
"DELUXO",
"BURRITO",
"SPAND",
"BAGGAGE",
"KAUFMAN",
"RANCHER",
"FBIRANCH",
"VIRGO",
"GREENWOO",
"HOTRING",
"SANDKING",
"BLISTAC",
"BOXVILLE",
"BENSON",
"DESPERAD",
"LOVEFIST",
"BLOODRA",
"BLOODRB",
"BIKE",
"MOPED",
"DIRTBIKE",
"ANGEL",
"FREEWAY",
"PREDATOR",
"SPEEDER",
"REEFER",
"RIO",
"SQUALO",
"TROPIC",
"COASTGRD",
"DINGHY",
"MARQUIS",
"CUPBOAT",
"SEAPLANE",
"SPARROW",
"SEASPAR",
"MAVERICK",
"COASTMAV",
"POLMAV",
"HUNTER",
"RCBARON",
"RCGOBLIN",
"RCCOPTER"
}; };
cHandlingDataMgr::cHandlingDataMgr(void) cHandlingDataMgr::cHandlingDataMgr(void)
@ -117,7 +166,9 @@ cHandlingDataMgr::LoadHandlingData(void)
// yeah, this is kinda crappy // yeah, this is kinda crappy
if(strncmp(line, ";the end", 9) == 0) if(strncmp(line, ";the end", 9) == 0)
keepGoing = 0; keepGoing = 0;
else if(line[0] != ';'){ // else if(line[0] != ';'){
// TODO(MIAMI): read boat, bike, flying values
else if(line[0] != ';' && line[0] != '%' && line[0] != '!' && line[0] != '$'){
field = 0; field = 0;
strcpy(delim, " \t"); strcpy(delim, " \t");
// FIX: game seems to use a do-while loop here // FIX: game seems to use a do-while loop here
@ -158,11 +209,14 @@ cHandlingDataMgr::LoadHandlingData(void)
case 27: handling->fSuspensionLowerLimit = strtod(word, nil); break; case 27: handling->fSuspensionLowerLimit = strtod(word, nil); break;
case 28: handling->fSuspensionBias = strtod(word, nil); break; case 28: handling->fSuspensionBias = strtod(word, nil); break;
case 29: case 29:
// TODO(MIAMI): suspension anti-dive multiplier
break;
case 30:
sscanf(word, "%x", &handling->Flags); sscanf(word, "%x", &handling->Flags);
handling->Transmission.Flags = handling->Flags; handling->Transmission.Flags = handling->Flags;
break; break;
case 30: handling->FrontLights = atoi(word); break; case 31: handling->FrontLights = atoi(word); break;
case 31: handling->RearLights = atoi(word); break; case 32: handling->RearLights = atoi(word); break;
} }
field++; field++;
} }

View File

@ -139,5 +139,4 @@ public:
bool HasRearWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'R'; } bool HasRearWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'R'; }
bool HasFrontWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'F'; } bool HasFrontWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'F'; }
}; };
VALIDATE_SIZE(cHandlingDataMgr, 0x3030);
extern cHandlingDataMgr mod_HandlingManager; extern cHandlingDataMgr mod_HandlingManager;

View File

@ -776,7 +776,6 @@ CHeli::InitHelis(void)
for(i = 0; i < NUM_HELIS; i++) for(i = 0; i < NUM_HELIS; i++)
pHelis[i] = nil; pHelis[i] = nil;
((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_ESCAPE))->SetColModel(&CTempColModels::ms_colModelPed1);
((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_CHOPPER))->SetColModel(&CTempColModels::ms_colModelPed1); ((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_CHOPPER))->SetColModel(&CTempColModels::ms_colModelPed1);
} }
@ -787,10 +786,7 @@ GenerateHeli(bool catalina)
CVector heliPos; CVector heliPos;
int i; int i;
if(catalina) heli = new CHeli(MI_CHOPPER, PERMANENT_VEHICLE);
heli = new CHeli(MI_ESCAPE, PERMANENT_VEHICLE);
else
heli = new CHeli(MI_CHOPPER, PERMANENT_VEHICLE);
if(catalina) if(catalina)
heliPos = CVector(-224.0f, 201.0f, 83.0f); heliPos = CVector(-224.0f, 201.0f, 83.0f);
@ -867,18 +863,6 @@ CHeli::UpdateHelis(void)
pHelis[HELI_SCRIPT]->m_heliStatus = HELI_STATUS_FLY_AWAY; pHelis[HELI_SCRIPT]->m_heliStatus = HELI_STATUS_FLY_AWAY;
} }
// Handle Catalina's heli
if(CatalinaHeliOn){
if(CStreaming::HasModelLoaded(MI_ESCAPE) && pHelis[HELI_CATALINA] == nil){
pHelis[HELI_CATALINA] = GenerateHeli(true);
pHelis[HELI_CATALINA]->m_heliType = HELI_TYPE_CATALINA;
}else
CStreaming::RequestModel(MI_ESCAPE, STREAMFLAGS_DONT_REMOVE);
}else{
if(pHelis[HELI_CATALINA])
pHelis[HELI_CATALINA]->m_heliStatus = HELI_STATUS_FLY_AWAY;
}
// Delete helis that we no longer need // Delete helis that we no longer need
for(i = 0; i < NUM_HELIS; i++) for(i = 0; i < NUM_HELIS; i++)
if(pHelis[i] && pHelis[i]->m_heliStatus == HELI_STATUS_FLY_AWAY && pHelis[i]->GetPosition().z > 150.0f){ if(pHelis[i] && pHelis[i]->m_heliStatus == HELI_STATUS_FLY_AWAY && pHelis[i]->GetPosition().z > 150.0f){

View File

@ -385,7 +385,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
case FLIGHT_MODEL_HELI: case FLIGHT_MODEL_HELI:
{ {
CVector vecMoveResistance; CVector vecMoveResistance;
if (GetModelIndex() == MI_MIAMI_SPARROW) if (GetModelIndex() == MI_SPARROW)
vecMoveResistance = vecHeliMoveRes; vecMoveResistance = vecHeliMoveRes;
else else
vecMoveResistance = vecRCHeliMoveRes; vecMoveResistance = vecRCHeliMoveRes;
@ -436,7 +436,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
CVector vecResistance; CVector vecResistance;
if (GetModelIndex() == MI_MIAMI_SPARROW) if (GetModelIndex() == MI_SPARROW)
vecResistance = vecHeliResistance; vecResistance = vecHeliResistance;
else else
vecResistance = vecRCHeliResistance; vecResistance = vecRCHeliResistance;
@ -875,24 +875,7 @@ CVehicle::IsVehicleNormal(void)
{ {
if (!pDriver || m_nNumPassengers != 0 || GetStatus() == STATUS_WRECKED) if (!pDriver || m_nNumPassengers != 0 || GetStatus() == STATUS_WRECKED)
return false; return false;
switch (GetModelIndex()){ return GetModelInfo()->m_vehicleClass != -1;
case MI_FIRETRUCK:
case MI_AMBULAN:
case MI_TAXI:
case MI_POLICE:
case MI_ENFORCER:
case MI_BUS:
case MI_RHINO:
case MI_BARRACKS:
case MI_DODO:
case MI_COACH:
case MI_CABBIE:
case MI_RCBANDIT:
case MI_BORGNINE:
return false;
default:
return true;
}
} }
bool bool
@ -1091,7 +1074,7 @@ CVehicle::SetDriver(CPed *driver)
driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5); driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5);
else if(GetModelIndex() == MI_ENFORCER) else if(GetModelIndex() == MI_ENFORCER)
driver->m_fArmour = Max(driver->m_fArmour, 100.0f); driver->m_fArmour = Max(driver->m_fArmour, 100.0f);
else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE) else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA) // TODO(MIAMI): check zebra
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25; CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
bFreebies = false; bFreebies = false;
} }

View File

@ -290,7 +290,7 @@ public:
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; } bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; } bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; }
AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); } AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); }
static bool bWheelsOnlyCheat; static bool bWheelsOnlyCheat;