From 876e402d1ecc07884f8562b8b1fbc3343fa4b677 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 7 May 2020 09:38:07 +0200 Subject: [PATCH 1/9] dont hardcode first vehicle ID; little fix for roadblocks --- src/audio/AudioManager.cpp | 2 +- src/control/RoadBlocks.cpp | 10 +++++----- src/modelinfo/ModelIndices.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index ec520eaa..a417e077 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -7989,7 +7989,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh) if (handling) 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) velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f; else diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 1c0d9f96..572f8134 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -79,8 +79,8 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType if (copType == COP_STREET) pCopPed->SetCurrentWeapon(WEAPONTYPE_COLT45); CPedPlacement::FindZCoorForPed(&posForZ); - pCopPed->m_matrix.GetPosition() = posForZ; - CVector vecSavedPos = pCopPed->m_matrix.GetPosition(); + pCopPed->SetPosition(posForZ); + CVector vecSavedPos = pCopPed->GetPosition(); pCopPed->m_matrix.SetRotate(0.0f, 0.0f, -HALFPI); pCopPed->m_matrix.GetPosition() += vecSavedPos; pCopPed->m_bIsDisabledCop = true; @@ -133,8 +133,8 @@ CRoadBlocks::GenerateRoadBlocks(void) float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f; int16 radius = (int16)(fMapObjectRadius / fModelRadius); if (radius > 0 && radius < 6) { - CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->m_matrix.GetPosition(); - float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->m_matrix.GetUp()); + CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition(); + float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward()); float fOffset = 0.5f * fModelRadius * (float)(radius - 1); for (int16 i = 0; i < radius; i++) { uint8 nRoadblockType = fDotProduct < 0.0f; @@ -174,7 +174,7 @@ CRoadBlocks::GenerateRoadBlocks(void) pVehicle->bExtendedRange = true; if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1) pVehicle->m_bSirenOrAlarm = true; - if (pVehicle->m_matrix.GetForward().z > 0.94f) { + if (pVehicle->GetForward().z > 0.94f) { CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0); CWorld::Add(pVehicle); pVehicle->bCreateRoadBlockPeds = true; diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 8e117882..cc6ed25c 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -255,7 +255,8 @@ enum MI_BUSKER4, // three more peds possible - MI_LANDSTAL = 90, + MI_FIRST_VEHICLE = 90, + MI_LANDSTAL = MI_FIRST_VEHICLE, MI_IDAHO, MI_STINGER, MI_LINERUN, From 05a1d64fbbe374dabb6572bb47d9a745464633bb Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 7 May 2020 11:33:20 +0200 Subject: [PATCH 2/9] VC vehicles just barely working now --- src/audio/AudioManager.cpp | 142 ++++++++++++++++++++++++------- src/audio/MusicManager.cpp | 3 +- src/audio/PoliceRadio.cpp | 64 +++++++------- src/control/CarCtrl.cpp | 34 ++++++-- src/control/CarCtrl.h | 11 ++- src/control/Garages.cpp | 11 +-- src/control/Replay.cpp | 3 +- src/control/Script.cpp | 39 +++++---- src/core/Cam.cpp | 2 +- src/core/FileLoader.cpp | 59 ++++++++----- src/core/PlayerInfo.cpp | 2 +- src/core/Streaming.cpp | 9 +- src/core/config.h | 2 +- src/core/re3.cpp | 30 ++++--- src/entities/Physical.cpp | 3 +- src/modelinfo/ModelIndices.h | 97 +++++++++++++++------ src/modelinfo/VehicleModelInfo.h | 11 --- src/peds/Gangs.cpp | 14 +-- src/peds/Ped.cpp | 4 +- src/peds/Population.cpp | 3 +- src/skel/win/win.cpp | 2 - src/vehicles/Automobile.cpp | 22 ++--- src/vehicles/Boat.cpp | 4 +- src/vehicles/HandlingMgr.cpp | 86 +++++++++++++++---- src/vehicles/HandlingMgr.h | 1 - src/vehicles/Heli.cpp | 18 +--- src/vehicles/Vehicle.cpp | 25 +----- src/vehicles/Vehicle.h | 2 +- 28 files changed, 444 insertions(+), 259 deletions(-) diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index ec520eaa..32cc5fae 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -100,13 +100,13 @@ enum eVehicleModel { LINERUN, PEREN, SENTINEL, - PATRIOT, + RIO, FIRETRUK, TRASH, STRETCH, MANANA, INFERNUS, - BLISTA, + VOODOO, PONY, MULE, CHEETAH, @@ -115,11 +115,11 @@ enum eVehicleModel { MOONBEAM, ESPERANT, TAXI, - KURUMA, + WASHING, BOBCAT, MRWHOOP, BFINJECT, - CORPSE, + HUNTER, POLICE, ENFORCER, SECURICA, @@ -128,42 +128,83 @@ enum eVehicleModel { BUS, RHINO, BARRACKS, - TRAIN, + CUBAN, CHOPPER, - DODO, + ANGEL, COACH, CABBIE, STALLION, RUMPO, RCBANDIT, - BELLYUP, - MRWONGS, - MAFIA, - YARDIE, - YAKUZA, - DIABLOS, - COLUMB, - HOODS, + ROMERO, + PACKER, + SENTXS, + ADMIRAL, + SQUALO, + SEASPAR, + PIZZABOY, + GANGBUR, AIRTRAIN, DEADDODO, SPEEDER, REEFER, - PANLANT, + TROPIC, FLATBED, YANKEE, - ESCAPE, - BORGNINE, - TOYZ, - GHOST, - CAR151, - CAR152, - CAR153, - CAR154, - CAR155, - CAR156, - CAR157, - CAR158, - CAR159, + 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, + +// 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 }; @@ -7103,7 +7144,8 @@ struct tVehicleSampleData { 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_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}, @@ -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}}; void @@ -7989,7 +8071,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh) if (handling) 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) velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f; else diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index fd02691e..841573a9 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -66,7 +66,8 @@ cMusicManager::PlayerInCar() case MI_TRAIN: case MI_SPEEDER: case MI_REEFER: - case MI_GHOST: return false; +// case MI_GHOST: + return false; default: return true; } } diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index f7c27515..abacb425 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -541,39 +541,41 @@ cAudioManager::SetupSuspectLastSeenReport() color_pre_modifier = gCarColourTable[color1][0]; color_post_modifier = gCarColourTable[color1][2]; switch (veh->GetModelIndex()) { +// TODO(MIAMI): just making this compile #ifdef FIX_BUGS - case MI_COLUMB: - main_color = SFX_POLICE_RADIO_BLUE; - color_pre_modifier = color_post_modifier = TOTAL_AUDIO_SAMPLES; + // case MI_COLUMB: + // main_color = SFX_POLICE_RADIO_BLUE; + // color_pre_modifier = color_post_modifier = TOTAL_AUDIO_SAMPLES; #endif case MI_LANDSTAL: - case MI_BLISTA: sample = SFX_POLICE_RADIO_CRUISER; break; + // case MI_BLISTA: + sample = SFX_POLICE_RADIO_CRUISER; break; #ifdef FIX_BUGS - case MI_YARDIE: - color_pre_modifier = TOTAL_AUDIO_SAMPLES; - main_color = SFX_POLICE_RADIO_RED; - color_post_modifier = SFX_POLICE_RADIO_YELLOW; - sample = SFX_POLICE_RADIO_CONVERTIBLE; break; - case MI_DIABLOS: - main_color = SFX_POLICE_RADIO_BLACK; + // case MI_YARDIE: + // color_pre_modifier = TOTAL_AUDIO_SAMPLES; + // main_color = SFX_POLICE_RADIO_RED; + // color_post_modifier = SFX_POLICE_RADIO_YELLOW; + // sample = SFX_POLICE_RADIO_CONVERTIBLE; break; + // case MI_DIABLOS: + // main_color = SFX_POLICE_RADIO_BLACK; #endif case MI_IDAHO: case MI_STALLION: sample = SFX_POLICE_RADIO_CONVERTIBLE; break; #ifdef FIX_BUGS - case MI_YAKUZA: - color_pre_modifier = TOTAL_AUDIO_SAMPLES; - main_color = SFX_POLICE_RADIO_SILVER; - color_post_modifier = SFX_POLICE_RADIO_RED; + // case MI_YAKUZA: + // color_pre_modifier = TOTAL_AUDIO_SAMPLES; + // main_color = SFX_POLICE_RADIO_SILVER; + // color_post_modifier = SFX_POLICE_RADIO_RED; #endif case MI_STINGER: case MI_INFERNUS: case MI_CHEETAH: case MI_BANSHEE: sample = SFX_POLICE_RADIO_SPORTS_CAR; break; #ifdef FIX_BUGS - case MI_MAFIA: - color_pre_modifier = color_post_modifier = TOTAL_AUDIO_SAMPLES; - main_color = SFX_POLICE_RADIO_GREY; - case MI_KURUMA: + // case MI_MAFIA: + // color_pre_modifier = color_post_modifier = TOTAL_AUDIO_SAMPLES; + // main_color = SFX_POLICE_RADIO_GREY; + case MI_WASHING: #endif case MI_PEREN: case MI_SENTINEL: @@ -588,21 +590,18 @@ cAudioManager::SetupSuspectLastSeenReport() case MI_TRASH: case MI_BARRACKS: sample = SFX_POLICE_RADIO_TRUCK; break; case MI_STRETCH: sample = SFX_POLICE_RADIO_LIMO; break; -#ifdef FIX_BUGS - case MI_CORPSE: -#endif case MI_MANANA: case MI_ESPERANT: sample = SFX_POLICE_RADIO_2_DOOR; break; #ifdef FIX_BUGS - case MI_HOODS: - color_pre_modifier = TOTAL_AUDIO_SAMPLES; - main_color = SFX_POLICE_RADIO_BLUE; - color_post_modifier = SFX_POLICE_RADIO_GREEN; - case MI_BELLYUP: + // case MI_HOODS: + // color_pre_modifier = TOTAL_AUDIO_SAMPLES; + // main_color = SFX_POLICE_RADIO_BLUE; + // color_post_modifier = SFX_POLICE_RADIO_GREEN; + // case MI_BELLYUP: case MI_YANKEE: - case MI_TOYZ: - case MI_MRWONGS: - case MI_PANLANT: + case MI_TOPFUN: + // case MI_MRWONGS: + // case MI_PANLANT: #endif case MI_PONY: case MI_MULE: @@ -613,7 +612,8 @@ cAudioManager::SetupSuspectLastSeenReport() case MI_AMBULAN: sample = SFX_POLICE_RADIO_AMBULANCE; break; case MI_TAXI: 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: sample = SFX_POLICE_RADIO_ICE_CREAM_VAN; break; @@ -622,7 +622,7 @@ cAudioManager::SetupSuspectLastSeenReport() #ifdef FIX_BUGS case MI_SPEEDER: case MI_REEFER: - case MI_GHOST: + // case MI_GHOST: #endif case MI_PREDATOR: sample = SFX_POLICE_RADIO_BOAT; break; case MI_BUS: diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index a4769d56..702bd411 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -302,9 +302,14 @@ CCarCtrl::GenerateOneRandomCar() case RICH: case EXEC: case WORKER: - case SPECIAL: case BIG: case TAXI: + // TODO(MIAMI): check this + case MOPED: + case MOTORBIKE: + case LEISUREBOAT: + case WORKERBOAT: + // case MAFIA: case TRIAD: case DIABLO: @@ -318,7 +323,7 @@ CCarCtrl::GenerateOneRandomCar() pCar->AutoPilot.m_nCruiseSpeed = CGeneral::GetRandomNumberInRange(9, 14); if (carClass == EXEC) pCar->AutoPilot.m_nCruiseSpeed = CGeneral::GetRandomNumberInRange(12, 18); - else if (carClass == POOR || carClass == SPECIAL) + else if (carClass == POOR) pCar->AutoPilot.m_nCruiseSpeed = CGeneral::GetRandomNumberInRange(7, 10); CVehicleModelInfo* pVehicleInfo = pCar->GetModelInfo(); if (pVehicleInfo->GetColModel()->boundingBox.max.y - pCar->GetModelInfo()->GetColModel()->boundingBox.min.y > 10.0f || carClass == BIG) { @@ -475,7 +480,12 @@ CCarCtrl::GenerateOneRandomCar() case RICH: case EXEC: case WORKER: - case SPECIAL: + // TODO(MIAMI): check this + case MOPED: + case MOTORBIKE: + case LEISUREBOAT: + case WORKERBOAT: + // case BIG: case TAXI: case MAFIA: @@ -550,16 +560,17 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) { int32 model = -1; while (model == -1 || !CStreaming::HasModelLoaded(model)){ int rnd = CGeneral::GetRandomNumberInRange(0, 1000); + // TODO(MIAMI): new car classes if (rnd < pZone->carThreshold[0]) - model = CCarCtrl::ChooseCarModel((*pClass = POOR)); + model = CCarCtrl::ChooseCarModel((*pClass = NORMAL)); else if (rnd < pZone->carThreshold[1]) - model = CCarCtrl::ChooseCarModel((*pClass = RICH)); + model = CCarCtrl::ChooseCarModel((*pClass = POOR)); else if (rnd < pZone->carThreshold[2]) - model = CCarCtrl::ChooseCarModel((*pClass = EXEC)); + model = CCarCtrl::ChooseCarModel((*pClass = RICH)); else if (rnd < pZone->carThreshold[3]) - model = CCarCtrl::ChooseCarModel((*pClass = WORKER)); + model = CCarCtrl::ChooseCarModel((*pClass = EXEC)); else if (rnd < pZone->carThreshold[4]) - model = CCarCtrl::ChooseCarModel((*pClass = SPECIAL)); + model = CCarCtrl::ChooseCarModel((*pClass = WORKER)); else if (rnd < pZone->carThreshold[5]) model = CCarCtrl::ChooseCarModel((*pClass = BIG)); else if (rnd < pZone->copThreshold) @@ -597,7 +608,12 @@ CCarCtrl::ChooseCarModel(int32 vehclass) case RICH: case EXEC: case WORKER: - case SPECIAL: + // TODO(MIAMI): check this + case MOPED: + case MOTORBIKE: + case LEISUREBOAT: + case WORKERBOAT: + // case BIG: case TAXI: { diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h index 4f92bdcf..89de0418 100644 --- a/src/control/CarCtrl.h +++ b/src/control/CarCtrl.h @@ -23,14 +23,19 @@ enum{ class CCarCtrl { +public: enum eCarClass { - POOR = 0, + NORMAL = 0, + POOR, RICH, EXEC, WORKER, - SPECIAL, BIG, TAXI, + MOPED, + MOTORBIKE, + LEISUREBOAT, + WORKERBOAT, TOTAL_CUSTOM_CLASSES, MAFIA, TRIAD, @@ -43,7 +48,7 @@ class CCarCtrl GANG9, COPS }; -public: + static void SwitchVehicleToRealPhysics(CVehicle*); static void AddToCarArray(int32 id, int32 vehclass); static void UpdateCarCount(CVehicle*, bool); diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 249b91ef..1b670dbe 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -106,8 +106,9 @@ 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 }, - { 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 }, + // TODO(MIAMI): bogus + { 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 } }; @@ -1612,8 +1613,6 @@ bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id) bool CGarage::DoesCraigNeedThisCar(int32 mi) { - if (mi == MI_CORPSE) - mi = MI_MANANA; int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) { if (mi == gaCarsToCollectInCraigsGarages[ct][i]) @@ -1624,8 +1623,6 @@ bool CGarage::DoesCraigNeedThisCar(int32 mi) bool CGarage::HasCraigCollectedThisCar(int32 mi) { - if (mi == MI_CORPSE) - mi = MI_MANANA; int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) { if (mi == gaCarsToCollectInCraigsGarages[ct][i]) @@ -1636,8 +1633,6 @@ bool CGarage::HasCraigCollectedThisCar(int32 mi) bool CGarage::MarkThisCarAsCollectedForCraig(int32 mi) { - if (mi == MI_CORPSE) - mi = MI_MANANA; int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); int index; for (index = 0; index < TOTAL_COLLECTCARS_CARS; index++) { diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 707f1d87..92cadab7 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -835,13 +835,14 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo CStreaming::RequestModel(mi, 0); } else { +// TODO(MIAMI): don't hardcode model indices if (mi == MI_DEADDODO || mi == MI_AIRTRAIN) { new_v = new(vp->index << 8) CPlane(mi, 2); } else if (mi == MI_TRAIN) { 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); } else if (CModelInfo::IsBoatModel(mi)){ diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 0c3806a3..58222317 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -5346,8 +5346,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); - int mi = pVehicle->GetModelIndex(); - UpdateCompareFlag(mi == MI_TAXI || mi == MI_CABBIE || mi == MI_BORGNINE); + UpdateCompareFlag(pVehicle->IsTaxi()); return 0; } case COMMAND_UNLOAD_SPECIAL_CHARACTER: @@ -8159,7 +8158,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_FBICAR: case MI_MRWHOOP: case MI_BFINJECT: - case MI_CORPSE: + // case MI_CORPSE: case MI_POLICE: case MI_ENFORCER: case MI_SECURICA: @@ -8172,27 +8171,27 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_DODO: case MI_COACH: case MI_RCBANDIT: - case MI_BELLYUP: - case MI_MRWONGS: - case MI_MAFIA: - case MI_YARDIE: - case MI_YAKUZA: - case MI_DIABLOS: - case MI_COLUMB: - case MI_HOODS: + // case MI_BELLYUP: + // case MI_MRWONGS: + // case MI_MAFIA: + case MI_VOODOO: + // case MI_YAKUZA: + // case MI_DIABLOS: + // case MI_COLUMB: + // case MI_HOODS: case MI_AIRTRAIN: case MI_DEADDODO: case MI_SPEEDER: case MI_REEFER: - case MI_PANLANT: + // case MI_PANLANT: case MI_FLATBED: case MI_YANKEE: - case MI_ESCAPE: - case MI_BORGNINE: - case MI_TOYZ: - case MI_GHOST: - case MI_MIAMI_RCBARON: - case MI_MIAMI_RCRAIDER: + // case MI_ESCAPE: + case MI_ZEBRA: + case MI_TOPFUN: + // case MI_GHOST: + case MI_RCBARON: + case MI_RCRAIDER: model = -1; break; case MI_IDAHO: @@ -8202,13 +8201,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_PATRIOT: case MI_MANANA: case MI_INFERNUS: - case MI_BLISTA: + // case MI_BLISTA: case MI_PONY: case MI_CHEETAH: case MI_MOONBEAM: case MI_ESPERANT: case MI_TAXI: - case MI_KURUMA: + case MI_WASHING: case MI_BOBCAT: case MI_BANSHEE: case MI_CABBIE: diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index e33e6bb0..2a147350 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4907,7 +4907,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, bool correctAlpha = true; // 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; } else { diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 21fd8a70..f886561c 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -781,21 +781,22 @@ CFileLoader::LoadVehicleObject(const char *line) { int id; 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; int32 level, misc; float wheelScale; CVehicleModelInfo *mi; 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, - type, handlingId, gamename, vehclass, + type, handlingId, gamename, anims, vehclass, &frequency, &level, &comprules, &misc, &wheelScale); mi = CModelInfo::AddVehicleModel(id); mi->SetName(model); mi->SetTexDictionary(txd); + // TODO(MIAMI): anims for(p = gamename; *p; p++) if(*p == '_') *p = ' '; strncpy(mi->m_gameName, gamename, 32); @@ -826,34 +827,52 @@ CFileLoader::LoadVehicleObject(const char *line) mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId); // Well this is kinda dumb.... - if(strncmp(vehclass, "poorfamily", 11) == 0){ - mi->m_vehicleClass = VEHICLE_CLASS_POOR; + if(strncmp(vehclass, "normal", 7) == 0){ + mi->m_vehicleClass = CCarCtrl::NORMAL; 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){ - mi->m_vehicleClass = VEHICLE_CLASS_RICH; + mi->m_vehicleClass = CCarCtrl::RICH; while(frequency-- > 0) - CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_RICH); + CCarCtrl::AddToCarArray(id, CCarCtrl::RICH); }else if(strncmp(vehclass, "executive", 10) == 0){ - mi->m_vehicleClass = VEHICLE_CLASS_EXECUTIVE; + mi->m_vehicleClass = CCarCtrl::EXEC; while(frequency-- > 0) - CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_EXECUTIVE); + CCarCtrl::AddToCarArray(id, CCarCtrl::EXEC); }else if(strncmp(vehclass, "worker", 7) == 0){ - mi->m_vehicleClass = VEHICLE_CLASS_WORKER; + mi->m_vehicleClass = CCarCtrl::WORKER; while(frequency-- > 0) - CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_WORKER); - }else if(strncmp(vehclass, "special", 8) == 0){ - mi->m_vehicleClass = VEHICLE_CLASS_SPECIAL; - while(frequency-- > 0) - CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_SPECIAL); + CCarCtrl::AddToCarArray(id, CCarCtrl::WORKER); }else if(strncmp(vehclass, "big", 4) == 0){ - mi->m_vehicleClass = VEHICLE_CLASS_BIG; + mi->m_vehicleClass = CCarCtrl::BIG; while(frequency-- > 0) - CCarCtrl::AddToCarArray(id, VEHICLE_CLASS_BIG); + CCarCtrl::AddToCarArray(id, CCarCtrl::BIG); }else if(strncmp(vehclass, "taxi", 5) == 0){ - mi->m_vehicleClass = VEHICLE_CLASS_TAXI; + mi->m_vehicleClass = CCarCtrl::TAXI; 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; } } diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index ec6d3023..3db42d8b 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -354,7 +354,7 @@ CPlayerInfo::Process(void) bool startTaxiTimer = true; if (m_bUnusedTaxiThing && m_pPed->bInVehicle) { 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) { for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) { timePassed -= 1000; diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 54d34848..05b0c1f9 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -1285,8 +1285,11 @@ CStreaming::StreamVehiclesAndPeds(void) else if(ms_numVehiclesLoaded <= desiredNumVehiclesLoaded){ for(i = 1; i <= 10; i++){ model = CCarCtrl::ChooseCarModel(modelQualityClass); +// TODO(MIAMI): check this +if(model < 0) + continue; modelQualityClass++; - if(modelQualityClass >= NUM_VEHICLE_CLASSES) + if(modelQualityClass >= CCarCtrl::TOTAL_CUSTOM_CLASSES) modelQualityClass = 0; // check if we want to load this model @@ -1374,6 +1377,10 @@ CStreaming::StreamZoneModels(const CVector &pos) ms_loadedGangs &= ~bit; } +// TODO(MIAMI): check this +if(CGangs::GetGangInfo(i)->m_nVehicleMI < 0) + continue; + if(gangCarsToLoad & bit && (ms_loadedGangCars & bit) == 0){ RequestModel(CGangs::GetGangInfo(i)->m_nVehicleMI, STREAMFLAGS_DONT_REMOVE); }else if((gangCarsToLoad & bit) == 0 && ms_loadedGangCars & bit){ diff --git a/src/core/config.h b/src/core/config.h index 110794b6..f4cc8b05 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -61,7 +61,7 @@ enum Config { // Cull zones NUMATTRIBZONES = 704, - NUMHANDLINGS = 57, + NUMHANDLINGS = 106, PATHNODESIZE = 4500, diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 739786b5..36cb101b 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -193,11 +193,17 @@ ResetCamStatics(void) } static const char *carnames[] = { - "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", "manana", "infernus", "blista", "pony", - "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "kuruma", "bobcat", "mrwhoop", "bfinject", "corpse", "police", "enforcer", - "securica", "banshee", "predator", "bus", "rhino", "barracks", "train", "chopper", "dodo", "coach", "cabbie", "stallion", "rumpo", "rcbandit", - "bellyup", "mrwongs", "mafia", "yardie", "yakuza", "diablos", "columb", "hoods", "airtrain", "deaddodo", "speeder", "reefer", "panlant", "flatbed", - "yankee", "escape", "borgnine", "toyz", "ghost", + "landstal", "idaho", "stinger", "linerun", "peren", "sentinel" "rio", "firetruk", "trash", "stretch", "manana", + "infernus", "voodoo", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "washing", + "bobcat", "mrwhoop", "bfinject", "hunter", "police", "enforcer", "securica", "banshee", "predator", "bus", + "rhino", "barracks", "cuban", "chopper", "angel", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "romero", + "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 TweakVarsList; @@ -292,14 +298,12 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat); 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); DebugMenuAddCmd("Spawn", "Spawn Car", [](){ - if(spawnCarId == MI_TRAIN || - spawnCarId == MI_CHOPPER || + if(spawnCarId == MI_CHOPPER || spawnCarId == MI_AIRTRAIN || - spawnCarId == MI_DEADDODO || - spawnCarId == MI_ESCAPE) + spawnCarId == MI_DEADDODO) return; SpawnCar(spawnCarId); }); @@ -311,13 +315,13 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); }); DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); }); 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 Police", [](){ SpawnCar(MI_POLICE); }); DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); }); DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); }); - DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); }); - DebugMenuAddCmd("Spawn", "Spawn Yardie", [](){ SpawnCar(MI_YARDIE); }); + DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); }); + DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); }); DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); }); DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); }); DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); }); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 987cc293..c5c34e1e 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -1528,7 +1528,8 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) if(A->GetModelIndex() == MI_RCBANDIT) 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(CSurfaceTable::GetAdhesionGroup(aColPoints[i].surfaceB) == ADHESIVE_LOOSE) adhesion *= 3.0f; diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 42c95894..938eda37 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -257,19 +257,20 @@ enum MI_BUSKER4, // three more peds possible - MI_LANDSTAL = 130, + MI_FIRST_VEHICLE = 130, + MI_LANDSTAL = MI_FIRST_VEHICLE, MI_IDAHO, MI_STINGER, MI_LINERUN, MI_PEREN, MI_SENTINEL, - MI_PATRIOT, + MI_RIO, MI_FIRETRUCK, MI_TRASH, MI_STRETCH, MI_MANANA, MI_INFERNUS, - MI_BLISTA, + MI_VOODOO, MI_PONY, MI_MULE, MI_CHEETAH, @@ -278,11 +279,11 @@ enum MI_MOONBEAM, MI_ESPERANT, MI_TAXI, - MI_KURUMA, + MI_WASHING, MI_BOBCAT, MI_MRWHOOP, MI_BFINJECT, - MI_CORPSE, + MI_HUNTER, MI_POLICE, MI_ENFORCER, MI_SECURICA, @@ -291,38 +292,82 @@ enum MI_BUS, MI_RHINO, MI_BARRACKS, - MI_TRAIN, + MI_CUBAN, MI_CHOPPER, - MI_DODO, + MI_ANGEL, MI_COACH, MI_CABBIE, MI_STALLION, MI_RUMPO, MI_RCBANDIT, - MI_BELLYUP, - MI_MRWONGS, - MI_MAFIA, - MI_YARDIE, - MI_YAKUZA, - MI_DIABLOS, - MI_COLUMB , - MI_HOODS, + MI_ROMERO, + MI_PACKER, + MI_SENTXS, + MI_ADMIRAL, + MI_SQUALO, + MI_SEASPAR, + MI_PIZZABOY, + MI_GANGBUR, MI_AIRTRAIN, MI_DEADDODO, MI_SPEEDER, MI_REEFER, - MI_PANLANT, + MI_TROPIC, MI_FLATBED, MI_YANKEE, - MI_ESCAPE, - MI_BORGNINE, - MI_TOYZ, - MI_GHOST, - - // leftovers on PC - MI_MIAMI_RCBARON = 194, - MI_MIAMI_RCRAIDER = 195, - MI_MIAMI_SPARROW = 199, + MI_CADDY, + MI_ZEBRA, + MI_TOPFUN, + MI_SKIMMER, + MI_PCJ600, + MI_FAGGIO, + MI_FREEWAY, + MI_RCBARON, + 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_AK47, @@ -393,6 +438,7 @@ IsBodyPart(int16 id) } // This is bad and should perhaps not be used +/* inline bool IsBoatModel(int16 id) { @@ -401,6 +447,7 @@ IsBoatModel(int16 id) id == MI_SPEEDER || id == MI_GHOST; } +*/ inline bool IsPedModel(int16 id) diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index 9992ab98..6946c5c1 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -35,17 +35,6 @@ enum eVehicleType { 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 { NUM_VEHICLE_POSITIONS = 10 }; diff --git a/src/peds/Gangs.cpp b/src/peds/Gangs.cpp index 8859e61e..2a075e52 100644 --- a/src/peds/Gangs.cpp +++ b/src/peds/Gangs.cpp @@ -15,13 +15,13 @@ CGangInfo::CGangInfo() : void CGangs::Initialise(void) { - Gang[GANG_MAFIA].m_nVehicleMI = MI_MAFIA; - Gang[GANG_TRIAD].m_nVehicleMI = MI_BELLYUP; - Gang[GANG_DIABLOS].m_nVehicleMI = MI_DIABLOS; - Gang[GANG_YAKUZA].m_nVehicleMI = MI_YAKUZA; - Gang[GANG_YARDIE].m_nVehicleMI = MI_YARDIE; - Gang[GANG_COLUMB].m_nVehicleMI = MI_COLUMB; - Gang[GANG_HOODS].m_nVehicleMI = MI_HOODS; + Gang[GANG_MAFIA].m_nVehicleMI = -1; + Gang[GANG_TRIAD].m_nVehicleMI = -1; + Gang[GANG_DIABLOS].m_nVehicleMI = -1; + Gang[GANG_YAKUZA].m_nVehicleMI = -1; + Gang[GANG_YARDIE].m_nVehicleMI = -1; + Gang[GANG_COLUMB].m_nVehicleMI = -1; + Gang[GANG_HOODS].m_nVehicleMI = -1; Gang[GANG_7].m_nVehicleMI = -1; Gang[GANG_8].m_nVehicleMI = -1; #ifdef FIX_BUGS diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 042596de..3b95dfdd 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -11976,7 +11976,7 @@ CPed::RegisterThreatWithGangPeds(CEntity *attacker) } 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; CEntity *vehicles[8]; 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 { if (veh->GetUp().z > -0.8f) { bool addDoorSmoke = false; - if (veh->GetModelIndex() == MI_YARDIE) + if (veh->GetModelIndex() == MI_VOODOO) addDoorSmoke = true; switch (m_vehEnterType) { diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index d81648fa..43dd475d 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -748,7 +748,8 @@ CPopulation::AddPedInCar(CVehicle* car) break; case MI_TAXI: case MI_CABBIE: - case MI_BORGNINE: + case MI_ZEBRA: + case MI_KAUFMAN: if (CGeneral::GetRandomTrueFalse()) { pedType = PEDTYPE_CIVMALE; preferredModel = MI_TAXI_D; diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index d20cc0bf..ec72bf7e 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1884,13 +1884,11 @@ WinMain(HINSTANCE instance, StaticPatcher::Apply(); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); -/* // TODO: make this an option somewhere AllocConsole(); freopen("CONIN$", "r", stdin); freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stderr); -*/ /* * Initialize the platform independent data. diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 4f0029ef..8ecea0ff 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -195,7 +195,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) CMatrix mat2(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LF])); mat1.GetPosition() += CVector(mat2.GetPosition().x + 0.1f, 0.0f, mat2.GetPosition().z); 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_RF]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LB]), 0); @@ -490,8 +490,7 @@ CAutomobile::ProcessControl(void) TankControl(); BlowUpCarsInPath(); break; - case MI_YARDIE: - // beta also had esperanto here it seems + case MI_VOODOO: HydraulicControl(); break; default: @@ -673,9 +672,9 @@ CAutomobile::ProcessControl(void) acceleration /= m_fForceMultiplier; // unused - if(GetModelIndex() == MI_MIAMI_RCBARON || - GetModelIndex() == MI_MIAMI_RCRAIDER || - GetModelIndex() == MI_MIAMI_SPARROW) + if(GetModelIndex() == MI_RCBARON || + GetModelIndex() == MI_RCRAIDER || + GetModelIndex() == MI_SPARROW) acceleration = 0.0f; brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep(); @@ -1001,7 +1000,7 @@ CAutomobile::ProcessControl(void) m_bSirenOrAlarm = !m_bSirenOrAlarm; }else m_nCarHornTimer = 0; - }else if(GetModelIndex() != MI_YARDIE && !CVehicle::bCheat3){ + }else if(GetModelIndex() != MI_VOODOO && !CVehicle::bCheat3){ if(Pads[0].GetHorn()) m_nCarHornTimer = 1; else @@ -1012,7 +1011,7 @@ CAutomobile::ProcessControl(void) // Flying 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); }else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) && m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){ @@ -1022,9 +1021,9 @@ CAutomobile::ProcessControl(void) else #endif FlyingControl(FLIGHT_MODEL_DODO); - }else if(GetModelIndex() == MI_MIAMI_RCBARON){ + }else if(GetModelIndex() == MI_RCBARON){ 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 if (bAllCarCheat) FlyingControl(FLIGHT_MODEL_HELI); @@ -1591,7 +1590,8 @@ CAutomobile::PreRender(void) case MI_TAXI: case MI_CABBIE: - case MI_BORGNINE: + case MI_ZEBRA: + case MI_KAUFMAN: if(bTaxiLight){ CVector pos = GetPosition() + GetUp()*0.95f; CCoronas::RegisterCorona((uintptr)this + 21, diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 2a33d68a..87b8a212 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -287,8 +287,8 @@ CBoat::ProcessControl(void) AddWakePoint(GetPosition()); float steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward()); - if (GetModelIndex() == MI_GHOST) - steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f; +// if (GetModelIndex() == MI_GHOST) +// steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f; if(steerFactor < 0.0f) steerFactor = 0.0f; CVector propeller(0.0f, -pHandling->Dimension.y*m_fPropellerY, -pHandling->Dimension.z*m_fPropellerZ); diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 3ac0da38..cc6428e1 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -21,7 +21,6 @@ const char VehicleNames[NUMHANDLINGS][14] = { "STRETCH", "MANANA", "INFERNUS", - "BLISTA", "PONY", "MULE", "CHEETAH", @@ -38,7 +37,6 @@ const char VehicleNames[NUMHANDLINGS][14] = { "ENFORCER", "SECURICA", "BANSHEE", - "PREDATOR", "BUS", "RHINO", "BARRACKS", @@ -50,22 +48,73 @@ const char VehicleNames[NUMHANDLINGS][14] = { "STALLION", "RUMPO", "RCBANDIT", - "BELLYUP", - "MRWONGS", "MAFIA", - "YARDIE", - "YAKUZA", - "DIABLOS", - "COLUMB", - "HOODS", "AIRTRAIN", "DEADDODO", - "SPEEDER", - "REEFER", - "PANLANT", "FLATBED", "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) @@ -117,7 +166,9 @@ cHandlingDataMgr::LoadHandlingData(void) // yeah, this is kinda crappy if(strncmp(line, ";the end", 9) == 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; strcpy(delim, " \t"); // 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 28: handling->fSuspensionBias = strtod(word, nil); break; case 29: + // TODO(MIAMI): suspension anti-dive multiplier + break; + case 30: sscanf(word, "%x", &handling->Flags); handling->Transmission.Flags = handling->Flags; break; - case 30: handling->FrontLights = atoi(word); break; - case 31: handling->RearLights = atoi(word); break; + case 31: handling->FrontLights = atoi(word); break; + case 32: handling->RearLights = atoi(word); break; } field++; } diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 398a415f..905ed7b8 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -139,5 +139,4 @@ public: bool HasRearWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'R'; } bool HasFrontWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'F'; } }; -VALIDATE_SIZE(cHandlingDataMgr, 0x3030); extern cHandlingDataMgr mod_HandlingManager; diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index e4cd5883..d9c364d2 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -776,7 +776,6 @@ CHeli::InitHelis(void) for(i = 0; i < NUM_HELIS; i++) pHelis[i] = nil; - ((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_ESCAPE))->SetColModel(&CTempColModels::ms_colModelPed1); ((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_CHOPPER))->SetColModel(&CTempColModels::ms_colModelPed1); } @@ -787,10 +786,7 @@ GenerateHeli(bool catalina) CVector heliPos; int i; - if(catalina) - heli = new CHeli(MI_ESCAPE, PERMANENT_VEHICLE); - else - heli = new CHeli(MI_CHOPPER, PERMANENT_VEHICLE); + heli = new CHeli(MI_CHOPPER, PERMANENT_VEHICLE); if(catalina) heliPos = CVector(-224.0f, 201.0f, 83.0f); @@ -867,18 +863,6 @@ CHeli::UpdateHelis(void) 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 for(i = 0; i < NUM_HELIS; i++) if(pHelis[i] && pHelis[i]->m_heliStatus == HELI_STATUS_FLY_AWAY && pHelis[i]->GetPosition().z > 150.0f){ diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 2baa9218..5fdbde06 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -385,7 +385,7 @@ CVehicle::FlyingControl(eFlightModel flightModel) case FLIGHT_MODEL_HELI: { CVector vecMoveResistance; - if (GetModelIndex() == MI_MIAMI_SPARROW) + if (GetModelIndex() == MI_SPARROW) vecMoveResistance = vecHeliMoveRes; else vecMoveResistance = vecRCHeliMoveRes; @@ -436,7 +436,7 @@ CVehicle::FlyingControl(eFlightModel flightModel) ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); CVector vecResistance; - if (GetModelIndex() == MI_MIAMI_SPARROW) + if (GetModelIndex() == MI_SPARROW) vecResistance = vecHeliResistance; else vecResistance = vecRCHeliResistance; @@ -875,24 +875,7 @@ CVehicle::IsVehicleNormal(void) { if (!pDriver || m_nNumPassengers != 0 || GetStatus() == STATUS_WRECKED) return false; - switch (GetModelIndex()){ - 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; - } + return GetModelInfo()->m_vehicleClass != -1; } bool @@ -1091,7 +1074,7 @@ CVehicle::SetDriver(CPed *driver) driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5); else if(GetModelIndex() == MI_ENFORCER) 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; bFreebies = false; } diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index a818456d..66dfebb1 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -290,7 +290,7 @@ public: bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; } CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } - bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; } + 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); } static bool bWheelsOnlyCheat; From aff89c6f5c7eaebb80efd9564af0d1830f8ec1f5 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 7 May 2020 11:47:08 +0200 Subject: [PATCH 3/9] typo --- src/core/re3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 36cb101b..c221d64b 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -193,7 +193,7 @@ ResetCamStatics(void) } static const char *carnames[] = { - "landstal", "idaho", "stinger", "linerun", "peren", "sentinel" "rio", "firetruk", "trash", "stretch", "manana", + "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "rio", "firetruk", "trash", "stretch", "manana", "infernus", "voodoo", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "washing", "bobcat", "mrwhoop", "bfinject", "hunter", "police", "enforcer", "securica", "banshee", "predator", "bus", "rhino", "barracks", "cuban", "chopper", "angel", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "romero", @@ -203,7 +203,7 @@ static const char *carnames[] = { "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", + "bloodra", "bloodrb", "vicechee" }; static std::list TweakVarsList; From 152c7c452cc4aeb54c66377c104bfa89bf4d01da Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 7 May 2020 12:48:09 +0200 Subject: [PATCH 4/9] few changes for vehicle model info --- librw | 2 +- src/fakerw/fake.cpp | 20 +++++- src/modelinfo/VehicleModelInfo.cpp | 97 +++++++++--------------------- src/modelinfo/VehicleModelInfo.h | 6 +- 4 files changed, 50 insertions(+), 75 deletions(-) diff --git a/librw b/librw index bdbc92d8..661feeab 160000 --- a/librw +++ b/librw @@ -1 +1 @@ -Subproject commit bdbc92d86eef28344e01c992d55a9c4f43629f84 +Subproject commit 661feeabf4a4f0a8b0bee23b53ba557a14352d00 diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index e569dea9..f1531490 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -756,6 +756,7 @@ RwCamera *RwCameraForAllClumpsNotInFrustum(RwCamera *camera, RwInt32 numClumps, RwBool RpMatFXPluginAttach( void ) { registerMatFXPlugin(); return true; } 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 *RpMatFXMaterialSetupEnvMap( RpMaterial *material, RwTexture *texture, RwFrame *frame, RwBool useFrameBufferAlpha, RwReal coef ) { MatFX *mfx = MatFX::get(material); @@ -764,8 +765,23 @@ RpMaterial *RpMatFXMaterialSetupEnvMap( RpMaterial *material, RwTexture *texture mfx->setEnvCoefficient(coef); 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(); +} diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 098400cc..97add380 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -21,7 +21,6 @@ int8 CVehicleModelInfo::ms_compsToUse[2] = { -2, -2 }; int8 CVehicleModelInfo::ms_compsUsed[2]; -RwTexture *CVehicleModelInfo::ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS]; RwRGBA CVehicleModelInfo::ms_vehicleColourTable[256]; RwTexture *CVehicleModelInfo::ms_colourTextureTable[256]; @@ -752,35 +751,26 @@ void CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2) { RwRGBA col, *colp; - RwTexture *coltex; RpMaterial **matp; if(c1 != m_currentColour1){ col = ms_vehicleColourTable[c1]; - coltex = ms_colourTextureTable[c1]; for(matp = m_materials1; *matp; matp++){ - if(RpMaterialGetTexture(*matp) && RwTextureGetName(RpMaterialGetTexture(*matp))[0] != '@'){ - colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const - colp->red = col.red; - colp->green = col.green; - colp->blue = col.blue; - }else - RpMaterialSetTexture(*matp, coltex); + colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const + colp->red = col.red; + colp->green = col.green; + colp->blue = col.blue; } m_currentColour1 = c1; } if(c2 != m_currentColour2){ col = ms_vehicleColourTable[c2]; - coltex = ms_colourTextureTable[c2]; for(matp = m_materials2; *matp; matp++){ - if(RpMaterialGetTexture(*matp) && RwTextureGetName(RpMaterialGetTexture(*matp))[0] != '@'){ - colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const - colp->red = col.red; - colp->green = col.green; - colp->blue = col.blue; - }else - RpMaterialSetTexture(*matp, coltex); + colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const + colp->red = col.red; + colp->green = col.green; + colp->blue = col.blue; } m_currentColour2 = c2; } @@ -925,7 +915,6 @@ CVehicleModelInfo::LoadVehicleColours(void) ms_vehicleColourTable[numCols].green = g; ms_vehicleColourTable[numCols].blue = b; ms_vehicleColourTable[numCols].alpha = 0xFF; - ms_colourTextureTable[numCols] = CreateCarColourTexture(r, g, b); numCols++; }else if(section == CARS){ n = sscanf(&line[start], // BUG: games doesn't add start @@ -960,38 +949,33 @@ CVehicleModelInfo::DeleteVehicleColourTextures(void) for(i = 0; i < 256; i++){ if(ms_colourTextureTable[i]){ RwTextureDestroy(ms_colourTextureTable[i]); -#ifdef GTA3_1_1_PATCH ms_colourTextureTable[i] = nil; -#endif } } } 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; - *(bool*)data = true; + *(int*)data = RpMatFXMaterialGetEffects(material); return nil; } RpMaterial* -CVehicleModelInfo::SetEnvironmentMapCB(RpMaterial *material, void *data) +CVehicleModelInfo::SetDefaultEnvironmentMapCB(RpMaterial *material, void *data) { - float spec; - - spec = RpMaterialGetSurfaceProperties(material)->specular; - if(spec <= 0.0f) - RpMatFXMaterialSetEffects(material, rpMATFXEFFECTNULL); - else{ + if(RpMatFXMaterialGetEffects(material) == rpMATFXEFFECTENVMAP){ + RpMatFXMaterialSetEnvMapFrame(material, pMatFxIdentityFrame); if(RpMaterialGetTexture(material) == nil) RpMaterialSetTexture(material, gpWhiteTexture); RpMatFXMaterialSetEffects(material, rpMATFXEFFECTENVMAP); #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 - RpMatFXMaterialSetupEnvMap(material, (RwTexture*)data, pMatFxIdentityFrame, false, spec); } return material; } @@ -999,17 +983,15 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpMaterial *material, void *data) RpAtomic* CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data) { - bool hasSpec; + int fx; RpGeometry *geo; geo = RpAtomicGetGeometry(atomic); - hasSpec = 0; - RpGeometryForAllMaterials(geo, HasSpecularMaterialCB, &hasSpec); - if(hasSpec){ - RpGeometryForAllMaterials(geo, SetEnvironmentMapCB, data); - RpGeometrySetFlags(geo, RpGeometryGetFlags(geo) | rpGEOMETRYMODULATEMATERIALCOLOR); + fx = 0; + RpGeometryForAllMaterials(geo, GetMatFXEffectMaterialCB, &fx); + if(fx != rpMATFXEFFECTNULL){ RpMatFXAtomicEnableEffects(atomic); - // PS2 sets of PS2Manager lighting CB here + RpGeometryForAllMaterials(geo, SetDefaultEnvironmentMapCB, data); } return atomic; } @@ -1021,44 +1003,29 @@ CVehicleModelInfo::SetEnvironmentMap(void) int32 i; if(pMatFxIdentityFrame == nil){ + RwV3d axis = { 1.0f, 0.0f, 0.0f }; pMatFxIdentityFrame = RwFrameCreate(); - RwMatrixSetIdentity(RwFrameGetMatrix(pMatFxIdentityFrame)); + RwMatrixRotate(RwFrameGetMatrix(pMatFxIdentityFrame), &axis, 60.0f, rwCOMBINEREPLACE); RwFrameUpdateObjects(pMatFxIdentityFrame); RwFrameGetLTM(pMatFxIdentityFrame); } - if(m_envMap != ms_pEnvironmentMaps[0]){ - m_envMap = ms_pEnvironmentMaps[0]; - RpClumpForAllAtomics(m_clump, SetEnvironmentMapCB, m_envMap); - if(m_wheelId != -1){ - wheelmi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(m_wheelId); - for(i = 0; i < wheelmi->m_numAtomics; i++) - SetEnvironmentMapCB(wheelmi->m_atomics[i], m_envMap); - } + RpClumpForAllAtomics(m_clump, SetEnvironmentMapCB, nil); + if(m_wheelId != -1){ + wheelmi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(m_wheelId); + for(i = 0; i < wheelmi->m_numAtomics; i++) + SetEnvironmentMapCB(wheelmi->m_atomics[i], nil); } } void CVehicleModelInfo::LoadEnvironmentMaps(void) { - const char *texnames[] = { - "reflection01", // only one used - "reflection02", - "reflection03", - "reflection04", - "reflection05", - "reflection06", - }; int32 txdslot; - int32 i; txdslot = CTxdStore::FindTxdSlot("particle"); CTxdStore::PushCurrentTxd(); 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){ gpWhiteTexture = RwTextureRead("white", nil); RwTextureGetName(gpWhiteTexture)[0] = '@'; @@ -1070,14 +1037,8 @@ CVehicleModelInfo::LoadEnvironmentMaps(void) void CVehicleModelInfo::ShutdownEnvironmentMaps(void) { - int32 i; - - // ignoring "initialised" as that's a PS2 thing only RwTextureDestroy(gpWhiteTexture); gpWhiteTexture = nil; - for(i = 0; i < NUM_VEHICLE_ENVMAPS; i++) - if(ms_pEnvironmentMaps[i]) - RwTextureDestroy(ms_pEnvironmentMaps[i]); RwFrameDestroy(pMatFxIdentityFrame); pMatFxIdentityFrame = nil; } diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index 6946c5c1..3ce92d78 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -6,7 +6,6 @@ enum { NUM_FIRST_MATERIALS = 26, NUM_SECOND_MATERIALS = 26, NUM_VEHICLE_COLOURS = 8, - NUM_VEHICLE_ENVMAPS = 1 }; enum { @@ -72,7 +71,6 @@ public: static int8 ms_compsToUse[2]; static int8 ms_compsUsed[2]; - static RwTexture *ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS]; static RwRGBA ms_vehicleColourTable[256]; static RwTexture *ms_colourTextureTable[256]; static RwObjectNameIdAssocation *ms_vehicleDescs[NUM_VEHICLE_TYPES]; @@ -114,8 +112,8 @@ public: static void DeleteVehicleColourTextures(void); static RpAtomic *SetEnvironmentMapCB(RpAtomic *atomic, void *data); - static RpMaterial *SetEnvironmentMapCB(RpMaterial *material, void *data); - static RpMaterial *HasSpecularMaterialCB(RpMaterial *material, void *data); + static RpMaterial *SetDefaultEnvironmentMapCB(RpMaterial *material, void *data); + static RpMaterial *GetMatFXEffectMaterialCB(RpMaterial *material, void *data); void SetEnvironmentMap(void); static void LoadEnvironmentMaps(void); static void ShutdownEnvironmentMaps(void); From ed1bb7236f2a8cac55de8cdbd63a6dfca050f36c Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 7 May 2020 14:10:56 +0300 Subject: [PATCH 5/9] Fixed arguments for sound collisions --- src/audio/AudioCollision.cpp | 125 ++++++++++++++++++++--------------- src/audio/AudioManager.cpp | 4 +- src/audio/AudioManager.h | 6 +- src/entities/Physical.cpp | 4 +- 4 files changed, 78 insertions(+), 61 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index 0e060568..28d7f3cd 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -117,58 +117,54 @@ cAudioManager::GetCollisionRatio(float a, float b, float c, float d) const } uint32 -cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision) +cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision) { - uint8 surface1 = audioCollision->m_bSurface1; - uint8 surface2 = audioCollision->m_bSurface2; + uint8 surface1 = audioCollision.m_bSurface1; + uint8 surface2 = audioCollision.m_bSurface2; int32 vol; float ratio; if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == 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_nFrequency = 13000.f * ratio + 35000; 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 { - 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; } - 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; - } - } + 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; } 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); if(emittingVol) { - m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance); + m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_nVolume) { 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_bIs2D = false; 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 -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 s2; @@ -216,21 +233,21 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col) for(int32 i = 0; i < 2; i++) { if(i) { - s1 = col->m_bSurface2; - s2 = col->m_bSurface1; + s1 = col.m_bSurface2; + s2 = col.m_bSurface1; } else { - s1 = col->m_bSurface1; - s2 = col->m_bSurface2; + s1 = col.m_bSurface1; + s2 = col.m_bSurface2; } - ratio = GetCollisionOneShotRatio(s1, col->m_fIntensity1); - if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio = 0.25f * ratio; + ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1); + if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio /= 4.0f; if(s1 == SURFACE_METAL6 && ratio < 0.6f) { s1 = SURFACE_BILLBOARD; ratio = Min(1.f, 2.f * ratio); } emittingVol = 40.f * ratio; if(emittingVol) { - m_sQueueSample.m_fDistance = Sqrt(col->m_fDistance); + m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance); 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_nCounter = counter++; 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_bIs2D = false; m_sQueueSample.m_nReleasingVolumeModificator = 11; @@ -330,7 +347,7 @@ cAudioManager::ServiceCollisions() someArr1[index] = true; someArr2[j] = true; 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; } } @@ -362,8 +379,8 @@ cAudioManager::ServiceCollisions() break; } } - SetUpOneShotCollisionSound(&m_sCollisionManager.m_asCollisions1[index]); - SetUpLoopingCollisionSound(&m_sCollisionManager.m_asCollisions1[index], j); + SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]); + SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j); } } diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index a417e077..88152f94 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -3625,14 +3625,14 @@ cAudioManager::ProcessActiveQueues() 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]]; 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) { --sample.m_nLoopsRemaining; sample.m_nReleasingVolumeDivider = 1; } else { - for (int32 j = 0; j < m_nActiveSamples; ++j) { + for (uint8 j = 0; j < m_nActiveSamples; ++j) { if (!m_asActiveSamples[j].m_bIsProcessed) { if (sample.m_nLoopCount) { v28 = sample.m_nFrequency / m_nTimeSpent; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index ccef42ff..426ff613 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -438,15 +438,15 @@ public: void SetEffectsFadeVolume(uint8 volume) const; void SetEffectsMasterVolume(uint8 volume) const; void SetEntityStatus(int32 id, uint8 status); - uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision); + uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision); void SetMissionAudioLocation(float x, float y, float z); void SetMissionScriptPoliceAudio(int32 sfx) const; void SetMonoMode(uint8); // todo (mobile) void SetMusicFadeVolume(uint8 volume) const; void SetMusicMasterVolume(uint8 volume) const; void SetSpeakerConfig(int32 conf) const; - void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter); - void SetUpOneShotCollisionSound(cAudioCollision *col); + void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter); + void SetUpOneShotCollisionSound(const cAudioCollision &col); bool SetupCrimeReport(); bool SetupJumboEngineSound(uint8 vol, int32 freq); bool SetupJumboFlySound(uint8 emittingVol); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 04783f31..64358cbf 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -326,8 +326,8 @@ int32 CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) { int32 numSpheres = CCollision::ProcessColModels( - GetMatrix(), *CModelInfo::GetModelInfo(GetModelIndex())->GetColModel(), - ent->GetMatrix(), *CModelInfo::GetModelInfo(ent->GetModelIndex())->GetColModel(), + GetMatrix(), *GetColModel(), + ent->GetMatrix(), *ent->GetColModel(), colpoints, nil, nil); // No Lines allowed! if(numSpheres > 0){ From 1ac6bea590aa07af40edd2cc2346f16f334096c5 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 7 May 2020 14:32:00 +0300 Subject: [PATCH 6/9] Fix GetDistanceSquared --- src/audio/AudioCollision.cpp | 2 +- src/audio/AudioManager.cpp | 56 ++++++++++++++++++------------------ src/audio/AudioManager.h | 4 ++- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index 28d7f3cd..4eb74388 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -410,7 +410,7 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface v2 = entity2->GetPosition(); } CVector pos = (v1 + v2) * 0.5f; - distSquared = GetDistanceSquared(&pos); + distSquared = GetDistanceSquared(pos); if(distSquared < SQR(CollisionSoundIntensity)) { m_sCollisionManager.m_sQueue.m_pEntity1 = entity1; m_sCollisionManager.m_sQueue.m_pEntity2 = entity2; diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 88152f94..be68d40f 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -2951,10 +2951,10 @@ cAudioManager::GetCurrent3DProviderIndex() const } float -cAudioManager::GetDistanceSquared(CVector *v) const +cAudioManager::GetDistanceSquared(const CVector &v) const { const CVector &c = TheCamera.GetPosition(); - return sq(v->x - c.x) + sq(v->y - c.y) + sq((v->z - c.z) * 0.2f); + return sq(v.x - c.x) + sq(v.y - c.y) + sq((v.z - c.z) * 0.2f); } int32 @@ -3747,7 +3747,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) default: return; } - float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -3970,7 +3970,7 @@ cAudioManager::ProcessBridge() if (CBridge::pLiftRoad) { m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition(); - dist = GetDistanceSquared(&m_sQueueSample.m_vecPos); + dist = GetDistanceSquared(m_sQueueSample.m_vecPos); if (dist < 202500.0f) { CalculateDistance(distCalculated, dist); switch (CBridge::State) { @@ -4206,7 +4206,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) default: return; } - float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); rand = m_anRandomTable[0] % 90 + 30; @@ -4246,7 +4246,7 @@ cAudioManager::ProcessCrane() if (crane->m_nCraneStatus == CCrane::ACTIVATED) { if (crane->m_nCraneState != CCrane::IDLE) { 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)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance); @@ -4306,7 +4306,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); rand = m_anRandomTable[0] % 60 + 40; @@ -4510,7 +4510,7 @@ cAudioManager::ProcessExplosions(int32 explosion) } pos = CExplosion::GetExplosionPosition(i); m_sQueueSample.m_vecPos = *pos; - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -4541,7 +4541,7 @@ cAudioManager::ProcessFireHydrant() static const int intensity = 35; m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition(); - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(intensity)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); @@ -4611,7 +4611,7 @@ void cAudioManager::ProcessFires(int32) m_sQueueSample.m_nReleasingVolumeModificator = 8; } 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)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -4875,7 +4875,7 @@ cAudioManager::ProcessGarages() continue; m_sQueueSample.m_vecPos = entity->GetPosition(); distCalculated = false; - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < 6400.f) { state = CGarages::aGarages[i].m_eGarageState; if (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { @@ -5021,7 +5021,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) default: return; } - dist = GetDistanceSquared(&m_sQueueSample.m_vecPos); + dist = GetDistanceSquared(m_sQueueSample.m_vecPos); if (dist < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(dist); rand = m_anRandomTable[0] % 30 + 40; @@ -5173,7 +5173,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) default: return; } - float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -5804,7 +5804,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -5914,7 +5914,7 @@ cAudioManager::ProcessMissionAudio() if (m_sMissionAudio.m_bPredefinedProperties) { SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1); } else { - distSquared = GetDistanceSquared(&m_sMissionAudio.m_vecPos); + distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos); if (distSquared >= 2500.f) { emittingVol = 0; pan = 63; @@ -6017,14 +6017,14 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L: male.m_pPed = nil; 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); return; case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S: case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L: female.m_pPed = nil; female.m_bDistanceCalculated = false; - female.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos); + female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); SetupPedComments(&female, SOUND_INJURED_PED_FEMALE); return; case SCRIPT_SOUND_GATE_START_CLUNK: @@ -6186,7 +6186,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = false; 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)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -6231,7 +6231,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -6261,7 +6261,7 @@ cAudioManager::ProcessPed(CPhysical *ped) // params.m_bDistanceCalculated = false; 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) ProcessPedHeadphones(¶ms); ProcessPedOneShots(¶ms); @@ -7458,7 +7458,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); if (m_FrameCounter & 1) @@ -7545,7 +7545,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { @@ -7622,7 +7622,7 @@ cAudioManager::ProcessProjectiles() m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition(); - float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -7762,7 +7762,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -7835,7 +7835,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -7980,7 +7980,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh) m_sQueueSample.m_vecPos = veh->GetPosition(); 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_pTransmission = nil; params.m_nIndex = 0; @@ -8990,7 +8990,7 @@ void cAudioManager::ProcessWaterCannon(int32) for (int32 i = 0; i < NUM_WATERCANNONS; i++) { if (CWaterCannons::aCannons[i].m_nId) { m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur]; - float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SOUND_INTENSITY) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); @@ -9136,7 +9136,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound) default: return; } - distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 426ff613..0d0c5d91 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -317,7 +317,7 @@ public: float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used float GetCollisionOneShotRatio(int32 a, float b) 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; bool GetMissionAudioLoadingStatus() const; int8 GetMissionScriptPoliceAudioPlayingStatus() const; @@ -468,6 +468,8 @@ public: // only used in pc void AdjustSamplesVolume(); uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); + + void DebugShit(); }; //dstatic_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error"); From dbbf39098327261d2e29424156789232e5e85517 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 7 May 2020 13:38:14 +0200 Subject: [PATCH 7/9] use water color and new water texture --- src/render/Timecycle.h | 5 +++++ src/render/WaterLevel.cpp | 13 +++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h index 2b835ddc..dc52d493 100644 --- a/src/render/Timecycle.h +++ b/src/render/Timecycle.h @@ -173,6 +173,11 @@ public: static int GetFogBlue(void) { return m_nCurrentFogColourBlue; } 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 Update(void); static CVector &GetSunPosition(void) { return m_VectorToSun[m_CurrentStoredValue]; } diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 37ae1dfa..7e26654c 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -36,9 +36,6 @@ RpAtomic *CWaterLevel::ms_pWavyAtomic; RpGeometry *CWaterLevel::apGeomArray[8]; int16 CWaterLevel::nGeomUsed; -//RwTexture *gpWaterTex; -//RwRaster *gpWaterRaster; - RwTexture *gpWaterTex; RwRaster *gpWaterRaster; @@ -84,7 +81,7 @@ CWaterLevel::Initialise(char *pWaterDat) CTxdStore::SetCurrentTxd(slot); if ( gpWaterTex == NULL ) - gpWaterTex = RwTextureRead("water_old", NULL); + gpWaterTex = RwTextureRead("waterclear256", NULL); gpWaterRaster = RwTextureGetRaster(gpWaterTex); CTxdStore::PopCurrentTxd(); @@ -364,10 +361,10 @@ CWaterLevel::RenderWater() WavesCalculatedThisFrame = false; RwRGBA color = { 0, 0, 0, 255 }; - - color.red = uint32((CTimeCycle::GetDirectionalRed() * 0.5f + CTimeCycle::GetAmbientRed() ) * 255.0f); - color.green = uint32((CTimeCycle::GetDirectionalGreen() * 0.5f + CTimeCycle::GetAmbientGreen()) * 255.0f); - color.blue = uint32((CTimeCycle::GetDirectionalBlue() * 0.5f + CTimeCycle::GetAmbientBlue() ) * 255.0f); + + color.red = CTimeCycle::GetWaterRed(); + color.green = CTimeCycle::GetWaterGreen(); + color.blue = CTimeCycle::GetWaterBlue(); TempBufferVerticesStored = 0; TempBufferIndicesStored = 0; From 0b848bc1470464e636117fa773e09734fa1365dd Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 7 May 2020 14:48:53 +0300 Subject: [PATCH 8/9] Fix looping collision sound --- src/audio/AudioCollision.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index 4eb74388..ecd0299c 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -328,13 +328,13 @@ void cAudioManager::ServiceCollisions() { int i, j; - bool someArr1[NUMAUDIOCOLLISIONS]; - bool someArr2[NUMAUDIOCOLLISIONS]; + bool abRepeatedCollision1[NUMAUDIOCOLLISIONS]; + bool abRepeatedCollision2[NUMAUDIOCOLLISIONS]; m_sQueueSample.m_nEntityIndex = m_nCollisionEntity; 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 (j = 0; j < NUMAUDIOCOLLISIONS; j++) { @@ -344,8 +344,8 @@ cAudioManager::ServiceCollisions() && (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) ) { - someArr1[index] = true; - someArr2[j] = true; + abRepeatedCollision1[index] = true; + abRepeatedCollision2[j] = true; m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume; SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j); break; @@ -354,7 +354,7 @@ cAudioManager::ServiceCollisions() } 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_pEntity2 = nil; m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT; @@ -368,9 +368,9 @@ cAudioManager::ServiceCollisions() for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) { int index = m_sCollisionManager.m_bIndicesTable[i]; - if (!someArr1[index]) { + if (!abRepeatedCollision1[index]) { 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_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1; m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2; From 6a7d08ecc25f21e61a62c06ff4d58065508bbb92 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 7 May 2020 14:41:35 +0200 Subject: [PATCH 9/9] some quick cosmetic fixes --- src/render/Fluff.cpp | 4 +++- src/render/Skidmarks.cpp | 42 +++++++++------------------------------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 9f3f6929..59ac1652 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -104,7 +104,8 @@ void CMovingThings::Init() EndCloseList.m_pNext = nil; EndCloseList.m_pPrev = &CMovingThings::StartCloseList; Num = 0; - + +#ifndef MIAMI // something is still used here actually // 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[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), -sz.x, -sz.y, 0, 255, 0, 100.0f, 0.8f ); +#endif } void CMovingThings::Shutdown() diff --git a/src/render/Skidmarks.cpp b/src/render/Skidmarks.cpp index 5d521041..7f057319 100644 --- a/src/render/Skidmarks.cpp +++ b/src/render/Skidmarks.cpp @@ -11,8 +11,6 @@ CSkidmark CSkidmarks::aSkidmarks[NUMSKIDMARKS]; RwImVertexIndex SkidmarkIndexList[SKIDMARK_LENGTH * 6]; RwIm3DVertex SkidmarkVertices[SKIDMARK_LENGTH * 2]; RwTexture *gpSkidTex; -RwTexture *gpSkidBloodTex; -RwTexture *gpSkidMudTex; void CSkidmarks::Init(void) @@ -22,8 +20,6 @@ CSkidmarks::Init(void) slot = CTxdStore::FindTxdSlot("particle"); CTxdStore::SetCurrentTxd(slot); gpSkidTex = RwTextureRead("particleskid", nil); - gpSkidBloodTex = RwTextureRead("particleskidblood", nil); - gpSkidMudTex = RwTextureRead("particleskidmud", nil); CTxdStore::PopCurrentTxd(); for(i = 0; i < NUMSKIDMARKS; i++){ @@ -54,17 +50,7 @@ void CSkidmarks::Shutdown(void) { RwTextureDestroy(gpSkidTex); -#ifdef GTA3_1_1_PATCH gpSkidTex = nil; -#endif - RwTextureDestroy(gpSkidBloodTex); -#ifdef GTA3_1_1_PATCH - gpSkidBloodTex = nil; -#endif - RwTextureDestroy(gpSkidMudTex); -#ifdef GTA3_1_1_PATCH - gpSkidMudTex = nil; -#endif } void @@ -116,33 +102,23 @@ void CSkidmarks::Render(void) { int i, j; - RwTexture *lastTex = nil; RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSkidTex)); for(i = 0; i < NUMSKIDMARKS; i++){ if(aSkidmarks[i].m_state == 0 || aSkidmarks[i].m_last < 1) continue; - if(aSkidmarks[i].m_isBloody){ - if(lastTex != gpSkidBloodTex){ - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSkidBloodTex)); - lastTex = gpSkidBloodTex; - } - }else if(aSkidmarks[i].m_isMuddy){ - if(lastTex != gpSkidMudTex){ - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSkidMudTex)); - lastTex = gpSkidMudTex; - } - }else{ - if(lastTex != gpSkidTex){ - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSkidTex)); - lastTex = gpSkidTex; - } - } + CRGBA color(0, 0, 0, 255); + // TODO(MIAMI): we have a type field here actually (0-3) + if(aSkidmarks[i].m_isBloody) // TODO: type 3 + color = CRGBA(132, 34, 11, 255); + else if(aSkidmarks[i].m_isMuddy) // TODO: type 1 + color = CRGBA(90, 62, 9, 255); uint32 fade, alpha; 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 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); - 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); }