From 43bf8543741e6c153cb8ddc9fc5f1594b332e9d8 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 9 Aug 2020 19:11:44 +0200 Subject: timecycle done --- src/control/Script.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index eb950464..9508677b 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -12709,13 +12709,13 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_SET_EXTRA_COLOURS: { CollectParameters(&m_nIp, 2); - debug("SET_EXTRA_COLOURS not implemented, skipping\n"); + CTimeCycle::StartExtraColour(ScriptParams[0]-1, ScriptParams[1] != 0); return 0; } case COMMAND_CLEAR_EXTRA_COLOURS: { CollectParameters(&m_nIp, 1); - debug("CLEAR_EXTRA_COLOURS not implemented, skipping\n"); + CTimeCycle::StopExtraColour(ScriptParams[0]); return 0; } //case COMMAND_CLOSE_CAR_BOOT: -- cgit v1.2.3 From b54bb62c944f8f3e8d85501fbb762915fdc6569b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Thu, 13 Aug 2020 23:39:55 +0300 Subject: Stats(except displaying), PlayerInfo, marker fix --- src/control/GameLogic.cpp | 6 +++++- src/control/Script.cpp | 40 ++++++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 19 deletions(-) (limited to 'src/control') diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index 2af9464c..f4e4fdd4 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -28,6 +28,7 @@ #include "Particle.h" #include "ColStore.h" #include "Automobile.h" +#include "MBlur.h" uint8 CGameLogic::ActivePlayers; uint8 CGameLogic::ShortCutState; @@ -343,7 +344,10 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector pPlayerPed->bIsVisible = true; pPlayerPed->m_bloodyFootprintCountOrDeathTime = 0; pPlayerPed->bDoBloodyFootprints = false; - //TODO(MIAMI): clear drunk stuff + pPlayerPed->m_nDrunkenness = 0; + pPlayerPed->m_nFadeDrunkenness = 0; + CMBlur::ClearDrunkBlur(); + pPlayerPed->m_nDrunkCountdown = 0; pPlayerPed->ClearAdrenaline(); pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina; if (pPlayerPed->m_pFire) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 9508677b..69b8ee4f 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1806,7 +1806,7 @@ void CMissionCleanup::Process() // TODO(MIAMI) //CSpecialFX::bLiftCam = false; //CSpecialFX::bVideoCam = false; - //CTimeCycle::StopExtraColour(0); + CTimeCycle::StopExtraColour(0); for (int i = 0; i < MISSION_AUDIO_SLOTS; i++) DMAudio.ClearMissionAudio(i); CWeather::ReleaseWeather(); @@ -1822,8 +1822,11 @@ void CMissionCleanup::Process() CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByCops = false; CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByEveryone = false; CWorld::Players[0].MakePlayerSafe(false); - //TODO(MIAMI): drunkenness, enable drive by - //DMAudio::ShutUpPlayerTalking(0); + CWorld::Players[0].m_pPed->m_nFadeDrunkenness = 1; + CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0; + // CPad::GetPad(0)->SetDrunkInputDelay(0); // TODO(Miami) + CWorld::Players[0].m_bDriveByAllowed = true; + // DMAudio::ShutUpPlayerTalking(0); // TODO(Miami) CVehicle::bDisableRemoteDetonation = false; CVehicle::bDisableRemoteDetonationOnContact = false; CGameLogic::ClearShortCut(); @@ -5353,7 +5356,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 2, BLIP_DISPLAY_BOTH); + int handle = CRadar::SetCoordBlip(BLIP_CONTACT_POINT, pos, 2, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); ScriptParams[0] = handle; StoreParameters(&m_nIp, 1); @@ -9792,7 +9795,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - C3dMarkers::PlaceMarkerSet((uintptr)this + m_nIp, 4, pos, *(float*)&ScriptParams[3], + C3dMarkers::PlaceMarkerSet((uintptr)this + m_nIp, MARKERTYPE_CYLINDER, pos, *(float*)&ScriptParams[3], SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0); return 0; @@ -13008,11 +13011,11 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_IS_MISSION_AUDIO_LOADING: case COMMAND_ADD_MONEY_SPENT_ON_WEAPONS: CollectParameters(&m_nIp, 1); - debug("ADD_MONEY_SPENT_ON_WEAPON not implemented\n"); // TODO(MIAMI) + CStats::MoneySpentOnWeapons(ScriptParams[0]); return 0; case COMMAND_ADD_MONEY_SPENT_ON_PROPERTY: CollectParameters(&m_nIp, 1); - debug("ADD_MONEY_SPENT_ON_PROPERTY not implemented\n"); // TODO(MIAMI) + CStats::MoneySpentOnProperty(ScriptParams[0]); return 0; //case COMMAND_ADD_MONEY_SPENT_ON_AUTO_PAINTING: case COMMAND_SET_CHAR_ANSWERING_MOBILE: @@ -13041,21 +13044,21 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_ADD_LOAN_SHARK_VISITS: case COMMAND_ADD_STORES_KNOCKED_OFF: CollectParameters(&m_nIp, 1); - debug("ADD_STORES_KNOCKED_OFF not implemented\n"); // TODO(MIAMI) + CStats::NumOfStoresKnockedOff(ScriptParams[0]); return 0; //case COMMAND_ADD_MOVIE_STUNTS: case COMMAND_ADD_NUMBER_OF_ASSASSINATIONS: CollectParameters(&m_nIp, 1); - debug("ADD_NUMBER_OF_ASSASSINATIONS not implemented\n"); // TODO(MIAMI) + CStats::NumOfAssassinations(ScriptParams[0]); return 0; case COMMAND_ADD_PIZZAS_DELIVERED: CollectParameters(&m_nIp, 1); - debug("ADD_PIZZAS_DELIVERED not implemented\n"); // TODO(MIAMI) + CStats::NumOfPizzasDelivered(ScriptParams[0]); return 0; //case COMMAND_ADD_GARBAGE_PICKUPS: case COMMAND_ADD_ICE_CREAMS_SOLD: CollectParameters(&m_nIp, 1); - debug("ADD_ICE_CREAMS_SOLD not implemented\n"); // TODO(MIAMI) + CStats::NumOfIceCreamSold(ScriptParams[0]); return 0; //case COMMAND_SET_TOP_SHOOTING_RANGE_SCORE: //case COMMAND_ADD_SHOOTING_RANGE_RANK: @@ -13137,15 +13140,15 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) } case COMMAND_SET_PROPERTY_AS_OWNED: CollectParameters(&m_nIp, 1); - debug("SET_PROPERTY_AS_OWNED not implemented\n"); // TODO(MIAMI) + CStats::AddPropertyAsOwned(ScriptParams[0]); return 0; case COMMAND_ADD_BLOOD_RING_KILLS: CollectParameters(&m_nIp, 1); - debug("ADD_BLOOD_RING_KILLS not implemented\n"); // TODO(MIAMI) + CStats::AddNumBloodRingKills(ScriptParams[0]); return 0; case COMMAND_SET_LONGEST_TIME_IN_BLOOD_RING: CollectParameters(&m_nIp, 1); - debug("SET_LONGEST_TIME_IN_BLOOD_RING not implemented\n"); // TODO(MIAMI) + CStats::LongestTimeInBloodRing(ScriptParams[0]); return 0; case COMMAND_REMOVE_EVERYTHING_FOR_HUGE_CUTSCENE: { @@ -13271,7 +13274,8 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_SET_CHAR_OBJ_GOTO_CAR_ON_FOOT: //case COMMAND_GET_CLOSEST_WATER_NODE: case COMMAND_ADD_PORN_LEAFLET_TO_RUBBISH: - debug("ADD_PORN_LEAFLET_TO_RUBBISH is not implemented\n"); // TODO(MIAMI) + CollectParameters(&m_nIp, 1); + CStats::PamphletMissionPassed = ScriptParams[0]; return 0; case COMMAND_CREATE_CLOTHES_PICKUP: { @@ -13541,7 +13545,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) switch (command) { case COMMAND_REGISTER_VIGILANTE_LEVEL: CollectParameters(&m_nIp, 1); - debug("REGISTER_VIGILANTE_LEVEL not implemented\n"); // TODO(MIAMI) + CStats::RegisterLevelVigilanteMission(ScriptParams[0]); return 0; case COMMAND_CLEAR_ALL_CHAR_ANIMS: { @@ -13854,7 +13858,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } case COMMAND_REGISTER_FIRE_LEVEL: CollectParameters(&m_nIp, 1); - debug("REGISTER_FIRE_LEVEL not implemented\n"); // TODO(MIAMI) + CStats::RegisterLevelFireMission(ScriptParams[0]); return 0; case COMMAND_IS_AUSTRALIAN_GAME: UpdateCompareFlag(false); // should we make some check? @@ -14007,7 +14011,7 @@ void CTheScripts::DrawScriptSpheres() { for (int i = 0; i < MAX_NUM_SCRIPT_SPHERES; i++) { if (ScriptSphereArray[i].m_bInUse) - C3dMarkers::PlaceMarkerSet(ScriptSphereArray[i].m_Id, 4, ScriptSphereArray[i].m_vecCenter, ScriptSphereArray[i].m_fRadius, + C3dMarkers::PlaceMarkerSet(ScriptSphereArray[i].m_Id, MARKERTYPE_CYLINDER, ScriptSphereArray[i].m_vecCenter, ScriptSphereArray[i].m_fRadius, SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0); } } -- cgit v1.2.3 From 489743da419b0da842e82dc6d430f6f3d8752055 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 14 Aug 2020 17:34:04 +0300 Subject: Darkel fixes --- src/control/Darkel.cpp | 16 +++++++++++----- src/control/Darkel.h | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src/control') diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index cfd58340..02627f33 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -30,9 +30,9 @@ int8 CDarkel::InterruptedWeapon; * makes game handle sounds & messages instead of SCM (just like in GTA2) * but it's never been used in the game. Has unused sliding text when frenzy completed etc. */ -int8 CDarkel::bStandardSoundAndMessages; -int8 CDarkel::bNeedHeadShot; -int8 CDarkel::bProperKillFrenzy; +bool CDarkel::bStandardSoundAndMessages; +bool CDarkel::bNeedHeadShot; +bool CDarkel::bProperKillFrenzy; uint16 CDarkel::Status; uint16 CDarkel::RegisteredKills[NUM_DEFAULT_MODELS]; int32 CDarkel::ModelToKill; @@ -108,9 +108,15 @@ CDarkel::DrawMessages() sprintf(gString, "%d", (CDarkel::KillsNeeded >= 0 ? CDarkel::KillsNeeded : 0)); AsciiToUnicode(gString, gUString); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString); +#ifdef FIX_BUGS +#define DARKEL_COUNTER_HEIGHT 143.0f +#else +#define DARKEL_COUNTER_HEIGHT 128.0f +#endif + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT + 1.0f), gUString); CFont::SetColor(CRGBA(255, 128, 128, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(143.0f), gUString); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT), gUString); +#undef DARKEL_COUNTER_HEIGHT break; } case KILLFRENZY_PASSED: diff --git a/src/control/Darkel.h b/src/control/Darkel.h index 14529c63..0f5c2329 100644 --- a/src/control/Darkel.h +++ b/src/control/Darkel.h @@ -24,9 +24,9 @@ private: static int32 AmmoInterruptedWeapon; static int32 KillsNeeded; static int8 InterruptedWeapon; - static int8 bStandardSoundAndMessages; - static int8 bNeedHeadShot; - static int8 bProperKillFrenzy; + static bool bStandardSoundAndMessages; + static bool bNeedHeadShot; + static bool bProperKillFrenzy; static uint16 Status; static uint16 RegisteredKills[NUM_DEFAULT_MODELS]; static int32 ModelToKill; -- cgit v1.2.3 From f403a63a5cc2262dc2a10f4963140aceff15e681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 14 Aug 2020 18:54:01 +0300 Subject: Wheelie opcode --- src/control/Script.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 69b8ee4f..0c3d269c 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -12725,14 +12725,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_GET_WHEELIE_STATS: { CollectParameters(&m_nIp, 1); - static bool bShowed = false; - if (!bShowed) { - debug("GET_WHEELIE_STATS not implemented\n"); - bShowed = true; - } - for (int i = 0; i < 6; i++) - ScriptParams[i] = 0; + CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; + ScriptParams[0] = pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels; + ScriptParams[1] = pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels; + ScriptParams[2] = pPlayerInfo->m_nLastTimeSpentOnWheelie; + ScriptParams[3] = pPlayerInfo->m_nLastDistanceTravelledOnWheelie; + ScriptParams[4] = pPlayerInfo->m_nLastTimeSpentOnStoppie; + ScriptParams[5] = pPlayerInfo->m_nLastDistanceTravelledOnStoppie; StoreParameters(&m_nIp, 6); + pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels = 0; + pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels = 0; + pPlayerInfo->m_nLastTimeSpentOnWheelie = 0; + pPlayerInfo->m_nLastDistanceTravelledOnWheelie = 0; + pPlayerInfo->m_nLastTimeSpentOnStoppie = 0; + pPlayerInfo->m_nLastDistanceTravelledOnStoppie = 0; return 0; } //case COMMAND_DISARM_CHAR: -- cgit v1.2.3 From 8b3ca9564b1eeef6fd9d6296499594cfc8fec3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 14 Aug 2020 22:41:04 +0300 Subject: Continue to Frontend, fix savegame list bug --- src/control/Script.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 0c3d269c..e16ba9e0 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -12727,18 +12727,18 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) CollectParameters(&m_nIp, 1); CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; ScriptParams[0] = pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels; - ScriptParams[1] = pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels; + ScriptParams[1] = *(int*)&pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels; ScriptParams[2] = pPlayerInfo->m_nLastTimeSpentOnWheelie; - ScriptParams[3] = pPlayerInfo->m_nLastDistanceTravelledOnWheelie; + ScriptParams[3] = *(int*)&pPlayerInfo->m_nLastDistanceTravelledOnWheelie; ScriptParams[4] = pPlayerInfo->m_nLastTimeSpentOnStoppie; - ScriptParams[5] = pPlayerInfo->m_nLastDistanceTravelledOnStoppie; + ScriptParams[5] = *(int*)&pPlayerInfo->m_nLastDistanceTravelledOnStoppie; StoreParameters(&m_nIp, 6); pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels = 0; - pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels = 0; + pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels = 0.0f; pPlayerInfo->m_nLastTimeSpentOnWheelie = 0; - pPlayerInfo->m_nLastDistanceTravelledOnWheelie = 0; + pPlayerInfo->m_nLastDistanceTravelledOnWheelie = 0.0f; pPlayerInfo->m_nLastTimeSpentOnStoppie = 0; - pPlayerInfo->m_nLastDistanceTravelledOnStoppie = 0; + pPlayerInfo->m_nLastDistanceTravelledOnStoppie = 0.0f; return 0; } //case COMMAND_DISARM_CHAR: -- cgit v1.2.3 From 980dd1b5a17440e9a272b7b47ad3553cd1ce11ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 16 Aug 2020 17:10:59 +0300 Subject: 2 new opcodes --- src/control/Script.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index e16ba9e0..e3ee5503 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1824,7 +1824,7 @@ void CMissionCleanup::Process() CWorld::Players[0].MakePlayerSafe(false); CWorld::Players[0].m_pPed->m_nFadeDrunkenness = 1; CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0; - // CPad::GetPad(0)->SetDrunkInputDelay(0); // TODO(Miami) + CPad::GetPad(0)->SetDrunkInputDelay(0); CWorld::Players[0].m_bDriveByAllowed = true; // DMAudio::ShutUpPlayerTalking(0); // TODO(Miami) CVehicle::bDisableRemoteDetonation = false; @@ -10645,7 +10645,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) case COMMAND_SET_DRUNK_INPUT_DELAY: { CollectParameters(&m_nIp, 2); - debug("SET_DRUNK_INPUT_DELAY not implemented\n"); + assert(ScriptParams[1] < CPad::DRUNK_STEERING_BUFFER_SIZE); + CPad::GetPad(ScriptParams[0])->SetDrunkInputDelay(ScriptParams[1]); return 0; } case COMMAND_SET_CHAR_MONEY: @@ -13606,9 +13607,11 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_GET_BUS_FARES_COLLECTED_BY_PLAYER: { CollectParameters(&m_nIp, 1); - debug("GET_BUS_FARES_COLLECTED_BY_PLAYER not implemented\n"); // TODO(MIAMI) - ScriptParams[0] = 0; + CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; + ScriptParams[0] = pPlayerInfo->m_pPed->m_nLastBusFareCollected; + pPlayerInfo->m_pPed->m_nLastBusFareCollected = 0; StoreParameters(&m_nIp, 1); + return 0; } case COMMAND_SET_CHAR_OBJ_BUY_ICE_CREAM: { -- cgit v1.2.3 From 732681db08438f0d61ad7fe4d670f79feaac7b9e Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 16 Aug 2020 17:26:44 +0300 Subject: Island loading and PS2 alpha test added to options --- src/control/Record.cpp | 8 ++++--- src/control/Script.cpp | 60 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 22 deletions(-) (limited to 'src/control') diff --git a/src/control/Record.cpp b/src/control/Record.cpp index 8dc0028a..8a23ffde 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -9,6 +9,7 @@ #include "Timer.h" #include "VehicleModelInfo.h" #include "World.h" +#include "Frontend.h" uint16 CRecordDataForGame::RecordingState; uint8* CRecordDataForGame::pDataBuffer; @@ -439,10 +440,11 @@ void CRecordDataForChase::StartChaseScene(float startTime) Status = STATE_PLAYBACK; AnimTime = startTime; AnimStartTime = CTimer::GetTimeInMilliseconds(); -#ifndef NO_ISLAND_LOADING - RemoveUnusedCollision(); - CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + RemoveUnusedCollision(); + CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); CGame::TidyUpMemory(true, true); CStreaming::ImGonnaUseStreamingMemory(); CFileMgr::SetDir("data\\paths"); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 6eb802b4..fa0fb463 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -10017,15 +10017,21 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; -#ifndef NO_ISLAND_LOADING - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + } CCollision::SortOutCollisionAfterLoad(); -#ifndef NO_ISLAND_LOADING - CStreaming::RequestIslands(CGame::currLevel); - CStreaming::LoadAllRequestedModels(true); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) #endif + { + CStreaming::RequestIslands(CGame::currLevel); + CStreaming::LoadAllRequestedModels(true); + } CTimer::Update(); return 0; } @@ -10641,24 +10647,40 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; if (CGame::currLevel != CCollision::ms_collisionInMemory) { -#ifndef NO_ISLAND_LOADING - DMAudio.SetEffectsFadeVol(0); - CPad::StopPadsShaking(); - CCollision::LoadCollisionScreen(CGame::currLevel); - DMAudio.Service(); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + DMAudio.SetEffectsFadeVol(0); + CPad::StopPadsShaking(); + CCollision::LoadCollisionScreen(CGame::currLevel); + DMAudio.Service(); + } CPopulation::DealWithZoneChange(CCollision::ms_collisionInMemory, CGame::currLevel, false); -#ifndef NO_ISLAND_LOADING - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + } CCollision::SortOutCollisionAfterLoad(); -#ifndef NO_ISLAND_LOADING - CStreaming::RequestIslands(CGame::currLevel); - CStreaming::RequestBigBuildings(CGame::currLevel); - CStreaming::LoadAllRequestedModels(true); - DMAudio.SetEffectsFadeVol(127); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) +#endif + CStreaming::RequestIslands(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) +#endif + CStreaming::RequestBigBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) +#endif + CStreaming::LoadAllRequestedModels(true); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + DMAudio.SetEffectsFadeVol(127); } CTimer::Update(); return 0; -- cgit v1.2.3 From d303c33c2e03edc4c4980a06afe81004f1ae430f Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 16 Aug 2020 18:39:11 +0300 Subject: CarCtrl finished, minor Script things --- src/control/CarCtrl.cpp | 52 +++++++++++- src/control/CarCtrl.h | 1 + src/control/Script.cpp | 222 ++++++++++++++++++++++++++---------------------- 3 files changed, 173 insertions(+), 102 deletions(-) (limited to 'src/control') diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index cd08753d..0d85d54f 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -81,6 +81,9 @@ #define OFFSCREEN_DESPAWN_RANGE (40.0f) #define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f) +//--MIAMI: file done + +bool CCarCtrl::bMadDriversCheat; int CCarCtrl::NumLawEnforcerCars; int CCarCtrl::NumAmbulancesOnDuty; int CCarCtrl::NumFiretrucksOnDuty; @@ -664,7 +667,7 @@ CCarCtrl::GenerateOneRandomCar() nMadDrivers = 6; break; } - if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers /* TODO(MIAMI): || mad drivers cheat */) { + if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers || bMadDriversCheat) { pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; pVehicle->AutoPilot.m_nCruiseSpeed += 10; @@ -2515,7 +2518,7 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe SteerAIBoatWithPhysicsAttackingPlayer(pVehicle, pSwerve, pAccel, pBrake, pHandbrake); return; case MISSION_PLANE_FLYTOCOORS: - //SteerAIPlaneTowardsTargetCoors((CAutomobile*)pVehicle); + SteerAIPlaneTowardsTargetCoors((CAutomobile*)pVehicle); return; case MISSION_SLOWLY_DRIVE_TOWARDS_PLAYER_1: SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, @@ -2737,6 +2740,51 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli) pHeli->GetMatrix().GetUp() = up; } +void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane) +{ + CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition(); + float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude(); + fForwardZ = clamp(fForwardZ, -0.3f, 0.3f); + float angle = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y); + while (angle > TWOPI) + angle -= TWOPI; + float difference = LimitRadianAngle(angle - pPlane->m_fOrientation); + float steer = difference > 0.0f ? 0.04f : -0.04f; + if (Abs(difference) < 0.2f) + steer *= 5.0f * Abs(difference); + pPlane->m_fPlaneSteer *= Pow(0.96, CTimer::GetTimeStep()); + float steerChange = steer - pPlane->m_fPlaneSteer; + float maxChange = 0.003f * CTimer::GetTimeStep(); + if (Abs(steerChange) < maxChange) + pPlane->m_fPlaneSteer = steer; + else if (steerChange < 0.0f) + pPlane->m_fPlaneSteer -= maxChange; + else + pPlane->m_fPlaneSteer += maxChange; + pPlane->m_fOrientation += pPlane->m_fPlaneSteer * CTimer::GetTimeStep(); + CVector up(0.0f, 0.0f, 1.0f); + up.Normalise(); + CVector forward(Cos(pPlane->m_fOrientation), Sin(pPlane->m_fOrientation), fForwardZ); + forward.Normalise(); + CVector right = CrossProduct(forward, up); + right.z -= 5.0f * pPlane->m_fPlaneSteer; + right.Normalise(); + up = CrossProduct(forward, right); + up.Normalise(); + right = CrossProduct(forward, up); + pPlane->GetMatrix().GetRight() = right; + pPlane->GetMatrix().GetForward() = forward; + pPlane->GetMatrix().GetUp() = up; + float newSplit = 1.0f - Pow(0.95, CTimer::GetTimeStep()); + float oldSplit = 1.0f - newSplit; +#ifdef FIX_BUGS + pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.GetCruiseSpeed() * 0.01f * forward * newSplit; +#else + pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.m_nCruiseSpeed * 0.01f * forward * newSplit; +#endif + pPlane->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); +} + void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerve, float* pAccel, float* pBrake, bool* pHandbrake) { CVector2D forward = pVehicle->GetForward(); diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h index 6b4e94ee..76491193 100644 --- a/src/control/CarCtrl.h +++ b/src/control/CarCtrl.h @@ -145,6 +145,7 @@ public: return angle; } + static bool bMadDriversCheat; static int32 NumLawEnforcerCars; static int32 NumAmbulancesOnDuty; static int32 NumFiretrucksOnDuty; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index e16ba9e0..6fbe6c81 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -3133,7 +3133,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) { CollectParameters(&m_nIp, 4); int32 index = ScriptParams[0]; - assert(index < NUMPLAYERS); + script_assert(index < NUMPLAYERS); printf("&&&&&&&&&&&&&Creating player: %d\n", index); if (!CStreaming::HasModelLoaded(MI_PLAYER)) { CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY); @@ -5174,7 +5174,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); if (pPed->bInVehicle) return 0; pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]); @@ -6000,7 +6000,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_DESTROY_OBJECT, pVehicle); @@ -10450,7 +10450,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_LEAVE_CAR, pPed->m_pMyVehicle); return 0; @@ -10652,7 +10652,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->m_nPedMoney = ScriptParams[1]; pPed->bMoneyHasBeenGivenByScript = true; return 0; @@ -10662,7 +10662,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 4); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CVector result = Multiply3x3(pObject->GetMatrix(), *(CVector*)&ScriptParams[1]) + pObject->GetPosition(); *(CVector*)&ScriptParams[0] = result; StoreParameters(&m_nIp, 3); @@ -10695,7 +10695,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 4); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CVector result = Multiply3x3(pVehicle->GetMatrix(), *(CVector*)&ScriptParams[1]) + pVehicle->GetPosition(); *(CVector*)&ScriptParams[0] = result; StoreParameters(&m_nIp, 3); @@ -11053,7 +11053,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(ScriptParams[1] < pVehicle->m_nNumMaxPassengers && pVehicle->pPassengers[ScriptParams[1]] == nil); return 0; } @@ -11204,7 +11204,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) return 0; */ case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED: - UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3); // TODO(MIAMI): more cheats! + UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3 || CVehicle::bHoverCheat || CVehicle::bCheat8); // TODO(MIAMI): more cheats! return 0; case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS: { @@ -11896,7 +11896,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->m_ceaseAttackTimer = ScriptParams[1]; return 0; } @@ -11932,7 +11932,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->m_nRouteSeed = ScriptParams[1]; return 0; } @@ -11949,7 +11949,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->ClearWeapons(); return 0; } @@ -11957,7 +11957,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); bool bFound = false; for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) { if (pPed->GetWeapon(i).m_eWeaponType == ScriptParams[1]) { @@ -11974,7 +11974,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle && pVehicle->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pVehicle && pVehicle->m_vehType == VEHICLE_TYPE_CAR); ((CAutomobile*)pVehicle)->bTankDetonateCars = ScriptParams[1]; return 0; } @@ -11993,7 +11993,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); bool bOnFire = false; if (pVehicle->m_pCarFire) bOnFire = true; @@ -12008,7 +12008,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); bool bIsBurst = false; CBike* pBike = (CBike*)pVehicle; if (pVehicle->m_vehType == VEHICLE_APPEARANCE_BIKE) { @@ -12081,7 +12081,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 5); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle && pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); + script_assert(pVehicle && pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); ((CAutomobile*)pVehicle)->TellHeliToGoToCoors(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], *(float*)&ScriptParams[3], ScriptParams[4]); return 0; } @@ -12124,7 +12124,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT); return 0; } @@ -12132,7 +12132,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT); return 0; } @@ -12140,7 +12140,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); return 0; } @@ -12148,7 +12148,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); return 0; } @@ -12156,7 +12156,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE); return 0; } @@ -12164,7 +12164,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); return 0; } @@ -12259,7 +12259,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); ScriptParams[0] = pPed->GetWeapon(ScriptParams[1]).m_eWeaponType; ScriptParams[1] = pPed->GetWeapon(ScriptParams[1]).m_nAmmoTotal; ScriptParams[2] = CPickups::ModelForWeapon((eWeaponType)ScriptParams[0]); @@ -12279,10 +12279,11 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); float speed = *(float*)&ScriptParams[1] / GAME_SPEED_TO_CARAI_SPEED; pVehicle->SetMoveSpeed(pVehicle->GetForward() * speed); - // TODO(MIAMI): heli hack! + if (pVehicle->IsRealHeli() && pVehicle->IsCar()) + ((CAutomobile*)pVehicle)->m_aWheelSpeed[1] = 0.22f; return 0; } case COMMAND_SET_AREA_VISIBLE: @@ -12303,7 +12304,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bPartOfConvoy = ScriptParams[1]; return 0; } @@ -12335,9 +12336,9 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pTargetPed); + script_assert(pTargetPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING, pTargetPed); return 0; @@ -12347,7 +12348,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 4); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVector result = Multiply3x3(pPed->GetMatrix(), *(CVector*)&ScriptParams[1]) + pPed->GetPosition(); *(CVector*)&ScriptParams[0] = result; StoreParameters(&m_nIp, 3); @@ -12357,7 +12358,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); bool result = false; if (pPed->bHasBeenPhotographed) { result = true; @@ -12370,9 +12371,9 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pTargetPed); + script_assert(pTargetPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_AIM_GUN_AT, pTargetPed); return 0; @@ -12388,7 +12389,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && (pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI || pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE)); return 0; } @@ -12418,7 +12419,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); + script_assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); float fAngle = DEGTORAD(*(float*)&ScriptParams[1] - 90.0f); while (fAngle < 0.0f) fAngle += TWOPI; @@ -12431,14 +12432,16 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); + script_assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); pHeli->ClearHeliOrientation(); return 0; } case COMMAND_PLANE_GOTO_COORDS: { CollectParameters(&m_nIp, 5); - debug("PLANE_GOTO_COORS is not implemented\n"); // TODO(MIAMI) + CAutomobile* pPlane = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + script_assert(pPlane && pPlane->IsCar() && pPlane->IsRealPlane()); + pPlane->TellPlaneToGoToCoors(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], *(float*)&ScriptParams[3], ScriptParams[4]); return 0; } case COMMAND_GET_NTH_CLOSEST_CAR_NODE: @@ -12470,7 +12473,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bIsFrozen = ScriptParams[1]; return 0; } @@ -12478,7 +12481,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bDrownsInWater = ScriptParams[1]; return 0; } @@ -12486,7 +12489,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->bUseCollisionRecords = ScriptParams[1]; return 0; } @@ -12494,7 +12497,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); UpdateCompareFlag(pObject->m_nCollisionRecords != 0); return 0; } @@ -12508,7 +12511,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); ScriptParams[0] = pPed->m_fArmour; StoreParameters(&m_nIp, 1); return 0; @@ -12518,7 +12521,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bHeliMinimumTilt = ScriptParams[1]; return 0; } @@ -12526,7 +12529,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->AutoPilot.m_nSwitchDistance = ScriptParams[1]; return 0; } @@ -12534,7 +12537,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pCar&& pCar->IsCar()); + script_assert(pCar&& pCar->IsCar()); pCar->PopBoot(); return 0; } @@ -12567,7 +12570,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); UpdateCompareFlag(pObject->bIsInWater); return 0; } @@ -12580,7 +12583,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) { pPed->bIsDucking = true; pPed->SetDuck(ScriptParams[2], true); @@ -12644,7 +12647,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bIsStaticWaitingForCollision); return 0; } @@ -12652,7 +12655,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->bIsStaticWaitingForCollision); return 0; } @@ -12660,7 +12663,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); UpdateCompareFlag(pObject->bIsStaticWaitingForCollision); return 0; } @@ -12683,7 +12686,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bIsPlayerFriend = ScriptParams[2]; return 0; } @@ -12691,7 +12694,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_DISPLAY_NTH_ONSCREEN_COUNTER_WITH_STRING: { char onscreen_str[12]; - assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); + script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); int16 var = CTheScripts::Read2BytesFromScript(&m_nIp); CollectParameters(&m_nIp, 2); wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? @@ -12762,7 +12765,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->m_prevObjective == OBJECTIVE_NONE && pPed->m_objective == OBJECTIVE_NONE); return 0; } @@ -12775,7 +12778,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++) key[i] = tolower(key[i]); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(strcmp(key, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName()) == 0); return 0; } @@ -12790,7 +12793,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVector pos; pos.x = *(float*)&ScriptParams[1]; pos.y = *(float*)&ScriptParams[2]; @@ -12823,7 +12826,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pCar&& pCar->IsCar()); + script_assert(pCar&& pCar->IsCar()); pCar->CloseAllDoors(); return 0; } @@ -12845,7 +12848,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pCar && pCar->IsCar()); + script_assert(pCar && pCar->IsCar()); pCar->PopBootUsingPhysics(); return 0; } @@ -12854,7 +12857,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE); return 0; } @@ -12862,7 +12865,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->m_pCollidingEntity = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); return 0; } @@ -12871,7 +12874,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 5); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(CWorld::IsWanderPathClear(pPed->GetPosition(), *(CVector*)&ScriptParams[0], *(float*)&ScriptParams[3], 4)); return 0; } @@ -12884,7 +12887,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) } //case COMMAND_PRINT_HELP_FOREVER_WITH_NUMBER: default: - assert(0); + script_assert(0); } return -1; } @@ -12896,7 +12899,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 3); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pTarget); + script_assert(pTarget); uint8 flag = 1 << (uint8)ScriptParams[1]; if (ScriptParams[2]) pTarget->m_gangFlags |= flag; @@ -12942,7 +12945,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bIsFrozen = ScriptParams[1]; return 0; } @@ -13010,7 +13013,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bStayInCarOnJack = ScriptParams[1]; return 0; } @@ -13075,7 +13078,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bDontFight = !ScriptParams[1]; return 0; } @@ -13083,7 +13086,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->ClearWaitState(); return 0; } @@ -13118,7 +13121,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bTyresDontBurst = !ScriptParams[1]; return 0; } @@ -13126,7 +13129,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); pPed->bDoomAim = ScriptParams[1]; return 0; } @@ -13165,7 +13168,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); CPhysical* pTestedEntity = pPed; if (pPed->bInVehicle && pPed->m_pMyVehicle) @@ -13197,7 +13200,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (pPed->GetPedState() == PED_FOLLOW_PATH) { pPed->RestorePreviousState(); pPed->ClearFollowPath(); @@ -13208,7 +13211,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bCanBeShotInVehicle = ScriptParams[1]; return 0; } @@ -13247,7 +13250,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->bIsFrozen = ScriptParams[1]; return 0; } @@ -13383,7 +13386,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bIgnoreThreatsBehindObjects = ScriptParams[1]; return 0; } @@ -13391,7 +13394,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); if (pPed->bInVehicle) { if (pPed->GetWeapon(5).m_eWeaponType) { // TODO(MIAMI): enum if (pPed->GetWeapon(5).m_nAmmoTotal < ScriptParams[1]) @@ -13410,7 +13413,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 1); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); + script_assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli()); pHeli->bHeliDestroyed = true; return 0; } @@ -13424,7 +13427,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->m_area = ScriptParams[1]; return 0; } @@ -13433,7 +13436,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bNeverEverTargetThisPed = ScriptParams[1]; return 0; } @@ -13454,7 +13457,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bCrouchWhenScared = true; return 0; } @@ -13462,7 +13465,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle && pPed->m_pMyVehicle->IsLawEnforcementVehicle() && pPed->m_pMyVehicle->GetModelIndex() != MI_PREDATOR); @@ -13491,7 +13494,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->m_nWaitState == WAITSTATE_STUCK); return 0; } @@ -13505,7 +13508,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) { pPed->bKindaStayInSamePlace = true; pPed->bStopAndShoot = true; @@ -13521,7 +13524,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); if (ScriptParams[1]) { pVehicle->bIsFrozen = true; pVehicle->bInfiniteMass = true; @@ -13541,7 +13544,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_FREEZE_OBJECT_POSITION_AND_DONT_LOAD_COLLISION: //case COMMAND_SET_FADE_AND_JUMPCUT_AFTER_RC_EXPLOSION: default: - assert(0); + script_assert(0); } return -1; } @@ -13557,7 +13560,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (!pPed->bInVehicle) { pPed->m_pVehicleAnim = nil; pPed->RestartNonPartialAnims(); @@ -13614,9 +13617,9 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); + script_assert(pVehicle); ScriptParams[0] = 0; if (pPed->m_objective == OBJECTIVE_NONE && !pPed->bHasAlreadyUsedAttractor) { C2dEffect* pEffect = (C2dEffect*)GetPedAttractorManager()->GetEffectForIceCreamVan(pVehicle, pPed->GetPosition()); // has to be casted, because inner methods are const @@ -13658,7 +13661,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (pPed->m_attractor) GetPedAttractorManager()->DeRegisterPed(pPed, pPed->m_attractor); return 0; @@ -13670,7 +13673,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bHasAlreadyUsedAttractor); return 0; } @@ -13678,7 +13681,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); if (ScriptParams[1]) { pVehicle->bDontLoadCollision = false; if (m_bMissionFlag) { @@ -13701,7 +13704,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) { pPed->bDontLoadCollision = false; if (m_bMissionFlag) { @@ -13731,7 +13734,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bBoughtIceCream); return 0; } @@ -13805,20 +13808,39 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } //case COMMAND_GET_RANDOM_ICE_CREAM_CUSTOMER_IN_ZONE: case COMMAND_UNLOCK_ALL_CAR_DOORS_IN_AREA: + { CollectParameters(&m_nIp, 4); - debug("UNLOCK_ALL_CAR_DOORS_IN_AREA not implemented\n"); // TODO(MIAMI) + uint32 i = CPools::GetVehiclePool()->GetSize(); + float infX = *(float*)&ScriptParams[0]; + float infY = *(float*)&ScriptParams[1]; + float supX = *(float*)&ScriptParams[2]; + float supY = *(float*)&ScriptParams[3]; + while (i--) { + CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); + if (!pVehicle) + continue; + if (pVehicle->IsWithinArea(infX, infY, supX, supY)) + pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; + } return 0; + } case COMMAND_SET_GANG_ATTACK_PLAYER_WITH_COPS: CollectParameters(&m_nIp, 2); CGangs::SetWillAttackPlayerWithCops((ePedType)((int)PEDTYPE_GANG1 + ScriptParams[0]), !!ScriptParams[1]); return 0; case COMMAND_SET_CHAR_FRIGHTENED_IN_JACKED_CAR: - assert(0); + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + script_assert(pPed); + pPed->bHeldHostageInCar = ScriptParams[1]; + return 0; + } case COMMAND_SET_VEHICLE_TO_FADE_IN: { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), ScriptParams[1]); return 0; } @@ -13832,7 +13854,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle && pPed->m_pMyVehicle == CGameLogic::pShortCutTaxi); return 0; } @@ -13840,7 +13862,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_DUCK_DOWN) != nil); return 0; } @@ -13880,7 +13902,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) return 0; } default: - assert(0); + script_assert(0); } return -1; } @@ -14860,7 +14882,7 @@ void CRunningScript::LocateObjectCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 8 : 6); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CVector pos = pObject->GetPosition(); X = *(float*)&ScriptParams[1]; Y = *(float*)&ScriptParams[2]; @@ -15415,7 +15437,7 @@ void CRunningScript::ObjectInAreaCheckCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 8 : 6); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CVector pos = pObject->GetPosition(); infX = *(float*)&ScriptParams[1]; infY = *(float*)&ScriptParams[2]; @@ -15468,7 +15490,7 @@ void CRunningScript::ObjectInAreaCheckCommand(int32 command, uint32* pIp) result = true; break; default: - assert(false); + script_assert(false); break; } } -- cgit v1.2.3 From b03f13b30dd71690aecb6ee8ffad9975d05ad973 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 18 Aug 2020 16:52:02 +0300 Subject: fixed bugfix --- src/control/Garages.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 33675ecf..1719028b 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1884,8 +1884,9 @@ CVehicle* CStoredCar::RestoreCar() pVehicle->m_nRadioStation = m_nRadioStation; pVehicle->bFreebies = false; #ifdef FIX_BUGS - ((CAutomobile*)pVehicle)->m_bombType = m_nCarBombType; + if (pVehicle->IsCar()) #endif + ((CAutomobile*)pVehicle)->m_bombType = m_nCarBombType; pVehicle->bHasBeenOwnedByPlayer = true; pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; pVehicle->bBulletProof = m_bBulletproof; -- cgit v1.2.3 From db1e5a6ec43246089e5e840b40b189c2c5e37183 Mon Sep 17 00:00:00 2001 From: Jack Powell Date: Tue, 18 Aug 2020 16:47:15 +0100 Subject: Fix small logic mistake in CGarage::RemoveCarsBlockingDoorNotInside --- src/control/Garages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 1719028b..c9112f81 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1384,7 +1384,7 @@ void CGarage::RemoveCarsBlockingDoorNotInside() if (pVehicle->GetPosition().x < m_fX1 || pVehicle->GetPosition().x > m_fX2 || pVehicle->GetPosition().y < m_fY1 || pVehicle->GetPosition().y > m_fY2 || pVehicle->GetPosition().z < m_fZ1 || pVehicle->GetPosition().z > m_fZ2) { - if (pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { + if (!pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { CWorld::Remove(pVehicle); delete pVehicle; return; // WHY? -- cgit v1.2.3 From 809c09938a47a030a386fead465147b753ac4286 Mon Sep 17 00:00:00 2001 From: Jack Powell Date: Tue, 18 Aug 2020 16:59:19 +0100 Subject: CREATE_RANDOM_CAR_FOR_CAR_PARK is supposed to be RANDOM_VEHICLE --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index fa0fb463..93c1ffe3 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -9700,7 +9700,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) return 0; CVehicle* car; if (!CModelInfo::IsBikeModel(model)) - car = new CAutomobile(model, MISSION_VEHICLE); + car = new CAutomobile(model, RANDOM_VEHICLE); CVector pos = *(CVector*)&ScriptParams[0]; pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); car->SetPosition(pos); -- cgit v1.2.3 From f09abe9ec13501d476d9277f3cfbcb098a545796 Mon Sep 17 00:00:00 2001 From: Jack Powell Date: Tue, 18 Aug 2020 17:14:27 +0100 Subject: Added bug fix to fix mission related crashes --- src/control/CarCtrl.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/control') diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 5db674cd..c6d90dd9 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -726,6 +726,10 @@ CCarCtrl::RemoveDistantCars() void CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle) { +#ifdef FIX_BUGS + if (pVehicle->bIsLocked) + return; +#endif CVector vecPlayerPos = FindPlayerCentreOfWorld(CWorld::PlayerInFocus); /* BUG: this variable is initialized only in if-block below but can be used outside of it. */ if (!IsThisVehicleInteresting(pVehicle) && !pVehicle->bIsLocked && -- cgit v1.2.3 From 4d1cfb7214a4867487f128c7e3360681f47e0239 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 19 Aug 2020 03:31:42 +0300 Subject: Island loading cleanup and fix --- src/control/Script.cpp | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 93c1ffe3..e9808643 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -10017,17 +10017,13 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + ISLAND_LOADING_IS(LOW) { CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); CStreaming::RemoveUnusedBuildings(CGame::currLevel); } CCollision::SortOutCollisionAfterLoad(); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) -#endif + ISLAND_LOADING_ISNT(HIGH) { CStreaming::RequestIslands(CGame::currLevel); CStreaming::LoadAllRequestedModels(true); @@ -10647,9 +10643,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; if (CGame::currLevel != CCollision::ms_collisionInMemory) { -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + ISLAND_LOADING_IS(LOW) { DMAudio.SetEffectsFadeVol(0); CPad::StopPadsShaking(); @@ -10657,29 +10651,24 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) DMAudio.Service(); } CPopulation::DealWithZoneChange(CCollision::ms_collisionInMemory, CGame::currLevel, false); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + + ISLAND_LOADING_IS(LOW) { CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); CStreaming::RemoveUnusedBuildings(CGame::currLevel); } CCollision::SortOutCollisionAfterLoad(); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) -#endif + + ISLAND_LOADING_ISNT(HIGH) CStreaming::RequestIslands(CGame::currLevel); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + + ISLAND_LOADING_IS(LOW) CStreaming::RequestBigBuildings(CGame::currLevel); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) -#endif + + ISLAND_LOADING_ISNT(HIGH) CStreaming::LoadAllRequestedModels(true); -#ifdef NO_ISLAND_LOADING - if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) -#endif + + ISLAND_LOADING_IS(LOW) DMAudio.SetEffectsFadeVol(127); } CTimer::Update(); -- cgit v1.2.3 From 03c90b7c4028d0db1e6eddf6c63c0842c136517a Mon Sep 17 00:00:00 2001 From: majestic Date: Wed, 19 Aug 2020 11:11:19 -0700 Subject: stable CScriptPaths --- src/control/Replay.cpp | 5 ++++- src/control/Script.cpp | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/control') diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 1a050bee..80c05f31 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -39,6 +39,7 @@ #include "Text.h" #include "Camera.h" #include "Radar.h" +#include "Fluff.h" uint8 CReplay::Mode; CAddressInReplayBuffer CReplay::Record; @@ -229,7 +230,7 @@ void CReplay::EnableReplays(void) void PlayReplayFromHD(void); void CReplay::Update(void) { - if (CCutsceneMgr::IsCutsceneProcessing() || CTimer::GetIsPaused()) + if (CCutsceneMgr::IsCutsceneProcessing() || CTimer::GetIsPaused() || CScriptPaths::IsOneActive()) return; switch (Mode){ case MODE_RECORD: @@ -1175,6 +1176,7 @@ void CReplay::StoreStuffInMem(void) if (ped) StoreDetailedPedAnimation(ped, &pPedAnims[i]); } + CScriptPaths::Save_ForReplay(); } void CReplay::RestoreStuffFromMem(void) @@ -1351,6 +1353,7 @@ void CReplay::RestoreStuffFromMem(void) } delete[] pPedAnims; pPedAnims = nil; + CScriptPaths::Load_ForReplay(); DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.SetRadioInCar(OldRadioStation); DMAudio.ChangeMusicMode(MUSICMODE_GAME); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index e470cad2..3b0e2201 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -82,6 +82,7 @@ #include "main.h" #include "Ropes.h" #include "MBlur.h" +#include "Fluff.h" #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #include #endif @@ -12046,36 +12047,42 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) //case COMMAND_IS_PLAYER_STANDING_ON_A_VEHICLE: //case COMMAND_IS_PLAYER_FOOT_DOWN: //case COMMAND_IS_CHAR_FOOT_DOWN: - case COMMAND_INITIALISE_OBJECT_PATH: - // TODO(MIAMI): script path + case COMMAND_INITIALISE_OBJECT_PATH: { CollectParameters(&m_nIp, 2); - debug("INITALISE_OBJECT_PATH not yet implemented, skipping\n"); - ScriptParams[0] = 0; + int32 counter = 0; + while (counter < 3 && CScriptPaths::aArray[counter].m_state != SCRIPT_PATH_DISABLED) { + counter++; + } + CScriptPaths::aArray[counter].InitialiseOne(ScriptParams[0], *(float*)&ScriptParams[1]); + ScriptParams[0] = counter; StoreParameters(&m_nIp, 1); return 0; + } case COMMAND_START_OBJECT_ON_PATH: { CollectParameters(&m_nIp, 2); - debug("START_OBJECT_ON_PATH not yet implemented, skipping\n"); + CObject *pObj = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + assert(pObj); + CScriptPaths::aArray[ScriptParams[1]].SetObjectToControl(pObj); return 0; } case COMMAND_SET_OBJECT_PATH_SPEED: { CollectParameters(&m_nIp, 2); - debug("SET_OBJECT_PATH_SPEED not yet implemented, skipping\n"); + CScriptPaths::aArray[ScriptParams[0]].m_fSpeed = *(float*)&ScriptParams[1]; return 0; } case COMMAND_SET_OBJECT_PATH_POSITION: { CollectParameters(&m_nIp, 2); - debug("SET_OBJECT_PATH_POSITION not yet implemented, skipping\n"); + CScriptPaths::aArray[ScriptParams[0]].m_fPosition = *(float*)&ScriptParams[1]; return 0; } //case COMMAND_GET_OBJECT_DISTANCE_ALONG_PATH: case COMMAND_CLEAR_OBJECT_PATH: { CollectParameters(&m_nIp, 1); - debug("CLEAR_OBJECT_PATH not yet implemented, skipping\n"); + CScriptPaths::aArray[ScriptParams[0]].Clear(); return 0; } case COMMAND_HELI_GOTO_COORDS: -- cgit v1.2.3 From a6fe606ce687b67c238f8671cf2dda5c840654c8 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 20 Aug 2020 23:43:13 +0200 Subject: CStreaming done, hopefully --- src/control/Script.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Script.h b/src/control/Script.h index 3577b401..ba315c46 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -374,10 +374,10 @@ private: static int32 GetNewUniqueScriptSphereIndex(int32 index); static void RemoveScriptSphere(int32 index); static void RemoveScriptTextureDictionary(); +public: static void RemoveThisPed(CPed* pPed); #ifdef MISSION_SWITCHER -public: static void SwitchToMission(int32 mission); #endif -- cgit v1.2.3 From 537b63acb50fcf482f518f11a62c766197f50a20 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 21 Aug 2020 00:05:05 +0200 Subject: call streaming funcs --- src/control/GameLogic.cpp | 2 +- src/control/Script.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src/control') diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index f4e4fdd4..c5394e7c 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -372,7 +372,7 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector CWorld::ClearExcitingStuffFromArea(pos, 4000.0, 1); pPlayerPed->RestoreHeadingRate(); CGame::currArea = AREA_MAIN_MAP; - //CStreaming::RemoveBuildingsNotInArea(0); // TODO(MIAMI) + CStreaming::RemoveBuildingsNotInArea(0); TheCamera.SetCameraDirectlyInFrontForFollowPed_CamOnAString(); TheCamera.Restore(); CReferences::RemoveReferencesToPlayer(); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index fb95e834..ea94794b 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -12308,8 +12308,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_SET_AREA_VISIBLE: CollectParameters(&m_nIp, 1); CGame::currArea = ScriptParams[0]; - // TODO(MIAMI) !! - //CStreaming::RemoveBuildingsNotInArea(ScriptParams[0]); + CStreaming::RemoveBuildingsNotInArea(ScriptParams[0]); return 0; case COMMAND_SET_CUTSCENE_ANIM_TO_LOOP: { -- cgit v1.2.3 From 0fd6fb1ff4b849a857ba1023421aa9232ba5ce15 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 23 Aug 2020 12:27:24 +0300 Subject: fixed a few embarassing mistakes --- src/control/CarCtrl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/control') diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 64049793..5b2454ac 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -161,7 +161,7 @@ CCarCtrl::GenerateOneRandomCar() carModel = ChoosePoliceCarModel(); }else{ carModel = ChooseModel(&zone, &vecTargetPos, &carClass); - if (carClass == COPS && pWanted->m_nWantedLevel >= 1 || carModel < 0) + if (carModel == -1 || (carClass == COPS && pWanted->m_nWantedLevel >= 1)) /* All cop spawns with wanted level are handled by condition above. */ /* In particular it means that cop cars never spawn if player has wanted level of 1. */ return; @@ -761,7 +761,8 @@ CCarCtrl::ChooseCarRating(CZoneInfo* pZoneInfo) int32 CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) { int32 model = -1; - for (int i = 0; i < 10 && (model == -1 || !CStreaming::HasModelLoaded(model)); i++) { + int32 i; + for (i = 10; i > 0 && (model == -1 || !CStreaming::HasModelLoaded(model)); i--) { int rnd = CGeneral::GetRandomNumberInRange(0, 1000); if (rnd < pZone->copThreshold) { @@ -770,9 +771,9 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) { continue; } - int j; + int32 j; for (j = 0; j < NUM_GANG_CAR_CLASSES; j++) { - if (rnd < pZone->gangThreshold[i]) { + if (rnd < pZone->gangThreshold[j]) { *pClass = j + FIRST_GANG_CAR_RATING; model = ChooseGangCarModel(j); break; @@ -785,6 +786,8 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) { *pClass = ChooseCarRating(pZone); model = ChooseCarModel(*pClass); } + if (i == 0) + return -1; return model; } -- cgit v1.2.3 From bbcf3fd7d2e699b0fb7e2cceda8e002dfa61ab3f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 24 Aug 2020 21:52:16 +0300 Subject: CutsceneMgr done --- src/control/CarCtrl.cpp | 4 ++-- src/control/Script.cpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/control') diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 5b2454ac..74c4f006 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -2759,7 +2759,7 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane) float steer = difference > 0.0f ? 0.04f : -0.04f; if (Abs(difference) < 0.2f) steer *= 5.0f * Abs(difference); - pPlane->m_fPlaneSteer *= Pow(0.96, CTimer::GetTimeStep()); + pPlane->m_fPlaneSteer *= Pow(0.96f, CTimer::GetTimeStep()); float steerChange = steer - pPlane->m_fPlaneSteer; float maxChange = 0.003f * CTimer::GetTimeStep(); if (Abs(steerChange) < maxChange) @@ -2782,7 +2782,7 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane) pPlane->GetMatrix().GetRight() = right; pPlane->GetMatrix().GetForward() = forward; pPlane->GetMatrix().GetUp() = up; - float newSplit = 1.0f - Pow(0.95, CTimer::GetTimeStep()); + float newSplit = 1.0f - Pow(0.95f, CTimer::GetTimeStep()); float oldSplit = 1.0f - newSplit; #ifdef FIX_BUGS pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.GetCruiseSpeed() * 0.01f * forward * newSplit; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index ea94794b..bf761a3f 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -13017,14 +13017,20 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) case COMMAND_ATTACH_CUTSCENE_OBJECT_TO_BONE: { CollectParameters(&m_nIp, 3); - debug("ATTACH_CUTSCENE_OBJECT_TO_BONE not implemented, skipping\n"); // TODO(MIAMI) + CCutsceneMgr::AttachObjectToBone(CPools::GetObjectPool()->GetAt(ScriptParams[0]), CPools::GetObjectPool()->GetAt(ScriptParams[1]), ScriptParams[2]); return 0; } case COMMAND_ATTACH_CUTSCENE_OBJECT_TO_COMPONENT: { CollectParameters(&m_nIp, 2); - debug("ATTACH_CUTSCENE_OBJECT_TO_COMPONENT not implemented, skipping\n"); // TODO(MIAMI) + CObject *obj1 = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject *obj2 = CPools::GetObjectPool()->GetAt(ScriptParams[1]); + + char key[KEY_LENGTH_IN_SCRIPT]; + CTheScripts::ReadTextLabelFromScript(&m_nIp, key); m_nIp += KEY_LENGTH_IN_SCRIPT; + + CCutsceneMgr::AttachObjectToFrame(obj1, obj2, key); return 0; } case COMMAND_SET_CHAR_STAY_IN_CAR_WHEN_JACKED: @@ -13236,7 +13242,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) case COMMAND_ATTACH_CUTSCENE_OBJECT_TO_VEHICLE: { CollectParameters(&m_nIp, 2); - debug("ATTACH_CUTSCENE_OBJECT_TO_VEHICLE not implemented\n"); // TODO(MIAMI) + CCutsceneMgr::AttachObjectToParent(CPools::GetObjectPool()->GetAt(ScriptParams[0]), CPools::GetVehiclePool()->GetAt(ScriptParams[1])); return 0; } case COMMAND_LOAD_MISSION_TEXT: -- cgit v1.2.3 From 14ed50a5591bacf857c33f78e6cef8c72ac8325d Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 24 Aug 2020 22:52:07 +0300 Subject: Remote done --- src/control/Remote.cpp | 21 +++++++++++++++------ src/control/Remote.h | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src/control') diff --git a/src/control/Remote.cpp b/src/control/Remote.cpp index 904e9023..714f9843 100644 --- a/src/control/Remote.cpp +++ b/src/control/Remote.cpp @@ -9,6 +9,8 @@ #include "PlayerInfo.h" #include "Vehicle.h" +//--MIAMI: file done + void CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uint16 model) { @@ -35,17 +37,24 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = car; CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->RegisterReference((CEntity**)&CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle); - TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT); + if (car->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE || car->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI) { + TheCamera.TakeControl(car, CCam::MODE_CAM_ON_A_STRING, INTERPOLATION, CAMCONTROL_SCRIPT); + TheCamera.SetZoomValueCamStringScript(0); + } else + TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT); } void -CRemote::TakeRemoteControlledCarFromPlayer(void) +CRemote::TakeRemoteControlledCarFromPlayer(bool unk) { - CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->VehicleCreatedBy = RANDOM_VEHICLE; - CCarCtrl::NumMissionCars--; - CCarCtrl::NumRandomCars++; + if (CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->VehicleCreatedBy == MISSION_VEHICLE) { + CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->VehicleCreatedBy = RANDOM_VEHICLE; + CCarCtrl::NumMissionCars--; + CCarCtrl::NumRandomCars++; + } CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bIsLocked = false; CWorld::Players[CWorld::PlayerInFocus].m_nTimeLostRemoteCar = CTimer::GetTimeInMilliseconds(); CWorld::Players[CWorld::PlayerInFocus].m_bInRemoteMode = true; - CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bRemoveFromWorld = true; + CWorld::Players[CWorld::PlayerInFocus].field_D5 = unk; + CWorld::Players[CWorld::PlayerInFocus].field_D6 = true; } diff --git a/src/control/Remote.h b/src/control/Remote.h index 5e474586..250641ca 100644 --- a/src/control/Remote.h +++ b/src/control/Remote.h @@ -4,5 +4,5 @@ class CRemote { public: static void GivePlayerRemoteControlledCar(float, float, float, float, uint16); - static void TakeRemoteControlledCarFromPlayer(void); + static void TakeRemoteControlledCarFromPlayer(bool); }; -- cgit v1.2.3 From 963e85f047965e0c0a1a8e50ca35e9368a2028b6 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 24 Aug 2020 23:01:51 +0300 Subject: Fix --- src/control/Remote.cpp | 4 ++-- src/control/Remote.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/control') diff --git a/src/control/Remote.cpp b/src/control/Remote.cpp index 714f9843..164a2f4c 100644 --- a/src/control/Remote.cpp +++ b/src/control/Remote.cpp @@ -45,7 +45,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin } void -CRemote::TakeRemoteControlledCarFromPlayer(bool unk) +CRemote::TakeRemoteControlledCarFromPlayer(bool blowUp) { if (CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->VehicleCreatedBy == MISSION_VEHICLE) { CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->VehicleCreatedBy = RANDOM_VEHICLE; @@ -55,6 +55,6 @@ CRemote::TakeRemoteControlledCarFromPlayer(bool unk) CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bIsLocked = false; CWorld::Players[CWorld::PlayerInFocus].m_nTimeLostRemoteCar = CTimer::GetTimeInMilliseconds(); CWorld::Players[CWorld::PlayerInFocus].m_bInRemoteMode = true; - CWorld::Players[CWorld::PlayerInFocus].field_D5 = unk; + CWorld::Players[CWorld::PlayerInFocus].field_D5 = blowUp; CWorld::Players[CWorld::PlayerInFocus].field_D6 = true; } diff --git a/src/control/Remote.h b/src/control/Remote.h index 250641ca..72cabb7c 100644 --- a/src/control/Remote.h +++ b/src/control/Remote.h @@ -4,5 +4,5 @@ class CRemote { public: static void GivePlayerRemoteControlledCar(float, float, float, float, uint16); - static void TakeRemoteControlledCarFromPlayer(bool); + static void TakeRemoteControlledCarFromPlayer(bool blowUp = true); }; -- cgit v1.2.3