From be1ab9aad907f712b6ac9071c4bb871e70ee27b4 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sat, 30 Oct 2021 07:41:20 +0600 Subject: [PATCH] [III & VC] Add flip vehicle --- .vscode/c_cpp_properties.json | 63 +++++++++++++++++++++++++++++++---- src/vehicle.cpp | 27 ++++++++++++--- 2 files changed, 78 insertions(+), 12 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index f2b4175..4ca2b8c 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -1,21 +1,70 @@ { "configurations": [ { - "name": "Win32", + "name": "GTASA", + "includePath": [ + "${workspaceFolder}/**", + "${PLUGIN_SDK_DIR}/*", + "${DIRECTX9_SDK_DIR}/Include/*", + "${PLUGIN_SDK_DIR}/plugin_sa/*", + "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", + "${PLUGIN_SDK_DIR}/shared/*", + "${PLUGIN_SDK_DIR}/shared/game/*", + "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*" + ], + "defines": [ + "_DEBUG", + "IS_PLATFORM_WIN", + "_CRT_SECURE_NO_WARNINGS", + "_CRT_NON_CONFORMING_SWPRINTFS", + "GTASA", + "_DX9_SDK_INSTALLED", + "PLUGIN_SGV_10US" + ], + "windowsSdkVersion": "10.0.19041.0", + "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe", + "cStandard": "c17", + "cppStandard": "c++20", + "intelliSenseMode": "windows-msvc-x86" + }, + { + "name": "GTAVC", + "includePath": [ + "${workspaceFolder}/**", + "${PLUGIN_SDK_DIR}/*", + "${DIRECTX9_SDK_DIR}/Include/*", + "${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\\*" + ], + "defines": [ + "_DEBUG", + "IS_PLATFORM_WIN", + "_CRT_SECURE_NO_WARNINGS", + "_CRT_NON_CONFORMING_SWPRINTFS", + "GTAVC", + "_DX9_SDK_INSTALLED", + "PLUGIN_SGV_10US" + ], + "windowsSdkVersion": "10.0.19041.0", + "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe", + "cStandard": "c17", + "cppStandard": "c++20", + "intelliSenseMode": "windows-msvc-x86" + }, + { + "name": "GTA3", "includePath": [ "${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_III/*", "${PLUGIN_SDK_DIR}/plugin_III/game_III/*", "${PLUGIN_SDK_DIR}/shared/*", "${PLUGIN_SDK_DIR}/shared/game/*", - "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*", - "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\include\\*" + "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*" ], "defines": [ "_DEBUG", diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 349e821..e0213e8 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -517,7 +517,7 @@ void Vehicle::Draw() int hplayer = CPools::GetPedRef(pPlayer); CVehicle *pVeh = pPlayer->m_pVehicle; - if (ImGui::Button("Blow up cars", ImVec2(Ui::GetSize(BY_GAME(3,2,2))))) + if (ImGui::Button("Blow up cars", ImVec2(Ui::GetSize(3)))) { for (CVehicle *pVeh : CPools::ms_pVehiclePool) { @@ -527,7 +527,7 @@ void Vehicle::Draw() ImGui::SameLine(); - if (ImGui::Button("Fix vehicle", ImVec2(Ui::GetSize(BY_GAME(3,2,2))))) + if (ImGui::Button("Fix vehicle", ImVec2(Ui::GetSize(3)))) { if (pPlayer && pVeh) { @@ -535,11 +535,11 @@ void Vehicle::Draw() } } -#ifdef GTASA ImGui::SameLine(); if (ImGui::Button("Flip vehicle", ImVec2(Ui::GetSize(3)))) - { + { +#ifdef GTASA if (pPlayer->m_nPedFlags.bInVehicle) { int hveh = CPools::GetVehicleRef(pPlayer->m_pVehicle); @@ -550,8 +550,25 @@ void Vehicle::Draw() Command(hveh, roll); Command(hveh, roll); // z rot fix } - } +#elif GTAVC + if (pPlayer->m_bInVehicle) + { + float x,y,z; + pPlayer->m_pVehicle->m_placement.GetOrientation(x, y, z); + y += 135.0f; + pPlayer->m_pVehicle->m_placement.SetOrientation(x, y, z); + } + +#else // GTA3 + if (pPlayer->m_bInVehicle) + { + float x,y,z; + pPlayer->m_pVehicle->GetOrientation(x, y, z); + y += 135.0f; + pPlayer->m_pVehicle->SetOrientation(x, y, z); + } #endif + } ImGui::Spacing();