fix: don't randomize components if we're cloning an existing ped (#2663)

This commit is contained in:
maybegreat48 2024-01-28 14:51:25 +00:00 committed by GitHub
parent 96048fa0f6
commit 1e11d83f7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 21 deletions

View File

@ -3,8 +3,22 @@
#include "gta/enums.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "util/is_key_pressed.hpp"
#include "windows.h"
#include "pointers.hpp"
namespace
{
inline bool is_key_pressed(uint16_t key)
{
if (GetForegroundWindow() == big::g_pointers->m_hwnd)
{
if (GetAsyncKeyState(key) & 0x8000)
{
return true;
}
}
return false;
}
}
namespace big
{
@ -42,7 +56,7 @@ namespace big
void update_key_state(key_state& key_last_tick)
{
if (big::is_key_pressed(key_last_tick.v_key))
if (is_key_pressed(key_last_tick.v_key))
{
switch (key_last_tick.state)
{

View File

@ -1,17 +0,0 @@
#pragma once
#include "../pointers.hpp"
namespace big
{
inline bool is_key_pressed(uint16_t key)
{
if (GetForegroundWindow() == g_pointers->m_hwnd)
{
if (GetAsyncKeyState(key) & 0x8000)
{
return true;
}
}
return false;
}
}

View File

@ -134,7 +134,9 @@ namespace big
PED::SET_PED_ID_RANGE(ped, 200.0f);
PED::SET_PED_FIRING_PATTERN(ped, RAGE_JOAAT("FIRING_PATTERN_FULL_AUTO"));
PED::SET_PED_SHOOT_RATE(ped, 150);
ped::set_ped_random_component_variation(ped);
if (!clone)
ped::set_ped_random_component_variation(ped);
if (is_bodyguard)
{