diff --git a/src/Ped.cpp b/src/Ped.cpp index 3619bc7..9fc6d2d 100644 --- a/src/Ped.cpp +++ b/src/Ped.cpp @@ -5,6 +5,10 @@ #include #include "Weapon.h" +#ifdef GTASA +#include +#endif + Ped::Ped() { #ifdef GTASA @@ -12,6 +16,39 @@ Ped::Ped() { m_bExGangWarsInstalled = true; } + + /* + Taken from gta chaos mod by Lordmau5 + https://github.com/gta-chaos-mod/Trilogy-ASI-Script + + TODO: Implement in VC too + */ + Events::pedRenderEvent += [](CPed *ped) + { + + if (m_bBigHead || m_bThinBody) + { + auto animHier = GetAnimHierarchyFromSkinClump (ped->m_pRwClump); + auto matrices = RpHAnimHierarchyGetMatrixArray (animHier); + + RwV3d scale = {0.7f, 0.7f, 0.7f}; + if (m_bThinBody) + { + for (int i = 1; i <= 52; i++) + { + RwMatrixScale (&matrices[RpHAnimIDGetIndex (animHier, i)], &scale, rwCOMBINEPRECONCAT); + } + } + scale = {3.0f, 3.0f, 3.0f}; + if (m_bBigHead) + { + for (int i = BONE_NECK; i <= BONE_HEAD; i++) + { + RwMatrixScale (&matrices[RpHAnimIDGetIndex (animHier, i)], &scale, rwCOMBINEPRECONCAT); + } + } + } + }; #endif } @@ -114,7 +151,6 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model) } } - void Ped::Draw() { if (ImGui::BeginTabBar("Ped", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll)) @@ -125,6 +161,7 @@ void Ped::Draw() ImGui::BeginChild("CheckboxesChild"); ImGui::Columns(2, 0, false); #ifdef GTASA + Ui::CheckboxWithHint("Big head effect", &m_bBigHead); Ui::CheckboxAddress("Elvis everywhere", 0x969157); Ui::CheckboxAddress("Everyone is armed", 0x969140); Ui::CheckboxAddress("Gangs control streets", 0x96915B); @@ -137,6 +174,7 @@ void Ped::Draw() Ui::CheckboxAddress("Peds attack with rockets", 0x969158); Ui::CheckboxAddress("Peds riot", 0x969175); Ui::CheckboxAddress("Slut magnet", 0x96915D); + Ui::CheckboxWithHint("Thin body effect", &m_bThinBody); #elif GTAVC Ui::CheckboxAddress("No prostitutes", 0xA10B99); Ui::CheckboxAddress("Slut magnet", 0xA10B5F); diff --git a/src/Ped.h b/src/Ped.h index 5aaca85..d18f919 100644 --- a/src/Ped.h +++ b/src/Ped.h @@ -8,6 +8,8 @@ class Ped { private: #ifdef GTASA + inline static bool m_bBigHead; + inline static bool m_bThinBody; inline static CJson m_SpecialPedJson = CJson("ped special"); inline static ResourceStore m_PedData{"ped", eResourceType::TYPE_BOTH, ImVec2(65, 110)}; #elif GTAVC @@ -56,6 +58,7 @@ public: #ifdef GTASA static void SpawnPed(std::string& model); + static void BigHeadEffect(CPed *ped); #elif GTAVC static void SpawnPed(std::string& cat, std::string& name, std::string& model); #endif diff --git a/src/Player.cpp b/src/Player.cpp index 0f2ddf5..6b0f5f5 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -3,7 +3,6 @@ #include "Menu.h" #include "Ui.h" #include "Util.h" - #ifdef GTASA #include "Ped.h" @@ -37,6 +36,72 @@ inline static void PlayerModelBrokenFix() if (pPlayer->m_nModelIndex == 0) Call<0x5A81E0>(0, pPlayer->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false); } + + +/* + Taken from gta chaos mod by Lordmau5 + https://github.com/gta-chaos-mod/Trilogy-ASI-Script +*/ +void Player::TopDownCameraView() +{ + CPlayerPed *player = FindPlayerPed (); + CVector pos = player->GetPosition (); + float curOffset = m_TopDownCamera::m_fOffset; + + // drunk effect causes issues + Command (0, 0); + + CVehicle *vehicle = FindPlayerVehicle(-1, false); + + // TODO: implement smooth transition + if (vehicle) + { + float speed = vehicle->m_vecMoveSpeed.Magnitude(); + if (speed > 1.2f) + { + speed = 1.2f; + } + if (speed * 40.0f > 40.0f) + { + speed = 40.0f; + } + + if (speed < 0.0f) + { + speed = 0.0f; + } + curOffset += speed; + } + + CVector playerOffset = CVector (pos.x, pos.y, pos.z + 2.0f); + CVector cameraPos + = CVector (playerOffset.x, playerOffset.y, playerOffset.z + curOffset); + + CColPoint outColPoint; + CEntity * outEntity; + + // TODO: Which variable? X, Y or Z for the look direction? + + if (CWorld::ProcessLineOfSight (playerOffset, cameraPos, outColPoint, + outEntity, true, true, true, true, true, + true, true, true)) + { + Command ( + outColPoint.m_vecPoint.x, outColPoint.m_vecPoint.y, + outColPoint.m_vecPoint.z, 0.0f, 0.0f, 0.0f); + } + else + { + Command ( + cameraPos.x, cameraPos.y, cameraPos.z, 0.0f, 0.0f, 0.0f); + } + + Command (pos.x, pos.y, + pos.z, 2); + + TheCamera.m_fGenerationDistMultiplier = 10.0f; + TheCamera.m_fLODDistMultiplier = 10.0f; +} #endif Player::Player() @@ -81,6 +146,16 @@ Player::Player() CPlayerPed* player = FindPlayerPed(); int hplayer = CPools::GetPedRef(player); + if (m_bDrunkEffect && !m_TopDownCamera::m_bEnabled) + { + Command (0, 100); + } + + if (m_TopDownCamera::m_bEnabled) + { + TopDownCameraView(); + } + if (m_KeepPosition::m_bEnabled) { if (Command(hplayer)) @@ -282,7 +357,28 @@ void Player::Draw() ImGui::Columns(2, 0, false); #ifdef GTASA - Ui::CheckboxAddress("Bounty on yourself", 0x96913F); + Ui::CheckboxAddress("Bounty on yourself", 0x96913F); + + ImGui::BeginDisabled(m_TopDownCamera::m_bEnabled); + if (Ui::CheckboxWithHint("Drunk effect", &m_bDrunkEffect)) + { + if (!m_bDrunkEffect) + { + Command (0, 0); + } + } + if (Ui::CheckboxWithHint("Fast Sprint", &m_bFastSprint, "Best to enable God Mode & Infinite sprint too")) + { + if(m_bFastSprint) + { + patch::Set(0x8D2458, 0.1f); + } + else + { + patch::Set(0x8D2458, 5.0f); + } + } + ImGui::EndDisabled(); #endif Ui::CheckboxAddress("Free healthcare", (int)&pInfo->m_bFreeHealthCare); @@ -306,20 +402,18 @@ void Player::Draw() #ifdef GTASA Ui::CheckboxAddress("Higher cycle jumps", 0x969161); Ui::CheckboxAddress("Infinite oxygen", 0x96916E); - Ui::CheckboxAddress("Infinite run", 0xB7CEE4); - if (Ui::CheckboxBitFlag("Invisible player", pPlayer->m_nPedFlags.bDontRender)) { pPlayer->m_nPedFlags.bDontRender = (pPlayer->m_nPedFlags.bDontRender == 1) ? 0 : 1; } #elif GTAVC - Ui::CheckboxAddress("Infinite run", (int)&pInfo->m_bNeverGetsTired); + Ui::CheckboxAddress("Infinite sprint", (int)&pInfo->m_bNeverGetsTired); #endif ImGui::NextColumn(); - Ui::CheckboxWithHint("Keep position", &m_KeepPosition::m_bEnabled, "Teleport to the position you died from"); #ifdef GTASA + Ui::CheckboxAddress("Infinite sprint", 0xB7CEE4); if (Ui::CheckboxBitFlag("Lock control", pad->bPlayerSafe)) { pad->bPlayerSafe = (pad->bPlayerSafe == 1) ? 0 : 1; @@ -354,6 +448,7 @@ void Player::Draw() } #endif Ui::CheckboxAddress("No arrest fee", (int)&pInfo->m_bGetOutOfJailFree); + Ui::CheckboxWithHint("Respawn die location", &m_KeepPosition::m_bEnabled, "Respawn to the location you died from"); ImGui::Columns(1); @@ -459,6 +554,17 @@ void Player::Draw() Ui::EditStat("Muscle", STAT_MUSCLE); Ui::EditStat("Respect", STAT_RESPECT); Ui::EditStat("Stamina", STAT_STAMINA); + if (ImGui::CollapsingHeader("Top down camera")) + { + if (ImGui::Checkbox("Enabled", &m_TopDownCamera::m_bEnabled)) + { + Command(); + } + ImGui::Spacing(); + ImGui::SliderFloat("Camera zoom", &m_TopDownCamera::m_fOffset, 20.0f, 60.0f); + ImGui::Spacing(); + ImGui::Separator(); + } #endif if (ImGui::CollapsingHeader("Wanted level")) { @@ -525,7 +631,6 @@ void Player::Draw() ImGui::Spacing(); ImGui::Separator(); } - ImGui::EndChild(); ImGui::EndTabItem(); } diff --git a/src/Player.h b/src/Player.h index f154f5a..c060410 100644 --- a/src/Player.h +++ b/src/Player.h @@ -14,6 +14,8 @@ private: #ifdef GTASA inline static bool m_bAimSkinChanger; + inline static bool m_bDrunkEffect; + inline static bool m_bFastSprint; inline static int m_nUiBodyState; inline static ResourceStore m_ClothData { "clothes" , eResourceType::TYPE_IMAGE, ImVec2(70, 100)}; struct m_CustomSkins @@ -22,6 +24,12 @@ private: inline static ImGuiTextFilter m_Filter; inline static std::vector m_List; }; + + struct m_TopDownCamera + { + inline static bool m_bEnabled = false; + inline static float m_fOffset = 40.0f; + }; #elif GTAVC inline static ResourceStore skinData{ "skin", eResourceType::TYPE_TEXT }; #endif @@ -33,6 +41,7 @@ public: #ifdef GTASA static void ChangePlayerModel(std::string& model); static void ChangePlayerCloth(std::string& model); + static void TopDownCameraView(); #elif GTAVC static void ChangePlayerModel(std::string& cat, std::string& name, std::string& id); #endif diff --git a/src/ResourceStore.cpp b/src/ResourceStore.cpp index 453a268..55d1db5 100644 --- a/src/ResourceStore.cpp +++ b/src/ResourceStore.cpp @@ -63,7 +63,7 @@ void ResourceStore::LoadTextureResource(std::string&& name) m_ImagesList.back().get()->m_pRwTexture = pTex; // Fetch IDirec9Texture9* from RwTexture* - m_ImagesList.back().get()->m_pTexture = GetTextureFromRaster(pTex); + m_ImagesList.back().get()->m_pTexture = GetTextureFromRaster(pTex); // Naming format in Txd `Category$TextureName` std::stringstream ss(pTex->name); diff --git a/src/pch.h b/src/pch.h index 7febd8d..2e89e68 100644 --- a/src/pch.h +++ b/src/pch.h @@ -51,7 +51,7 @@ struct HotKeyData static void SetHelpMessage(const char *message, bool b1, bool b2, bool b3) { #if GTAVC - CHud::SetHelpMessage(message, b1, b2); + CHud::SetHelpMessage(message, b1, b2); #elif GTASA CHud::SetHelpMessage(message, b1, b2, b3); #endif