From c7841540a95bc054bc8c61b46cf5112d567091be Mon Sep 17 00:00:00 2001 From: Serius41 <118758994+Serius41@users.noreply.github.com> Date: Tue, 5 Dec 2023 13:40:51 +0300 Subject: [PATCH 1/4] Update CMultiplayerSA_1.3.cpp --- Client/multiplayer_sa/CMultiplayerSA_1.3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/multiplayer_sa/CMultiplayerSA_1.3.cpp b/Client/multiplayer_sa/CMultiplayerSA_1.3.cpp index afea015991..b84dd9a490 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_1.3.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_1.3.cpp @@ -1435,7 +1435,7 @@ void CVehicleModelInterface_SetClump() { // Loop through all vehicles and find the vehicle id that this interface belongs to CModelInfo* pModelInfo = NULL; - for (int i = 400; i < 612; i++) + for (int i = 400; i < 80000000; i++) { pModelInfo = pGameInterface->GetModelInfo(i); if (pModelInfo && (DWORD)pModelInfo->GetInterface() == (DWORD)pLoadingModelInfo) From 51d3f677780a0dbcbb433ba01ed90fb3121da0e4 Mon Sep 17 00:00:00 2001 From: Serius41 <118758994+Serius41@users.noreply.github.com> Date: Tue, 5 Dec 2023 13:41:43 +0300 Subject: [PATCH 2/4] Update CVehicleUpgrades.cpp --- Client/mods/deathmatch/logic/CVehicleUpgrades.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp b/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp index da592b41ef..257857a6fc 100644 --- a/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp +++ b/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp @@ -64,6 +64,7 @@ bool CVehicleUpgrades::IsUpgradeCompatible(unsigned short usUpgrade) return false; unsigned short usModel = m_pVehicle->GetModel(); + // Wheels should be compatible with any vehicle which have wheels, except // bike/bmx (they're buggy). Vortex is technically a car, but it has no // wheels. @@ -80,7 +81,15 @@ bool CVehicleUpgrades::IsUpgradeCompatible(unsigned short usUpgrade) return true; bool bReturn = false; - switch (usModel) + int model = NULL; + int modelRequestIDParent = g_pGame->GetModelInfo(usModel)->GetParentID(); + if (modelRequestIDParent == 0){ + model = usModel; + }else{ + model = modelRequestIDParent; + } + + switch (model) { case 400: bReturn = (us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1013 || us == 1024 || us == 1008 || us == 1009 || us == 1010); From 58d03fc74835cfb03398d2491f6fc66818edde74 Mon Sep 17 00:00:00 2001 From: Serius41 <118758994+Serius41@users.noreply.github.com> Date: Wed, 6 Dec 2023 22:39:53 +0300 Subject: [PATCH 3/4] Update CMultiplayerSA_1.3.cpp --- Client/multiplayer_sa/CMultiplayerSA_1.3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/multiplayer_sa/CMultiplayerSA_1.3.cpp b/Client/multiplayer_sa/CMultiplayerSA_1.3.cpp index b84dd9a490..afea015991 100644 --- a/Client/multiplayer_sa/CMultiplayerSA_1.3.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA_1.3.cpp @@ -1435,7 +1435,7 @@ void CVehicleModelInterface_SetClump() { // Loop through all vehicles and find the vehicle id that this interface belongs to CModelInfo* pModelInfo = NULL; - for (int i = 400; i < 80000000; i++) + for (int i = 400; i < 612; i++) { pModelInfo = pGameInterface->GetModelInfo(i); if (pModelInfo && (DWORD)pModelInfo->GetInterface() == (DWORD)pLoadingModelInfo) From 16ee9b2c7601a70de3b830ab611f9c8dab8b3b0b Mon Sep 17 00:00:00 2001 From: Serius41 <118758994+Serius41@users.noreply.github.com> Date: Wed, 6 Dec 2023 22:40:51 +0300 Subject: [PATCH 4/4] Update CVehicleUpgrades.cpp --- .../deathmatch/logic/CVehicleUpgrades.cpp | 604 +++++++----------- 1 file changed, 236 insertions(+), 368 deletions(-) diff --git a/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp b/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp index 257857a6fc..52ac729421 100644 --- a/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp +++ b/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp @@ -9,6 +9,13 @@ *****************************************************************************/ #include +#include +#include + +#define VEHICLE_UPGRADE_SLOTS 17 + +#define NUM_VEHICLE_MODELS 212 + char szUpgradeNameEmpty[] = ""; @@ -35,6 +42,224 @@ static const SFixedArray UpgradeNames = {{{"Hood"}, {"Rear Bumper"}, {"Misc"}}}; +// Define a structure to represent vehicle upgrades + +using VehicleUpgradeSlots = std::array; // 224 bits +static const std::array vehicleUpgradeSlots = {{ + /*400=*/{0x33c2700, 0x0, 0xfffe00, 0x7}, + /*401=*/{0x29be7ff, 0x14060000, 0xfffe00, 0x7, 0x400dcc00, 0x1c}, + /*402=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*403=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*404=*/{0x2bbe78f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*405=*/{0x2bdc70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*406=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*407=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*408=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*409=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*410=*/{0x3bbe78f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*411=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*412=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*413=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*414=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*415=*/{0x28fc78f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*416=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*417=*/{0x0, 0x0, 0x400000}, + /*418=*/{0x2b1c74f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*419=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*420=*/{0x2a9c73f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*421=*/{0x2bdc70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*422=*/{0x23a0780, 0x0, 0xfffe00, 0x7}, + /*423=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*424=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*425=*/{0x0, 0x0, 0x400000}, + /*426=*/{0x2a9c77f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*427=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*428=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*429=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*430=*/{}, + /*431=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*432=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*433=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*434=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*435=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*436=*/{0x2fbe7cf, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*437=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*438=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*439=*/{0x283e78f, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*440=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*441=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*442=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*443=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*444=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*445=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*446=*/{}, + /*447=*/{0x0, 0x0, 0x400000}, + /*448=*/{0x0, 0x0, 0x400000}, + /*449=*/{}, + /*450=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*451=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*452=*/{}, + /*453=*/{}, + /*454=*/{}, + /*455=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*456=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*457=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*458=*/{0x281c70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*459=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*460=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*461=*/{0x0, 0x0, 0x400000}, + /*462=*/{0x0, 0x0, 0x400000}, + /*463=*/{0x0, 0x0, 0x400000}, + /*464=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*465=*/{0x0, 0x0, 0x400000}, + /*466=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*467=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*468=*/{0x0, 0x0, 0x400000}, + /*469=*/{0x0, 0x0, 0x400000}, + /*470=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*471=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*472=*/{}, + /*473=*/{}, + /*474=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*475=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*476=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*477=*/{0x23e07c0, 0x0, 0xfffe00, 0x7}, + /*478=*/{0x2701730, 0x0, 0xfffe00, 0x7}, + /*479=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*480=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*481=*/{0x0, 0x0, 0x400000}, + /*482=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*483=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*484=*/{}, + /*485=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*486=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*487=*/{0x0, 0x0, 0x400000}, + /*488=*/{0x0, 0x0, 0x400000}, + /*489=*/{0x39de77f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*490=*/{0x281c70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*491=*/{0x2bfc78f, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*492=*/{0x281c77f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*493=*/{}, + /*494=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*495=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*496=*/{0x29bcfcf, 0x14060000, 0xfffe00, 0x7, 0x400ccc00, 0x1c}, + /*497=*/{0x0, 0x0, 0x400000}, + /*498=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*499=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*500=*/{0x2380700, 0x0, 0xfffe00, 0x7}, + /*501=*/{0x0, 0x0, 0x400000}, + /*502=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*503=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*504=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*505=*/{0x281c70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*506=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*507=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*508=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*509=*/{0x0, 0x0, 0x400000}, + /*510=*/{0x0, 0x0, 0x400000}, + /*511=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*512=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*513=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*514=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*515=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*516=*/{0x2bfc79f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*517=*/{0x29fc78f, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*518=*/{0x297e7ef, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*519=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*520=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*521=*/{0x0, 0x0, 0x400000}, + /*522=*/{0x0, 0x0, 0x400000}, + /*523=*/{0x0, 0x0, 0x400000}, + /*524=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*525=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*526=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*527=*/{0x2b7c78f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*528=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*529=*/{0x29fdfcf, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*530=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*531=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*532=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*533=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*534=*/{0x2000700, 0x0, 0xfffe00, 0x7fffffff, 0x0, 0x21c0000}, + /*535=*/{0x2000700, 0x0, 0xfffe00, 0x3fe6007}, + /*536=*/{0x2000700, 0x0, 0xfffe00, 0x1b87, 0x1, 0x1e00000}, + /*537=*/{}, + /*538=*/{}, + /*539=*/{0x0, 0x0, 0x400000}, + /*540=*/{0x39fc7df, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*541=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*542=*/{0x2bdc70f, 0x14060000, 0xfffe00, 0x7, 0x400f0c00, 0x1c}, + /*543=*/{0x281c70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*544=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*545=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*546=*/{0x38fc7df, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*547=*/{0x2bdc70f, 0x14060000, 0xfffe00, 0x7, 0x400ccc00, 0x1c}, + /*548=*/{0x0, 0x0, 0x400000}, + /*549=*/{0x29fdf8f, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*550=*/{0x29dc77f, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*551=*/{0x2bdc76f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*552=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*553=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*554=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*555=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*556=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*557=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*558=*/{0x281c70f, 0x14060000, 0x7fffffff, 0x7, 0x400c0c00, 0x1fc}, + /*559=*/{0x281c70f, 0x14060000, 0xfffffe, 0x7, 0x7fffffff, 0x201f}, + /*560=*/{0x7fffffff, 0x14060003, 0xfffe00, 0x7, 0x400c3c00, 0x61c}, + /*561=*/{0x281c70f, 0x7fffffff, 0xfffe01, 0x7, 0x7c0c0c00, 0x1c}, + /*562=*/{0x281c70f, 0x140603fc, 0xfffe00, 0x7, 0x403c0c00, 0x181c}, + /*563=*/{0x0, 0x0, 0x400000}, + /*564=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*565=*/{0x281c70f, 0x147fe000, 0xfffe00, 0x7, 0x43cc0c00, 0x1c}, + /*566=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*567=*/{0x2000700, 0x0, 0xfffe00, 0x47, 0x3e, 0x3c000000}, + /*568=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*569=*/{}, + /*570=*/{}, + /*571=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*572=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*573=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*574=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*575=*/{0x2000700, 0x1c00, 0xfffe00, 0xf, 0x0, 0x3c000}, + /*576=*/{0x2000700, 0x0, 0xfffe00, 0x7, 0x3c0, 0x7fffffff, 0x3}, + /*577=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*578=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*579=*/{0x281c70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*580=*/{0x297c7cf, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*581=*/{0x0, 0x0, 0x400000}, + /*582=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*583=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*584=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*585=*/{0x29fe7cf, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*586=*/{0x0, 0x0, 0x400000}, + /*587=*/{0x281c70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*588=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*589=*/{0x297c7ff, 0x14060000, 0xfffe00, 0x7, 0x400f0c00, 0x1c}, + /*590=*/{}, + /*591=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*592=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*593=*/{0x2000000, 0x0, 0x7ffe00, 0x7}, + /*594=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*595=*/{}, + /*596=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*597=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*598=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*599=*/{0x281c70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*600=*/{0x25627f0, 0x0, 0xfffe00, 0x7}, + /*601=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*602=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*603=*/{0x29fc7cf, 0x14060000, 0xfffe00, 0x7, 0x400fcc00, 0x1c}, + /*604=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*605=*/{0x281c70f, 0x14060000, 0xfffe00, 0x7, 0x400c0c00, 0x1c}, + /*606=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*607=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*608=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*609=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*610=*/{0x2000700, 0x0, 0xfffe00, 0x7}, + /*611=*/{0x2000700, 0x0, 0xfffe00, 0x7}, +}}; + CVehicleUpgrades::CVehicleUpgrades(CClientVehicle* pVehicle) { m_pVehicle = pVehicle; @@ -64,385 +289,28 @@ bool CVehicleUpgrades::IsUpgradeCompatible(unsigned short usUpgrade) return false; unsigned short usModel = m_pVehicle->GetModel(); - - // Wheels should be compatible with any vehicle which have wheels, except - // bike/bmx (they're buggy). Vortex is technically a car, but it has no - // wheels. - if ((us == 1025 || us == 1073 || us == 1074 || us == 1075 || us == 1076 || us == 1077 || us == 1078 || us == 1079 || us == 1080 || us == 1081 || - us == 1082 || us == 1083 || us == 1084 || us == 1085 || us == 1096 || us == 1097 || us == 1098) && - usModel != 539) - return true; // No nitro or other upgrades for planes if (vehicleType == CLIENTVEHICLE_PLANE) return false; - if (us == VEHICLEUPGRADE_NITRO_5X || us == VEHICLEUPGRADE_NITRO_2X || us == VEHICLEUPGRADE_NITRO_10X || us == VEHICLEUPGRADE_HYDRAULICS) - return true; - bool bReturn = false; - int model = NULL; int modelRequestIDParent = g_pGame->GetModelInfo(usModel)->GetParentID(); - if (modelRequestIDParent == 0){ - model = usModel; - }else{ - model = modelRequestIDParent; - } - switch (model) - { - case 400: - bReturn = (us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1013 || us == 1024 || us == 1008 || us == 1009 || us == 1010); - break; - case 401: - bReturn = (us == 1005 || us == 1004 || us == 1142 || us == 1143 || us == 1144 || us == 114 || us == 1020 || us == 1019 || us == 1013 || - us == 1008 || us == 1009 || us == 1010 || us == 1006 || us == 1001 || us == 1003 || us == 1017 || us == 1007); - break; - case 402: - bReturn = (us == 1009 || us == 1010); - break; - case 404: - bReturn = (us == 1020 || us == 1021 || us == 1019 || us == 1013 || us == 1008 || us == 1009 || us == 1010 || us == 1002 || us == 1016 || - us == 1000 || us == 1017 || us == 1007); - break; - case 405: - bReturn = (us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1001 || us == 1014 || - us == 1023 || us == 1000); - break; - case 409: - bReturn = (us == 1009); - break; - case 410: - bReturn = (us == 1019 || us == 1021 || us == 1020 || us == 1013 || us == 1024 || us == 1008 || us == 1009 || us == 1010 || us == 1001 || - us == 1023 || us == 1003 || us == 1017 || us == 1007); - break; - case 411: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 412: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 415: - bReturn = - (us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1001 || us == 1023 || us == 1003 || us == 1017 || us == 1007); - break; - case 418: - bReturn = (us == 1020 || us == 1021 || us == 1008 || us == 1009 || us == 1010 || us == 1006 || us == 1002 || us == 1016); - break; - case 419: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 420: - bReturn = (us == 1005 || us == 1004 || us == 1021 || us == 1019 || us == 1008 || us == 1009 || us == 1010 || us == 1001 || us == 1003); - break; - case 421: - bReturn = (us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1014 || us == 1023 || - us == 1016 || us == 1000); - break; - case 422: - bReturn = (us == 1020 || us == 1021 || us == 1019 || us == 1013 || us == 1008 || us == 1009 || us == 1010 || us == 1017 || us == 1007); - break; - case 426: - bReturn = - (us == 1005 || us == 1004 || us == 1021 || us == 1019 || us == 1008 || us == 1009 || us == 1010 || us == 1006 || us == 1001 || us == 1003); - break; - case 429: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 436: - bReturn = (us == 1020 || us == 1021 || us == 1022 || us == 1019 || us == 1013 || us == 1008 || us == 1009 || us == 1010 || us == 1006 || - us == 1001 || us == 1003 || us == 1017 || us == 1007); - break; - case 438: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 439: - bReturn = (us == 1003 || us == 1023 || us == 1001 || us == 1008 || us == 1009 || us == 1010 || us == 1017 || us == 1007 || us == 1142 || - us == 1143 || us == 1144 || us == 1145 || us == 1013); - break; - case 442: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 445: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 451: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 458: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 466: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 467: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 474: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 475: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 477: - bReturn = - (us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1006 || us == 1017 || us == 1007); - break; - case 478: - bReturn = (us == 1005 || us == 1004 || us == 1012 || us == 1020 || us == 1021 || us == 1022 || us == 1013 || us == 1024 || us == 1008 || - us == 1009 || us == 1010); - break; - case 479: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 480: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 489: - bReturn = (us == 1005 || us == 1004 || us == 1020 || us == 1019 || us == 1018 || us == 1013 || us == 1024 || us == 1008 || us == 1009 || - us == 1010 || us == 1006 || us == 1002 || us == 1016 || us == 1000); - break; - case 491: - bReturn = (us == 1142 || us == 1143 || us == 1144 || us == 1145 || us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1008 || - us == 1009 || us == 1010 || us == 1014 || us == 1023 || us == 1003 || us == 1017 || us == 1007); - break; - case 492: - bReturn = (us == 1005 || us == 1004 || us == 1008 || us == 1009 || us == 1010 || us == 1006 || us == 1016 || us == 1000); - break; - case 496: - bReturn = (us == 1006 || us == 1017 || us == 1007 || us == 1011 || us == 1019 || us == 1023 || us == 1001 || us == 1008 || us == 1009 || - us == 1010 || us == 1003 || us == 1002 || us == 1142 || us == 1143 || us == 1020); - break; - case 500: - bReturn = (us == 1020 || us == 1021 || us == 1019 || us == 1013 || us == 1024 || us == 1008 || us == 1009 || us == 1010); - break; - case 506: - bReturn = (us == 1009); - break; - case 507: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 516: - bReturn = (us == 1004 || us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1002 || - us == 1015 || us == 1016 || us == 1000 || us == 1017 || us == 1007); - break; - case 517: - bReturn = (us == 1142 || us == 1143 || us == 1144 || us == 1145 || us == 1020 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || - us == 1010 || us == 1002 || us == 1023 || us == 1016 || us == 1003 || us == 1017 || us == 1007); - break; - case 518: - bReturn = (us == 1005 || us == 1142 || us == 1143 || us == 1144 || us == 1145 || us == 1020 || us == 1018 || us == 1013 || us == 1008 || - us == 1009 || us == 1010 || us == 1006 || us == 1001 || us == 1023 || us == 1003 || us == 1017 || us == 1007); - break; - case 526: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 527: - bReturn = (us == 1021 || us == 1020 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1001 || us == 1014 || us == 1015 || - us == 1017 || us == 1007); - break; - case 529: - bReturn = (us == 1012 || us == 1011 || us == 1020 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1006 || - us == 1001 || us == 1023 || us == 1003 || us == 1017 || us == 1007); - break; - case 533: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 534: - bReturn = (us == 1126 || us == 1127 || us == 1179 || us == 1185 || us == 1100 || us == 1123 || us == 1125 || us == 1008 || us == 1009 || - us == 1010 || us == 1180 || us == 1178 || us == 1101 || us == 1122 || us == 1124 || us == 1106); - break; - case 535: - bReturn = (us == 1109 || us == 1110 || us == 1113 || us == 1114 || us == 1115 || us == 1116 || us == 1117 || us == 1008 || us == 1009 || - us == 1010 || us == 1120 || us == 1118 || us == 1121 || us == 1119); - break; - case 536: - bReturn = (us == 1104 || us == 1105 || us == 1182 || us == 1181 || us == 1008 || us == 1009 || us == 1010 || us == 1184 || us == 1183 || - us == 1128 || us == 1103 || us == 1107 || us == 1108); - break; - case 540: - bReturn = (us == 1004 || us == 1142 || us == 1143 || us == 1144 || us == 1145 || us == 1020 || us == 1019 || us == 1018 || us == 1024 || - us == 1008 || us == 1009 || us == 1010 || us == 1006 || us == 1001 || us == 1023 || us == 1017 || us == 1007); - break; - case 541: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 542: - bReturn = (us == 1144 || us == 1145 || us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || - us == 1014 || us == 1015); - break; - case 545: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 546: - bReturn = (us == 1004 || us == 1142 || us == 1143 || us == 1144 || us == 1145 || us == 1019 || us == 1018 || us == 1024 || us == 1008 || - us == 1009 || us == 1010 || us == 1006 || us == 1002 || us == 1001 || us == 1023 || us == 1017 || us == 1007); - break; - case 547: - bReturn = (us == 1142 || us == 1143 || us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || - us == 1016 || us == 1003 || us == 1000); - break; - case 549: - bReturn = (us == 1012 || us == 1011 || us == 1142 || us == 1143 || us == 1144 || us == 1145 || us == 1020 || us == 1019 || us == 1018 || - us == 1008 || us == 1009 || us == 1010 || us == 1001 || us == 1023 || us == 1003 || us == 1017 || us == 1007); - break; - case 550: - bReturn = (us == 1005 || us == 1004 || us == 1142 || us == 1143 || us == 1144 || us == 1145 || us == 1020 || us == 1019 || us == 1018 || - us == 1008 || us == 1009 || us == 1010 || us == 1006 || us == 1001 || us == 1023 || us == 1003); - break; - case 551: - bReturn = (us == 1005 || us == 1020 || us == 1021 || us == 1019 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1006 || - us == 1002 || us == 1023 || us == 1016 || us == 1003); - break; - case 555: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 558: - bReturn = (us == 1092 || us == 1089 || us == 1166 || us == 1165 || us == 1008 || us == 1009 || us == 1010 || us == 1168 || us == 1167 || - us == 1088 || us == 1091 || us == 1164 || us == 1163 || us == 1094 || us == 1090 || us == 1095 || us == 1093); - break; - case 559: - bReturn = (us == 1065 || us == 1066 || us == 1160 || us == 1173 || us == 1008 || us == 1009 || us == 1010 || us == 1159 || us == 1161 || - us == 1162 || us == 1158 || us == 1067 || us == 1068 || us == 1071 || us == 1069 || us == 1072 || us == 1070); - break; - case 560: - bReturn = (us == 1028 || us == 1029 || us == 1169 || us == 1170 || us == 1008 || us == 1009 || us == 1010 || us == 1141 || us == 1140 || - us == 1032 || us == 1033 || us == 1138 || us == 1139 || us == 1027 || us == 1026 || us == 1030 || us == 1031); - break; - case 561: - bReturn = (us == 1064 || us == 1059 || us == 1155 || us == 1157 || us == 1008 || us == 1009 || us == 1010 || us == 1154 || us == 1156 || - us == 1055 || us == 1061 || us == 1058 || us == 1060 || us == 1062 || us == 1056 || us == 1063 || us == 1057); - break; - case 562: - bReturn = (us == 1034 || us == 1037 || us == 1171 || us == 1172 || us == 1008 || us == 1009 || us == 1010 || us == 1149 || us == 1148 || - us == 1038 || us == 1035 || us == 1147 || us == 1146 || us == 1040 || us == 1036 || us == 1041 || us == 1039); - break; - case 565: - bReturn = (us == 1046 || us == 1045 || us == 1153 || us == 1152 || us == 1008 || us == 1009 || us == 1010 || us == 1150 || us == 1151 || - us == 1054 || us == 1053 || us == 1049 || us == 1050 || us == 1051 || us == 1047 || us == 1052 || us == 1048); - break; - case 566: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 567: - bReturn = (us == 1129 || us == 1132 || us == 1189 || us == 1188 || us == 1008 || us == 1009 || us == 1010 || us == 1187 || us == 1186 || - us == 1130 || us == 1131 || us == 1102 || us == 1133); - break; - case 575: - bReturn = (us == 1044 || us == 1043 || us == 1174 || us == 1175 || us == 1008 || us == 1009 || us == 1010 || us == 1176 || us == 1177 || - us == 1099 || us == 1042); - break; - case 576: - bReturn = (us == 1136 || us == 1135 || us == 1191 || us == 1190 || us == 1008 || us == 1009 || us == 1010 || us == 1192 || us == 1193 || - us == 1137 || us == 1134); - break; - case 579: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 580: - bReturn = - (us == 1020 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || us == 1006 || us == 1001 || us == 1023 || us == 1017 || us == 1007); - break; - case 585: - bReturn = (us == 1142 || us == 1143 || us == 1144 || us == 1145 || us == 1020 || us == 1019 || us == 1018 || us == 1013 || us == 1008 || - us == 1009 || us == 1010 || us == 1006 || us == 1001 || us == 1023 || us == 1003 || us == 1017 || us == 1007); - break; - case 587: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 589: - bReturn = (us == 1005 || us == 1004 || us == 1144 || us == 1145 || us == 1020 || us == 1018 || us == 1008 || us == 1009 || us == 1010 || - us == 1024 || us == 1013 || us == 1006 || us == 1016 || us == 1000 || us == 1017 || us == 1007); - break; - case 600: - bReturn = (us == 1005 || us == 1004 || us == 1020 || us == 1022 || us == 1018 || us == 1013 || us == 1008 || us == 1009 || us == 1010 || - us == 1006 || us == 1017 || us == 1007); - break; - case 602: - bReturn = (us == 1008 || us == 1009 || us == 1010); - break; - case 603: - bReturn = (us == 1144 || us == 1145 || us == 1142 || us == 1143 || us == 1020 || us == 1019 || us == 1018 || us == 1024 || us == 1008 || - us == 1009 || us == 1010 || us == 1006 || us == 1001 || us == 1023 || us == 1017 || us == 1007); - break; - } - unsigned char ucSlot = 0; - // Allow slot 2 to be upgraded regardless of ID and then check it has the required part - if (GetSlotFromUpgrade(us, ucSlot) && (bReturn || ucSlot == 2)) - { - // Get our model supported upgrades - SVehicleSupportedUpgrades supportedUpgrades = m_pVehicle->GetModelInfo()->GetVehicleSupportedUpgrades(); - // Initialisation happens when we load the clump which is done when we require a specific model rather than in bulk - if (supportedUpgrades.m_bInitialised == true) - { - // Hood and Vents - if (ucSlot == 0 || ucSlot == 1) - { - if (supportedUpgrades.m_bBonnet == true) - { - if (us == 1142 || us == 1144) - { - // We add both left and right for some reason seems to be SA doing it - bReturn &= supportedUpgrades.m_bBonnet_Left; - bReturn &= supportedUpgrades.m_bBonnet_Left_dam; + if (auto* pModelInfo = g_pGame->GetModelInfo(usModel); pModelInfo && pModelInfo->GetParentID() != 0) + usModel = static_cast(pModelInfo->GetParentID()); - bReturn &= supportedUpgrades.m_bBonnet_Right; - bReturn &= supportedUpgrades.m_bBonnet_Right_dam; - } - else if (us == 1004 || us == 1005 || us == 1011 || us == 1012) - { - // Just needs m_bBonnet - bReturn = true; - } - } - } - else if (ucSlot == 2) - { - bReturn = supportedUpgrades.m_bSpoiler; - } - else if (ucSlot == 3) - { - bReturn = supportedUpgrades.m_bSideSkirt_Right; - bReturn &= supportedUpgrades.m_bSideSkirt_Left; - } - else if (ucSlot == 4) - { - bReturn = supportedUpgrades.m_bFrontBullbars; - } - else if (ucSlot == 5) - { - bReturn = supportedUpgrades.m_bRearBullbars; - } - else if (ucSlot == 6) - { - bReturn = supportedUpgrades.m_bLamps; - bReturn &= supportedUpgrades.m_bLamps_dam; - } - else if (ucSlot == 7) - { - bReturn = supportedUpgrades.m_bRoof; - } - else if (ucSlot == 13) - { - bReturn = supportedUpgrades.m_bExhaust; - } - else if (ucSlot == 14) - { - bReturn = supportedUpgrades.m_bFrontBumper; - } - else if (ucSlot == 15) - { - bReturn = supportedUpgrades.m_bRearBumper; - } - else if (ucSlot == 16) - { - bReturn = supportedUpgrades.m_bMisc; - } - } - } - return bReturn; + size_t vehicleIndex = (usModel - 400); + size_t upgradeIndex = (usUpgrade - 1000); + + const VehicleUpgradeSlots& slots = vehicleUpgradeSlots[vehicleIndex]; + size_t slotIndex = upgradeIndex / 32; + uint32_t slot = slots[slotIndex]; + size_t upgradeBit = (upgradeIndex - (slotIndex * 32)); + return slot & (1 << upgradeBit); } + bool CVehicleUpgrades::GetSlotFromUpgrade(unsigned short us, unsigned char& ucSlot) { if (us == 1011 || us == 1012 || us == 1111 || us == 1112 || us == 1142 || /* bonet */