diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 9bf22bb..aa011ad 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -6,10 +6,10 @@ "${workspaceFolder}/**", "${PLUGIN_SDK_DIR}/*", "${DIRECTX9_SDK_DIR}/Include/*", - // "${PLUGIN_SDK_DIR}/plugin_sa/*", - // "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", - "${PLUGIN_SDK_DIR}/plugin_vc/*", - "${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*", + "${PLUGIN_SDK_DIR}/plugin_sa/*", + "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", + // "${PLUGIN_SDK_DIR}/plugin_vc/*", + // "${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*", "${PLUGIN_SDK_DIR}/shared/*", "${PLUGIN_SDK_DIR}/shared/game/*", "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*", @@ -20,7 +20,7 @@ "IS_PLATFORM_WIN", "_CRT_SECURE_NO_WARNINGS", "_CRT_NON_CONFORMING_SWPRINTFS", - "GTAVC", + "GTASA", "_DX9_SDK_INSTALLED", "PLUGIN_SGV_10US" ], diff --git a/src/game.cpp b/src/game.cpp index f386414..fbf805b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -212,15 +212,21 @@ void SetPlayerMission(std::string& rootkey, std::string& name, std::string& id) player->SetWantedLevel(0); Command(std::stoi(id)); } - else SetHelpMessage("Can't start mission now", false, false, false); + else + { + SetHelpMessage("Can't start mission now", false, false, false); + } } #ifdef GTASA void Game::FreeCam() { - int deltaSpeed = m_Freecam::m_fSpeed * (CTimer::m_snTimeInMillisecondsNonClipped - - CTimer::m_snPreviousTimeInMillisecondsNonClipped); - + int delta = (CTimer::m_snTimeInMillisecondsNonClipped - + CTimer::m_snPreviousTimeInMillisecondsNonClipped); + + int ratio = 1 / (1 + (delta * m_Freecam::m_nMul)); + int speed = m_Freecam::m_nMul + m_Freecam::m_nMul * ratio * delta; + if (!m_Freecam::m_bInitDone) { CPlayerPed* player = FindPlayerPed(-1); @@ -285,48 +291,48 @@ void Game::FreeCam() if (KeyPressed(VK_RCONTROL)) { - deltaSpeed /= 2; + speed /= 2; } if (KeyPressed(VK_RSHIFT)) { - deltaSpeed *= 2; + speed *= 2; } if (KeyPressed(VK_KEY_I) || KeyPressed(VK_KEY_K)) { if (KeyPressed(VK_KEY_K)) { - deltaSpeed *= -1; + speed *= -1; } float angle; Command(m_Freecam::m_nPed, &angle); - pos.x += deltaSpeed * cos(angle * 3.14159f / 180.0f); - pos.y += deltaSpeed * sin(angle * 3.14159f / 180.0f); - pos.z += deltaSpeed * 2 * sin(m_Freecam::m_fTotalMouse.y / 3 * 3.14159f / 180.0f); + pos.x += speed * cos(angle * 3.14159f / 180.0f); + pos.y += speed * sin(angle * 3.14159f / 180.0f); + pos.z += speed * 2 * sin(m_Freecam::m_fTotalMouse.y / 3 * 3.14159f / 180.0f); } if (KeyPressed(VK_KEY_J) || KeyPressed(VK_KEY_L)) { if (KeyPressed(VK_KEY_J)) { - deltaSpeed *= -1; + speed *= -1; } float angle; Command(m_Freecam::m_nPed, &angle); angle -= 90; - pos.x += deltaSpeed * cos(angle * 3.14159f / 180.0f); - pos.y += deltaSpeed * sin(angle * 3.14159f / 180.0f); + pos.x += speed * cos(angle * 3.14159f / 180.0f); + pos.y += speed * sin(angle * 3.14159f / 180.0f); } if (CPad::NewMouseControllerState.wheelUp) { if (m_Freecam::m_fFOV > 10.0f) { - m_Freecam::m_fFOV -= 2.0f * deltaSpeed; + m_Freecam::m_fFOV -= 2.0f * speed; } TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250, true); @@ -337,7 +343,7 @@ void Game::FreeCam() { if (m_Freecam::m_fFOV < 115.0f) { - m_Freecam::m_fFOV += 2.0f * deltaSpeed; + m_Freecam::m_fFOV += 2.0f * speed; } TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250, true); @@ -543,7 +549,7 @@ Lowers armour, health, stamina etc.")) ImGui::Spacing(); ImGui::SliderFloat("Field of view", &m_Freecam::m_fFOV, 5.0f, 120.0f); - ImGui::SliderFloat("Movement Speed", &m_Freecam::m_fSpeed, 0.0f, 0.5f); + ImGui::SliderInt("Movement Speed", &m_Freecam::m_nMul, 1, 10); ImGui::Spacing(); ImGui::TextWrapped("Press Enter to teleport player to camera location"); ImGui::Spacing(); diff --git a/src/game.h b/src/game.h index f7f6fa2..7b5b710 100644 --- a/src/game.h +++ b/src/game.h @@ -34,7 +34,7 @@ public: struct m_Freecam { static inline bool m_bEnabled; - static inline float m_fSpeed = 0.08f; + static inline int m_nMul = 1; static inline float m_fFOV = 60.0f; static inline bool m_bInitDone; static inline CPed* m_pPed; diff --git a/src/menuinfo.h b/src/menuinfo.h index ee6187f..da633d7 100644 --- a/src/menuinfo.h +++ b/src/menuinfo.h @@ -2,5 +2,5 @@ #define MENU_NAME "Cheat Menu" #define MENU_VERSION_NUMBER "3.0" #define MENU_VERSION MENU_VERSION_NUMBER"-beta" -#define BUILD_NUMBER "20211002" +#define BUILD_NUMBER "20211009" #define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")" diff --git a/src/ped.cpp b/src/ped.cpp index bc8461c..6bb24cb 100644 --- a/src/ped.cpp +++ b/src/ped.cpp @@ -81,6 +81,7 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model) CPed* ped; int hplayer; + static size_t currentSlot = 1; #ifdef GTASA if (m_SpecialPedJson.m_Data.contains(model)) @@ -91,18 +92,22 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model) else name = model; - CStreaming::RequestSpecialChar(1, name.c_str(), PRIORITY_REQUEST); + CStreaming::RequestSpecialChar(currentSlot, name.c_str(), PRIORITY_REQUEST); CStreaming::LoadAllRequestedModels(true); - Command(m_SpawnPed::m_nSelectedPedType + 4, 291, pos.x, pos.y, pos.z + 1, &hplayer); - CStreaming::SetSpecialCharIsDeletable(291); + Command(m_SpawnPed::m_nSelectedPedType + 4, 290 + currentSlot, pos.x, pos.y, pos.z + 1, &hplayer); + CStreaming::SetSpecialCharIsDeletable(290 + currentSlot); + + // SA has 10 slots + ++currentSlot; + if (currentSlot > 10) + { + currentSlot = 1; + } } #elif GTAVC - if (cat == "Special") // Special model { - static size_t currentSlot = 1; - Command(currentSlot, model.c_str()); Command(); @@ -197,15 +202,20 @@ void Ped::Draw() if (ImGui::Button("Start gang war", ImVec2(Ui::GetSize(2)))) { if (Util::GetLargestGangInZone() == 1) + { CGangWars::StartDefensiveGangWar(); + } else + { CGangWars::StartOffensiveGangWar(); - + } CGangWars::bGangWarsActive = true; } ImGui::SameLine(); if (ImGui::Button("End gang war", ImVec2(Ui::GetSize(2)))) + { CGangWars::EndGangWar(true); + } ImGui::Dummy(ImVec2(0, 20)); ImGui::TextWrapped("Gang zone density:"); @@ -236,8 +246,10 @@ void Ped::Draw() ImGui::TextWrapped("You'll need ExGangWars plugin to display some turf colors"); ImGui::Spacing(); if (ImGui::Button("Download ExGangWars", Ui::GetSize(1))) + { ShellExecute(NULL, "open", "https://gtaforums.com/topic/682194-extended-gang-wars/", NULL, NULL, SW_SHOWNORMAL); + } } ImGui::Spacing(); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 832bfb0..2af68ca 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -280,7 +280,6 @@ int Vehicle::GetRandomTrainIdForModel(int model) void WarpPlayerIntoVehicle(CVehicle *pVeh, int seatId) { CPlayerPed *pPlayer = FindPlayerPed(); - pPlayer->m_bInVehicle = true; pPlayer->m_pVehicle = pVeh; pPlayer->RegisterReference((CEntity**)&pPlayer->m_pVehicle); @@ -288,6 +287,8 @@ void WarpPlayerIntoVehicle(CVehicle *pVeh, int seatId) pPlayer->RegisterReference((CEntity**)&pPlayer->m_pObjectiveVehicle); pPlayer->m_dwAction = ePedAction::Driving; pPlayer->m_dwObjective = OBJECTIVE_NO_OBJ; + patch::Set(0x7838CD, 1); // player got in car flag + Call<0x41D370>(pVeh); // CCarCtrl::RegisterVehicleOfInterest if (pVeh->m_passengers[seatId]) { @@ -296,9 +297,7 @@ void WarpPlayerIntoVehicle(CVehicle *pVeh, int seatId) pVeh->m_passengers[seatId] = pPlayer; pVeh->RegisterReference((CEntity**)&pVeh->m_passengers[seatId]); - patch::Set(0x7838CD, 1); // player got in car flag - Call<0x41D370>(pVeh); // CCarCtrl::RegisterVehicleOfInterest - + // Set player position CWorld::Remove(pPlayer); pPlayer->m_placement.pos.x = pVeh->m_placement.pos.x; pPlayer->m_placement.pos.y = pVeh->m_placement.pos.y;