[SA] Make player controllable in freecam

This commit is contained in:
Grinch_ 2022-08-07 01:17:49 +06:00
parent 9e1b5db4d9
commit 86b9697203
4 changed files with 38 additions and 43 deletions

View File

@ -368,7 +368,7 @@ NeedCJSkin = "You need to be in CJ skin"
NeverGetHungry = "Never get hungry" NeverGetHungry = "Never get hungry"
NeverWanted = "Never wanted" NeverWanted = "Never wanted"
NoFee = "No arrest fee" NoFee = "No arrest fee"
NoUndress = "Don't lose clothes" NoUndress = "Keep outfits"
NoUndressTip = "Don't lose clothes after being busted/wasted" NoUndressTip = "Don't lose clothes after being busted/wasted"
PedSkinsTab = "Ped skins" PedSkinsTab = "Ped skins"
PlayerFlags = "Player flags," PlayerFlags = "Player flags,"

View File

@ -31,8 +31,6 @@ void Freecam::Process()
m_bRadarState = patch::Get<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL)); // radar m_bRadarState = patch::Get<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL)); // radar
CVector playerPos = player->GetPosition(); CVector playerPos = player->GetPosition();
CPad::GetPad(0)->DisablePlayerControls = true;
Command<Commands::CREATE_RANDOM_CHAR>(playerPos.x, playerPos.y, playerPos.z, &m_nPed); Command<Commands::CREATE_RANDOM_CHAR>(playerPos.x, playerPos.y, playerPos.z, &m_nPed);
m_pPed = CPools::GetPed(m_nPed); m_pPed = CPools::GetPed(m_nPed);
@ -191,8 +189,6 @@ void Freecam::Clear()
patch::Set<BYTE>(BY_GAME(0xBA6769, 0x86963A, NULL), m_bHudState); // hud patch::Set<BYTE>(BY_GAME(0xBA6769, 0x86963A, NULL), m_bHudState); // hud
patch::Set<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL), m_bRadarState); // radar patch::Set<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL), m_bRadarState); // radar
CPad::GetPad(0)->DisablePlayerControls = false;
Command<Commands::DELETE_CHAR>(m_nPed); Command<Commands::DELETE_CHAR>(m_nPed);
m_pPed = nullptr; m_pPed = nullptr;

View File

