mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
[Bug Fix]: Fixes for Never Wanted "Flickering" in Zancudo/Bolingbroke (#3152)
* replace REPORT_CRIME with SET_MAX_WANTED_LEVEL --------- Co-authored-by: gir489 <100792176+gir489returns@users.noreply.github.com> Co-authored-by: Arthur <redacted@gmail.com>
This commit is contained in:
parent
b90a59badb
commit
a3d8bf590d
@ -1,7 +1,10 @@
|
||||
#include "backend/command.hpp"
|
||||
#include "backend/looped_command.hpp"
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "backend/looped_command.hpp"
|
||||
#include "core/scr_globals.hpp"
|
||||
#include "util/misc.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "natives.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -19,7 +22,7 @@ namespace big
|
||||
|
||||
// Clear current wanted level
|
||||
g_local_player->m_player_info->m_wanted_level = 0;
|
||||
g_local_player->m_player_info->m_is_wanted = false;
|
||||
g_local_player->m_player_info->m_is_wanted = false;
|
||||
|
||||
// Keep the lock if it's on, but reset the wanted level
|
||||
g.self.wanted_level = 0;
|
||||
@ -34,7 +37,15 @@ namespace big
|
||||
|
||||
virtual void on_tick() override
|
||||
{
|
||||
// Disable never wanted if the script needs to force-modify the wanted level in heists
|
||||
if (auto script = gta_util::find_script_thread("fm_mission_controller"_J))
|
||||
{
|
||||
if (!misc::has_bit_set(script_local(script, scr_locals::fm_mission_controller::mission_controller_wanted_state_flags).as<PINT>(), 7))
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear current wanted level
|
||||
PLAYER::SET_MAX_WANTED_LEVEL(0);
|
||||
g_local_player->m_player_info->m_wanted_level = 0;
|
||||
g_local_player->m_player_info->m_is_wanted = false;
|
||||
|
||||
@ -42,9 +53,15 @@ namespace big
|
||||
g.self.wanted_level = 0;
|
||||
g.self.force_wanted_level = false;
|
||||
}
|
||||
|
||||
virtual void on_disable() override
|
||||
{
|
||||
// There are cases where it is set to 6 in the scripts, but the native automatically reverts it back to 5 anyway
|
||||
PLAYER::SET_MAX_WANTED_LEVEL(5);
|
||||
}
|
||||
};
|
||||
|
||||
never_wanted g_never_wanted("neverwanted", "NEVER_WANTED", "NEVER_WANTED", g.self.never_wanted);
|
||||
never_wanted g_never_wanted("neverwanted", "NEVER_WANTED", "NEVER_WANTED_DESC", g.self.never_wanted);
|
||||
|
||||
void looped::self_wanted()
|
||||
{
|
||||
|
@ -96,6 +96,11 @@ namespace big::scr_locals
|
||||
constexpr static auto broadcast_idx = 12327;
|
||||
}
|
||||
|
||||
namespace fm_mission_controller
|
||||
{
|
||||
constexpr static auto mission_controller_wanted_state_flags = 60051;
|
||||
}
|
||||
|
||||
namespace freemode
|
||||
{
|
||||
// first uLocal_ in this function call
|
||||
|
@ -45,8 +45,6 @@ namespace big
|
||||
#pragma pack(push, 1)
|
||||
struct gta_pointers
|
||||
{
|
||||
memory::handle m_max_wanted_level;
|
||||
|
||||
PVOID m_world_model_spawn_bypass;
|
||||
|
||||
memory::handle m_blame_explode;
|
||||
|
@ -1418,15 +1418,6 @@ namespace big
|
||||
g_pointers->m_gta.m_delete_object = ptr.as<functions::delete_object>();
|
||||
}
|
||||
},
|
||||
// Max Wanted Level
|
||||
{
|
||||
"MWL",
|
||||
"8B 43 6C 89 05",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_max_wanted_level = ptr;
|
||||
}
|
||||
},
|
||||
// World Model Spawn Bypass
|
||||
{
|
||||
"WMSB",
|
||||
|
@ -210,9 +210,7 @@ namespace big
|
||||
|
||||
ImGui::SeparatorText("WANTED_LEVEL"_T.data());
|
||||
|
||||
ImGui::Checkbox("NEVER_WANTED"_T.data(), &g.self.never_wanted);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("NEVER_WANTED_DESC"_T.data());
|
||||
components::command_checkbox<"neverwanted">();
|
||||
|
||||
// Only show all the other stuff like clear wanted, force wanted, and the slider if we don't have never_wanted enabled, since never_wanted overrides all of that
|
||||
if (!g.self.never_wanted)
|
||||
|
Loading…
Reference in New Issue
Block a user