diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-17 14:02:19 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-17 14:02:19 +0100 |
commit | e5af1edcb9e7f444eb3b5256f75841d57bb50ac5 (patch) | |
tree | eefc16e2d08568f6008a2881ddf02f9b8ea4ec95 /src | |
parent | sync (diff) | |
download | re3-e5af1edcb9e7f444eb3b5256f75841d57bb50ac5.tar re3-e5af1edcb9e7f444eb3b5256f75841d57bb50ac5.tar.gz re3-e5af1edcb9e7f444eb3b5256f75841d57bb50ac5.tar.bz2 re3-e5af1edcb9e7f444eb3b5256f75841d57bb50ac5.tar.lz re3-e5af1edcb9e7f444eb3b5256f75841d57bb50ac5.tar.xz re3-e5af1edcb9e7f444eb3b5256f75841d57bb50ac5.tar.zst re3-e5af1edcb9e7f444eb3b5256f75841d57bb50ac5.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/control/Script.cpp | 68 | ||||
-rw-r--r-- | src/control/Script10.cpp | 213 | ||||
-rw-r--r-- | src/control/Script5.cpp | 1 | ||||
-rw-r--r-- | src/control/Script7.cpp | 97 | ||||
-rw-r--r-- | src/control/Script8.cpp | 1074 | ||||
-rw-r--r-- | src/control/Script9.cpp | 338 | ||||
-rw-r--r-- | src/control/ScriptCommands.h | 64 | ||||
-rw-r--r-- | src/core/Pad.h | 10 | ||||
-rw-r--r-- | src/peds/Ped.h | 36 | ||||
-rw-r--r-- | src/render/Hud.cpp | 2 |
10 files changed, 1105 insertions, 798 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 3f602de3..0f32f873 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1592,24 +1592,24 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_IS_AUSTRALIAN_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), REGISTER_COMMAND(COMMAND_DISARM_CAR_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_IS_JAPANESE_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), - REGISTER_COMMAND(COMMAND_1442, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1442, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1443, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1444, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1445, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1446, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1447, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1448, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1449, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1450, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1451, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1452, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1453, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_DISTANCE_BETWEEN_2D_POINTS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_DISTANCE_BETWEEN_3D_POINTS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""), + REGISTER_COMMAND(COMMAND_DOT_PRODUCT_2D, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""), + REGISTER_COMMAND(COMMAND_DOT_PRODUCT_3D, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""), + REGISTER_COMMAND(COMMAND_DEBUG_PRINT_WITH_1_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DEBUG_PRINT_WITH_2_FLOATS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DEBUG_PRINT_WITH_3_FLOATS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_PAD_BUTTON_STATE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_NAVIGATION_ARROW, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_NAVIGATION_ARROW, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_CALL, INPUT_ARGUMENTS(ARGTYPE_FUNCTION, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_NOTCALL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1456, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1457, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1458, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1459, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CALLNOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_AUTOMOBILE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_BIKE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_PLANE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_HELI, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), REGISTER_COMMAND(COMMAND_1460, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1461, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1462, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), @@ -1627,26 +1627,26 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_1474, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1475, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1476, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1477, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1478, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1479, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1480, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1481, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1482, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1483, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1484, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1485, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1486, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1487, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1488, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RETURN_IF_TRUE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RETURN_TRUE_IF_TRUE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_ONLY_ALLOWED_TO_SIT_BEHIND, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_RC_HELI_HEIGHT_LIMIT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_SCRIPT_CORONA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_SCRIPT_CORONA, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_BOAT_IN_WATER, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_DRIVER_BEING_JACKED, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_ONLY_ALLOWED_TO_SIT_IN_FRONT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_TILTED_BY_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_WEAPON_TYPE_FOR_PICKUP_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_USING_FIRST_PERSON_WEAPON_CAMERA, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), REGISTER_COMMAND(COMMAND_1489, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1490, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1491, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1492, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1493, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1494, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1495, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_1496, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1491, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_DEBUG_MENU_ACTUVE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_DRAW_HUD, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_RANDOM_CHAR_IN_AREA_NO_CHECKS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_RANDOM_CAR_IN_AREA_NO_CHECKS_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_CAR_COLLIDED_WITH_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1497, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1498, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1499, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp new file mode 100644 index 00000000..d558727e --- /dev/null +++ b/src/control/Script10.cpp @@ -0,0 +1,213 @@ +#include "common.h" + +#include "Script.h" +#include "ScriptCommands.h" + +#include "PlayerPed.h" +#include "World.h" + +int8 CRunningScript::ProcessCommands1600To1699(int32 command) +{ + switch (command) { + case COMMAND_1600: + script_assert(false); + return 0; + case COMMAND_1601: + script_assert(false); + return 0; + case COMMAND_1602: + script_assert(false); + return 0; + case COMMAND_1603: + script_assert(false); + return 0; + case COMMAND_1604: + script_assert(false); + return 0; + case COMMAND_1605: + script_assert(false); + return 0; + case COMMAND_1606: + script_assert(false); + return 0; + case COMMAND_1607: + CollectParameters(&m_nIp, 1); + // TODO (SET_TOTAL_CARS_FOR_EXPORT) + return 0; + case COMMAND_1608: + script_assert(false); + return 0; + case COMMAND_1609: + script_assert(false); + return 0; + case COMMAND_1610: + script_assert(false); + return 0; + case COMMAND_1611: + script_assert(false); + return 0; + case COMMAND_1612: + script_assert(false); + return 0; + case COMMAND_1613: + script_assert(false); + return 0; + case COMMAND_1614: + script_assert(false); + return 0; + case COMMAND_1615: + // TODO (GET_DEVELOPER_FLAG?) + UpdateCompareFlag(false); + return 0; + case COMMAND_1616: + // TODO (SET_DEVELOPER_FLAG) + return 0; + case COMMAND_1617: + script_assert(false); + return 0; + case COMMAND_1618: + script_assert(false); + return 0; + case COMMAND_1619: + script_assert(false); + return 0; + case COMMAND_1620: + script_assert(false); + return 0; + case COMMAND_1621: + { + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 2); + // TODO (SET_SUBTITLE_TEXT) + return 0; + } + case COMMAND_1622: + script_assert(false); + return 0; + case COMMAND_1623: + script_assert(false); + return 0; + case COMMAND_1624: + script_assert(false); + return 0; + case COMMAND_1625: + script_assert(false); + return 0; + case COMMAND_1626: + script_assert(false); + return 0; + case COMMAND_1627: + script_assert(false); + return 0; + case COMMAND_1628: + script_assert(false); + return 0; + case COMMAND_1629: + script_assert(false); + return 0; + case COMMAND_1630: + script_assert(false); + return 0; + case COMMAND_1631: + script_assert(false); + return 0; + case COMMAND_1632: + script_assert(false); + return 0; + case COMMAND_1633: + script_assert(false); + return 0; + case COMMAND_1634: + script_assert(false); + return 0; + case COMMAND_1635: + { + char tmp[12]; // TODO + CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp); + m_nIp += KEY_LENGTH_IN_SCRIPT; + // TODO (CHANGE_STORED_PLAYER_OUTFIT?) + return 0; + } + case COMMAND_1636: + script_assert(false); + return 0; + case COMMAND_1637: + script_assert(false); + return 0; + case COMMAND_1638: + script_assert(false); + return 0; + case COMMAND_1639: + script_assert(false); + return 0; + case COMMAND_1640: + CollectParameters(&m_nIp, 2); + // TODO (LOCK_GARAGE?) + return 0; + case COMMAND_1641: + // TODO + UpdateCompareFlag(true); + return 0; + case COMMAND_1642: + script_assert(false); + return 0; + case COMMAND_1643: + script_assert(false); + return 0; + case COMMAND_1644: + script_assert(false); + return 0; + case COMMAND_1645: + { + CollectParameters(&m_nIp, 1); + // TODO (GET_STORED_WEAPON?) + CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + script_assert(pPed); + ScriptParams[0] = pPed->m_storedWeapon; + StoreParameters(&m_nIp, 1); + return 0; + } + case COMMAND_1646: + CollectParameters(&m_nIp, 1); + // TODO (DISABLE_PAUSE_MENU?) + return 0; + case COMMAND_1647: + CollectParameters(&m_nIp, 1); + // TODO (IS_CHANNEL_PLAYING?) + UpdateCompareFlag(false); + return 0; + case COMMAND_1648: + CollectParameters(&m_nIp, 3); + // TODO (SET_CLOCK_EVENT_WARNING); + return 0; + case COMMAND_1649: + CollectParameters(&m_nIp, 3); + // TODO (SET_EXTRA_COLOUR_DIRECTION) + return 0; + case COMMAND_1650: + script_assert(false); + return 0; + case COMMAND_1651: + script_assert(false); + return 0; + case COMMAND_1652: + script_assert(false); + return 0; + case COMMAND_1653: + script_assert(false); + return 0; + case COMMAND_1654: + script_assert(false); + return 0; + case COMMAND_1655: + script_assert(false); + return 0; + case COMMAND_1656: + CollectParameters(&m_nIp, 2); + // TODO (?) + return 0; + default: + script_assert(0); + } + return -1; +}
\ No newline at end of file diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index 38dcdaf9..65e85779 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -2278,6 +2278,7 @@ INITSAVEBUF uint32 runningScripts = ReadSaveBuf<uint32>(buf); for (uint32 i = 0; i < runningScripts; i++) StartNewScript(0)->Load(buf); + return true; VALIDATESAVEBUF(size) } diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp index 72ad0d41..cddda5e9 100644 --- a/src/control/Script7.cpp +++ b/src/control/Script7.cpp @@ -32,6 +32,8 @@ #include "World.h" #include "Zones.h" +// LCS: file done except TODOs + int8 CRunningScript::ProcessCommands1200To1299(int32 command) { switch (command) { @@ -856,14 +858,68 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) UpdateCompareFlag(result); return 0; } - //case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CAR: - //case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CHAR: - //case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CAR: + case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CAR: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + CVehicle* pTestedVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); + bool result = false; + if (pPed) { + if (pPed->m_lastDamEntity) { + if (pPed->m_lastDamEntity == pTestedVehicle) + result = true; + } + } + else + debug("HAS_CHAR_BEEN_DAMAGED_BY_CAR - Character doesn't exist\n"); + UpdateCompareFlag(result); + return 0; + } + case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CHAR: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + CPed* pTestedPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); + bool result = false; + if (pVehicle) { + if (pVehicle->m_pLastDamageEntity) { + if (pVehicle->m_pLastDamageEntity == pTestedPed) + result = true; + if (pTestedPed->bInVehicle && pVehicle->m_pLastDamageEntity == pTestedPed->m_pMyVehicle) + result = true; + } + } + else + debug("HAS_CAR_BEEN_DAMAGED_BY_CHAR - Car doesn't exist\n"); + UpdateCompareFlag(result); + return 0; + } + case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CAR: + { + CollectParameters(&m_nIp, 2); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + CVehicle* pTestedVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); + bool result = false; + if (pVehicle) { + if (pVehicle->m_pLastDamageEntity) { + if (pVehicle->m_pLastDamageEntity == pTestedVehicle) + result = true; + } + } + else + debug("HAS_CAR_BEEN_DAMAGED_BY_CAR - First car doesn't exist\n"); + UpdateCompareFlag(result); + return 0; + } case COMMAND_GET_RADIO_CHANNEL: { - // TODO - SET_INTEGER_PARAM(0, -1); + uint8 radio = DMAudio.GetRadioInCar(); + if (radio < NUM_RADIOS || radio == STREAMED_SOUND_MISSION_COMPLETED) + SET_INTEGER_PARAM(0, radio); + else + SET_INTEGER_PARAM(0, -1); StoreParameters(&m_nIp, 1); + return 0; } //case COMMAND_DISPLAY_TEXT_WITH_3_NUMBERS: //case COMMAND_IS_CAR_DROWNING_IN_WATER: @@ -924,7 +980,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) return 0; case COMMAND_ADD_MONEY_SPENT_ON_PROPERTY: CollectParameters(&m_nIp, 1); - CStats::MoneySpentOnProperty(GET_INTEGER_PARAM(0)); + //CStats::MoneySpentOnProperty(GET_INTEGER_PARAM(0)); return 0; //case COMMAND_ADD_MONEY_SPENT_ON_AUTO_PAINTING: case COMMAND_SET_CHAR_ANSWERING_MOBILE: @@ -953,12 +1009,12 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_ADD_LOAN_SHARK_VISITS: case COMMAND_ADD_STORES_KNOCKED_OFF: CollectParameters(&m_nIp, 1); - CStats::NumOfStoresKnockedOff(GET_INTEGER_PARAM(0)); + //CStats::NumOfStoresKnockedOff(GET_INTEGER_PARAM(0)); return 0; //case COMMAND_ADD_MOVIE_STUNTS: case COMMAND_ADD_NUMBER_OF_ASSASSINATIONS: CollectParameters(&m_nIp, 1); - CStats::NumOfAssassinations(GET_INTEGER_PARAM(0)); + //CStats::NumOfAssassinations(GET_INTEGER_PARAM(0)); return 0; case COMMAND_ADD_PIZZAS_DELIVERED: CollectParameters(&m_nIp, 1); @@ -1145,7 +1201,16 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) debug("CLEAR_CHAR_LAST_DAMAGE_ENTITY - Character doesn't exist\n"); return 0; } - //case COMMAND_CLEAR_CAR_LAST_DAMAGE_ENTITY: + case COMMAND_CLEAR_CAR_LAST_DAMAGE_ENTITY: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + if (pVehicle) + pVehicle->m_pLastDamageEntity = nil; + else + debug("CLEAR_CAR_LAST_DAMAGE_ENTITY - Car doesn't exist\n"); + return 0; + } case COMMAND_FREEZE_OBJECT_POSITION: { CollectParameters(&m_nIp, 2); @@ -1180,6 +1245,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) } case COMMAND_CLEAR_TAXI_SHORTCUT: CGameLogic::ClearShortCut(); + CGameLogic::RemoveShortCutDropOffPointForMission(); return 0; //case COMMAND_SET_CHAR_OBJ_GOTO_CAR_ON_FOOT: //case COMMAND_GET_CLOSEST_WATER_NODE: @@ -1194,7 +1260,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_CLOTHES, PICKUP_ON_STREET, GET_INTEGER_PARAM(3))); + SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_PICKUP_CLOTHES, PICKUP_ON_STREET, GET_INTEGER_PARAM(3))); // TODO: gpModelIndices StoreParameters(&m_nIp, 1); return 0; } @@ -1212,6 +1278,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) CPlayerInfo* pPlayerInfo = &CWorld::Players[GET_INTEGER_PARAM(0)]; pPlayerInfo->m_nMaxHealth += GET_INTEGER_PARAM(1); pPlayerInfo->m_pPed->m_fHealth = pPlayerInfo->m_nMaxHealth; + CHud::m_ItemToFlash = ITEM_HEALTH; return 0; } case COMMAND_INCREASE_PLAYER_MAX_ARMOUR: @@ -1220,6 +1287,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) CPlayerInfo* pPlayerInfo = &CWorld::Players[GET_INTEGER_PARAM(0)]; pPlayerInfo->m_nMaxArmour += GET_INTEGER_PARAM(1); pPlayerInfo->m_pPed->m_fArmour = pPlayerInfo->m_nMaxArmour; + CHud::m_ItemToFlash = ITEM_ARMOUR; return 0; } case COMMAND_CREATE_RANDOM_CHAR_AS_DRIVER: @@ -1378,13 +1446,16 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) return 0; case COMMAND_DOES_VEHICLE_EXIST: { - // TODO CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); bool bExist = false; if (pVehicle) { - int index = CPools::GetVehiclePool()->GetJustIndex_NoFreeAssert(pVehicle); - bExist = (index >= 0 && index <= NUMVEHICLES); // TODO: FIX_BUGS + int index = GET_INTEGER_PARAM(0) >> 8; +#ifdef FIX_BUGS + bExist = (index >= 0 && index < NUMVEHICLES); // epic fail +#else + bExist = (index > 0 && index < NUMVEHICLES); +#endif } UpdateCompareFlag(bExist); return 0; diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp index afa213f2..6de73b82 100644 --- a/src/control/Script8.cpp +++ b/src/control/Script8.cpp @@ -4,7 +4,7 @@ #include "ScriptCommands.h" #include "DMAudio.h" -#if ((defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT) && defined MORE_LANGUAGES) +#ifdef MORE_LANGUAGES #include "Frontend.h" #endif #include "GameLogic.h" @@ -12,13 +12,10 @@ #ifdef MISSION_REPLAY #include "GenericGameStorage.h" #endif -#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) -#include "General.h" -#include "maths.h" -#endif #include "Hud.h" #include "Pad.h" #include "PedAttractor.h" +#include "Pickups.h" #include "Population.h" #include "Pools.h" #include "RpAnimBlend.h" @@ -34,14 +31,13 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) switch (command) { case COMMAND_REGISTER_VIGILANTE_LEVEL: CollectParameters(&m_nIp, 1); - CStats::RegisterLevelVigilanteMission(ScriptParams[0]); + CStats::RegisterLevelVigilanteMission(GET_INTEGER_PARAM(0)); return 0; case COMMAND_CLEAR_ALL_CHAR_ANIMS: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - script_assert(pPed); - if (!pPed->bInVehicle) { + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + if (pPed && pPed->GetPedState() != PED_DRIVING && !pPed->GetPedState() != PED_AIM_GUN) { pPed->m_pVehicleAnim = nil; pPed->RestartNonPartialAnims(); RpAnimBlendClumpRemoveAllAssociations(pPed->GetClump()); @@ -62,7 +58,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } case COMMAND_SET_MAXIMUM_NUMBER_OF_CARS_IN_GARAGE: CollectParameters(&m_nIp, 2); - CGarages::SetMaxNumStoredCarsForGarage(ScriptParams[0], ScriptParams[1]); + CGarages::SetMaxNumStoredCarsForGarage(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; case COMMAND_WANTED_STARS_ARE_FLASHING: { @@ -72,25 +68,25 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } case COMMAND_SET_ALLOW_HURRICANES: CollectParameters(&m_nIp, 1); - CStats::NoMoreHurricanes = ScriptParams[0]; + CStats::NoMoreHurricanes = GET_INTEGER_PARAM(0); return 0; case COMMAND_PLAY_ANNOUNCEMENT: { CollectParameters(&m_nIp, 1); - DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_NEWS_A); + DMAudio.PlayRadioAnnouncement(GET_INTEGER_PARAM(0) + STREAMED_SOUND_NEWS_A); return 0; } case COMMAND_SET_PLAYER_IS_IN_STADIUM: { CollectParameters(&m_nIp, 1); - CTheScripts::bPlayerIsInTheStatium = ScriptParams[0]; + CTheScripts::bPlayerIsInTheStatium = GET_INTEGER_PARAM(0); return 0; } case COMMAND_GET_BUS_FARES_COLLECTED_BY_PLAYER: { CollectParameters(&m_nIp, 1); - CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; - ScriptParams[0] = pPlayerInfo->m_pPed->m_nLastBusFareCollected; + CPlayerInfo* pPlayerInfo = &CWorld::Players[GET_INTEGER_PARAM(0)]; + SET_INTEGER_PARAM(0, pPlayerInfo->m_pPed->m_nLastBusFareCollected); pPlayerInfo->m_pPed->m_nLastBusFareCollected = 0; StoreParameters(&m_nIp, 1); return 0; @@ -98,11 +94,11 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_SET_CHAR_OBJ_BUY_ICE_CREAM: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); script_assert(pVehicle); - ScriptParams[0] = 0; + SET_INTEGER_PARAM(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 if (pEffect) { @@ -111,7 +107,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) if ((pPed->GetPosition() - pos).MagnitudeSqr() < SQR(20.0f)) { if (GetPedAttractorManager()->HasEmptySlot(pEffect) && GetPedAttractorManager()->IsApproachable(pEffect, pVehicle->GetMatrix(), 0, pPed)) { if (GetPedAttractorManager()->RegisterPedWithAttractor(pPed, pEffect, pVehicle->GetMatrix())) - ScriptParams[0] = 1; + SET_INTEGER_PARAM(0, 1); } } } @@ -121,16 +117,17 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } case COMMAND_DISPLAY_RADAR: CollectParameters(&m_nIp, 1); - CHud::m_HideRadar = ScriptParams[0] == 0; + CHud::m_HideRadar = GET_INTEGER_PARAM(0) == 0; + // on PS2 two flags are set, on mobile none return 0; case COMMAND_REGISTER_BEST_POSITION: CollectParameters(&m_nIp, 2); - CStats::RegisterBestPosition(ScriptParams[0], ScriptParams[1]); + CStats::RegisterBestPosition(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; case COMMAND_IS_PLAYER_IN_INFO_ZONE: { CollectParameters(&m_nIp, 1); - CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; + CPlayerInfo* pPlayerInfo = &CWorld::Players[GET_INTEGER_PARAM(0)]; char key[KEY_LENGTH_IN_SCRIPT]; memset(key, 0, KEY_LENGTH_IN_SCRIPT); CTheScripts::ReadTextLabelFromScript(&m_nIp, key); @@ -143,7 +140,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_CLEAR_CHAR_ICE_CREAM_PURCHASE: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); if (pPed->m_attractor) GetPedAttractorManager()->DeRegisterPed(pPed, pPed->m_attractor); @@ -155,7 +152,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_HAS_CHAR_ATTEMPTED_ATTRACTOR: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); UpdateCompareFlag(pPed->bHasAlreadyUsedAttractor); return 0; @@ -163,9 +160,9 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_SET_LOAD_COLLISION_FOR_CAR_FLAG: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - if (ScriptParams[1]) { + if (GET_INTEGER_PARAM(1)) { pVehicle->bDontLoadCollision = false; if (m_bMissionFlag) { CWorld::Remove(pVehicle); @@ -186,9 +183,9 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_SET_LOAD_COLLISION_FOR_CHAR_FLAG: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - if (ScriptParams[1]) { + if (GET_INTEGER_PARAM(1)) { pPed->bDontLoadCollision = false; if (m_bMissionFlag) { CWorld::Remove(pPed); @@ -210,31 +207,31 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_ADD_BIG_GUN_FLASH: { CollectParameters(&m_nIp, 6); - CWeapon::AddGunFlashBigGuns(*(CVector*)&ScriptParams[0], *(CVector*)&ScriptParams[3]); + CWeapon::AddGunFlashBigGuns(GET_VECTOR_PARAM(0), GET_VECTOR_PARAM(3)); return 0; } case COMMAND_HAS_CHAR_BOUGHT_ICE_CREAM: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); UpdateCompareFlag(pPed->bBoughtIceCream); return 0; } case COMMAND_GET_PROGRESS_PERCENTAGE: - *(float*)&ScriptParams[0] = CStats::GetPercentageProgress(); + SET_FLOAT_PARAM(0, CStats::GetPercentageProgress()); StoreParameters(&m_nIp, 1); return 0; case COMMAND_SET_SHORTCUT_PICKUP_POINT: { CollectParameters(&m_nIp, 4); - CGameLogic::AddShortCutPointAfterDeath(*(CVector*)&ScriptParams[0], *(float*)&ScriptParams[3]); + CGameLogic::AddShortCutPointAfterDeath(GET_VECTOR_PARAM(0), GET_FLOAT_PARAM(3)); return 0; } case COMMAND_SET_SHORTCUT_DROPOFF_POINT_FOR_MISSION: { CollectParameters(&m_nIp, 4); - CGameLogic::AddShortCutDropOffPointForMission(*(CVector*)&ScriptParams[0], *(float*)&ScriptParams[3]); + CGameLogic::AddShortCutDropOffPointForMission(GET_VECTOR_PARAM(0), GET_FLOAT_PARAM(3)); return 0; } case COMMAND_GET_RANDOM_ICE_CREAM_CUSTOMER_IN_AREA: @@ -242,10 +239,10 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) CollectParameters(&m_nIp, 7); int ped_handle = -1; CVector pos = FindPlayerCoors(); - float x1 = *(float*)&ScriptParams[0]; - float y1 = *(float*)&ScriptParams[1]; - float x2 = *(float*)&ScriptParams[2]; - float y2 = *(float*)&ScriptParams[3]; + float x1 = GET_FLOAT_PARAM(0); + float y1 = GET_FLOAT_PARAM(1); + float x2 = GET_FLOAT_PARAM(2); + float y2 = GET_FLOAT_PARAM(3); int i = CPools::GetPedPool()->GetSize(); while (--i && ped_handle == -1) { CPed* pPed = CPools::GetPedPool()->GetSlot(i); @@ -267,7 +264,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) continue; if (pPed->m_attractor) continue; - if (!ThisIsAValidRandomPed(pPed->m_nPedType, ScriptParams[4], ScriptParams[5], ScriptParams[6])) + if (!ThisIsAValidRandomPed(pPed->m_nPedType, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6))) continue; if (pPed->bIsLeader || pPed->m_leader) continue; @@ -285,7 +282,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) if (m_bIsMissionScript) CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR); } - ScriptParams[0] = ped_handle; + SET_INTEGER_PARAM(0, ped_handle); StoreParameters(&m_nIp, 1); return 0; } @@ -294,10 +291,10 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) { CollectParameters(&m_nIp, 4); 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]; + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float supX = GET_FLOAT_PARAM(2); + float supY = GET_FLOAT_PARAM(3); while (i--) { CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); if (!pVehicle) @@ -309,22 +306,23 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } case COMMAND_SET_GANG_ATTACK_PLAYER_WITH_COPS: CollectParameters(&m_nIp, 2); - CGangs::SetWillAttackPlayerWithCops((ePedType)((int)PEDTYPE_GANG1 + ScriptParams[0]), !!ScriptParams[1]); + CGangs::SetWillAttackPlayerWithCops((ePedType)((int)PEDTYPE_GANG1 + GET_INTEGER_PARAM(0)), !!GET_INTEGER_PARAM(1)); return 0; case COMMAND_SET_CHAR_FRIGHTENED_IN_JACKED_CAR: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->bHeldHostageInCar = ScriptParams[1]; + pPed->bHeldHostageInCar = GET_INTEGER_PARAM(1); + pPed->b1A4_2 = GET_INTEGER_PARAM(1); return 0; } case COMMAND_SET_VEHICLE_TO_FADE_IN: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), ScriptParams[1]); + CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), GET_INTEGER_PARAM(1)); return 0; } case COMMAND_REGISTER_ODDJOB_MISSION_PASSED: @@ -336,7 +334,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_IS_PLAYER_IN_SHORTCUT_TAXI: { CollectParameters(&m_nIp, 1); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle && pPed->m_pMyVehicle == CGameLogic::pShortCutTaxi); return 0; @@ -344,7 +342,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_IS_CHAR_DUCKING: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_DUCK_DOWN) != nil); return 0; @@ -352,24 +350,24 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_CREATE_DUST_EFFECT_FOR_CUTSCENE_HELI: { CollectParameters(&m_nIp, 3); - CObject* pHeli = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pHeli = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); bool found = false; float waterLevel = -1000.0f; CVector pos = pHeli->GetPosition(); - float radius = *(float*)&ScriptParams[1]; + float radius = GET_FLOAT_PARAM(1); float ground = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &found); if (!CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &waterLevel, false)) waterLevel = 0.0f; if (waterLevel > ground) ground = waterLevel; - if (ScriptParams[2] > 8) - ScriptParams[2] = 8; - CVehicle::HeliDustGenerate(pHeli, (pos.z - ground - 1.0f - radius) * 0.3 + radius, ground, ScriptParams[2]); + if (GET_INTEGER_PARAM(2) > 8) + SET_INTEGER_PARAM(2, 8); + CVehicle::HeliDustGenerate(pHeli, (pos.z - ground - 1.0f - radius) * 0.3 + radius, ground, GET_INTEGER_PARAM(2)); return 0; } case COMMAND_REGISTER_FIRE_LEVEL: CollectParameters(&m_nIp, 1); - CStats::RegisterLevelFireMission(ScriptParams[0]); + CStats::RegisterLevelFireMission(GET_INTEGER_PARAM(0)); return 0; case COMMAND_IS_AUSTRALIAN_GAME: UpdateCompareFlag(false); // should we make some check? @@ -377,7 +375,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_DISARM_CAR_BOMB: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); if (pVehicle->m_bombType != CARBOMB_NONE) { pVehicle->m_bombType = CARBOMB_NONE; pVehicle->m_pBombRigger = nil; @@ -394,48 +392,135 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) #endif return 0; case COMMAND_1442: - script_assert(false); - return 0; - case COMMAND_1443: - script_assert(false); + CollectParameters(&m_nIp, 4); return 0; - case COMMAND_1444: - script_assert(false); + //case COMMAND_1443: + case COMMAND_GET_DISTANCE_BETWEEN_2D_POINTS: + { + CollectParameters(&m_nIp, 4); + float X1 = GET_FLOAT_PARAM(0); + float Y1 = GET_FLOAT_PARAM(1); + float X2 = GET_FLOAT_PARAM(2); + float Y2 = GET_FLOAT_PARAM(3); + float fDistance = Sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2)); + SET_FLOAT_PARAM(0, fDistance); + StoreParameters(&m_nIp, 1); return 0; - case COMMAND_1445: - script_assert(false); + } + case COMMAND_GET_DISTANCE_BETWEEN_3D_POINTS: + { + CollectParameters(&m_nIp, 6); + float X1 = GET_FLOAT_PARAM(0); + float Y1 = GET_FLOAT_PARAM(1); + float Z1 = GET_FLOAT_PARAM(2); + float X2 = GET_FLOAT_PARAM(3); + float Y2 = GET_FLOAT_PARAM(4); + float Z2 = GET_FLOAT_PARAM(5); + float fDistance = Sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2) + (Z1 - Z2) * (Z1 - Z2)); + SET_FLOAT_PARAM(0, fDistance); + StoreParameters(&m_nIp, 1); return 0; - case COMMAND_1446: - script_assert(false); + } + case COMMAND_DOT_PRODUCT_2D: + { + CollectParameters(&m_nIp, 4); + float X1 = GET_FLOAT_PARAM(0); + float Y1 = GET_FLOAT_PARAM(1); + float X2 = GET_FLOAT_PARAM(2); + float Y2 = GET_FLOAT_PARAM(3); + float fDistance = X1 * X2 + Y1 * Y2; + SET_FLOAT_PARAM(0, fDistance); + StoreParameters(&m_nIp, 1); return 0; - case COMMAND_1447: - script_assert(false); + } + case COMMAND_DOT_PRODUCT_3D: + { + CollectParameters(&m_nIp, 4); + float X1 = GET_FLOAT_PARAM(0); + float Y1 = GET_FLOAT_PARAM(1); + float Z1 = GET_FLOAT_PARAM(2); + float X2 = GET_FLOAT_PARAM(3); + float Y2 = GET_FLOAT_PARAM(4); + float Z2 = GET_FLOAT_PARAM(5); + float fDistance = X1 * X2 + Y1 * Y2 + Z1 * Z2; + SET_FLOAT_PARAM(0, fDistance); + StoreParameters(&m_nIp, 1); return 0; - case COMMAND_1448: - script_assert(false); + } + case COMMAND_DEBUG_PRINT_WITH_1_FLOAT: return 0; - case COMMAND_1449: - script_assert(false); + case COMMAND_DEBUG_PRINT_WITH_2_FLOATS: return 0; - case COMMAND_1450: - script_assert(false); + case COMMAND_DEBUG_PRINT_WITH_3_FLOATS: return 0; - case COMMAND_1451: + case COMMAND_GET_PAD_BUTTON_STATE: + { CollectParameters(&m_nIp, 1); - // TODO (GET_PAD_BUTTON_STATE) - ScriptParams[0] = 0; + switch (GET_INTEGER_PARAM(0)) { + case 0: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetOddJobTrigger()); break; + case 1: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetBrake()); break; + case 2: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetSteeringLeftRight()); break; + case 3: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetSteeringUpDown()); break; + case 4: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetCarGunLeftRight()); break; + case 5: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetCarGunUpDown()); break; + case 6: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetPedWalkLeftRight()); break; + case 7: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetPedWalkUpDown()); break; + case 8: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetLookLeft()); break; + case 9: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetLookRight()); break; + case 10: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetLookBehindForCar()); break; + case 11: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetLookBehindForPed()); break; + case 12: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetHorn()); break; + case 13: SET_INTEGER_PARAM(0, CPad::GetPad(0)->HornJustDown()); break; + case 14: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetCarGunFired()); break; + case 15: SET_INTEGER_PARAM(0, CPad::GetPad(0)->CarGunJustDown()); break; + case 16: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetHandBrake()); break; + case 17: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetBrake()); break; + case 18: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetExitVehicle()); break; + case 19: SET_INTEGER_PARAM(0, CPad::GetPad(0)->ExitVehicleJustDown()); break; + case 20: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetWeapon()); break; + case 21: SET_INTEGER_PARAM(0, CPad::GetPad(0)->WeaponJustDown()); break; + case 22: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetAccelerate()); break; + case 23: SET_INTEGER_PARAM(0, CPad::GetPad(0)->CycleCameraModeUpJustDown()); break; + case 24: SET_INTEGER_PARAM(0, CPad::GetPad(0)->CycleWeaponLeftJustDown()); break; + case 25: SET_INTEGER_PARAM(0, CPad::GetPad(0)->CycleWeaponRightJustDown()); break; + case 26: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetTarget()); break; + case 27: SET_INTEGER_PARAM(0, CPad::GetPad(0)->TargetJustDown()); break; + case 28: SET_INTEGER_PARAM(0, CPad::GetPad(0)->JumpJustDown()); break; + case 29: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetSprint()); break; + case 30: SET_INTEGER_PARAM(0, CPad::GetPad(0)->ShiftTargetLeftJustDown()); break; + case 31: SET_INTEGER_PARAM(0, CPad::GetPad(0)->ForceCameraBehindPlayer()); break; + case 32: SET_INTEGER_PARAM(0, CPad::GetPad(0)->SniperZoomIn()); break; + case 33: SET_INTEGER_PARAM(0, CPad::GetPad(0)->SniperZoomOut()); break; + case 34: SET_INTEGER_PARAM(0, CPad::GetPad(0)->SniperModeLookLeftRight()); break; + case 35: SET_INTEGER_PARAM(0, CPad::GetPad(0)->SniperModeLookUpDown()); break; + case 36: SET_INTEGER_PARAM(0, CPad::GetPad(0)->LookAroundLeftRight()); break; + case 37: SET_INTEGER_PARAM(0, CPad::GetPad(0)->LookAroundUpDown()); break; + case 38: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GuiLeft()); break; + case 39: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GuiRight()); break; + case 40: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GuiUp()); break; + case 41: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GuiDown()); break; + case 42: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GuiSelect()); break; + case 43: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GuiBack()); break; + case 44: SET_INTEGER_PARAM(0, CPad::GetPad(0)->GetSkipCutscene()); if (GET_INTEGER_PARAM(0)) TheCamera.m_bIgnoreFadingStuffForMusic = false; break; // spectacular hack + } StoreParameters(&m_nIp, 1); return 0; - case COMMAND_1452: - script_assert(false); + } + case COMMAND_SET_NAVIGATION_ARROW: + { + CollectParameters(&m_nIp, 3); + // cNavArrow::SetTarget(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(0)); // TODO, although it's unused return 0; - case COMMAND_1453: - script_assert(false); + } + case COMMAND_CLEAR_NAVIGATION_ARROW: + { + // cNavArrow::ClearTarget(); // TODO, although it's unused return 0; + } case COMMAND_CALL: - case COMMAND_NOTCALL: + case COMMAND_CALLNOT: { - m_anStack[m_nStackPointer++] = m_nIp | BIT(STACKVALUE_IS_FUNCTION_CALL_BIT) | ((command == COMMAND_NOTCALL) ? BIT(STACKVALUE_INVERT_RETURN_BIT) : 0); + m_anStack[m_nStackPointer++] = m_nIp | BIT(STACKVALUE_IS_FUNCTION_CALL_BIT) | ((command == COMMAND_CALLNOT) ? BIT(STACKVALUE_INVERT_RETURN_BIT) : 0); uint8 nInputParams = CTheScripts::Read1ByteFromScript(&m_nIp); uint8 nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp); uint8 nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp); @@ -445,676 +530,245 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) CollectParameters(&m_nIp, nInputParams, &m_anLocalVariables[m_nLocalsPointer + nLocalsOffset]); m_nLocalsPointer += nLocalsOffset; m_anStack[m_nStackPointer - 1] |= (m_nIp - nIPBeforeParameters) << STACKVALUE_IP_PARAMS_OFFSET; - if (ScriptParams[0] < 0) - m_nIp = CTheScripts::MainScriptSize - ScriptParams[0]; + if (GET_INTEGER_PARAM(0) < 0) + m_nIp = CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0); else - m_nIp = ScriptParams[0]; + m_nIp = GET_INTEGER_PARAM(0); return 0; } - case COMMAND_1456: - script_assert(false); - return 0; - case COMMAND_1457: - script_assert(false); - return 0; - case COMMAND_1458: - script_assert(false); - return 0; - case COMMAND_1459: - script_assert(false); - return 0; - case COMMAND_1460: - script_assert(false); - return 0; - case COMMAND_1461: - script_assert(false); - return 0; - case COMMAND_1462: - script_assert(false); - return 0; - case COMMAND_1463: - script_assert(false); - return 0; - case COMMAND_1464: - script_assert(false); - return 0; - case COMMAND_1465: - script_assert(false); - return 0; - case COMMAND_1466: - script_assert(false); - return 0; - case COMMAND_1467: - script_assert(false); - return 0; - case COMMAND_1468: - script_assert(false); - return 0; - case COMMAND_1469: - script_assert(false); - return 0; - case COMMAND_1470: - script_assert(false); - return 0; - case COMMAND_1471: - script_assert(false); - return 0; - case COMMAND_1472: - script_assert(false); - return 0; - case COMMAND_1473: - script_assert(false); - return 0; - case COMMAND_1474: - script_assert(false); - return 0; - case COMMAND_1475: - script_assert(false); - return 0; - case COMMAND_1476: - script_assert(false); - return 0; - case COMMAND_1477: - script_assert(false); - return 0; - case COMMAND_1478: - script_assert(false); - return 0; - case COMMAND_1479: - CollectParameters(&m_nIp, 2); - // TODO (SET_CHAR_ONLY_ENTER_BACK_DOOR) - return 0; - case COMMAND_1480: - script_assert(false); - return 0; - case COMMAND_1481: - script_assert(false); - return 0; - case COMMAND_1482: - script_assert(false); - return 0; - case COMMAND_1483: - script_assert(false); - return 0; - case COMMAND_1484: - script_assert(false); - return 0; - case COMMAND_1485: - script_assert(false); - return 0; - case COMMAND_1486: - script_assert(false); - return 0; - case COMMAND_1487: - script_assert(false); - return 0; - case COMMAND_1488: - script_assert(false); - return 0; - case COMMAND_1489: - script_assert(false); - return 0; - case COMMAND_1490: - script_assert(false); - return 0; - case COMMAND_1491: - script_assert(false); - return 0; - case COMMAND_1492: - script_assert(false); - return 0; - case COMMAND_1493: - script_assert(false); - return 0; - case COMMAND_1494: - script_assert(false); - return 0; - case COMMAND_1495: - script_assert(false); - return 0; - case COMMAND_1496: - script_assert(false); - return 0; - case COMMAND_1497: - script_assert(false); - return 0; - case COMMAND_1498: - script_assert(false); - return 0; - case COMMAND_1499: - script_assert(false); + case COMMAND_IS_CAR_AUTOMOBILE: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); + UpdateCompareFlag(pVehicle->GetModelIndex() >= MI_FIRST_VEHICLE && pVehicle->GetModelIndex() < MI_FERRY); return 0; - default: - script_assert(0); } - return -1; -} - -int8 CRunningScript::ProcessCommands1500To1599(int32 command) -{ - switch (command) { - case COMMAND_1500: - script_assert(false); - return 0; - case COMMAND_1501: - script_assert(false); - return 0; - case COMMAND_1502: - script_assert(false); - return 0; - case COMMAND_1503: - script_assert(false); - return 0; - case COMMAND_1504: - script_assert(false); - return 0; - case COMMAND_1505: - script_assert(false); - return 0; - case COMMAND_1506: - script_assert(false); - return 0; - case COMMAND_1507: - script_assert(false); - return 0; - case COMMAND_1508: - script_assert(false); - return 0; - case COMMAND_1509: - script_assert(false); - return 0; - case COMMAND_1510: - script_assert(false); - return 0; - case COMMAND_1511: - script_assert(false); - return 0; - case COMMAND_1512: - script_assert(false); - return 0; - case COMMAND_1513: - script_assert(false); - return 0; - case COMMAND_1514: - script_assert(false); - return 0; - case COMMAND_1515: - script_assert(false); - return 0; - case COMMAND_1516: - script_assert(false); - return 0; - case COMMAND_1517: - script_assert(false); + case COMMAND_IS_CAR_BIKE: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); + UpdateCompareFlag(pVehicle->GetModelIndex() >= MI_ANGEL && pVehicle->GetModelIndex() <= MI_SANCHEZ); return 0; - case COMMAND_1518: - // TODO (?) - UpdateCompareFlag(true); + } return 0; - case COMMAND_1519: + case COMMAND_IS_CAR_PLANE: + { CollectParameters(&m_nIp, 1); - // TODO (SET_NUMBER_USJ_FOUND?) + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); + UpdateCompareFlag(pVehicle->GetModelIndex() >= MI_AIRTRAIN && pVehicle->GetModelIndex() <= MI_DEADDODO); return 0; - case COMMAND_1520: + } + case COMMAND_IS_CAR_HELI: + { CollectParameters(&m_nIp, 1); - // TODO (SET_TOTAL_HIDDEN_PACKAGES?) - return 0; - case COMMAND_1521: - script_assert(false); - return 0; - case COMMAND_1522: - script_assert(false); - return 0; - case COMMAND_1523: - script_assert(false); - return 0; - case COMMAND_1524: - script_assert(false); - return 0; - case COMMAND_1525: - script_assert(false); - return 0; - case COMMAND_1526: - script_assert(false); - return 0; - case COMMAND_1527: - script_assert(false); - return 0; - case COMMAND_1528: - script_assert(false); - return 0; - case COMMAND_1529: - script_assert(false); - return 0; - case COMMAND_1530: - script_assert(false); - return 0; - case COMMAND_1531: - script_assert(false); - return 0; - case COMMAND_1532: - script_assert(false); - return 0; - case COMMAND_1533: - script_assert(false); - return 0; - case COMMAND_1534: - script_assert(false); - return 0; - case COMMAND_1535: - script_assert(false); - return 0; - case COMMAND_1536: - script_assert(false); - return 0; - case COMMAND_1537: - script_assert(false); - return 0; - case COMMAND_1538: - script_assert(false); - return 0; - case COMMAND_1539: - //TODO (REGISTER_OUTFIT_CHANGE) - return 0; - case COMMAND_1540: - script_assert(false); - return 0; - case COMMAND_1541: - script_assert(false); - return 0; - case COMMAND_1542: - script_assert(false); - return 0; - case COMMAND_1543: - script_assert(false); - return 0; - case COMMAND_1544: - script_assert(false); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); + UpdateCompareFlag(pVehicle->GetModelIndex() >= MI_ESCAPE && pVehicle->GetModelIndex() <= MI_CHOPPER); return 0; - case COMMAND_1545: - script_assert(false); + } +#ifdef FIX_BUGS + case COMMAND_1476: // they DO have it in script return 0; - case COMMAND_1546: - script_assert(false); +#endif + case COMMAND_RETURN_IF_TRUE: + if (m_bCondResult) { + ReturnFromGosubOrFunction(); + } return 0; - case COMMAND_1547: - script_assert(false); + case COMMAND_RETURN_TRUE_IF_TRUE: + if (m_bCondResult) { + UpdateCompareFlag(false); + ReturnFromGosubOrFunction(); + } return 0; - case COMMAND_1548: - // TODO (GET_ONFOOT_CAMERA_MODE) - ScriptParams[0] = 0; - StoreParameters(&m_nIp, 1); + case COMMAND_SET_CHAR_ONLY_ALLOWED_TO_SIT_BEHIND: + { + CollectParameters(&m_nIp, 2); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pPed); + pPed->bOnlyAllowedToSitBehind = GET_INTEGER_PARAM(1); return 0; - case COMMAND_1549: + } + case COMMAND_SET_RC_HELI_HEIGHT_LIMIT: CollectParameters(&m_nIp, 1); - // TODO (SET_ONFOOT_CAMERA_MODE?) - return 0; - case COMMAND_1550: - script_assert(false); + // CVehicle::rcHeliHeightLimit = GET_FLOAT_PARAM(0); // TODO return 0; - case COMMAND_1551: - script_assert(false); - return 0; - case COMMAND_1552: - script_assert(false); - return 0; - case COMMAND_1553: - script_assert(false); - return 0; - case COMMAND_1554: - script_assert(false); - return 0; - case COMMAND_1555: + case COMMAND_CREATE_SCRIPT_CORONA: + { + CollectParameters(&m_nIp, 9); + static bool bShowed = false; + if (!bShowed) { + debug("CREATE_SCRIPT_CORONA not implemented"); + bShowed = true; + } + SET_INTEGER_PARAM(0, -1); + StoreParameters(&m_nIp, 1); + } + case COMMAND_REMOVE_SCRIPT_CORONA: CollectParameters(&m_nIp, 1); - // TODO (FREEZE_ONFOOT_CAMERA_MODE?) - return 0; - case COMMAND_1556: - script_assert(false); - return 0; - case COMMAND_1557: - script_assert(false); - return 0; - case COMMAND_1558: - UpdateCompareFlag(false); // TODO return 0; - case COMMAND_1559: - script_assert(false); - return 0; - case COMMAND_1560: - // TODO (IS_E3_BUILD?) - UpdateCompareFlag(false); - return 0; - case COMMAND_1561: - // TODO (check, SET_FS_DESTROYED_FLAG) - CTheScripts::FSDestroyedFlag = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace; - return 0; - case COMMAND_1562: - script_assert(false); - return 0; - case COMMAND_1563: - script_assert(false); - return 0; - case COMMAND_1564: - script_assert(false); - return 0; - case COMMAND_1565: - script_assert(false); - return 0; - case COMMAND_1566: - script_assert(false); - return 0; - case COMMAND_1567: + case COMMAND_IS_BOAT_IN_WATER: + { CollectParameters(&m_nIp, 1); - // TODO (BUILD_WORLD_GEOMETRY) - return 0; - case COMMAND_1568: - script_assert(false); - return 0; - case COMMAND_1569: - // TODO (IS_MULTIPLAYER_ACTIVE?) - UpdateCompareFlag(false); - return 0; - case COMMAND_1570: - script_assert(false); - return 0; - case COMMAND_1571: - script_assert(false); - return 0; - case COMMAND_1572: - script_assert(false); - return 0; - case COMMAND_1573: - script_assert(false); - return 0; - case COMMAND_1574: - script_assert(false); - return 0; - case COMMAND_1575: - script_assert(false); + CBoat* pVehicle = (CBoat*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle && pVehicle->IsBoat()); + UpdateCompareFlag(pVehicle->bBoatInWater); return 0; - case COMMAND_1576: - script_assert(false); - return 0; - case COMMAND_1577: - script_assert(false); - return 0; - case COMMAND_1578: - script_assert(false); - return 0; - case COMMAND_1579: - script_assert(false); - return 0; - case COMMAND_1580: - script_assert(false); - return 0; - case COMMAND_1581: + } + case COMMAND_IS_CAR_DRIVER_BEING_JACKED: { - // TODO (SET_HELP_MESSAGE?) - wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); + UpdateCompareFlag(pVehicle->bIsBeingCarJacked); return 0; } - case COMMAND_1582: - script_assert(false); - return 0; - case COMMAND_1583: - script_assert(false); - return 0; - case COMMAND_1584: - script_assert(false); - return 0; - case COMMAND_1585: - script_assert(false); - return 0; - case COMMAND_1586: - script_assert(false); - return 0; - case COMMAND_1587: - script_assert(false); - return 0; - case COMMAND_1588: - script_assert(false); - return 0; - case COMMAND_1589: + case COMMAND_SET_CHAR_ONLY_ALLOWED_TO_SIT_IN_FRONT: + { CollectParameters(&m_nIp, 2); - // TODO (SWAP_BUILDING?) - return 0; - case COMMAND_1590: - script_assert(false); - return 0; - case COMMAND_1591: - script_assert(false); - return 0; - case COMMAND_1592: - script_assert(false); - return 0; - case COMMAND_1593: - script_assert(false); - return 0; - case COMMAND_1594: - script_assert(false); - return 0; - case COMMAND_1595: - script_assert(false); - return 0; - case COMMAND_1596: - script_assert(false); - return 0; - case COMMAND_1597: - script_assert(false); - return 0; - case COMMAND_1598: - script_assert(false); - return 0; - case COMMAND_1599: - script_assert(false); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pPed); + pPed->bOnlyAllowedToSitInFront = GET_INTEGER_PARAM(1); return 0; - default: - script_assert(0); } - return -1; -} - -int8 CRunningScript::ProcessCommands1600To1699(int32 command) -{ - switch (command) { - case COMMAND_1600: - script_assert(false); - return 0; - case COMMAND_1601: - script_assert(false); - return 0; - case COMMAND_1602: - script_assert(false); - return 0; - case COMMAND_1603: - script_assert(false); - return 0; - case COMMAND_1604: - script_assert(false); - return 0; - case COMMAND_1605: - script_assert(false); - return 0; - case COMMAND_1606: - script_assert(false); - return 0; - case COMMAND_1607: - CollectParameters(&m_nIp, 1); - // TODO (SET_TOTAL_CARS_FOR_EXPORT) - return 0; - case COMMAND_1608: - script_assert(false); - return 0; - case COMMAND_1609: - script_assert(false); - return 0; - case COMMAND_1610: - script_assert(false); - return 0; - case COMMAND_1611: - script_assert(false); - return 0; - case COMMAND_1612: - script_assert(false); - return 0; - case COMMAND_1613: - script_assert(false); - return 0; - case COMMAND_1614: - script_assert(false); - return 0; - case COMMAND_1615: - // TODO (GET_DEVELOPER_FLAG?) - UpdateCompareFlag(false); - return 0; - case COMMAND_1616: - // TODO (SET_DEVELOPER_FLAG) - return 0; - case COMMAND_1617: - script_assert(false); - return 0; - case COMMAND_1618: - script_assert(false); - return 0; - case COMMAND_1619: - script_assert(false); - return 0; - case COMMAND_1620: - script_assert(false); - return 0; - case COMMAND_1621: + case COMMAND_SET_CAR_TILTED_BY_CHAR: { - wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 2); - // TODO (SET_SUBTITLE_TEXT) + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); + script_assert(pVehicle); + pVehicle->ApplyTurnForce(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(-0.8f, -1.2f)* pPed->m_fMass, + pPed->GetPosition().x - pVehicle->GetPosition().x, pPed->GetPosition().y - pVehicle->GetPosition().y, 0.0f); + DMAudio.PlayOneShot(pVehicle->m_audioEntityId, SOUND_CAR_JERK, 0.0f); return 0; } - case COMMAND_1622: - script_assert(false); - return 0; - case COMMAND_1623: - script_assert(false); - return 0; - case COMMAND_1624: - script_assert(false); - return 0; - case COMMAND_1625: - script_assert(false); - return 0; - case COMMAND_1626: - script_assert(false); - return 0; - case COMMAND_1627: - script_assert(false); - return 0; - case COMMAND_1628: - script_assert(false); - return 0; - case COMMAND_1629: - script_assert(false); - return 0; - case COMMAND_1630: - script_assert(false); - return 0; - case COMMAND_1631: - script_assert(false); - return 0; - case COMMAND_1632: - script_assert(false); - return 0; - case COMMAND_1633: - script_assert(false); - return 0; - case COMMAND_1634: - script_assert(false); - return 0; - case COMMAND_1635: + case COMMAND_GET_WEAPON_TYPE_FOR_PICKUP_IN_AREA: { - char tmp[12]; // TODO - CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp); - m_nIp += KEY_LENGTH_IN_SCRIPT; - // TODO (CHANGE_STORED_PLAYER_OUTFIT?) - return 0; + CollectParameters(&m_nIp, 4); + float X = GET_FLOAT_PARAM(0); + float Y = GET_FLOAT_PARAM(1); + float Z = GET_FLOAT_PARAM(2); + float radius = GET_FLOAT_PARAM(3); + int model = -1; + bool found = false; + for (uint32 i = 0; i < NUMPICKUPS; i++) { + CPickup* pPickup = &CPickups::aPickUps[i]; + if (pPickup->m_eType != PICKUP_NONE) { + CVector fDist = pPickup->m_vecPos - CVector(X, Y, Z); +#ifndef FIX_BUGS // this breaks ALL pickups! + pPickup->m_eModelIndex = 4; +#endif + if (fDist.Magnitude() < radius && pPickup->m_pObject) { + found = true; + model = CPickups::WeaponForModel(pPickup->m_pObject->GetModelIndex()); + } + } + } + SET_INTEGER_PARAM(0, model); + StoreParameters(&m_nIp, 1); } - case COMMAND_1636: - script_assert(false); - return 0; - case COMMAND_1637: - script_assert(false); - return 0; - case COMMAND_1638: - script_assert(false); + case COMMAND_IS_USING_FIRST_PERSON_WEAPON_CAMERA: + UpdateCompareFlag(TheCamera.Using1stPersonWeaponMode()); return 0; - case COMMAND_1639: - script_assert(false); - return 0; - case COMMAND_1640: - CollectParameters(&m_nIp, 2); - // TODO (LOCK_GARAGE?) - return 0; - case COMMAND_1641: - // TODO - UpdateCompareFlag(true); - return 0; - case COMMAND_1642: - script_assert(false); - return 0; - case COMMAND_1643: - script_assert(false); + //case COMMAND_1489: + //case COMMAND_1490: + //case COMMAND_1491: + case COMMAND_SET_DEBUG_MENU_ACTUVE: + CollectParameters(&m_nIp, 1); + // this sets two values on PS2, but not on mobile - TODO? return 0; - case COMMAND_1644: - script_assert(false); + case COMMAND_SET_DRAW_HUD: + CollectParameters(&m_nIp, 1); + CHud::m_Wants_To_Draw_Hud = (GET_INTEGER_PARAM(0) != 0); return 0; - case COMMAND_1645: + case COMMAND_GET_RANDOM_CHAR_IN_AREA_NO_CHECKS: { - CollectParameters(&m_nIp, 1); - // TODO (GET_STORED_WEAPON?) - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - script_assert(pPed); - ScriptParams[0] = pPed->m_storedWeapon; + CollectParameters(&m_nIp, 4); + int ped_handle = -1; + CVector pos = FindPlayerCoors(); + float x1 = GET_FLOAT_PARAM(0); + float y1 = GET_FLOAT_PARAM(1); + float x2 = GET_FLOAT_PARAM(2); + float y2 = GET_FLOAT_PARAM(3); + int i = CPools::GetPedPool()->GetSize(); + while (--i && ped_handle == -1) { + CPed* pPed = CPools::GetPedPool()->GetSlot(i); + if (!pPed) + continue; + if (pPed->bRemoveFromWorld) + continue; + if (pPed->bFadeOut) + continue; + if (pPed->m_nWaitState != WAITSTATE_FALSE) + continue; + if (!pPed->IsWithinArea(x1, y1, x2, y2)) + continue; + if (pos.z - PED_FIND_Z_OFFSET > pPed->GetPosition().z) + continue; + if (pos.z + PED_FIND_Z_OFFSET < pPed->GetPosition().z) + continue; + ped_handle = CPools::GetPedPool()->GetIndex(pPed); + CTheScripts::LastRandomPedId = ped_handle; + pPed->CharCreatedBy = MISSION_CHAR; + pPed->bRespondsToThreats = false; + ++CPopulation::ms_nTotalMissionPeds; + if (m_bIsMissionScript) + CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR); + } + SET_INTEGER_PARAM(0, ped_handle); StoreParameters(&m_nIp, 1); return 0; } - case COMMAND_1646: - CollectParameters(&m_nIp, 1); - // TODO (DISABLE_PAUSE_MENU?) + case COMMAND_GET_RANDOM_CAR_IN_AREA_NO_CHECKS_NO_SAVE: + { + CollectParameters(&m_nIp, 4); + int handle = -1; + uint32 i = CPools::GetVehiclePool()->GetSize(); + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float supX = GET_FLOAT_PARAM(2); + float supY = GET_FLOAT_PARAM(3); + while (i-- && handle == -1) { + CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); + if (!pVehicle) + continue; + if (!pVehicle->IsWithinArea(infX, infY, supX, supY)) + continue; + handle = CPools::GetVehiclePool()->GetIndex(pVehicle); + } + SET_INTEGER_PARAM(0, handle); + StoreParameters(&m_nIp, 1); return 0; - case COMMAND_1647: + } + case COMMAND_STORE_CAR_COLLIDED_WITH_NO_SAVE: + { CollectParameters(&m_nIp, 1); - // TODO (IS_CHANNEL_PLAYING?) - UpdateCompareFlag(false); - return 0; - case COMMAND_1648: - CollectParameters(&m_nIp, 3); - // TODO (SET_CLOCK_EVENT_WARNING); - return 0; - case COMMAND_1649: - CollectParameters(&m_nIp, 3); - // TODO (SET_EXTRA_COLOUR_DIRECTION) - return 0; - case COMMAND_1650: - script_assert(false); - return 0; - case COMMAND_1651: - script_assert(false); - return 0; - case COMMAND_1652: - script_assert(false); - return 0; - case COMMAND_1653: - script_assert(false); - return 0; - case COMMAND_1654: - script_assert(false); - return 0; - case COMMAND_1655: - script_assert(false); - return 0; - case COMMAND_1656: - CollectParameters(&m_nIp, 2); - // TODO (?) + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + if (!pVehicle) + printf("STORE_CAR_COLLIDED_WITH_NO_SAVE - Car doesn\'t exist\n"); + else { + if (pVehicle->m_pLastDamageEntity == nil) + SET_INTEGER_PARAM(0, -1); + else { + // what they are doing is not very safe as m_pLastDamageEntity doesn't have to be CVehicle +#ifdef FIX_BUGS + if (!pVehicle->m_pLastDamageEntity->IsVehicle()) { + SET_INTEGER_PARAM(0, -1); + } + else +#endif + { + SET_INTEGER_PARAM(0, CPools::GetVehiclePool()->GetIndex((CVehicle*)pVehicle->m_pLastDamageEntity)); + pVehicle->m_pLastDamageEntity = nil; + } + } + } return 0; + } default: script_assert(0); } diff --git a/src/control/Script9.cpp b/src/control/Script9.cpp new file mode 100644 index 00000000..1bd4f99d --- /dev/null +++ b/src/control/Script9.cpp @@ -0,0 +1,338 @@ +#include "common.h" + +#include "Script.h" +#include "ScriptCommands.h" + +int8 CRunningScript::ProcessCommands1500To1599(int32 command) +{ + switch (command) { + case COMMAND_1497: + script_assert(false); + return 0; + case COMMAND_1498: + script_assert(false); + return 0; + case COMMAND_1499: + script_assert(false); + return 0; + case COMMAND_1500: + script_assert(false); + return 0; + case COMMAND_1501: + script_assert(false); + return 0; + case COMMAND_1502: + script_assert(false); + return 0; + case COMMAND_1503: + script_assert(false); + return 0; + case COMMAND_1504: + script_assert(false); + return 0; + case COMMAND_1505: + script_assert(false); + return 0; + case COMMAND_1506: + script_assert(false); + return 0; + case COMMAND_1507: + script_assert(false); + return 0; + case COMMAND_1508: + script_assert(false); + return 0; + case COMMAND_1509: + script_assert(false); + return 0; + case COMMAND_1510: + script_assert(false); + return 0; + case COMMAND_1511: + script_assert(false); + return 0; + case COMMAND_1512: + script_assert(false); + return 0; + case COMMAND_1513: + script_assert(false); + return 0; + case COMMAND_1514: + script_assert(false); + return 0; + case COMMAND_1515: + script_assert(false); + return 0; + case COMMAND_1516: + script_assert(false); + return 0; + case COMMAND_1517: + script_assert(false); + return 0; + case COMMAND_1518: + // TODO (?) + UpdateCompareFlag(true); + return 0; + case COMMAND_1519: + CollectParameters(&m_nIp, 1); + // TODO (SET_NUMBER_USJ_FOUND?) + return 0; + case COMMAND_1520: + CollectParameters(&m_nIp, 1); + // TODO (SET_TOTAL_HIDDEN_PACKAGES?) + return 0; + case COMMAND_1521: + script_assert(false); + return 0; + case COMMAND_1522: + script_assert(false); + return 0; + case COMMAND_1523: + script_assert(false); + return 0; + case COMMAND_1524: + script_assert(false); + return 0; + case COMMAND_1525: + script_assert(false); + return 0; + case COMMAND_1526: + script_assert(false); + return 0; + case COMMAND_1527: + script_assert(false); + return 0; + case COMMAND_1528: + script_assert(false); + return 0; + case COMMAND_1529: + script_assert(false); + return 0; + case COMMAND_1530: + script_assert(false); + return 0; + case COMMAND_1531: + script_assert(false); + return 0; + case COMMAND_1532: + script_assert(false); + return 0; + case COMMAND_1533: + script_assert(false); + return 0; + case COMMAND_1534: + script_assert(false); + return 0; + case COMMAND_1535: + script_assert(false); + return 0; + case COMMAND_1536: + script_assert(false); + return 0; + case COMMAND_1537: + script_assert(false); + return 0; + case COMMAND_1538: + script_assert(false); + return 0; + case COMMAND_1539: + //TODO (REGISTER_OUTFIT_CHANGE) + return 0; + case COMMAND_1540: + script_assert(false); + return 0; + case COMMAND_1541: + script_assert(false); + return 0; + case COMMAND_1542: + script_assert(false); + return 0; + case COMMAND_1543: + script_assert(false); + return 0; + case COMMAND_1544: + script_assert(false); + return 0; + case COMMAND_1545: + script_assert(false); + return 0; + case COMMAND_1546: + script_assert(false); + return 0; + case COMMAND_1547: + script_assert(false); + return 0; + case COMMAND_1548: + // TODO (GET_ONFOOT_CAMERA_MODE) + ScriptParams[0] = 0; + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_1549: + CollectParameters(&m_nIp, 1); + // TODO (SET_ONFOOT_CAMERA_MODE?) + return 0; + case COMMAND_1550: + script_assert(false); + return 0; + case COMMAND_1551: + script_assert(false); + return 0; + case COMMAND_1552: + script_assert(false); + return 0; + case COMMAND_1553: + script_assert(false); + return 0; + case COMMAND_1554: + script_assert(false); + return 0; + case COMMAND_1555: + CollectParameters(&m_nIp, 1); + // TODO (FREEZE_ONFOOT_CAMERA_MODE?) + return 0; + case COMMAND_1556: + script_assert(false); + return 0; + case COMMAND_1557: + script_assert(false); + return 0; + case COMMAND_1558: + UpdateCompareFlag(false); + // TODO + return 0; + case COMMAND_1559: + script_assert(false); + return 0; + case COMMAND_1560: + // TODO (IS_E3_BUILD?) + UpdateCompareFlag(false); + return 0; + case COMMAND_1561: + // TODO (check, SET_FS_DESTROYED_FLAG) + CTheScripts::FSDestroyedFlag = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace; + return 0; + case COMMAND_1562: + script_assert(false); + return 0; + case COMMAND_1563: + script_assert(false); + return 0; + case COMMAND_1564: + script_assert(false); + return 0; + case COMMAND_1565: + script_assert(false); + return 0; + case COMMAND_1566: + script_assert(false); + return 0; + case COMMAND_1567: + CollectParameters(&m_nIp, 1); + // TODO (BUILD_WORLD_GEOMETRY) + return 0; + case COMMAND_1568: + script_assert(false); + return 0; + case COMMAND_1569: + // TODO (IS_MULTIPLAYER_ACTIVE?) + UpdateCompareFlag(false); + return 0; + case COMMAND_1570: + script_assert(false); + return 0; + case COMMAND_1571: + script_assert(false); + return 0; + case COMMAND_1572: + script_assert(false); + return 0; + case COMMAND_1573: + script_assert(false); + return 0; + case COMMAND_1574: + script_assert(false); + return 0; + case COMMAND_1575: + script_assert(false); + return 0; + case COMMAND_1576: + script_assert(false); + return 0; + case COMMAND_1577: + script_assert(false); + return 0; + case COMMAND_1578: + script_assert(false); + return 0; + case COMMAND_1579: + script_assert(false); + return 0; + case COMMAND_1580: + script_assert(false); + return 0; + case COMMAND_1581: + { + // TODO (SET_HELP_MESSAGE?) + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + return 0; + } + case COMMAND_1582: + script_assert(false); + return 0; + case COMMAND_1583: + script_assert(false); + return 0; + case COMMAND_1584: + script_assert(false); + return 0; + case COMMAND_1585: + script_assert(false); + return 0; + case COMMAND_1586: + script_assert(false); + return 0; + case COMMAND_1587: + script_assert(false); + return 0; + case COMMAND_1588: + script_assert(false); + return 0; + case COMMAND_1589: + CollectParameters(&m_nIp, 2); + // TODO (SWAP_BUILDING?) + return 0; + case COMMAND_1590: + script_assert(false); + return 0; + case COMMAND_1591: + script_assert(false); + return 0; + case COMMAND_1592: + script_assert(false); + return 0; + case COMMAND_1593: + script_assert(false); + return 0; + case COMMAND_1594: + script_assert(false); + return 0; + case COMMAND_1595: + script_assert(false); + return 0; + case COMMAND_1596: + script_assert(false); + return 0; + case COMMAND_1597: + script_assert(false); + return 0; + case COMMAND_1598: + script_assert(false); + return 0; + case COMMAND_1599: + script_assert(false); + return 0; + default: + script_assert(0); + } + return -1; +}
\ No newline at end of file diff --git a/src/control/ScriptCommands.h b/src/control/ScriptCommands.h index 105fa82f..e6bea785 100644 --- a/src/control/ScriptCommands.h +++ b/src/control/ScriptCommands.h @@ -1445,22 +1445,22 @@ enum { COMMAND_IS_JAPANESE_GAME, COMMAND_1442, COMMAND_1443, - COMMAND_1444, - COMMAND_1445, - COMMAND_1446, - COMMAND_1447, - COMMAND_1448, - COMMAND_1449, - COMMAND_1450, - COMMAND_1451, - COMMAND_1452, - COMMAND_1453, + COMMAND_GET_DISTANCE_BETWEEN_2D_POINTS, + COMMAND_GET_DISTANCE_BETWEEN_3D_POINTS, + COMMAND_DOT_PRODUCT_2D, + COMMAND_DOT_PRODUCT_3D, + COMMAND_DEBUG_PRINT_WITH_1_FLOAT, + COMMAND_DEBUG_PRINT_WITH_2_FLOATS, + COMMAND_DEBUG_PRINT_WITH_3_FLOATS, + COMMAND_GET_PAD_BUTTON_STATE, + COMMAND_SET_NAVIGATION_ARROW, + COMMAND_CLEAR_NAVIGATION_ARROW, COMMAND_CALL, - COMMAND_NOTCALL, - COMMAND_1456, - COMMAND_1457, - COMMAND_1458, - COMMAND_1459, + COMMAND_CALLNOT, + COMMAND_IS_CAR_AUTOMOBILE, + COMMAND_IS_CAR_BIKE, + COMMAND_IS_CAR_PLANE, + COMMAND_IS_CAR_HELI, COMMAND_1460, COMMAND_1461, COMMAND_1462, @@ -1478,26 +1478,26 @@ enum { COMMAND_1474, COMMAND_1475, COMMAND_1476, - COMMAND_1477, - COMMAND_1478, - COMMAND_1479, - COMMAND_1480, - COMMAND_1481, - COMMAND_1482, - COMMAND_1483, - COMMAND_1484, - COMMAND_1485, - COMMAND_1486, - COMMAND_1487, - COMMAND_1488, + COMMAND_RETURN_IF_TRUE, + COMMAND_RETURN_TRUE_IF_TRUE, + COMMAND_SET_CHAR_ONLY_ALLOWED_TO_SIT_BEHIND, + COMMAND_SET_RC_HELI_HEIGHT_LIMIT, + COMMAND_CREATE_SCRIPT_CORONA, + COMMAND_REMOVE_SCRIPT_CORONA, + COMMAND_IS_BOAT_IN_WATER, + COMMAND_IS_CAR_DRIVER_BEING_JACKED, + COMMAND_SET_CHAR_ONLY_ALLOWED_TO_SIT_IN_FRONT, + COMMAND_SET_CAR_TILTED_BY_CHAR, + COMMAND_GET_WEAPON_TYPE_FOR_PICKUP_IN_AREA, + COMMAND_IS_USING_FIRST_PERSON_WEAPON_CAMERA, COMMAND_1489, COMMAND_1490, COMMAND_1491, - COMMAND_1492, - COMMAND_1493, - COMMAND_1494, - COMMAND_1495, - COMMAND_1496, + COMMAND_SET_DEBUG_MENU_ACTUVE, + COMMAND_SET_DRAW_HUD, + COMMAND_GET_RANDOM_CHAR_IN_AREA_NO_CHECKS, + COMMAND_GET_RANDOM_CAR_IN_AREA_NO_CHECKS_NO_SAVE, + COMMAND_STORE_CAR_COLLIDED_WITH_NO_SAVE, COMMAND_1497, COMMAND_1498, COMMAND_1499, diff --git a/src/core/Pad.h b/src/core/Pad.h index 3a4f54b3..a3634134 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -277,6 +277,16 @@ public: uint32 InputHowLongAgo(void); void SetDrunkInputDelay(int32 delay) { DrunkDrivingBufferUsed = delay; } + // TODO(LCS): properly, this is just to get some estimation for script + int16 GetOddJobTrigger() { return GetRightShockJustDown(); } + int16 GuiLeft() { return GetAnaloguePadLeft() || GetDPadLeftJustDown(); } + int16 GuiRight() { return GetAnaloguePadRight() || GetDPadRightJustDown(); } + int16 GuiUp() { return GetAnaloguePadUp() || GetDPadUpJustDown(); } + int16 GuiDown() { return GetAnaloguePadDown() || GetDPadDownJustDown(); } + int16 GuiSelect() { return GetSelect(); } + int16 GuiBack() { return GetStart(); } + int16 GetSkipCutscene() { return GetCrossJustDown(); } + #ifdef XINPUT void AffectFromXinput(uint32 pad); #endif diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 9ed6f2ff..9c77b596 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -499,7 +499,7 @@ public: uint32 bIsDrowning : 1; uint32 bDrownsInWater : 1; uint32 bWaitForLeaderToComeCloser : 1; - uint32 bHeldHostageInCar : 1; + uint32 bHeldHostageInCar : 1; // one flag was added somewhere after this one (TODO: figure out where and which) uint32 bIsPlayerFriend : 1; uint32 bHeadStuckInCollision : 1; uint32 bDeadPedInFrontOfCar : 1; @@ -512,7 +512,7 @@ public: uint32 bMakeFleeScream : 1; uint32 bPushedAlongByCar : 1; uint32 bRemoveMeWhenIGotIntoCar : 1; - uint32 bIgnoreThreatsBehindObjects : 1; + uint32 bIgnoreThreatsBehindObjects : 1; // one flag was added somewhere before this one (TODO: figure out where and which) uint32 bNeverEverTargetThisPed : 1; uint32 bCrouchWhenScared : 1; @@ -523,8 +523,8 @@ public: uint32 bDonePositionOutOfCollision : 1; uint32 bCanAttackPlayerWithCops : 1; // 1A1_1 on PS2 - uint32 b1A1_2 : 1; - uint32 b1A1_4 : 1; + uint32 bOnlyAllowedToSitBehind : 1; + uint32 bOnlyAllowedToSitInFront : 1; uint32 b1A1_8 : 1; uint32 b1A1_10 : 1; uint32 b1A1_20 : 1; @@ -534,11 +534,29 @@ public: uint32 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle #endif - uint8 m_gangFlags; - uint8 m_unused15D; // these 3 can't be padding but had to actually have been members ... - uint8 m_unused15E; - uint8 m_unused15F; - uint8 CharCreatedBy; + uint16 m_gangFlags; // <- this one is uint16 + + uint8 b1A4_1 : 1; + uint8 b1A4_2 : 1; + uint8 b1A4_4 : 1; + uint8 b1A4_8 : 1; + uint8 b1A4_10 : 1; + uint8 b1A4_20 : 1; + uint8 b1A4_40 : 1; + uint8 b1A4_80 : 1; + + uint8 b1A5_1 : 1; + uint8 b1A5_2 : 1; + uint8 b1A5_4 : 1; + uint8 b1A5_8 : 1; + uint8 b1A5_10 : 1; + uint8 b1A5_20 : 1; + uint8 b1A5_40 : 1; + uint8 b1A5_80 : 1; + + uint8 unk_1A6; // <- init with 100 in constructor + + uint8 CharCreatedBy; // 1AC eObjective m_objective; eObjective m_prevObjective; CPed *m_pedInObjective; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index f3181fa8..e896b871 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -130,6 +130,8 @@ uint32 CHud::m_LastTimeEnergyLost; CSprite2d CHud::Sprites[NUM_HUD_SPRITES]; +wchar* CHud::gLastPrintForeverString; + struct { const char *name; |