diff --git a/.vscode/settings.json b/.vscode/settings.json index 065abe0..108e7e7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -75,6 +75,7 @@ "xtree": "cpp", "xutility": "cpp", "*.rh": "cpp", - "csignal": "cpp" + "csignal": "cpp", + "coroutine": "cpp" } } \ No newline at end of file diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index f467871..f319058 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -569,12 +569,13 @@ TotalSeats = "Total seats: %d" TractionBias = "Traction bias" TractionLoss = "Traction loss" TractionMul = "Traction multiplier" +TrafficColor = "TrafficColor" TrafficNeon = "Traffic neons" TrafficNeonMSG = """ Adds neon lights to traffic vehicles. Only some vehicles will have them.""" -TrafficOpt = "Traffic options" +TrafficType = "Traffic type" TuneTab = "Tune" TurnMass = "Turn mass" Type = "Type" diff --git a/src/defines.h b/src/defines.h index aa4a1fa..a2c741c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -9,7 +9,7 @@ #define MENU_NAME "Cheat Menu" #define MENU_VERSION_NUMBER "3.3" #define MENU_VERSION MENU_VERSION_NUMBER"-beta" -#define BUILD_NUMBER "20220626" +#define BUILD_NUMBER "20220701" #define MENU_TITLE MENU_NAME " v" MENU_VERSION #ifdef GTASA diff --git a/src/game.cpp b/src/game.cpp index 3fe9151..e4fd32a 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -347,7 +347,6 @@ void Game::Init() } RandomCheats::Process(); -#endif if (freeCam.Pressed()) { @@ -366,6 +365,7 @@ void Game::Init() { Freecam::Process(); } +#endif // improve this later static uint syncTimer; diff --git a/src/ped.cpp b/src/ped.cpp index 1dc1f59..a4024c2 100644 --- a/src/ped.cpp +++ b/src/ped.cpp @@ -18,8 +18,8 @@ static const char* pedTypeList = "Civ Male\0Civ Female\0Cop (crash)\0Cubans\0Hai "\0Criminal\0Unused\0Prostitute\0Special\0"; #else -static const char* pedTypeList = L"Civ Male\0Civ Female\0Cop\0Leones\0Triads\0Diablos\0Yakuza\0Yardies\0Colombians\0" -L"Hoods\0unused\0unused\0Emergency\0Fireman\0Criminal\0unused\0Prostitute\0Special\0"; +static const char* pedTypeList = "Civ Male\0Civ Female\0Cop\0Leones\0Triads\0Diablos\0Yakuza\0Yardies\0Colombians\0" +"Hoods\0unused\0unused\0Emergency\0Fireman\0Criminal\0unused\0Prostitute\0Special\0"; #endif @@ -144,7 +144,7 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model) Command(currentSlot, model.c_str()); Command(); - Command(SpawnPed::m_nSelectedPedType + 4, 108+currentSlot, pos.x, pos.y, pos.z + 1, &hplayer); + Command(Spawner::m_nSelectedPedType + 4, 108+currentSlot, pos.x, pos.y, pos.z + 1, &hplayer); Command(currentSlot); ++currentSlot; @@ -369,7 +369,7 @@ void Ped::ShowPage() Widget::DataList(Weapon::m_WeaponData, [](std::string& root, std::string& key, std::string& id) { - SpawnPed::m_nWeaponId = std::stoi(id); + Spawner::m_nWeaponId = std::stoi(id); weaponName = key; }, nullptr); diff --git a/src/player.cpp b/src/player.cpp index d8a88fa..34a51f3 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -484,7 +484,7 @@ void Player::ShowPage() } Widget::CheckboxAddr(TEXT("Player.InfSprint"), 0xB7CEE4); #else - Widget::CheckboxAddr(TEXT("Player.InfSprint"),Ui::CheckboxBits (int)&pInfo->m_bInfiniteSprint); + Widget::CheckboxAddr(TEXT("Player.InfSprint"), (int)&pInfo->m_bInfiniteSprint); #endif ImGui::NextColumn(); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 894fb53..e102965 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -887,27 +887,20 @@ void Vehicle::ShowPage() } #ifndef GTA3 - if (ImGui::CollapsingHeader(TEXT("Vehicle.TrafficOpt"))) + std::vector color { - - std::vector color - { - {TEXT("Vehicle.Black"), BY_GAME(0x969151, 0xA10B82, NULL)}, - {TEXT("Vehicle.Pink"), BY_GAME(0x969150, 0xA10B26, NULL)} - }; - Widget::EditRadioBtnAddr(TEXT("Vehicle.Color"), color); - ImGui::Spacing(); -#ifdef GTASA - std::vector type - { - {TEXT("Vehicle.Cheap"), 0x96915E}, {TEXT("Vehicle.Country"), 0x96917B}, - {TEXT("Vehicle.Fast"), 0x96915F} - }; - Widget::EditRadioBtnAddr(TEXT("Vehicle.Type"), type); + {TEXT("Vehicle.Black"), BY_GAME(0x969151, 0xA10B82, NULL)}, + {TEXT("Vehicle.Pink"), BY_GAME(0x969150, 0xA10B26, NULL)} + }; + Widget::EditRadioBtnAddr(TEXT("Vehicle.TrafficColor"), color); #endif - ImGui::Spacing(); - ImGui::Separator(); - } +#ifdef GTASA + std::vector type + { + {TEXT("Vehicle.Cheap"), 0x96915E}, {TEXT("Vehicle.Country"), 0x96917B}, + {TEXT("Vehicle.Fast"), 0x96915F} + }; + Widget::EditRadioBtnAddr(TEXT("Vehicle.TrafficType"), type); #endif if (pPlayer && pPlayer->m_pVehicle) { @@ -1049,7 +1042,8 @@ void Vehicle::ShowPage() #ifdef GTASA SpawnVehicle(str); #else - SpawnVehicle("", "", str); + std::string temp = ""; + SpawnVehicle(temp, temp, str); #endif } else diff --git a/src/visual.cpp b/src/visual.cpp index 53e387d..d4dfd49 100644 --- a/src/visual.cpp +++ b/src/visual.cpp @@ -286,35 +286,6 @@ int CalcArrayIndex() return TOTAL_WEATHERS * hour + CWeather::OldWeatherType; } - -bool TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b) -{ - bool rtn = false; - int val = CalcArrayIndex(); - -#ifdef GTASA - auto red = static_cast(patch::GetPointer(int(r))); - auto green = static_cast(patch::GetPointer(int(g))); - auto blue = static_cast(patch::GetPointer(int(b))); -#else - auto red = static_cast(r); - auto green = static_cast(g); - auto blue = static_cast(b); -#endif - - float col[3] { red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f }; - - if (ImGui::ColorEdit3(label, col)) - { - red[val] = col[0] * 255; - green[val] = col[1] * 255; - blue[val] = col[2] * 255; - rtn = true; - } - - return rtn; -} - template void TimecycSlider(const char* label, T* ptr, int min, int max) { @@ -331,26 +302,72 @@ void TimecycSlider(const char* label, T* ptr, int min, int max) arr[val] = static_cast(a); } -bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a) +template +bool Visual::TimeCycColorEdit3(const char* label, T* r, T* g, T* b, ImGuiColorEditFlags flags) { bool rtn = false; int val = CalcArrayIndex(); #ifdef GTASA - auto red = static_cast(patch::GetPointer(int(r))); - auto green = static_cast(patch::GetPointer(int(g))); - auto blue = static_cast(patch::GetPointer(int(b))); - auto alpha = static_cast(patch::GetPointer(int(a))); + auto red = static_cast(patch::GetPointer(int(r))); + auto green = static_cast(patch::GetPointer(int(g))); + auto blue = static_cast(patch::GetPointer(int(b))); #else - auto red = static_cast(r); - auto green = static_cast(g); - auto blue = static_cast(b); - auto alpha = static_cast(a); + auto red = static_cast(r); + auto green = static_cast(g); + auto blue = static_cast(b); +#endif + + float col[3] { red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f }; + + if (ImGui::ColorEdit3(label, col, flags)) + { + red[val] = col[0] * 255; + green[val] = col[1] * 255; + blue[val] = col[2] * 255; + rtn = true; + } + + return rtn; +} + +template +void Visual::TimecycSlider(const char* label, T* ptr, int min, int max) +{ + int val = CalcArrayIndex(); +#ifdef GTASA + // Compatable with 24h TimeCyc + T* arr = static_cast(patch::GetPointer(int(ptr))); +#else + T* arr = static_cast(ptr); +#endif + int a = arr[val]; + + if (ImGui::SliderInt(label, &a, min, max)) + arr[val] = static_cast(a); +} + +template +bool Visual::TimeCycColorEdit4(const char* label, T* r, T* g, T* b, T* a, ImGuiColorEditFlags flags) +{ + bool rtn = false; + int val = CalcArrayIndex(); + +#ifdef GTASA + auto red = static_cast(patch::GetPointer(int(r))); + auto green = static_cast(patch::GetPointer(int(g))); + auto blue = static_cast(patch::GetPointer(int(b))); + auto alpha = static_cast(patch::GetPointer(int(a))); +#else + auto red = static_cast(r); + auto green = static_cast(g); + auto blue = static_cast(b); + auto alpha = static_cast(a); #endif float col[4] { red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f, alpha[val] / 255.0f }; - if (ImGui::ColorEdit4(label, col)) + if (ImGui::ColorEdit4(label, col, flags)) { red[val] = col[0] * 255; green[val] = col[1] * 255; @@ -362,6 +379,7 @@ bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a return rtn; } + static void ColorPickerAddr(const char* label, int addr, ImVec4&& default_color) { if (ImGui::CollapsingHeader(label)) diff --git a/src/visual.h b/src/visual.h index a614aad..7fd0a2f 100644 --- a/src/visual.h +++ b/src/visual.h @@ -16,6 +16,13 @@ private: static inline bool m_bNoTextures; #endif + template + static bool TimeCycColorEdit3(const char* label, T* r, T* g, T* b, ImGuiColorEditFlags flags = 0); + template + static bool TimeCycColorEdit4(const char* label, T* r, T* g, T* b, T* a, ImGuiColorEditFlags flags = 0); + template + static void TimecycSlider(const char* label, T* data, int min, int max); + public: Visual() = delete; Visual(const Visual&) = delete; diff --git a/src/widget.h b/src/widget.h index 9ea463b..734664e 100644 --- a/src/widget.h +++ b/src/widget.h @@ -46,8 +46,6 @@ public: // Draws a dropdown editor for memory address template static void EditAddr(const char* label, uint address, int min = 0, int def = 0, int max = 100); - - // Draws a dropdown editor for memory address float static void EditAddr(const char* label, uint address, float min = 0.0f, float def = 0.0f, float max = 100.0f, float mul = 1, float change = 1.0f);