add bighead, thinbody, topdown camera, drunk effect, fast sprint

This commit is contained in:
Grinch_ 2021-08-25 16:06:21 +06:00
parent ce7641e08b
commit bd75524368
6 changed files with 165 additions and 10 deletions

View File

@ -5,6 +5,10 @@
#include <CPopulation.h>
#include "Weapon.h"
#ifdef GTASA
#include <ePedBones.h>
#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);

View File

@ -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

View File

@ -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<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (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<eScriptCommands::COMMAND_SET_FIXED_CAMERA_POSITION> (
outColPoint.m_vecPoint.x, outColPoint.m_vecPoint.y,
outColPoint.m_vecPoint.z, 0.0f, 0.0f, 0.0f);
}
else
{
Command<eScriptCommands::COMMAND_SET_FIXED_CAMERA_POSITION> (
cameraPos.x, cameraPos.y, cameraPos.z, 0.0f, 0.0f, 0.0f);
}
Command<eScriptCommands::COMMAND_POINT_CAMERA_AT_POINT> (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<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 100);
}
if (m_TopDownCamera::m_bEnabled)
{
TopDownCameraView();
}
if (m_KeepPosition::m_bEnabled)
{
if (Command<Commands::IS_CHAR_DEAD>(hplayer))
@ -283,6 +358,27 @@ void Player::Draw()
#ifdef GTASA
Ui::CheckboxAddress("Bounty on yourself", 0x96913F);
ImGui::BeginDisabled(m_TopDownCamera::m_bEnabled);
if (Ui::CheckboxWithHint("Drunk effect", &m_bDrunkEffect))
{
if (!m_bDrunkEffect)
{
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 0);
}
}
if (Ui::CheckboxWithHint("Fast Sprint", &m_bFastSprint, "Best to enable God Mode & Infinite sprint too"))
{
if(m_bFastSprint)
{
patch::Set<float>(0x8D2458, 0.1f);
}
else
{
patch::Set<float>(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<Commands::RESTORE_CAMERA_JUMPCUT>();
}
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();
}

View File

@ -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<std::string> 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