From 3e64274f6b68069600c243cea61f94555dccf388 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 12 May 2020 01:59:35 +0300 Subject: more script --- src/control/Pickups.cpp | 2 +- src/control/Pickups.h | 2 +- src/control/Script.cpp | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 6b56cd8f..5fb51aa2 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -485,7 +485,7 @@ CPickups::RemovePickUp(int32 pickupIndex) } int32 -CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity) +CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity, uint32 rate, bool highPriority, wchar* pText) { bool bFreeFound = false; int32 slot = 0; diff --git a/src/control/Pickups.h b/src/control/Pickups.h index 51c6ab64..2842edfa 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -77,7 +77,7 @@ public: static void DoMoneyEffects(CEntity *ent); static void DoMineEffects(CEntity *ent); static void DoPickUpEffects(CEntity *ent); - static int32 GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity); + static int32 GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity, uint32 rate = 0, bool highPriority = false, wchar* pText = nil); static int32 GenerateNewOne_WeaponType(CVector pos, eWeaponType weaponType, uint8 type, uint32 quantity); static void RemovePickUp(int32 pickupIndex); static void RemoveAllFloatingPickups(); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index f6d5b2f0..f9ee5e75 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -9945,7 +9945,31 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) case COMMAND_LOAD_AND_LAUNCH_MISSION_EXCLUSIVE: case COMMAND_IS_MISSION_AUDIO_PLAYING: case COMMAND_CREATE_LOCKED_PROPERTY_PICKUP: + { + CollectParameters(&m_nIp, 3); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= MAP_Z_LOW_LIMIT) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + // TODO(MIAMI) - add text + CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY, PICKUP_PROPERTY_LOCKED, 0, 0, false, text); + StoreParameters(&m_nIp, 1); + return 0; + } case COMMAND_CREATE_FORSALE_PROPERTY_PICKUP: + { + CollectParameters(&m_nIp, 4); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= MAP_Z_LOW_LIMIT) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + // TODO(MIAMI) - add text + CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_PICKUP_PROPERTY_FORSALE, PICKUP_PROPERTY_FORSALE, ScriptParams[3], 0, false, text); + StoreParameters(&m_nIp, 1); + return 0; + } case COMMAND_FREEZE_CAR_POSITION: case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CHAR: case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CAR: @@ -10034,6 +10058,18 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) case COMMAND_DOES_VEHICLE_EXIST: case COMMAND_ADD_SHORT_RANGE_BLIP_FOR_CONTACT_POINT: case COMMAND_ADD_SHORT_RANGE_SPRITE_BLIP_FOR_CONTACT_POINT: + { + CollectParameters(&m_nIp, 4); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= MAP_Z_LOW_LIMIT) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); + int id = CRadar::SetShortRangeCoordBlip(BLIP_COORD, pos, 2, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, ScriptParams[3]); + ScriptParams[0] = id; + StoreParameters(&m_nIp, 1); + return 0; + } case COMMAND_IS_CHAR_STUCK: case COMMAND_SET_ALL_TAXIS_HAVE_NITRO: case COMMAND_SET_CHAR_STOP_SHOOT_DONT_SEEK_ENTITY: -- cgit v1.2.3