Add option to remove each cloth item separately

This commit is contained in:
Grinch_ 2021-07-31 04:01:17 +06:00
parent b90d95fd75
commit 46549d8558
13 changed files with 196 additions and 64 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
build/

4
.vscode/tasks.json vendored
View File

@ -6,7 +6,7 @@
{
"label": "Build Debug",
"type": "shell",
"command": "Debug.bat",
"command": "${workspaceFolder}/tools/Debug.bat",
"presentation": {
"echo": true,
"reveal": "always",
@ -23,7 +23,7 @@
{
"label": "Build Release",
"type": "shell",
"command": "Release.bat",
"command": "${workspaceFolder}/tools/Release.bat",
"presentation": {
"echo": true,
"reveal": "always",

File diff suppressed because one or more lines are too long

View File

@ -55,7 +55,7 @@ void CheatMenu::DrawWindow()
CheatMenu::CheatMenu()
{
ApplyStyle();
window_callback = std::bind(&DrawWindow);
windowCallback = std::bind(&DrawWindow);
// Load menu settings
Globals::m_HeaderId = config.GetValue("window.id", std::string(""));

View File

@ -91,10 +91,14 @@ Game::Game()
Command<Commands::CREATE_OBJECT>(3095, pos.x, pos.y, waterHeight, &m_nSolidWaterObj);
Command<Commands::SET_OBJECT_VISIBLE>(m_nSolidWaterObj, false);
if (pos.z < (waterHeight + 1))
{
pPlayer->SetPosn(pos.x, pos.y, waterHeight + 1);
}
}
else
{
Command<Commands::SET_OBJECT_COORDINATES>(m_nSolidWaterObj, pos.x, pos.y, waterHeight);
}
}
else
{
@ -216,10 +220,14 @@ void Game::FreeCam()
m_Freecam::m_fTotalMouse.y = m_Freecam::m_fTotalMouse.y + m_Freecam::m_fMouse.y / 3;
if (m_Freecam::m_fTotalMouse.x > 150)
{
m_Freecam::m_fTotalMouse.y = 150;
}
if (m_Freecam::m_fTotalMouse.y < -150)
{
m_Freecam::m_fTotalMouse.y = -150;
}
if (Ui::HotKeyPressed(Menu::m_HotKeys::freeCamTeleportPlayer))
{
@ -236,15 +244,21 @@ void Game::FreeCam()
}
if (KeyPressed(VK_RCONTROL))
{
deltaSpeed /= 2;
}
if (KeyPressed(VK_RSHIFT))
{
deltaSpeed *= 2;
}
if (KeyPressed(VK_KEY_I) || KeyPressed(VK_KEY_K))
{
if (KeyPressed(VK_KEY_K))
{
deltaSpeed *= -1;
}
float angle;
Command<Commands::GET_CHAR_HEADING>(m_Freecam::m_nPed, &angle);
@ -256,7 +270,9 @@ void Game::FreeCam()
if (KeyPressed(VK_KEY_J) || KeyPressed(VK_KEY_L))
{
if (KeyPressed(VK_KEY_J))
{
deltaSpeed *= -1;
}
float angle;
Command<Commands::GET_CHAR_HEADING>(m_Freecam::m_nPed, &angle);
@ -269,7 +285,9 @@ void Game::FreeCam()
if (CPad::NewMouseControllerState.wheelUp)
{
if (m_Freecam::m_fFOV > 10.0f)
{
m_Freecam::m_fFOV -= 2.0f * deltaSpeed;
}
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250, true);
Command<Commands::CAMERA_PERSIST_FOV>(true);
@ -278,7 +296,9 @@ void Game::FreeCam()
if (CPad::NewMouseControllerState.wheelDown)
{
if (m_Freecam::m_fFOV < 115.0f)
{
m_Freecam::m_fFOV += 2.0f * deltaSpeed;
}
TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250, true);
Command<Commands::CAMERA_PERSIST_FOV>(true);
@ -341,9 +361,13 @@ void Game::Draw()
if (ImGui::Checkbox("Disable F1 & F3 replay", &m_bDisableReplay))
{
if (m_bDisableReplay)
{
patch::SetInt(0x460500, 0xC3, false);
}
else
{
patch::SetInt(0x460500, 0xBD844BB, false);
}
}
Ui::CheckboxAddress("Faster clock", 0x96913B);
@ -352,9 +376,13 @@ void Game::Draw()
of LS without completing missions"))
{
if (m_bForbiddenArea)
{
patch::Set<BYTE>(0x441770, 0x83, false);
}
else
{
patch::Set<BYTE>(0x441770, 0xC3, false);
}
}
Ui::CheckboxAddress("Free pay n spray", 0x96C009);
@ -421,7 +449,10 @@ Lowers armour, health, stamina etc."))
{
int day = CClock::CurrentDay - 1;
if (Ui::ListBox("Select day", m_DayNames, day))
{
CClock::CurrentDay = day + 1;
}
ImGui::Spacing();
ImGui::Separator();
}
@ -483,26 +514,38 @@ Lowers armour, health, stamina etc."))
{
using func = void(void);
if (ImGui::Button("Foggy", Ui::GetSize(3)))
{
((func*)0x438F80)();
}
ImGui::SameLine();
if (ImGui::Button("Overcast", Ui::GetSize(3)))
{
((func*)0x438F60)();
}
ImGui::SameLine();
if (ImGui::Button("Rainy", Ui::GetSize(3)))
{
((func*)0x438F70)();
}
if (ImGui::Button("Sandstorm", Ui::GetSize(3)))
{
((func*)0x439590)();
}
ImGui::SameLine();
if (ImGui::Button("Thunderstorm", Ui::GetSize(3)))
{
((func*)0x439570)();
}
ImGui::SameLine();
if (ImGui::Button("Very sunny", Ui::GetSize(3)))
{
((func*)0x438F50)();
}
ImGui::Spacing();
ImGui::Separator();
@ -560,9 +603,11 @@ It's recommanded not to save after using the mission loader. Use it at your own
{
for (auto _data : root.value().items())
{
auto name = _data.value().get<std::string>();
std::string name = _data.value().get<std::string>();
if (m_StatData.m_Filter.PassFilter(name.c_str()))
{
Ui::EditStat(name.c_str(), std::stoi(_data.key()));
}
}
}
}
@ -586,12 +631,14 @@ It's recommanded not to save after using the mission loader. Use it at your own
ImGui::Separator();
if (ImGui::BeginChild("Cheats list"))
{
for (auto element : m_RandomCheats::m_EnabledCheats)
for (std::string* element : m_RandomCheats::m_EnabledCheats)
{
bool selected = (element[1] == "true") ? true : false;
if (ImGui::MenuItem(element[0].c_str(), nullptr, selected))
{
element[1] = selected ? "false" : "true";
}
}
ImGui::EndChild();
}

View File

@ -37,7 +37,9 @@ HRESULT Hook::Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentat
void Hook::RenderFrame(void* ptr)
{
if (!ImGui::GetCurrentContext())
{
return;
}
ImGuiIO& io = ImGui::GetIO();
@ -49,15 +51,19 @@ void Hook::RenderFrame(void* ptr)
ImVec2 size(screen::GetScreenWidth(), screen::GetScreenHeight());
if (Globals::m_fScreenSize.x != size.x && Globals::m_fScreenSize.y != size.y)
{
int font_size = static_cast<int>(size.y / 54.85f); // manually tested
int fontSize = static_cast<int>(size.y / 54.85f); // manually tested
io.FontDefault = io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/trebucbd.ttf", font_size);
io.FontDefault = io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/trebucbd.ttf", fontSize);
io.Fonts->Build();
if (Globals::renderer == Render_DirectX9)
{
ImGui_ImplDX9_InvalidateDeviceObjects();
}
else
{
ImGui_ImplDX11_InvalidateDeviceObjects();
}
if (Globals::m_fScreenSize.x != -1 && Globals::m_fScreenSize.y != -1)
{
@ -66,36 +72,46 @@ void Hook::RenderFrame(void* ptr)
}
ImGuiStyle* style = &ImGui::GetStyle();
float scale_x = size.x / 1366.0f;
float scale_y = size.y / 768.0f;
float scaleX = size.x / 1366.0f;
float scaleY = size.y / 768.0f;
style->FramePadding = ImVec2(5 * scale_x, 3 * scale_y);
style->ItemSpacing = ImVec2(8 * scale_x, 4 * scale_y);
style->ScrollbarSize = 12 * scale_x;
style->IndentSpacing = 20 * scale_x;
style->ItemInnerSpacing = ImVec2(4 * scale_x, 4 * scale_y);
style->FramePadding = ImVec2(5 * scaleX, 3 * scaleY);
style->ItemSpacing = ImVec2(8 * scaleX, 4 * scaleY);
style->ScrollbarSize = 12 * scaleX;
style->IndentSpacing = 20 * scaleX;
style->ItemInnerSpacing = ImVec2(4 * scaleX, 4 * scaleY);
Globals::m_fScreenSize = size;
}
ImGui_ImplWin32_NewFrame();
if (Globals::renderer == Render_DirectX9)
{
ImGui_ImplDX9_NewFrame();
}
else
{
ImGui_ImplDX11_NewFrame();
}
ImGui::NewFrame();
if (window_callback != nullptr)
window_callback();
if (windowCallback != nullptr)
{
windowCallback();
}
ImGui::EndFrame();
ImGui::Render();
if (Globals::renderer == Render_DirectX9)
{
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
}
else
{
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
}
}
else
{
@ -240,10 +256,14 @@ static int _cdecl _GetMouseState(Mouse* pMouse)
GetCursorPos(&Point);
if (mouseInfo.x >= 0)
{
pMouse->x = int(Point.x - mouseInfo.x);
}
if (mouseInfo.y >= 0)
{
pMouse->y = int(Point.y - mouseInfo.y);
}
mouseInfo.wheelDelta = 0;

View File

@ -25,7 +25,7 @@ private:
public:
inline static bool m_bShowMouse = false;
inline static std::function<void()> window_callback = nullptr;
inline static std::function<void()> windowCallback = nullptr;
static void ApplyMouseFix();
Hook();

View File

@ -407,23 +407,17 @@ void Player::Draw()
{
if (ImGui::BeginTabItem("Clothes"))
{
static int bClothOption = 0;
ImGui::RadioButton("Add", &bClothOption, 0);
ImGui::SameLine();
ImGui::RadioButton("Remove", &bClothOption, 1);
ImGui::Spacing();
if (pPlayer->m_nModelIndex == 0)
{
if (ImGui::Button("Remove clothes", ImVec2(Ui::GetSize())))
if (bClothOption == 0)
{
CPlayerPed* player = FindPlayerPed();
int temp = 0;
for (uint i = 0; i < 18; i++)
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(temp, temp, i);
CClothes::RebuildPlayer(player, false);
}
ImGui::Spacing();
Ui::DrawImages(m_ClothData.m_ImagesList, ImVec2(70, 100), m_ClothData.m_Categories, m_ClothData.m_Selected,
Ui::DrawImages(m_ClothData.m_ImagesList, ImVec2(70, 100), m_ClothData.m_Categories, m_ClothData.m_Selected,
m_ClothData.m_Filter, ChangePlayerCloth, nullptr,
[](std::string str)
{
@ -435,6 +429,40 @@ void Player::Draw()
return temp;
}, nullptr, cloth_category, sizeof(cloth_category)/ sizeof(const char*));
}
else
{
size_t count = 0;
if(ImGui::Button("Remove all", ImVec2(Ui::GetSize(2))))
{
CPlayerPed* player = FindPlayerPed();
for (uint i = 0; i < 18; i++)
{
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(0u, 0u, i);
}
CClothes::RebuildPlayer(player, false);
}
ImGui::SameLine();
for (const char* clothName : cloth_category)
{
if(ImGui::Button(clothName, ImVec2(Ui::GetSize(2))))
{
CPlayerPed* player = FindPlayerPed();
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(0u, 0u, count);
CClothes::RebuildPlayer(player, false);
}
if (count %2 != 0)
{
ImGui::SameLine();
}
++count;
}
ImGui::Spacing();
ImGui::TextWrapped("If CJ is wearing a full suit, click 'Extras/ Remove all' to remove it.");
}
}
else
{

View File

@ -20,41 +20,55 @@ Weapon::Weapon()
if (CPad::NewMouseControllerState.X == 0 && CPad::NewMouseControllerState.Y == 0)
{
if (KeyPressed(2))
{
CCamera::m_bUseMouse3rdPerson = false;
}
}
else
{
CCamera::m_bUseMouse3rdPerson = true;
}
}
uchar slot = player->m_nActiveWeaponSlot;
if (m_nCurrentWeaponSlot != slot)
{
auto weapon_type = player->m_aWeapons[slot].m_nType;
CWeaponInfo* pweapon_info = CWeaponInfo::GetWeaponInfo(weapon_type, player->GetWeaponSkill(weapon_type));
eWeaponType weaponType = player->m_aWeapons[slot].m_nType;
CWeaponInfo* pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType, player->GetWeaponSkill(weaponType));
if (m_bHugeDamage)
pweapon_info->m_nDamage = 1000;
{
pWeaponInfo->m_nDamage = 1000;
}
if (m_bLongRange)
{
pweapon_info->m_fTargetRange = 1000.0f;
pweapon_info->m_fWeaponRange = 1000.0f;
pweapon_info->m_fAccuracy = 1.0f;
pweapon_info->m_nFlags.bReload2Start = true;
pWeaponInfo->m_fTargetRange = 1000.0f;
pWeaponInfo->m_fWeaponRange = 1000.0f;
pWeaponInfo->m_fAccuracy = 1.0f;
pWeaponInfo->m_nFlags.bReload2Start = true;
}
if (m_bRapidFire && weapon_type != WEAPON_MINIGUN) // mingun doesn't work with rapidfire
pweapon_info->m_nFlags.bContinuosFire = true;
if (m_bRapidFire && weaponType != WEAPON_MINIGUN) // mingun doesn't work with rapidfire
{
pWeaponInfo->m_nFlags.bContinuosFire = true;
}
if (m_bDualWeild && (weapon_type == WEAPON_PISTOL || weapon_type == WEAPON_MICRO_UZI || weapon_type ==
WEAPON_TEC9 || weapon_type == WEAPON_SAWNOFF))
pweapon_info->m_nFlags.bTwinPistol = true;
if (m_bDualWeild && (weaponType == WEAPON_PISTOL || weaponType == WEAPON_MICRO_UZI || weaponType ==
WEAPON_TEC9 || weaponType == WEAPON_SAWNOFF))
{
pWeaponInfo->m_nFlags.bTwinPistol = true;
}
if (m_bMoveAim)
pweapon_info->m_nFlags.bMoveAim = true;
{
pWeaponInfo->m_nFlags.bMoveAim = true;
}
if (m_bMoveFire)
pweapon_info->m_nFlags.bMoveFire = true;
{
pWeaponInfo->m_nFlags.bMoveFire = true;
}
m_nCurrentWeaponSlot = slot;
}
@ -75,7 +89,9 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
int hplayer = CPools::GetPedRef(player);
if (weapon_type == "-1") // Jetpack
{
Command<Commands::TASK_JETPACK>(hplayer);
}
else
{
int iweapon_type = std::stoi(weapon_type);
@ -86,14 +102,17 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
CStreaming::RequestModel(model, PRIORITY_REQUEST);
if (model == 363) // remote bomb
{
CStreaming::RequestModel(364, PRIORITY_REQUEST); // detonator
}
CStreaming::LoadAllRequestedModels(false);
Command<Commands::GIVE_WEAPON_TO_CHAR>(hplayer, iweapon_type, m_nAmmoCount);
if (model == 363) // remote bomb
{
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(364); // detonator
}
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
}
@ -101,33 +120,37 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type)
void Weapon::Draw()
{
CPlayerPed* player = FindPlayerPed();
uint hplayer = CPools::GetPedRef(player);
CPlayerPed* pPlayer = FindPlayerPed();
uint hplayer = CPools::GetPedRef(pPlayer);
ImGui::Spacing();
if (ImGui::Button("Drop weapon", Ui::GetSize(3)))
{
float x, y, z;
Command<Commands::GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS>(hplayer, 0.0, 3.0, 0.0, &x, &y, &z);
auto type = player->m_aWeapons[player->m_nActiveWeaponSlot].m_nType;
eWeaponType weaponType = pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_nType;
if (type)
if (weaponType)
{
int model = 0, pickup = 0;
Command<Commands::GET_WEAPONTYPE_MODEL>(type, &model);
Command<Commands::GET_WEAPONTYPE_MODEL>(weaponType, &model);
Command<Commands::CREATE_PICKUP_WITH_AMMO>(model, 3, 999, x, y, z, &pickup);
Command<Commands::REMOVE_WEAPON_FROM_CHAR>(hplayer, type);
Command<Commands::REMOVE_WEAPON_FROM_CHAR>(hplayer, weaponType);
}
}
ImGui::SameLine();
if (ImGui::Button("Remove all", Ui::GetSize(3)))
{
Command<Commands::REMOVE_ALL_CHAR_WEAPONS>(hplayer);
}
ImGui::SameLine();
if (ImGui::Button("Remove current", Ui::GetSize(3)))
Command<Commands::REMOVE_WEAPON_FROM_CHAR>(hplayer, player->m_aWeapons[player->m_nActiveWeaponSlot].m_nType);
{
Command<Commands::REMOVE_WEAPON_FROM_CHAR>(hplayer, pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_nType);
}
ImGui::Spacing();
@ -145,12 +168,16 @@ void Weapon::Draw()
"Dual wield pistol, shawoff, uzi, tec9\n(Other weapons don't work)"))
{
if (!m_bDualWeild)
{
CWeaponInfo::LoadWeaponData();
}
}
if (Ui::CheckboxWithHint("Huge damage", &m_bHugeDamage))
{
if (!m_bHugeDamage)
{
CWeaponInfo::LoadWeaponData();
}
}
if (Ui::CheckboxWithHint("Fast reload", &m_bFastReload))
Command<Commands::SET_PLAYER_FAST_RELOAD>(hplayer, m_bFastReload);
@ -162,22 +189,30 @@ void Weapon::Draw()
if (Ui::CheckboxWithHint("Long range", &m_bLongRange))
{
if (!m_bLongRange)
{
CWeaponInfo::LoadWeaponData();
}
}
if (Ui::CheckboxWithHint("Move when aiming", &m_bMoveAim))
{
if (!m_bMoveAim)
{
CWeaponInfo::LoadWeaponData();
}
}
if (Ui::CheckboxWithHint("Move when firing", &m_bMoveFire))
{
if (!m_bMoveFire)
{
CWeaponInfo::LoadWeaponData();
}
}
if (Ui::CheckboxWithHint("Rapid fire", &m_bRapidFire))
{
if (!m_bRapidFire)
{
CWeaponInfo::LoadWeaponData();
}
}
ImGui::Columns(1, 0, false);
ImGui::EndChild();

View File

@ -1,6 +1,7 @@
@echo off
cd tools
premake5.exe vs2019
cd build
cd ../build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
MsBuild CheatMenu.sln /property:Configuration=Debug
cd ..

View File

@ -1,6 +1,7 @@
@echo off
cd tools
premake5.exe vs2019
cd build
cd ../build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
MsBuild CheatMenu.sln /property:Configuration=Release
cd ..

View File

@ -24,17 +24,17 @@ workspace "CheatMenu"
cppdialect "C++20"
characterset "MBCS"
staticruntime "On"
location "build"
location "../build"
project "Depend"
kind "StaticLib"
targetdir "build/bin"
targetdir "../build/bin"
files {
"depned/**.h",
"depend/**.hpp",
"depend/**.c",
"depend/**.cpp"
"../depned/**.h",
"../depend/**.hpp",
"../depend/**.c",
"../depend/**.cpp"
}
libdirs (PSDK_DIR .. "/output/lib")
@ -52,9 +52,9 @@ project "CheatMenu"
targetextension ".asi"
files {
"src/**.h",
"src/**.hpp",
"src/**.cpp"
"../src/**.h",
"../src/**.hpp",
"../src/**.cpp"
}
includedirs {
PSDK_DIR .. "/plugin_sa/",
@ -75,7 +75,7 @@ project "CheatMenu"
}
pchheader "pch.h"
pchsource "src/pch.cpp"
pchsource "../src/pch.cpp"
filter "configurations:Debug"
symbols "On"