@ -5,10 +5,10 @@ DataStore gConfig = DataStore(FILE_NAME, true);
ResourceStore gTextureList { "misc", eResourceType::TYPE_IMAGE, ImVec2(100, 80) }; ResourceStore gTextureList { "misc", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
Hotkey aimSkinChanger {VK_RETURN, VK_RETURN, "AimSkinChanger"}; Hotkey aimSkinChanger {VK_RETURN, VK_RETURN, "AimSkinChanger"};
Hotkey freeCam {VK_F6, VK_F6, "Freecam.Toggle"}; Hotkey freeCam {VK_F6, VK_F6, "Freecam.Toggle"};
Hotkey freeCamForward {VK_KEY_W, VK_KEY_W, "Freecam.Forward"};; Hotkey freeCamForward {VK_KEY_I, VK_KEY_I, "Freecam.Forward"};;
Hotkey freeCamBackward {VK_KEY_S, VK_KEY_S, "Freecam.Backward"};; Hotkey freeCamBackward {VK_KEY_K, VK_KEY_K, "Freecam.Backward"};;
Hotkey freeCamLeft {VK_KEY_A, VK_KEY_A, "Freecam.Left"};; Hotkey freeCamLeft {VK_KEY_J, VK_KEY_J, "Freecam.Left"};;
Hotkey freeCamRight {VK_KEY_D, VK_KEY_D, "Freecam.Right"}; Hotkey freeCamRight {VK_KEY_L, VK_KEY_L, "Freecam.Right"};
Hotkey freeCamTeleport {VK_RETURN, VK_RETURN, "Freecam.Teleport"}; Hotkey freeCamTeleport {VK_RETURN, VK_RETURN, "Freecam.Teleport"};
Hotkey commandWindow {VK_LCONTROL, VK_KEY_C, "CommandWindowToggle"};; Hotkey commandWindow {VK_LCONTROL, VK_KEY_C, "CommandWindowToggle"};;
Hotkey fixVeh {VK_NONE, VK_NONE, "Vehicle.Fix"}; Hotkey fixVeh {VK_NONE, VK_NONE, "Vehicle.Fix"};

View File

@ -447,39 +447,6 @@ void Player::ShowPage()
patch::Set<float>(0x8D2458, m_bFastSprint ? 0.1f : 5.0f); patch::Set<float>(0x8D2458, m_bFastSprint ? 0.1f : 5.0f);
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
#endif
#ifdef GTAVC
if (Widget::Checkbox(TEXT("Player.NoUndress"), &m_bNoUndress, TEXT("Player.NoUndressTip")))
{
if (m_bNoUndress)
{
// pop ecx
patch::SetUChar(0x42BDC5, 0x59);
patch::SetUChar(0x42C1B0, 0x59);
patch::SetUChar(0x42C3B2, 0x59);
patch::SetUChar(0x42BDC5, 0x59);
patch::SetUChar(0x42C1B0, 0x59);
patch::SetUChar(0x42C3B2, 0x59);
// nop Undress()
patch::RedirectShortJump(0x42BDC6, (void*)0x42BDE1);
patch::RedirectShortJump(0x42C1B1, (void*)0x42C1CC);
patch::RedirectShortJump(0x42C3B3, (void*)0x42C3CE);
// nop Dress()
patch::RedirectShortJump(0x42BDC6, (void*)0x42BE05);
patch::RedirectShortJump(0x42C1B1, (void*)0x42C1F0);
patch::RedirectShortJump(0x42C3B3, (void*)0x42C3F2);
}
else
{
// restore
patch::SetRaw(0x42BDC5, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42C1B0, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42C3B2, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42BDC5, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42C1B0, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42C3B2, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
}
}
#endif #endif
Widget::CheckboxAddr(TEXT("Player.FreeHealthcare"), (int)&pInfo->m_bGetOutOfHospitalFree); Widget::CheckboxAddr(TEXT("Player.FreeHealthcare"), (int)&pInfo->m_bGetOutOfHospitalFree);
@ -559,7 +526,39 @@ void Player::ShowPage()
#else #else
Widget::CheckboxAddr(TEXT("Player.InfSprint"), (int)&pInfo->m_bInfiniteSprint); Widget::CheckboxAddr(TEXT("Player.InfSprint"), (int)&pInfo->m_bInfiniteSprint);
#endif #endif
#ifdef GTAVC
if (Widget::Checkbox(TEXT("Player.NoUndress"), &m_bNoUndress, TEXT("Player.NoUndressTip")))
{
if (m_bNoUndress)
{
// pop ecx
patch::SetUChar(0x42BDC5, 0x59);
patch::SetUChar(0x42C1B0, 0x59);
patch::SetUChar(0x42C3B2, 0x59);
patch::SetUChar(0x42BDC5, 0x59);
patch::SetUChar(0x42C1B0, 0x59);
patch::SetUChar(0x42C3B2, 0x59);
// nop Undress()
patch::RedirectShortJump(0x42BDC6, (void*)0x42BDE1);
patch::RedirectShortJump(0x42C1B1, (void*)0x42C1CC);
patch::RedirectShortJump(0x42C3B3, (void*)0x42C3CE);
// nop Dress()
patch::RedirectShortJump(0x42BDC6, (void*)0x42BE05);
patch::RedirectShortJump(0x42C1B1, (void*)0x42C1F0);
patch::RedirectShortJump(0x42C3B3, (void*)0x42C3F2);
}
else
{
// restore
patch::SetRaw(0x42BDC5, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42C1B0, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42C3B2, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42BDC5, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42C1B0, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
patch::SetRaw(0x42C3B2, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6);
}
}
#endif
ImGui::NextColumn(); ImGui::NextColumn();
#ifdef GTASA #ifdef GTASA