diff options
Diffstat (limited to '')
-rw-r--r-- | src/control/Script10.cpp | 438 |
1 files changed, 320 insertions, 118 deletions
diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp index d558727e..388bfe8e 100644 --- a/src/control/Script10.cpp +++ b/src/control/Script10.cpp @@ -3,209 +3,411 @@ #include "Script.h" #include "ScriptCommands.h" +#include "CarCtrl.h" +#include "DMAudio.h" +#include "Frontend.h" +#include "GameLogic.h" +#include "General.h" +#include "Hud.h" +#include "Messages.h" +#include "Object.h" +#include "Pad.h" +#include "Pickups.h" #include "PlayerPed.h" +#include "Pools.h" +#include "Vehicle.h" +#include "SpecialFX.h" +#include "Stats.h" +#include "User.h" +#include "Weather.h" #include "World.h" +bool gDeveloperFlag; + int8 CRunningScript::ProcessCommands1600To1699(int32 command) { switch (command) { - case COMMAND_1600: - script_assert(false); + case COMMAND_ADD_NOODLES_DELIEVERED: + CollectParameters(&m_nIp, 1); + // CStats::NoodlesDelievered += GET_INTEGER_PARAM(0); return 0; - case COMMAND_1601: - script_assert(false); + case COMMAND_REGISTER_SCRAPYARD_CHALLENGE_SCORE: + //CStats::TopScrapyardChallengeScore = Max(CStats::TopScrapyardChallengeScore, GET_INTEGER_PARAM(0)); return 0; - case COMMAND_1602: - script_assert(false); + case COMMAND_REGISTER_9MM_MAYHEM_SCORE: + //CStats::Top9mmMayhemScore = Max(CStats::Top9mmMayhemScore, GET_INTEGER_PARAM(0)); return 0; - case COMMAND_1603: - script_assert(false); + case COMMAND_REGISTER_SCOOTER_SHOOTER_SCORE: + //CStats::TopScooterShooterScore = Max(CStats::TopScooterShooterScore, GET_INTEGER_PARAM(0)); return 0; - case COMMAND_1604: - script_assert(false); + case COMMAND_ADD_MONEY_MADE_FROM_TOURIST: + CollectParameters(&m_nIp, 1); + // CStats::MoneyMadeFromTourist += GET_INTEGER_PARAM(0); return 0; - case COMMAND_1605: - script_assert(false); + case COMMAND_ADD_TOURISTS_TAKEN_TO_SPOTS: + CollectParameters(&m_nIp, 1); + // CStats::TouristsTakenToSpots += GET_INTEGER_PARAM(0); return 0; - case COMMAND_1606: - script_assert(false); + case COMMAND_ADD_EXPORTED_CARS: + CollectParameters(&m_nIp, 1); + // CStats::NumberOfExportedCars += GET_INTEGER_PARAM(0); return 0; - case COMMAND_1607: + case COMMAND_SET_TOTAL_EXPORT_CARS: CollectParameters(&m_nIp, 1); - // TODO (SET_TOTAL_CARS_FOR_EXPORT) + // CStats::TotalNumberOfCarExport = GET_INTEGER_PARAM(0); return 0; - case COMMAND_1608: - script_assert(false); + case COMMAND_REGISTER_DIRT_BIKE_FASTEST_LAP: + CollectParameters(&m_nIp, 2); + // CStats::RegisterDirtBikeFastestLap(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; - case COMMAND_1609: - script_assert(false); + case COMMAND_REGISTER_DIRT_BIKE_FASTEST_TIME: + CollectParameters(&m_nIp, 2); + // CStats::RegisterDirtBikeFastestTime(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; - case COMMAND_1610: - script_assert(false); + case COMMAND_REGISTER_DIRT_BIKE_AIR_TIME: + //CStats::DirtBikeMostAir = Max(CStats::DirtBikeMostAir, GET_INTEGER_PARAM(0)); return 0; - case COMMAND_1611: - script_assert(false); + case COMMAND_ADD_ARROW_3D_MARKER: + { + uint32 ip = m_nIp; + uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0); + CollectParameters(&m_nIp, 10); + CVector pos = GET_VECTOR_PARAM(0); + CVector dir = GET_VECTOR_PARAM(3); + pos.z += GET_FLOAT_PARAM(9) + 7.0f; + //C3dMarkers::PlaceMarker(id, MARKERTYPE_ARROW, pos, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(8), 200, 1, 3.2f, 1, dir, 1.0f, 0, 0); - TODO return 0; - case COMMAND_1612: - script_assert(false); + } + case COMMAND_PRINT_NOW_OVERRIDE_FADE: + { + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 2); + CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); // true, true return 0; - case COMMAND_1613: - script_assert(false); + } + case COMMAND_GET_PICKUP_VALUE: + { + CollectParameters(&m_nIp, 1); + SET_INTEGER_PARAM(0, CPickups::GetValue(GET_INTEGER_PARAM(0))); return 0; - case COMMAND_1614: - script_assert(false); + } + case COMMAND_SET_PICKUP_VALUE: + { + CollectParameters(&m_nIp, 2); + CPickups::SetValue(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; - case COMMAND_1615: - // TODO (GET_DEVELOPER_FLAG?) - UpdateCompareFlag(false); + } + case COMMAND_IS_DEVELOPER: + UpdateCompareFlag(gDeveloperFlag); return 0; - case COMMAND_1616: - // TODO (SET_DEVELOPER_FLAG) + case COMMAND_SET_DEVELOPER_FLAG: + CollectParameters(&m_nIp, 1); + gDeveloperFlag = GET_INTEGER_PARAM(0); return 0; - case COMMAND_1617: - script_assert(false); + case COMMAND_REGISTER_WICHITA_WIPEOUT_SCORE: + CollectParameters(&m_nIp, 1); + //CStats::TopWichitaWipeoutScore = Max(CStats::TopWichitaWipeoutScore, GET_INTEGER_PARAM(0)); return 0; - case COMMAND_1618: - script_assert(false); + case COMMAND_ATTACH_OBJECT_TO_CAR: + { + CollectParameters(&m_nIp, 5); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pObject); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); + script_assert(pVehicle); + CVector offset = GET_VECTOR_PARAM(2); + // pObject->AttachObjectToEntity(pVehicle, offset); return 0; - case COMMAND_1619: - script_assert(false); + } + case COMMAND_DETACH_OBJECT_FROM_CAR: + { + CollectParameters(&m_nIp, 1); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pObject); + // if (pObject && pObject->m_pAttachedTo) + // pObject->DettachObjectFromEntity(); return 0; - case COMMAND_1620: - script_assert(false); + } + case COMMAND_SET_PAD_STICKS_MULTIPLIER: + { + CollectParameters(&m_nIp, 2); + CPad::GetPad(0)->unk_B4 = GET_FLOAT_PARAM(0); + CPad::GetPad(0)->unk_B8 = GET_FLOAT_PARAM(1); return 0; - case COMMAND_1621: + } + case COMMAND_PRINT_SUBTITLE_NOW: { wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 2); - // TODO (SET_SUBTITLE_TEXT) + if (FrontEndMenuManager.m_PrefsShowSubtitles) + CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); // false, true + else + CMessages::AddToPreviousBriefArray(key, -1, -1, -1, -1, -1, -1, nil); return 0; } - case COMMAND_1622: - script_assert(false); + case COMMAND_PRINT_SUBTITLE_NOW_OVERRIDE_FADE: + { + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 2); + if (FrontEndMenuManager.m_PrefsShowSubtitles) + CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); // true, true + else + CMessages::AddToPreviousBriefArray(key, -1, -1, -1, -1, -1, -1, nil); return 0; - case COMMAND_1623: - script_assert(false); + } + case COMMAND_PRINT_SUBTITLE_NOW_NO_BRIEF: + { + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 2); + if (FrontEndMenuManager.m_PrefsShowSubtitles) + CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); // false, false + else + CMessages::AddToPreviousBriefArray(key, -1, -1, -1, -1, -1, -1, nil); return 0; - case COMMAND_1624: - script_assert(false); + } + case COMMAND_PRINT_WITH_NUMBER_NOW_NO_BRIEF: + { + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 3); + CMessages::AddMessageJumpQWithNumber(key, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1); // 0 return 0; - case COMMAND_1625: - script_assert(false); + } + case COMMAND_GET_ANGLE_BETWEEN_POINTS: + { + CollectParameters(&m_nIp, 4); + SET_FLOAT_PARAM(0, CGeneral::GetAngleBetweenPoints(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2), GET_FLOAT_PARAM(3))); + StoreParameters(&m_nIp, 1); return 0; - case COMMAND_1626: - script_assert(false); + } + case COMMAND_OVERRIDE_CHAR_MOVE_ANIM: + { + CollectParameters(&m_nIp, 1); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pPed); + pPed->bOverrideMoveAnim = true; return 0; + } case COMMAND_1627: - script_assert(false); + { + CollectParameters(&m_nIp, 1); + // something related to debug menu, not implemented return 0; - case COMMAND_1628: - script_assert(false); + } + case COMMAND_ENABLE_EMERGENCY_VEHICLES: + { + CollectParameters(&m_nIp, 1); + gbEmergencyVehiclesEnabled = GET_INTEGER_PARAM(0) != 0; return 0; - case COMMAND_1629: - script_assert(false); + } + case COMMAND_ADD_UNLOCKED_COSTUME: + CollectParameters(&m_nIp, 1); + // CStats::AddUnlockedCostume(GET_INTEGER_PARAM(0)); return 0; - case COMMAND_1630: - script_assert(false); + case COMMAND_CLEAR_MULTIPLAYER_SPLASH_SCREEN: + // ClearMultiplayerSplashScreen(); return 0; - case COMMAND_1631: - script_assert(false); + case COMMAND_PRINT_WITH_2_NUMBERS_NOW_NO_BRIEF: + { + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 3); + CMessages::AddMessageJumpQWithNumber(key, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1); // 0 return 0; - case COMMAND_1632: - script_assert(false); + } + case COMMAND_GET_OBJECT_ORIENTATION: + { + CollectParameters(&m_nIp, 1); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pObject); + SET_FLOAT_PARAM(1, LimitAngleOnCircle(RADTODEG(Asin(pObject->GetForward().z)))); + SET_FLOAT_PARAM(2, LimitAngleOnCircle(RADTODEG(CGeneral::GetATanOfXY(pObject->GetForward().x, pObject->GetForward().y)))); + SET_FLOAT_PARAM(0, LimitAngleOnCircle(RADTODEG(CGeneral::GetATanOfXY(pObject->GetUp().z, pObject->GetRight().z)))); + StoreParameters(&m_nIp, 3); return 0; - case COMMAND_1633: - script_assert(false); + } + case COMMAND_SET_OBJECT_ORIENTATION: + { + CollectParameters(&m_nIp, 4); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pObject); + pObject->SetOrientation(DEGTORAD(GET_FLOAT_PARAM(2)), DEGTORAD(GET_FLOAT_PARAM(1)), DEGTORAD(GET_FLOAT_PARAM(3))); return 0; - case COMMAND_1634: - script_assert(false); + } + case COMMAND_CHANGE_ONSCREEN_COUNTER_PREFIX: + { + uint16 offset = (uint8*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - CTheScripts::ScriptSpace; + CollectParameters(&m_nIp, 1); + //CUserDisplay::OnscnTimer.ChangeCounterPrefix(offset, GET_INTEGER_PARAMS(0)); return 0; - case COMMAND_1635: + } + case COMMAND_STORE_PLAYER_OUTFIT: { char tmp[12]; // TODO CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp); + for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++) + CGameLogic::mStoredPlayerOutfit[i] = tmp[i]; + printf("STORED PLAYOUR OUTFIT : %s\n", CGameLogic::mStoredPlayerOutfit); m_nIp += KEY_LENGTH_IN_SCRIPT; - // TODO (CHANGE_STORED_PLAYER_OUTFIT?) return 0; } - case COMMAND_1636: - script_assert(false); + case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_NUMBER_AND_STRING: + { + char onscreen_str1[12]; + uint16 var = (uint8*)GetPointerToScriptVariable(&m_nIp, 0) - CTheScripts::ScriptSpace; + CollectParameters(&m_nIp, 2); + wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); + strncpy(onscreen_str1, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); + m_nIp += KEY_LENGTH_IN_SCRIPT; + CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data return 0; - case COMMAND_1637: - script_assert(false); + } + case COMMAND_SET_PLAYER_CURRENT_WEAPON_AMMO_IN_CLIP: + { + CollectParameters(&m_nIp, 1); + CWeapon* pWeapon = FindPlayerPed()->GetWeapon(); + if (pWeapon && GET_INTEGER_PARAM(0)) + pWeapon->m_nAmmoInClip = GET_INTEGER_PARAM(0); return 0; - case COMMAND_1638: - script_assert(false); + } + case COMMAND_SET_CHAR_WAIT_STATE_REPEAT: + { + CollectParameters(&m_nIp, 3); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + if (pPed) + pPed->SetWaitState((eWaitState)GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) >= 0 ? (void*)GET_INTEGER_PARAM(0) : nil); // + true return 0; - case COMMAND_1639: - script_assert(false); + } + case COMMAND_REGISTER_BEST_TIME_GOGO_FAGGIO: + CollectParameters(&m_nIp, 1); + // CStats::RegisterBestTimeGoGoFaggio(GET_INTEGER_PARAM(0)); return 0; - case COMMAND_1640: + case COMMAND_LOCK_GARAGE: CollectParameters(&m_nIp, 2); - // TODO (LOCK_GARAGE?) + // CGarages::LockGarage(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; - case COMMAND_1641: - // TODO + case COMMAND_IS_FINAL_GAME: +#ifdef FINAL + UpdateCompareFlag(false); +#else UpdateCompareFlag(true); +#endif return 0; - case COMMAND_1642: - script_assert(false); - return 0; - case COMMAND_1643: - script_assert(false); + case COMMAND_SET_ALLOWED_COLLISION: + { + CollectParameters(&m_nIp, 2); + CTheScripts::AllowedCollision[0] = GET_INTEGER_PARAM(0); + CTheScripts::AllowedCollision[1] = GET_INTEGER_PARAM(1); return 0; - case COMMAND_1644: - script_assert(false); + } + case COMMAND_REGISTER_GUARDIAN_ANGEL_LEVEL: + CollectParameters(&m_nIp, 3); + //CStats::GuardianAngelHighestLevel_Ind = Max(CStats::GuardianAngelHighestLevel_Ind, GET_INTEGER_PARAM(0)); + //CStats::GuardianAngelHighestLevel_Com = Max(CStats::GuardianAngelHighestLevel_Com, GET_INTEGER_PARAM(1)); + //CStats::GuardianAngelHighestLevel_Sub = Max(CStats::GuardianAngelHighestLevel_Sub, GET_INTEGER_PARAM(2)); return 0; - case COMMAND_1645: + case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_NUMBER_AND_2_STRINGS: + { + char onscreen_str1[12]; + char onscreen_str2[12]; + uint16 var = (uint8*)GetPointerToScriptVariable(&m_nIp, 0) - CTheScripts::ScriptSpace; + CollectParameters(&m_nIp, 3); + wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); + strncpy(onscreen_str1, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); + m_nIp += KEY_LENGTH_IN_SCRIPT; + wchar* text2 = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); + strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); + m_nIp += KEY_LENGTH_IN_SCRIPT; + CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data + } + case COMMAND_GET_PLAYER_STORED_WEAPON: { CollectParameters(&m_nIp, 1); - // TODO (GET_STORED_WEAPON?) - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - ScriptParams[0] = pPed->m_storedWeapon; + SET_INTEGER_PARAM(0, pPed->m_storedWeapon); StoreParameters(&m_nIp, 1); return 0; } - case COMMAND_1646: + case COMMAND_DISABLE_PAUSE_MENU: CollectParameters(&m_nIp, 1); - // TODO (DISABLE_PAUSE_MENU?) + // FrontEndMenuManager.mDisablePauseMenu = GET_INTEGER_PARAM(0) != 0; // TODO: static + member return 0; - case COMMAND_1647: + case COMMAND_IS_CHANNEL_PLAYING: CollectParameters(&m_nIp, 1); - // TODO (IS_CHANNEL_PLAYING?) + //UpdateCompareFlag(DMAudio.IsChannelPlaying(GET_INTEGER_PARAM(0)); UpdateCompareFlag(false); return 0; - case COMMAND_1648: + case COMMAND_SET_CLOCK_EVENT_WARNING: CollectParameters(&m_nIp, 3); - // TODO (SET_CLOCK_EVENT_WARNING); - return 0; - case COMMAND_1649: + /* + if (CHud::m_ClockEventWarningMinutes || GET_INTEGER_PARAMS(2)){ + CHud::m_ClockEventWarningMinutes = GET_INTEGER_PARAMS(2); + CHud::m_ClockEventMinutes = GET_INTEGER_PARAMS(1); + CHud::m_ClockEventHours = GET_INTEGER_PARAMS(0); + CHud::m_ClockEventFlashTimer = 0; + } + */ + return 0; + case COMMAND_SET_EXTRA_COLOUR_LIGHT_DIRECTION: CollectParameters(&m_nIp, 3); - // TODO (SET_EXTRA_COLOUR_DIRECTION) + // CWeather::ExtraColourLightDir = GET_VECTOR_PARAM(0); + // CWeather::ExtraColourLightDir.Normalise(); return 0; - case COMMAND_1650: - script_assert(false); + case COMMAND_SET_CHAR_CAN_BE_TARGETTED_BY_LEADER: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pPed); + pPed->bCanBeTargettedByLeader = GET_INTEGER_PARAM(1) != 0; return 0; - case COMMAND_1651: - script_assert(false); + } + case COMMAND_PRINT_HELP_NO_BRIEF: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CHud::SetHelpMessage(text, false); // + false, false return 0; - case COMMAND_1652: - script_assert(false); + } + case COMMAND_PRINT_HELP_FOREVER_NO_BRIEF: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CHud::SetHelpMessage(text, false, true); // + false return 0; - case COMMAND_1653: - script_assert(false); + } + case COMMAND_PRINT_HELP_ALWAYS_NO_BRIEF: + { + // CHud::mAlwaysAllowHelpText = true; + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CHud::SetHelpMessage(text, false); // + false, false return 0; - case COMMAND_1654: - script_assert(false); + } + case COMMAND_PRINT_HELP_FOREVER_ALWAYS_NO_BRIEF: + { + // CHud::mAlwaysAllowHelpText = true; + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CHud::SetHelpMessage(text, false, true); // + false return 0; - case COMMAND_1655: - script_assert(false); + } + case COMMAND_SET_MISSION_CAR_CAN_BE_STORED_IN_GARAGE: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); + pVehicle->bAllowGarageToStore = (GET_INTEGER_PARAM(1) != 0); return 0; - case COMMAND_1656: + } + case COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS: + { CollectParameters(&m_nIp, 2); - // TODO (?) + CPlayerPed* pPlayerPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; + script_assert(pPlayerPed); + for (int i = 0; i < CPools::GetVehiclePool()->GetSize(); i++) { + CPed* pPed = CPools::GetPedPool()->GetSlot(i); + if (pPed && IsPedPointerValid(pPed)) { + if (pPed->m_leader == pPlayerPed || (pPed->m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION && pPed->m_pedInObjective == pPlayerPed)) + pPed->bIsFrozen = (GET_INTEGER_PARAM(1) != 0); + } + } return 0; + } default: script_assert(0); } |