From a1c241af37c31ea94e908eb719f80e6421f8b73d Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 30 Aug 2021 02:46:28 +0300 Subject: [PATCH] script revision p2 --- src/control/Pickups.cpp | 6 ++++-- src/control/Script.cpp | 2 +- src/control/Script10.cpp | 4 ++++ src/control/Script6.cpp | 6 ++++++ src/control/Script7.cpp | 14 ++++++-------- src/control/Script8.cpp | 11 +++-------- src/control/Script9.cpp | 7 ++++++- src/modelinfo/ModelIndices.h | 4 ---- 8 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index f31d89b3..020083cf 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -709,8 +709,10 @@ bool CPickups::TestForPickupsInBubble(CVector pos, float range) { for (int i = 0; i < NUMPICKUPS; i++) { - if ((aPickUps[i].m_vecPos - pos).Magnitude() < range) - return true; + if (aPickUps[i].m_eType != PICKUP_NONE) { + if ((aPickUps[i].m_vecPos - pos).Magnitude() < range) + return true; + } } return false; } diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 26d9d380..fc62aab7 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -442,7 +442,7 @@ void CMissionCleanup::Process() #endif CStreaming::ms_disableStreaming = false; if (CHud::m_ItemToFlash != ITEM_ARMOUR && CHud::m_ItemToFlash != ITEM_HEALTH) - CHud::m_ItemToFlash = -1; + CHud::m_ItemToFlash = ITEM_NONE; CHud::SetHelpMessage(nil, false); // nil, false, false, true TODO(LCS) CUserDisplay::OnscnTimer.m_bDisabled = false; CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByCops = false; diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp index b6489843..ed1a9264 100644 --- a/src/control/Script10.cpp +++ b/src/control/Script10.cpp @@ -104,7 +104,11 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command) return 0; } case COMMAND_IS_DEVELOPER: +#ifdef GTA_NETWORK + UpdateCompareFlag(gDeveloperFlag || gIsMultiplayerGame); +#else UpdateCompareFlag(gDeveloperFlag); +#endif return 0; case COMMAND_SET_DEVELOPER_FLAG: CollectParameters(&m_nIp, 1); diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp index 94378cc0..2dca5be9 100644 --- a/src/control/Script6.cpp +++ b/src/control/Script6.cpp @@ -1785,6 +1785,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) StoreParameters(&m_nIp, 1); return 0; } + /* case COMMAND_IS_CHAR_IN_ANY_BOAT: { CollectParameters(&m_nIp, 1); @@ -1793,6 +1794,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT); return 0; } + */ case COMMAND_IS_PLAYER_IN_ANY_BOAT: { CollectParameters(&m_nIp, 1); @@ -1801,6 +1803,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT); return 0; } + /* case COMMAND_IS_CHAR_IN_ANY_HELI: { CollectParameters(&m_nIp, 1); @@ -1809,6 +1812,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); return 0; } + */ case COMMAND_IS_PLAYER_IN_ANY_HELI: { CollectParameters(&m_nIp, 1); @@ -1817,6 +1821,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI); return 0; } + /* case COMMAND_IS_CHAR_IN_ANY_PLANE: { CollectParameters(&m_nIp, 1); @@ -1825,6 +1830,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE); return 0; } + */ case COMMAND_IS_PLAYER_IN_ANY_PLANE: { CollectParameters(&m_nIp, 1); diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp index ee197783..fb8e69fe 100644 --- a/src/control/Script7.cpp +++ b/src/control/Script7.cpp @@ -373,6 +373,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) } case COMMAND_HAS_PHOTOGRAPH_BEEN_TAKEN: UpdateCompareFlag(CWeapon::bPhotographHasBeenTaken); + CWeapon::bPhotographHasBeenTaken = false; return 0; case COMMAND_GET_CHAR_ARMOUR: { @@ -508,7 +509,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) CTheScripts::ReadTextLabelFromScript(&m_nIp, key); m_nIp += KEY_LENGTH_IN_SCRIPT; CStreaming::RemoveAnim(CAnimManager::GetAnimationBlockIndex(key)); - // + empty function on PS2 + // + empty function on PS2 (not PSP) return 0; } case COMMAND_IS_CHAR_WAITING_FOR_WORLD_COLLISION: @@ -636,11 +637,8 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) SET_INTEGER_PARAM(1, 0); else if (GET_INTEGER_PARAM(1) == 3) SET_INTEGER_PARAM(1, 1); - pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true); - } - else { - pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true); } + pVehicle->BurstTyre(GET_INTEGER_PARAM(1), true); return 0; } case COMMAND_IS_CHAR_OBJ_NO_OBJ: @@ -812,7 +810,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) m_nIp += KEY_LENGTH_IN_SCRIPT; // TheText.Get(key); CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY, PICKUP_PROPERTY_LOCKED, 0, 0, false, key)); // TODO: gpModelIndices + SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY, PICKUP_PROPERTY_LOCKED, 0, 0, false, key)); StoreParameters(&m_nIp, 1); return 0; } @@ -825,9 +823,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) char key[KEY_LENGTH_IN_SCRIPT]; CTheScripts::ReadTextLabelFromScript(&m_nIp, key); m_nIp += KEY_LENGTH_IN_SCRIPT; - // TheText.Get(key); + TheText.Get(key); CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY_FORSALE, PICKUP_PROPERTY_FORSALE, GET_INTEGER_PARAM(3), 0, false, key)); // TODO: gpModelIndices + SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY_FORSALE, PICKUP_PROPERTY_FORSALE, GET_INTEGER_PARAM(3), 0, false, key)); StoreParameters(&m_nIp, 1); return 0; } diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp index c4f80e79..3955cacb 100644 --- a/src/control/Script8.cpp +++ b/src/control/Script8.cpp @@ -379,23 +379,18 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); -#ifdef FIX_BUGS if (pVehicle->IsCar()) { if (((CAutomobile*)pVehicle)->m_bombType != CARBOMB_NONE) { ((CAutomobile*)pVehicle)->m_bombType = CARBOMB_NONE; ((CAutomobile*)pVehicle)->m_pBombRigger = nil; } } +#ifdef FIX_BUGS else if (pVehicle->IsBike()) { if (((CBike*)pVehicle)->m_bombType != CARBOMB_NONE) { ((CBike*)pVehicle)->m_bombType = CARBOMB_NONE; ((CBike*)pVehicle)->m_pBombRigger = nil; } - } -#else - if (((CAutomobile*)pVehicle)->m_bombType != CARBOMB_NONE) { - ((CAutomobile*)pVehicle)->m_bombType = CARBOMB_NONE; - ((CAutomobile*)pVehicle)->m_pBombRigger = nil; } #endif return 0; @@ -612,7 +607,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } case COMMAND_SET_RC_HELI_HEIGHT_LIMIT: CollectParameters(&m_nIp, 1); - // CVehicle::rcHeliHeightLimit = GET_FLOAT_PARAM(0); // TODO + CVehicle::rcHeliHeightLimit = GET_FLOAT_PARAM(0); return 0; case COMMAND_CREATE_SCRIPT_CORONA: { @@ -716,7 +711,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) //case COMMAND_1491: case COMMAND_SET_DEBUG_MENU_ACTIVE: CollectParameters(&m_nIp, 1); - // this sets two values on PS2, but not on mobile - TODO? + // this sets two values on PS2 and PSP, but not on mobile - TODO? return 0; case COMMAND_SET_DRAW_HUD: CollectParameters(&m_nIp, 1); diff --git a/src/control/Script9.cpp b/src/control/Script9.cpp index f5b964ad..875aa96b 100644 --- a/src/control/Script9.cpp +++ b/src/control/Script9.cpp @@ -594,13 +594,18 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command) // base::cWorldGeom::GetInstance()->StoreBuildingSwap(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3) != 0); return 0; case COMMAND_IS_MULTIPLAYER_ACTIVE: - UpdateCompareFlag(false); // TODO? +#ifdef GTA_NETWORK + UpdateCompareFlag(gIsMultiplayerGame); +#else + UpdateCompareFlag(false); +#endif return 0; case COMMAND_GET_MULTIPLAYER_MODE: SET_INTEGER_PARAM(0, 0); // TODO StoreParameters(&m_nIp, 1); return 0; case COMMAND_MULTIPLAYER_SCRIPT_DONE: + printf("COMMAND_MULTIPLAYER_SCRIPT_DONE\n"); //gbStartingScriptsFromLua = false; TODO? return 0; case COMMAND_IS_MULTIPLAYER_SERVER: diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 4cbcffff..26fd0de8 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -1111,10 +1111,6 @@ enum MI_RCBARON = -955, MI_VICECHEE = -954, - // these two are unknown - MI_RIO = -992, - MI_TROPIC = -988, - // 7 of the following MIs originally are in this set: {-998, -996, -979, -978, -977, -975, -969} MI_WASHING = -3000, MI_ADMIRAL,