From a68c400389cefc0b5ce3de4cbd0b71edf993a978 Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:35:21 +0000 Subject: [PATCH 01/16] Version Update - Add 2802.0 --- Solution/source/macros.h | 2 +- Solution/source/main.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Solution/source/macros.h b/Solution/source/macros.h index b29d7876..2e1d44a5 100644 --- a/Solution/source/macros.h +++ b/Solution/source/macros.h @@ -16,7 +16,7 @@ #define _CRT_SECURE_NO_WARNINGS // version -#define MENYOO_CURRENT_VER_ "1.7.2" +#define MENYOO_CURRENT_VER_ "1.7.3" #define GAME_PLAYERCOUNT 30 diff --git a/Solution/source/main.h b/Solution/source/main.h index 9f1397ee..3ac22438 100644 --- a/Solution/source/main.h +++ b/Solution/source/main.h @@ -256,6 +256,13 @@ enum eGameVersion : int VER_1_0_2699_0_STEAM, VER_1_0_2699_0_NOSTEAM, + VER_1_0_2699_16_STEAM, + VER_1_0_2699_16_NOSTEAM, + + VER_1_0_2802_0_STEAM, + VER_1_0_2802_0_NOSTEAM, + + VER_SIZE, VER_UNK = -1 }; From f3e9764a0e8e2147c35a0d32dbd64b3b2ed57cc8 Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:36:52 +0000 Subject: [PATCH 02/16] New Functionality and Minor Bug Fixes - Fixed bug with menu colour display not showing for blue on RGB paints - Fixed spawn bug with amphibious vehicles when being recovered as saved vehicles - Added 2nd livery option for those that support it (Tornado Roof) - Added options to retain Dirt when repairing cars - Added hidden function to store and print carvariation colours for private use. Option is currently commented out. --- Solution/source/Submenus/VehicleModShop.cpp | 63 ++++++++++++++++----- Solution/source/Submenus/VehicleOptions.cpp | 10 ++-- Solution/source/Submenus/VehicleSpawner.cpp | 38 ++++++++++++- Solution/source/Submenus/VehicleSpawner.h | 1 + 4 files changed, 92 insertions(+), 20 deletions(-) diff --git a/Solution/source/Submenus/VehicleModShop.cpp b/Solution/source/Submenus/VehicleModShop.cpp index 56fb0678..c7f505a7 100644 --- a/Solution/source/Submenus/VehicleModShop.cpp +++ b/Solution/source/Submenus/VehicleModShop.cpp @@ -16,7 +16,6 @@ #include "..\Natives\natives2.h" #include "..\Util\GTAmath.h" -#include "..\Util\StringManip.h" #include "..\Scripting\enums.h" #include "..\main.h" #include "..\Scripting\GTAvehicle.h" @@ -564,7 +563,7 @@ namespace sub set_mspaints_index_5 = 0, set_mspaints_index_6 = 0, paintFade_plus = 0, paintFade_minus = 0, dirtLevel_plus = 0, dirtLevel_minus = 0, - carvarcol_plus = 0, carvarcol_minus = 0; + carvarcol_plus = 0, carvarcol_minus = 0, carvarcol_input=0; getpaint = true; menuselect = true; @@ -581,7 +580,7 @@ namespace sub AddBreak("---Collateral---"); AddNumber("Paint Fade", paintFade, 2, null, paintFade_plus, paintFade_minus); AddNumber("Dirt Level", dirtLevel, 2, null, dirtLevel_plus, dirtLevel_minus); - AddNumber("CarVariation Colours", carvarcol, 0, null, carvarcol_plus, carvarcol_minus); + AddNumber("CarVariation Colours", carvarcol, 0, carvarcol_input, carvarcol_plus, carvarcol_minus); if (firsttime) { @@ -645,6 +644,26 @@ namespace sub } } + if (carvarcol_input) { + std::string inputStr = Game::InputBox("", 4, "Enter a CarVariation index:", std::to_string(carvarcol)); + if (inputStr.length() > 0) + { + try + { + carvarcol = stoi(inputStr); + SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol-1); + } + catch (...) + { + Game::Print::PrintError_InvalidInput(); + } + } + return; + //OnscreenKeyboard::State::Set(OnscreenKeyboard::Purpose::CustomsPaintIndex, std::string(), 3U, "Enter a paint index:", std::to_string(paintIndex)); + //OnscreenKeyboard::State::arg1._int = Static_12; + //OnscreenKeyboard::State::arg2._int = paintIndex; + } + if (carvarcol_plus) { if (carvarcol < GET_NUMBER_OF_VEHICLE_COLOURS(Static_12)) @@ -1174,7 +1193,7 @@ namespace sub switch (*Menu::currentopATM) { - case 1:case 2:case 3: + case 2:case 3:case 4: Add_preset_colour_options_previews(ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b); break; } @@ -1331,11 +1350,12 @@ namespace sub if (ms_paints_hexinput) { + char buffer[2041]; std::size_t hexcheck; - std::string titlestring; - std::string hexr = int_to_hexstring(ms_paints_rgb_r, false); - std::string hexg = int_to_hexstring(ms_paints_rgb_g, false); - std::string hexb = int_to_hexstring(ms_paints_rgb_b, false); + std::string titlestring, + hexr = _itoa(ms_paints_rgb_r, buffer, 16), //compiler says this may be unsafe + hexg = _itoa(ms_paints_rgb_g, buffer, 16), //I say fuck the compiler + hexb = _itoa(ms_paints_rgb_b, buffer, 16); if (hexr.length() == 1) hexr = "0" + hexr; if (hexg.length() == 1) @@ -1589,6 +1609,8 @@ namespace sub ms_exh_minus = 0, ms_livery_plus = 0, ms_livery_minus = 0, + ms_livery2_plus = 0, + ms_livery2_minus = 0, ms_turbo_toggle = 0, ms_light_int_1 = 0, ms_light_int_plus = 0, @@ -1623,7 +1645,8 @@ namespace sub ms_brakes = GET_VEHICLE_MOD(Static_12, 12) + 1, ms_susp = GET_VEHICLE_MOD(Static_12, 15) + 1, ms_exh = GET_VEHICLE_MOD(Static_12, 4) + 1, - ms_livery = GET_VEHICLE_LIVERY(Static_12) + 1; + ms_livery = GET_VEHICLE_LIVERY(Static_12) + 1, + ms_livery2 = GET_VEHICLE_LIVERY2(Static_12) + 1; auto rpmMultVal = 1.0f; auto& rpmMultIt = g_multList_rpm.find(vehicle.Handle()); @@ -1720,7 +1743,9 @@ namespace sub AddOption(Game::GetGXTEntry("CMOD_COL0_3", "Emblem"), null, nullFunc, SUB::MS_EMBLEM, true, false); // Crew Emblems CMOD_COL0_3 AddOption(Game::GetGXTEntry("CMOD_MOD_GLD2", "Extras"), SubMS_Extra, nullFunc, -1, true, false); // Extras CMOD_MOD_GLD2 if (GET_VEHICLE_LIVERY_COUNT(Static_12) > 0) - AddNumber(Game::GetGXTEntry("CMOD_COL0_4", "Livery"), ms_livery, 0, null, ms_livery_plus, ms_livery_minus); + AddNumber(Game::GetGXTEntry("CMOD_COL0_4", "Livery"), ms_livery, 0, null, ms_livery_plus, ms_livery_minus); + if (GET_VEHICLE_LIVERY2_COUNT(Static_12) > 0) + AddNumber(Game::GetGXTEntry("Roof Livery", "Roof Livery"), ms_livery2, 0, null, ms_livery2_plus, ms_livery2_minus); AddLocal(Game::GetGXTEntry("CMOD_MOD_TUR", "Turbo"), IS_TOGGLE_MOD_ON(Static_12, VehicleMod::Turbo), ms_turbo_toggle, ms_turbo_toggle); // Turbo AddLocal(Game::GetGXTEntry("CMOD_LGT_1", "Xenon Lights"), IS_TOGGLE_MOD_ON(Static_12, VehicleMod::XenonHeadlights), ms_lights_toggle, ms_lights_toggle); // Xenon lights AddLocal("Lower Suspension", lowersuspension, MSLowerSuspension_, MSLowerSuspension_, true); // Tuners Lower Suspension @@ -1985,6 +2010,17 @@ namespace sub return; } + if (ms_livery2_plus) { + if (ms_livery2 < GET_VEHICLE_LIVERY2_COUNT(Static_12)) ms_livery2++; + SET_VEHICLE_LIVERY2(Static_12, ms_livery2 - 1); + return; + } + if (ms_livery2_minus) { + if (ms_livery2 > 1) ms_livery2--; + SET_VEHICLE_LIVERY2(Static_12, ms_livery2 - 1); + return; + } + if (ms_lights_toggle) { if (IS_TOGGLE_MOD_ON(Static_12, 22)) TOGGLE_VEHICLE_MOD(Static_12, 22, 0); else TOGGLE_VEHICLE_MOD(Static_12, 22, 1); @@ -2597,7 +2633,6 @@ namespace sub Model Static_12_veh_model = GET_ENTITY_MODEL(Static_12); - bool isBike = Static_12_veh_model.IsBike(); INT wheel_no = GET_VEHICLE_MOD(Static_12, 23); INT ms_custom_tyres = GET_VEHICLE_MOD_VARIATION(Static_12, 23); BOOL ms_drift_tyres = _GET_DRIFT_TYRES_ENABLED(Static_12); @@ -2619,9 +2654,9 @@ namespace sub for (i = 0; i < vWheelTNames.size(); i++) { - const bool ibw = (i == WheelType::BikeWheels); - if (isBike && ibw || !isBike && !ibw) - __AddpointOption(vWheelTNames[i], i); + if (i == WheelType::BikeWheels && !Static_12_veh_model.IsBike()) continue; + if (i != WheelType::BikeWheels && Static_12_veh_model.IsBike()) continue; //removes all non-bike wheels from bike menu. Wheels don't render properly on bikes so makes sense to remove them to me. - ijc + __AddpointOption(vWheelTNames[i], i); } AddLocal("CMOD_TYR_1", ms_custom_tyres, MSWheelsCustomTyres_, MSWheelsCustomTyres_, true); // Custom Tyres diff --git a/Solution/source/Submenus/VehicleOptions.cpp b/Solution/source/Submenus/VehicleOptions.cpp index 574be55a..337d6748 100644 --- a/Solution/source/Submenus/VehicleOptions.cpp +++ b/Solution/source/Submenus/VehicleOptions.cpp @@ -130,7 +130,7 @@ namespace sub Model& myVehicleModel = myVehicle.Model(); static int __VechicleOpsFixCar_texterVal = 0; - static std::vector __VechicleOpsFixCar_texter{ "Full", "Keep windows open" }; + static std::vector __VechicleOpsFixCar_texter{ "Full", "Keep Dirt", "Keep windows open", "Keep windows open with Dirt"}; auto& fixCarTexterVal = __VechicleOpsFixCar_texterVal; auto& fixCarTexter = __VechicleOpsFixCar_texter; bool bFixCar_plus = false, bFixCar_minus = false; @@ -273,7 +273,7 @@ namespace sub else { std::vector windowsToOpen; - if (fixCarTexterVal == 1) + if (fixCarTexterVal == 1 || fixCarTexterVal == 3) { for (int i = (int)VehicleWindow::FrontLeftWindow; i < (int)VehicleWindow::Last; i++) { @@ -282,9 +282,11 @@ namespace sub } } + myVehicle.RequestControlOnce(); SET_VEHICLE_FIXED(g_myVeh); - SET_VEHICLE_DIRT_LEVEL(g_myVeh, 0.0f); + if(fixCarTexterVal == 0 || fixCarTexterVal == 2) + SET_VEHICLE_DIRT_LEVEL(g_myVeh, 0.0f); SET_VEHICLE_ENGINE_CAN_DEGRADE(g_myVeh, 0); SET_VEHICLE_ENGINE_HEALTH(g_myVeh, 1250.0f); SET_VEHICLE_PETROL_TANK_HEALTH(g_myVeh, 1250.0f); @@ -293,7 +295,7 @@ namespace sub if (!GET_IS_VEHICLE_ENGINE_RUNNING(g_myVeh)) SET_VEHICLE_ENGINE_ON(g_myVeh, 1, 1); - if (fixCarTexterVal == 1) + if (fixCarTexterVal == 1 || fixCarTexterVal == 3) { for (auto& i : windowsToOpen) { diff --git a/Solution/source/Submenus/VehicleSpawner.cpp b/Solution/source/Submenus/VehicleSpawner.cpp index f7e4c6b1..934d56df 100644 --- a/Solution/source/Submenus/VehicleSpawner.cpp +++ b/Solution/source/Submenus/VehicleSpawner.cpp @@ -199,6 +199,7 @@ namespace sub //} SET_VEHICLE_IS_STOLEN(newcar, false); } + return newcar; } @@ -1876,7 +1877,6 @@ namespace sub g_multList_headlights[ev.Handle()] = nodeVehicleHeadlightIntensity.text().as_float(); } - int opacityLevel = nodeVehicle.child("OpacityLevel").text().as_int(); if (opacityLevel < 255) ev.Alpha_set(opacityLevel); ev.LodDistance_set(nodeVehicle.child("LodDistance").text().as_int()); @@ -2017,6 +2017,32 @@ namespace sub Game::Print::PrintBottomLeft(ss); } + int saveCarVars(GTAvehicle vehicle) + { + std::ofstream outfile; + Model& eModel = vehicle.Model(); + std::string spawnname = GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(eModel.hash); + int color1 = vehicle.PrimaryColour_get(), + color2 = vehicle.SecondaryColour_get(), + color3 = vehicle.PearlescentColour_get(), + color4 = vehicle.RimColour_get(), + color5 = vehicle.InteriorColour_get(), + color6 = vehicle.DashboardColour_get(); + + + outfile.open(dict3 + "\\Carvar colours.txt", std::ios_base::app); // append instead of overwrite + outfile << spawnname << "\n"; + outfile << std::to_string(color1) << "\n"; + outfile << std::to_string(color2) << "\n"; + outfile << std::to_string(color3) << "\n"; + outfile << std::to_string(color4) << "\n"; + outfile << std::to_string(color5) << "\n"; + outfile << std::to_string(color6) << "\n"; + outfile << "\n"; + Game::Print::PrintBottomLeft("Saved Vehicle Carvariations"); + return 0; + } + void Sub_VehSaver() { auto& _searchStr = dict2; @@ -2027,7 +2053,7 @@ namespace sub auto vehicle = GET_VEHICLE_PED_IS_USING(ped); bool isPedInVeh = IS_PED_IN_ANY_VEHICLE(ped, 0) || IS_PED_SITTING_IN_ANY_VEHICLE(ped); - bool save2 = false, bCreateFolderPressed = false; + bool save2 = false, bCreateFolderPressed = false, savecarvar = false; std::vector vfilnames; AddTitle("Saved Vehicles"); @@ -2045,6 +2071,8 @@ namespace sub AddOption("Save Current Vehicle", save2); + //AddOption("Store CarVariations", savecarvar); + AddOption("Create New Folder", bCreateFolderPressed); //get_all_filenames_with_extension(GetPathffA(Pathff::Vehicle, false), ".xml", vfilnames, false); @@ -2135,6 +2163,12 @@ namespace sub } } + if (savecarvar) + { + if (isPedInVeh) + saveCarVars(vehicle); + } + if (bCreateFolderPressed) { std::string inputStr = Game::InputBox("", 28U, "Enter folder name:"); diff --git a/Solution/source/Submenus/VehicleSpawner.h b/Solution/source/Submenus/VehicleSpawner.h index b7834408..1360e3cb 100644 --- a/Solution/source/Submenus/VehicleSpawner.h +++ b/Solution/source/Submenus/VehicleSpawner.h @@ -71,6 +71,7 @@ namespace sub void Sub_VehSaver(); void Sub_VehSaver_InItem(); + int saveCarVars(); } From dbf5c461fa24cb92a7a06cff5f1ceca493d38566 Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:37:35 +0000 Subject: [PATCH 03/16] Add new Vehicle Despawn pointer for 2802 --- Solution/source/Memory/GTAmemory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Solution/source/Memory/GTAmemory.cpp b/Solution/source/Memory/GTAmemory.cpp index 1fa770b9..4eae48b5 100644 --- a/Solution/source/Memory/GTAmemory.cpp +++ b/Solution/source/Memory/GTAmemory.cpp @@ -1645,7 +1645,10 @@ void GeneralGlobalHax::EnableBlockedMpVehiclesInSp(bool uSure) case eGameVersion::VER_1_0_2628_0_NOSTEAM: case eGameVersion::VER_1_0_2628_0_STEAM: case eGameVersion::VER_1_0_2628_2_NOSTEAM: case eGameVersion::VER_1_0_2628_2_STEAM: case eGameVersion::VER_1_0_2699_0_NOSTEAM: case eGameVersion::VER_1_0_2699_0_STEAM: + case eGameVersion::VER_1_0_2699_16_NOSTEAM: case eGameVersion::VER_1_0_2699_16_STEAM: *GTAmemory::GetGlobalPtr(4533757) = uSure ? 1 : 0; break; + case eGameVersion::VER_1_0_2802_0_NOSTEAM: case eGameVersion::VER_1_0_2802_0_STEAM: + *GTAmemory::GetGlobalPtr(4540726) = uSure ? 1 : 0; break; } } From f981d09871575eb4470cc250d38339d85abda2ed Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:38:34 +0000 Subject: [PATCH 04/16] Addition of New Natives --- Solution/source/Natives/natives.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Solution/source/Natives/natives.h b/Solution/source/Natives/natives.h index c82b0ecb..e0aed53c 100644 --- a/Solution/source/Natives/natives.h +++ b/Solution/source/Natives/natives.h @@ -1208,6 +1208,8 @@ namespace VEHICLE static void SET_RENDER_TRAIN_AS_DERAILED(Vehicle train, BOOL toggle) { invoke(0x317B11A312DF5534, train, toggle); } // 0x317B11A312DF5534 0x899D9092 static void SET_VEHICLE_EXTRA_COLOURS(Vehicle vehicle, int pearlescentColor, int wheelColor) { invoke(0x2036F561ADD12E33, vehicle, pearlescentColor, wheelColor); } // 0x2036F561ADD12E33 0x515DB2A0 static void GET_VEHICLE_EXTRA_COLOURS(Vehicle vehicle, int* pearlescentColor, int* wheelColor) { invoke(0x3BC4245933A166F7, vehicle, pearlescentColor, wheelColor); } // 0x3BC4245933A166F7 0x80E4659B + static void GET_VEHICLE_EXTRA_COLOUR_5(Vehicle vehicle, int* color) { invoke(0x7D1464D472D32136, vehicle, color); }// 0x7D1464D472D32136 b505 + static void GET_VEHICLE_EXTRA_COLOUR_6(Vehicle vehicle, int* color) { invoke(0xB7635E80A5C31BFF, vehicle, color); }// 0xB7635E80A5C31BFF b505 static void STOP_ALL_GARAGE_ACTIVITY() { invoke(0x0F87E938BDF29D66); } // 0x0F87E938BDF29D66 0x17A0BCE5 static void SET_VEHICLE_FIXED(Vehicle vehicle) { invoke(0x115722B1B9C14C1C, vehicle); } // 0x115722B1B9C14C1C 0x17469AA1 static void SET_VEHICLE_DEFORMATION_FIXED(Vehicle vehicle) { invoke(0x953DA1E1B12C0491, vehicle); } // 0x953DA1E1B12C0491 0xDD2920C8 @@ -1230,6 +1232,9 @@ namespace VEHICLE static void RAISE_CONVERTIBLE_ROOF(Vehicle vehicle, BOOL instantlyRaise) { invoke(0x8F5FB35D7E88FC70, vehicle, instantlyRaise); } // 0x8F5FB35D7E88FC70 0xA4E4CBA3 static int GET_CONVERTIBLE_ROOF_STATE(Vehicle vehicle) { return invoke(0xF8C397922FC03F41, vehicle); } // 0xF8C397922FC03F41 0x1B09714D static BOOL IS_VEHICLE_A_CONVERTIBLE(Vehicle vehicle, BOOL p1) { return invoke(0x52F357A30698BCCE, vehicle, p1); } // 0x52F357A30698BCCE 0x6EF54490 + static BOOL TRANSFORM_TO_SUBMARINE(Vehicle vehicle, BOOL noAnimation) { return invoke(0xBE4C854FFDB6EEBE, vehicle, noAnimation); } // 0x52F357A30698BCCE 0x6EF54490 + static void TRANSFORM_TO_CAR(Vehicle vehicle, BOOL noAnimation) { invoke(0x2A69FFD1B42BFF9E, vehicle, noAnimation); } // 0x2A69FFD1B42BFF9E 0xD8B90941 b1290 + static BOOL IS_VEHICLE_IN_SUBMARINE_MODE(Vehicle vehicle) { return invoke(0xA77DC70BD689A1E5, vehicle); } // 0xA77DC70BD689A1E5 0xE2FF06DB b1290 static BOOL IS_VEHICLE_STOPPED_AT_TRAFFIC_LIGHTS(Vehicle vehicle) { return invoke(0x2959F696AE390A99, vehicle); } // 0x2959F696AE390A99 0x69200FA4 static void SET_VEHICLE_DAMAGE(Vehicle vehicle, float xOffset, float yOffset, float zOffset, float damage, float radius, BOOL p6) { invoke(0xA1DD317EA8FD4F29, vehicle, xOffset, yOffset, zOffset, damage, radius, p6); } // 0xA1DD317EA8FD4F29 0x21B458B2 static float GET_VEHICLE_ENGINE_HEALTH(Vehicle vehicle) { return invoke(0xC45D23BAF168AAB8, vehicle); } // 0xC45D23BAF168AAB8 0x8880038A @@ -1251,6 +1256,9 @@ namespace VEHICLE static void SET_VEHICLE_LIVERY(Vehicle vehicle, int livery) { invoke(0x60BF608F1B8CD1B6, vehicle, livery); } // 0x60BF608F1B8CD1B6 0x7AD87059 static int GET_VEHICLE_LIVERY(Vehicle vehicle) { return invoke(0x2BB9230590DA5E8A, vehicle); } // 0x2BB9230590DA5E8A 0xEC82A51D static int GET_VEHICLE_LIVERY_COUNT(Vehicle vehicle) { return invoke(0x87B63E25A529D526, vehicle); } // 0x87B63E25A529D526 0xFB0CA947 + static void SET_VEHICLE_LIVERY2(Vehicle vehicle, int livery) { invoke(0xA6D3A8750DC73270, vehicle, livery); } // 0xA6D3A8750DC73270 b505 + static int GET_VEHICLE_LIVERY2(Vehicle vehicle) { return invoke(0x60190048C0764A26, vehicle); } // 0x60190048C0764A26 b505 + static int GET_VEHICLE_LIVERY2_COUNT(Vehicle vehicle) { return invoke(0x5ECB40269053C0D4, vehicle); } // 0x5ECB40269053C0D4 b505 static BOOL IS_VEHICLE_WINDOW_INTACT(Vehicle vehicle, int windowIndex) { return invoke(0x46E571A0E20D01F1, vehicle, windowIndex); } // 0x46E571A0E20D01F1 0xAC4EF23D static BOOL ARE_ALL_VEHICLE_WINDOWS_INTACT(Vehicle vehicle) { return invoke(0x11D862A3E977A9EF, vehicle); } // 0x11D862A3E977A9EF 0xBB619744 static BOOL _IS_ANY_VEHICLE_SEAT_EMPTY(Vehicle vehicle) { return invoke(0x2D34FC3BC4ADB780, vehicle); } // 0x2D34FC3BC4ADB780 0x648E685A From 57012fd3539c0472ab0dba21eed91e2237fc9605 Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:41:14 +0000 Subject: [PATCH 05/16] Added amphibious behicle check --- Solution/source/Scripting/GTAvehicle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Solution/source/Scripting/GTAvehicle.cpp b/Solution/source/Scripting/GTAvehicle.cpp index 50e517d5..a055d52d 100644 --- a/Solution/source/Scripting/GTAvehicle.cpp +++ b/Solution/source/Scripting/GTAvehicle.cpp @@ -656,7 +656,10 @@ void GTAvehicle::PaintFade_set(float value) VehicleRoofState GTAvehicle::RoofState_get() const { - return static_cast(GET_CONVERTIBLE_ROOF_STATE(this->mHandle)); + if (_IS_THIS_MODEL_AN_AMPHIBIOUS_CAR(this->mHandle)) + return static_cast(1); + else + return static_cast(GET_CONVERTIBLE_ROOF_STATE(this->mHandle)); } void GTAvehicle::RoofState_set(VehicleRoofState value) { From d71795ae9089ff4b49b7c9a66fed921ba49bf31f Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:50:57 +0000 Subject: [PATCH 06/16] Correcting old retained code Changes made to master were not copied into this before changes made --- Solution/source/Submenus/VehicleModShop.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Solution/source/Submenus/VehicleModShop.cpp b/Solution/source/Submenus/VehicleModShop.cpp index c7f505a7..65f846a4 100644 --- a/Solution/source/Submenus/VehicleModShop.cpp +++ b/Solution/source/Submenus/VehicleModShop.cpp @@ -2633,6 +2633,7 @@ namespace sub Model Static_12_veh_model = GET_ENTITY_MODEL(Static_12); + bool isBike = Static_12_veh_model.IsBike(); INT wheel_no = GET_VEHICLE_MOD(Static_12, 23); INT ms_custom_tyres = GET_VEHICLE_MOD_VARIATION(Static_12, 23); BOOL ms_drift_tyres = _GET_DRIFT_TYRES_ENABLED(Static_12); @@ -2654,9 +2655,9 @@ namespace sub for (i = 0; i < vWheelTNames.size(); i++) { - if (i == WheelType::BikeWheels && !Static_12_veh_model.IsBike()) continue; - if (i != WheelType::BikeWheels && Static_12_veh_model.IsBike()) continue; //removes all non-bike wheels from bike menu. Wheels don't render properly on bikes so makes sense to remove them to me. - ijc - __AddpointOption(vWheelTNames[i], i); + const bool ibw = (i == WheelType::BikeWheels); + if (isBike && ibw || !isBike && !ibw) + __AddpointOption(vWheelTNames[i], i); } AddLocal("CMOD_TYR_1", ms_custom_tyres, MSWheelsCustomTyres_, MSWheelsCustomTyres_, true); // Custom Tyres From 487b0ebaadc2ef24f335b5e729dcf64fa0b3de8f Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:55:39 +0000 Subject: [PATCH 07/16] Fix Paint Index not saving colours selected using index scroll did not save when navigating back. Issue should now be resolved --- Solution/source/Submenus/VehicleModShop.cpp | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Solution/source/Submenus/VehicleModShop.cpp b/Solution/source/Submenus/VehicleModShop.cpp index 65f846a4..e20f4d27 100644 --- a/Solution/source/Submenus/VehicleModShop.cpp +++ b/Solution/source/Submenus/VehicleModShop.cpp @@ -16,6 +16,7 @@ #include "..\Natives\natives2.h" #include "..\Util\GTAmath.h" +#include "..\Util\StringManip.h" #include "..\Scripting\enums.h" #include "..\main.h" #include "..\Scripting\GTAvehicle.h" @@ -690,6 +691,20 @@ namespace sub SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol-1); } } + if (MenuPressTimer::IsButtonTapped(MenuPressTimer::Button::Back)) + { + //getpaint = true; + menuselect = false; + if (IS_ENTITY_A_VEHICLE(Static_12) || ms_curr_paint_index == 10 || ms_curr_paint_index == 11) + paintCarUsing_index(Static_12, ms_curr_paint_index, lastpaint, lastpearl); + if (iscustompaint) + { + if (ms_curr_paint_index == 1) + SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(Static_12, lastr, lastg, lastb); + else if (ms_curr_paint_index == 2) + SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(Static_12, lastr, lastg, lastb); + } + } } void MSPaints2_() { @@ -1352,10 +1367,10 @@ namespace sub { char buffer[2041]; std::size_t hexcheck; - std::string titlestring, - hexr = _itoa(ms_paints_rgb_r, buffer, 16), //compiler says this may be unsafe - hexg = _itoa(ms_paints_rgb_g, buffer, 16), //I say fuck the compiler - hexb = _itoa(ms_paints_rgb_b, buffer, 16); + std::string titlestring; + std::string hexr = int_to_hexstring(ms_paints_rgb_r, false); + std::string hexg = int_to_hexstring(ms_paints_rgb_g, false); + std::string hexb = int_to_hexstring(ms_paints_rgb_b, false); if (hexr.length() == 1) hexr = "0" + hexr; if (hexg.length() == 1) From 67b943b9a21d721b5b32d2f970bef1105fa25cdb Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 22:20:21 +0000 Subject: [PATCH 08/16] Potential fix for #424 Disabled resets the currentop variable, causing the menus to reset to the top when users expect the option to be where they left it. No known consequences in testing are apparent as yet. --- Solution/source/Menu/Menu.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Solution/source/Menu/Menu.cpp b/Solution/source/Menu/Menu.cpp index 7d68e3b3..4c71bdb9 100644 --- a/Solution/source/Menu/Menu.cpp +++ b/Solution/source/Menu/Menu.cpp @@ -590,8 +590,7 @@ void Menu::while_opened() { SetSub_closed(); } - - + } void Menu::Up(bool playSound) { @@ -639,7 +638,9 @@ void Menu::SetSub_previous() Game::Sound::PlayFrontend_default("BACK"); // Play sound *currentopATM = currentop; + } + void Menu::SetSub_new(INT sub_index) { currentsub_ar_index++; //Increment array index @@ -653,7 +654,10 @@ void Menu::SetSub_new(INT sub_index) totalop = 0; // Reset total number of options var" *currentopATM = currentop; //SetSub_new complete + } + + void Menu::SetSub_closed() { //Game::RequestScript("cellphone_controller"); @@ -840,8 +844,10 @@ void Menu::sub_handler() { submenu_switch(); - if (Menu::currentop > Menu::printingop) { Menu::currentop = Menu::printingop + 1; Menu::Up(false); } - else if (Menu::currentop < 1) { Menu::currentop = 0; Menu::Down(false); } + //Does anyone know what the below does? Caused shit when trying to navigate back and retain menu position - IJC + + //if (Menu::currentop > Menu::printingop) { Menu::currentop = Menu::printingop + 1; Menu::Up(false); } + //else if (Menu::currentop < 1) { Menu::currentop = 0; Menu::Down(false); } //// These czechs is kill //if (currentop < 1) currentop = 1; From ce4475d6269e9b614be1dcfe942853c3d9c58d3f Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Mon, 19 Dec 2022 22:56:43 +0000 Subject: [PATCH 09/16] Fixed bike wheel selection bug #438 --- Solution/source/Submenus/VehicleModShop.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Solution/source/Submenus/VehicleModShop.cpp b/Solution/source/Submenus/VehicleModShop.cpp index e20f4d27..21136036 100644 --- a/Solution/source/Submenus/VehicleModShop.cpp +++ b/Solution/source/Submenus/VehicleModShop.cpp @@ -2882,6 +2882,7 @@ namespace sub __AddOption(get_mod_text_label(Static_12, VehicleMod::FrontWheels, i, false), Static_12, wtype, i, chrtype == 2); } } + if(_globalLSC_Customs) if (MenuPressTimer::IsButtonTapped(MenuPressTimer::Button::Back)) // this has been split out for bikes, see further comments on the original section below (line 2575) { setwheel = false; From c8fdd91ca76b0c2657fead31162ffe0cff2887fa Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Tue, 20 Dec 2022 20:16:31 +0000 Subject: [PATCH 10/16] Corrected version list Supplement to fix for #427. Two additional versions were added to the list, throwing off the switch/case when applying the despawn global. --- Solution/source/main.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Solution/source/main.h b/Solution/source/main.h index 3ac22438..b8f1f84b 100644 --- a/Solution/source/main.h +++ b/Solution/source/main.h @@ -221,7 +221,7 @@ enum eGameVersion : int VER_1_0_1868_1_STEAM, VER_1_0_1868_1_NOSTEAM, - VER_1_0_1868_4_EPIC, + VER_1_0_1868_4_EGS, VER_1_0_2060_0_STEAM, VER_1_0_2060_0_NOSTEAM, @@ -244,11 +244,8 @@ enum eGameVersion : int VER_1_0_2545_0_STEAM, VER_1_0_2545_0_NOSTEAM, - VER_1_0_2612_0_STEAM, - VER_1_0_2612_0_NOSTEAM, - - VER_1_0_2628_0_STEAM, - VER_1_0_2628_0_NOSTEAM, + VER_1_0_2612_1_STEAM, + VER_1_0_2612_1_NOSTEAM, VER_1_0_2628_2_STEAM, VER_1_0_2628_2_NOSTEAM, @@ -256,11 +253,9 @@ enum eGameVersion : int VER_1_0_2699_0_STEAM, VER_1_0_2699_0_NOSTEAM, - VER_1_0_2699_16_STEAM, - VER_1_0_2699_16_NOSTEAM, + VER_1_0_2699_16, - VER_1_0_2802_0_STEAM, - VER_1_0_2802_0_NOSTEAM, + VER_1_0_2802_0, VER_SIZE, From c8cf65bcff248368871fac70c8394517609cc40a Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Tue, 20 Dec 2022 20:19:52 +0000 Subject: [PATCH 11/16] Corrected Vehicle Despawn Pointers Fix for #427, added the new pointer and corrected some old game versions. --- Solution/source/Memory/GTAmemory.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Solution/source/Memory/GTAmemory.cpp b/Solution/source/Memory/GTAmemory.cpp index 4eae48b5..f860b0f4 100644 --- a/Solution/source/Memory/GTAmemory.cpp +++ b/Solution/source/Memory/GTAmemory.cpp @@ -1599,6 +1599,7 @@ void GeneralGlobalHax::DisableAnnoyingRecordingUI(bool uSure) void GeneralGlobalHax::EnableBlockedMpVehiclesInSp(bool uSure) { // Has to be updated every patch. + switch (GTAmemory::GetGameVersion()) { case eGameVersion::VER_1_0_757_4_NOSTEAM: case eGameVersion::VER_1_0_757_4_STEAM: @@ -1641,13 +1642,13 @@ void GeneralGlobalHax::EnableBlockedMpVehiclesInSp(bool uSure) case eGameVersion::VER_1_0_2372_0_NOSTEAM: case eGameVersion::VER_1_0_2372_0_STEAM: *GTAmemory::GetGlobalPtr(4270934) = uSure ? 1 : 0; break; case eGameVersion::VER_1_0_2545_0_NOSTEAM: case eGameVersion::VER_1_0_2545_0_STEAM: - case eGameVersion::VER_1_0_2612_0_NOSTEAM: case eGameVersion::VER_1_0_2612_0_STEAM: - case eGameVersion::VER_1_0_2628_0_NOSTEAM: case eGameVersion::VER_1_0_2628_0_STEAM: + case eGameVersion::VER_1_0_2612_1_NOSTEAM: case eGameVersion::VER_1_0_2612_1_STEAM: case eGameVersion::VER_1_0_2628_2_NOSTEAM: case eGameVersion::VER_1_0_2628_2_STEAM: - case eGameVersion::VER_1_0_2699_0_NOSTEAM: case eGameVersion::VER_1_0_2699_0_STEAM: - case eGameVersion::VER_1_0_2699_16_NOSTEAM: case eGameVersion::VER_1_0_2699_16_STEAM: *GTAmemory::GetGlobalPtr(4533757) = uSure ? 1 : 0; break; - case eGameVersion::VER_1_0_2802_0_NOSTEAM: case eGameVersion::VER_1_0_2802_0_STEAM: + case eGameVersion::VER_1_0_2699_0_NOSTEAM: case eGameVersion::VER_1_0_2699_0_STEAM: + case eGameVersion::VER_1_0_2699_16: + *GTAmemory::GetGlobalPtr(4539659) = uSure ? 1 : 0; break; + case eGameVersion::VER_1_0_2802_0: default: *GTAmemory::GetGlobalPtr(4540726) = uSure ? 1 : 0; break; } } From aa4ca803d54d3f1b2d3fcc960db9e3544632bcf8 Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Wed, 21 Dec 2022 00:07:36 +0000 Subject: [PATCH 12/16] Fix to paint selection bug Removed segment that forced selection of a carvariation colour instead of retaining selected colour from paint menus --- Solution/source/Submenus/VehicleModShop.cpp | 37 +++++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Solution/source/Submenus/VehicleModShop.cpp b/Solution/source/Submenus/VehicleModShop.cpp index 21136036..549a015d 100644 --- a/Solution/source/Submenus/VehicleModShop.cpp +++ b/Solution/source/Submenus/VehicleModShop.cpp @@ -559,12 +559,12 @@ namespace sub float paintFade = _GET_VEHICLE_PAINT_FADE(Static_12); float dirtLevel = GET_VEHICLE_DIRT_LEVEL(Static_12); - float carvarcol = GET_VEHICLE_COLOUR_COMBINATION(Static_12)+1; + float carvarcol = GET_VEHICLE_COLOUR_COMBINATION(Static_12) + 1; bool set_mspaints_index_4 = 0, set_mspaints_index_3 = 0, set_mspaints_index_5 = 0, set_mspaints_index_6 = 0, paintFade_plus = 0, paintFade_minus = 0, dirtLevel_plus = 0, dirtLevel_minus = 0, - carvarcol_plus = 0, carvarcol_minus = 0, carvarcol_input=0; + carvarcol_plus = 0, carvarcol_minus = 0, carvarcol_input = 0, getpaint = true; menuselect = true; @@ -644,7 +644,6 @@ namespace sub SET_VEHICLE_DIRT_LEVEL(Static_12, dirtLevel); } } - if (carvarcol_input) { std::string inputStr = Game::InputBox("", 4, "Enter a CarVariation index:", std::to_string(carvarcol)); if (inputStr.length() > 0) @@ -652,7 +651,12 @@ namespace sub try { carvarcol = stoi(inputStr); - SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol-1); + SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol - 1); + if (_globalLSC_Customs) + { + lastpaint = getpaintCarUsing_index(Static_12, ms_curr_paint_index); + lastpearl = getpaintCarUsing_index(Static_12, 3); + } } catch (...) { @@ -670,12 +674,17 @@ namespace sub if (carvarcol < GET_NUMBER_OF_VEHICLE_COLOURS(Static_12)) { carvarcol += 1; - SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol-1); + SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol - 1); } else { carvarcol = 1; - SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol-1); + SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol - 1); + } + if (_globalLSC_Customs) + { + lastpaint = getpaintCarUsing_index(Static_12, ms_curr_paint_index); + lastpearl = getpaintCarUsing_index(Static_12, 3); } } if (carvarcol_minus) @@ -683,15 +692,21 @@ namespace sub if (carvarcol > 1) { carvarcol -= 1; - SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol-1); + SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol - 1); } else { carvarcol = GET_NUMBER_OF_VEHICLE_COLOURS(Static_12); - SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol-1); + SET_VEHICLE_COLOUR_COMBINATION(Static_12, carvarcol - 1); + } + if (_globalLSC_Customs) + { + lastpaint = getpaintCarUsing_index(Static_12, ms_curr_paint_index); + lastpearl = getpaintCarUsing_index(Static_12, 3); } } - if (MenuPressTimer::IsButtonTapped(MenuPressTimer::Button::Back)) + + /*if (MenuPressTimer::IsButtonTapped(MenuPressTimer::Button::Back)) { //getpaint = true; menuselect = false; @@ -704,7 +719,7 @@ namespace sub else if (ms_curr_paint_index == 2) SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(Static_12, lastr, lastg, lastb); } - } + }*/ } void MSPaints2_() { @@ -857,6 +872,7 @@ namespace sub //OnscreenKeyboard::State::arg1._int = Static_12; //OnscreenKeyboard::State::arg2._int = paintIndex; } + if (copypaint) { paintCarUsing_index(Static_12, 3 - ms_curr_paint_index, getpaintCarUsing_index(Static_12, ms_curr_paint_index), -1); @@ -1365,7 +1381,6 @@ namespace sub if (ms_paints_hexinput) { - char buffer[2041]; std::size_t hexcheck; std::string titlestring; std::string hexr = int_to_hexstring(ms_paints_rgb_r, false); From b92548a28d46addb8584c2f8460186b562db1e64 Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Wed, 21 Dec 2022 00:09:30 +0000 Subject: [PATCH 13/16] Addressed requested changes put back removed code as potential fix for menu jump issue. Put special case to skip this segment for the modshop menu only. --- Solution/source/Menu/Menu.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Solution/source/Menu/Menu.cpp b/Solution/source/Menu/Menu.cpp index 4c71bdb9..fd2bb74c 100644 --- a/Solution/source/Menu/Menu.cpp +++ b/Solution/source/Menu/Menu.cpp @@ -628,7 +628,7 @@ void Menu::SetSub_previous() { currentsub = currentsub_ar[currentsub_ar_index]; // Get previous submenu from array and set as current submenu currentop = currentop_ar[currentsub_ar_index]; // Get last selected option from array and set as current selected option - + currentsub_ar[currentsub_ar_index] = -2; currentop_ar[currentsub_ar_index] = -2; @@ -845,9 +845,12 @@ void Menu::sub_handler() submenu_switch(); //Does anyone know what the below does? Caused shit when trying to navigate back and retain menu position - IJC - - //if (Menu::currentop > Menu::printingop) { Menu::currentop = Menu::printingop + 1; Menu::Up(false); } - //else if (Menu::currentop < 1) { Menu::currentop = 0; Menu::Down(false); } + + if (Menu::currentsub != SUB::MODSHOP) + { + if (Menu::currentop > Menu::printingop) { Menu::currentop = Menu::printingop + 1; Menu::Up(false); } + else if (Menu::currentop < 1) { Menu::currentop = 0; Menu::Down(false); } + } //// These czechs is kill //if (currentop < 1) currentop = 1; From d621d1b99bf9629b9056f9feac3885f5665a6cb2 Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Thu, 22 Dec 2022 18:45:28 +0000 Subject: [PATCH 14/16] Fix out of range error #41 Add fix for rgb paint scripts when number outside of 0-255 is used. --- Solution/source/Submenus/VehicleModShop.cpp | 36 ++++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Solution/source/Submenus/VehicleModShop.cpp b/Solution/source/Submenus/VehicleModShop.cpp index 549a015d..4b783653 100644 --- a/Solution/source/Submenus/VehicleModShop.cpp +++ b/Solution/source/Submenus/VehicleModShop.cpp @@ -1259,9 +1259,12 @@ namespace sub { int newVal = abs(stoi(inputStr)); if (newVal < 0 || newVal > 255) - throw; - ms_paints_rgb_r = newVal; - rgb_mode_set_carcol(Static_12, ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b, ms_paints_rgb_a); + Game::Print::PrintError_InvalidInput(); + else + { + ms_paints_rgb_r = newVal; + rgb_mode_set_carcol(Static_12, ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b, ms_paints_rgb_a); + } } catch (...) { @@ -1294,9 +1297,12 @@ namespace sub { int newVal = abs(stoi(inputStr)); if (newVal < 0 || newVal > 255) - throw; - ms_paints_rgb_g = newVal; - rgb_mode_set_carcol(Static_12, ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b, ms_paints_rgb_a); + Game::Print::PrintError_InvalidInput(); + else + { + ms_paints_rgb_g = newVal; + rgb_mode_set_carcol(Static_12, ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b, ms_paints_rgb_a); + } } catch (...) { @@ -1329,9 +1335,12 @@ namespace sub { int newVal = abs(stoi(inputStr)); if (newVal < 0 || newVal > 255) - throw; - ms_paints_rgb_b = newVal; - rgb_mode_set_carcol(Static_12, ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b, ms_paints_rgb_a); + Game::Print::PrintError_InvalidInput(); + else + { + ms_paints_rgb_b = newVal; + rgb_mode_set_carcol(Static_12, ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b, ms_paints_rgb_a); + } } catch (...) { @@ -1364,9 +1373,12 @@ namespace sub { int newVal = abs(stoi(inputStr)); if (newVal < 0 || newVal > 255) - throw; - ms_paints_rgb_a = newVal; - rgb_mode_set_carcol(Static_12, ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b, ms_paints_rgb_a); + Game::Print::PrintError_InvalidInput(); + else + { + ms_paints_rgb_a = newVal; + rgb_mode_set_carcol(Static_12, ms_paints_rgb_r, ms_paints_rgb_g, ms_paints_rgb_b, ms_paints_rgb_a); + } } catch (...) { From 4d956646c4cd6a8b6edec2eb01f91225434de8df Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Thu, 22 Dec 2022 19:32:45 +0000 Subject: [PATCH 15/16] Fix speed limiter in boats #380 --- Solution/source/Scripting/GTAentity.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Solution/source/Scripting/GTAentity.cpp b/Solution/source/Scripting/GTAentity.cpp index 474158a9..9de12eb4 100644 --- a/Solution/source/Scripting/GTAentity.cpp +++ b/Solution/source/Scripting/GTAentity.cpp @@ -357,7 +357,8 @@ float GTAentity::Speed_get() const } void GTAentity::MaxSpeed_set(float value) { - SET_ENTITY_MAX_SPEED(this->mHandle, value); + //SET_ENTITY_MAX_SPEED(this->mHandle, value); + SET_VEHICLE_MAX_SPEED(this->mHandle, value); } Vector3 GTAentity::SpeedVector_get(bool relative) { @@ -521,7 +522,7 @@ Vector3 GTAentity::GetOffsetFromBoneInWorldCoords(int boneIndex, const Vector3& } Vector3 GTAentity::GetOffsetFromBoneInWorldCoords(const std::string& boneLabel, const Vector3& offset) const { - return this->GetOffsetFromBoneInWorldCoords(this->GetBoneIndex(boneLabel), offset); + this->GetOffsetFromBoneInWorldCoords(this->GetBoneIndex(boneLabel), offset); } bool GTAentity::HasBone(const std::string& boneLabel) const { From 13632a3214606dc811e93e7751d53270d3b72fc3 Mon Sep 17 00:00:00 2001 From: itsjustcurtis <70447190+itsjustcurtis@users.noreply.github.com> Date: Thu, 22 Dec 2022 19:33:25 +0000 Subject: [PATCH 16/16] Support for #380 fix --- Solution/source/Natives/natives.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Solution/source/Natives/natives.h b/Solution/source/Natives/natives.h index e0aed53c..2ae44f15 100644 --- a/Solution/source/Natives/natives.h +++ b/Solution/source/Natives/natives.h @@ -357,6 +357,7 @@ namespace ENTITY static void SET_ENTITY_LOAD_COLLISION_FLAG(Entity entity, BOOL toggle) { invoke(0x0DC7CABAB1E9B67E, entity, toggle); } // 0x0DC7CABAB1E9B67E 0xC52F295B static BOOL HAS_COLLISION_LOADED_AROUND_ENTITY(Entity entity) { return invoke(0xE9676F61BC0B3321, entity); } // 0xE9676F61BC0B3321 0x851687F9 static void SET_ENTITY_MAX_SPEED(Entity entity, float speed) { invoke(0x0E46A3FCBDE2A1B1, entity, speed); } // 0x0E46A3FCBDE2A1B1 0x46AFFED3 + static void SET_VEHICLE_MAX_SPEED(Vehicle vehicle, float speed) { invoke(0xBAA045B4E42F3C06, vehicle, speed); } // 0xBAA045B4E42F3C06 b1103 static void SET_ENTITY_ONLY_DAMAGED_BY_PLAYER(Entity entity, BOOL toggle) { invoke(0x79F020FF9EDC0748, entity, toggle); } // 0x79F020FF9EDC0748 0x4B707F50 static void SET_ENTITY_ONLY_DAMAGED_BY_RELATIONSHIP_GROUP(Entity entity, BOOL p1, Any p2) { invoke(0x7022BD828FA0B082, entity, p1, p2); } // 0x7022BD828FA0B082 0x202237E2 static void SET_ENTITY_PROOFS(Entity entity, BOOL bulletProof, BOOL fireProof, BOOL explosionProof, BOOL collisionProof, BOOL meleeProof, BOOL p6, BOOL p7, BOOL drownProof) { invoke(0xFAEE099C6F890BB8, entity, bulletProof, fireProof, explosionProof, collisionProof, meleeProof, p6, p7, drownProof); } // 0xFAEE099C6F890BB8 0x7E9EAB66