Improve hotkeys, freecam

This commit is contained in:
Grinch_ 2021-01-28 14:01:32 +06:00
parent 7dcc092bad
commit 29669f7fea
4 changed files with 21 additions and 11 deletions

View File

@ -221,7 +221,7 @@ void Game::FreeCam()
Command<Commands::SET_CHAR_COLLISION>(freecam::hped, false);
Command<Commands::SET_LOAD_COLLISION_FOR_CHAR_FLAG>(freecam::hped, false);
freecam::tmouseX = player->GetHeading();
freecam::tmouseX = player->GetHeading() + 89.6f;
freecam::tmouseY = 0;
freecam::init_done = true;

View File

@ -52,11 +52,11 @@ Menu::Menu()
hotkeys::aim_skin_changer.key1 = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
hotkeys::aim_skin_changer.key2 = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
hotkeys::freecam.key1 = config.GetValue("hotkey.freecam.key1", VK_LMENU);
hotkeys::freecam.key2 = config.GetValue("hotkey.freecam.key2", VK_KEY_A);
hotkeys::freecam.key1 = config.GetValue("hotkey.freecam.key1", VK_F6);
hotkeys::freecam.key2 = config.GetValue("hotkey.freecam.key2", VK_F6);
hotkeys::quick_ss.key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_LCONTROL);
hotkeys::quick_ss.key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_KEY_S);
hotkeys::quick_ss.key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_F5);
hotkeys::quick_ss.key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_F5);
hotkeys::quick_tp.key1 = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
hotkeys::quick_tp.key2 = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);

View File

@ -791,7 +791,7 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
{
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
for (int key = 3; key != 90; ++key)
for (int key = 3; key != 135; ++key)
{
if (KeyPressed(key))
{
@ -800,7 +800,7 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
}
}
for (int key = 90; key != 3; --key)
for (int key = 135; key != 3; --key)
{
if (KeyPressed(key))
{
@ -836,6 +836,7 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
{
key_data.key1 = VK_NONE;
key_data.key2 = VK_NONE;
state = true;
}
ImGui::SameLine();
@ -852,7 +853,7 @@ bool Ui::HotKey(const char* label, HotKeyData& key_data)
bool Ui::HotKeyPressed(HotKeyData& hotkey)
{
if (CTimer::m_snTimeInMilliseconds - hotkey.timer > 250*CTimer::ms_fTimeScale)
if (CTimer::m_snTimeInMilliseconds - hotkey.timer > 150*CTimer::ms_fTimeScale)
{
hotkey.timer = CTimer::m_snTimeInMilliseconds;
return current_hotkey == "" && KeyPressed(hotkey.key1) && KeyPressed(hotkey.key2);

View File

@ -1,16 +1,25 @@
#include "plugin.h"
#include "CHud.h"
using namespace plugin;
_asm
{
xor ebx, ebx
cmp eax, ebx
jz short loc_6D1CFD
call _ZN10CGameLogic17IsCoopGameGoingOnEv ; CGameLogic::IsCoopGameGoingOn(void)
test al, al
jnz short loc_6D1CC4
}
class Test
{
public:
Test()
{
Events::processScriptsEvent += []
Events::initGameEvent += []
{
patch::ReplaceFunctionCall(0x6D1C80);
};
}
} test;