mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-07 09:53:50 +08:00
feat(Mobile): Added mors mutual insurance fix all vehicles
This commit is contained in:
parent
ec22ca2905
commit
831ba8ad3a
@ -13,6 +13,17 @@ namespace big
|
||||
VEHICLE_GUN
|
||||
};
|
||||
|
||||
enum eVehicleFlags
|
||||
{
|
||||
UNK0 = 1 << 0,
|
||||
DESTROYED = 1 << 1,
|
||||
HAS_INSURANCE = 1 << 2,
|
||||
IMPOUNDED = 1 << 6,
|
||||
UNK1 = 1 << 10,
|
||||
UNK2 = 1 << 11,
|
||||
UNK3 = 1 << 16
|
||||
};
|
||||
|
||||
enum class ePedTask
|
||||
{
|
||||
TASK_NONE,
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
namespace big::tab_main
|
||||
{
|
||||
void tab_mobile();
|
||||
void tab_tunables();
|
||||
void tab_self();
|
||||
void tab_recovery();
|
||||
|
29
BigBaseV2/src/gui/window/main/tab_mobile.cpp
Normal file
29
BigBaseV2/src/gui/window/main/tab_mobile.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include "main_tabs.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "script.hpp"
|
||||
#include "util/mobile.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void tab_main::tab_mobile()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Mobile"))
|
||||
{
|
||||
if (ImGui::Button("Mors Mutual Fix All Vehicles"))
|
||||
{
|
||||
int amount_fixed = mobile::mors_mutual::fix_all();
|
||||
|
||||
QUEUE_JOB_BEGIN_CLAUSE(amount_fixed)
|
||||
{
|
||||
char vehicles_fixed[42];
|
||||
sprintf(vehicles_fixed, "<C>%d</C> vehicle%s been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have");
|
||||
|
||||
notify::above_map(vehicles_fixed);
|
||||
}QUEUE_JOB_END_CLAUSE
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ namespace big
|
||||
{
|
||||
ImGui::BeginTabBar("tabbar");
|
||||
tab_main::tab_self();
|
||||
tab_main::tab_mobile();
|
||||
tab_main::tab_spawn();
|
||||
tab_main::tab_tunables();
|
||||
tab_main::tab_teleport();
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "blip.hpp"
|
||||
#include "entity.hpp"
|
||||
#include "math.hpp"
|
||||
#include "mobile.hpp"
|
||||
#include "notify.hpp"
|
||||
#include "player.hpp"
|
||||
#include "session.hpp"
|
||||
|
34
BigBaseV2/src/util/misc.hpp
Normal file
34
BigBaseV2/src/util/misc.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
namespace big::misc
|
||||
{
|
||||
inline void clear_bit(int* address, int pos)
|
||||
{
|
||||
*address &= ~(1 << pos);
|
||||
}
|
||||
|
||||
inline void clear_bits(int* address, int bits)
|
||||
{
|
||||
*address &= ~(bits);
|
||||
}
|
||||
|
||||
inline bool has_bit_set(int* address, int pos)
|
||||
{
|
||||
return *address & 1 << pos;
|
||||
}
|
||||
|
||||
inline bool has_bits_set(int* address, int bits)
|
||||
{
|
||||
return (*address & bits) == bits;
|
||||
}
|
||||
|
||||
inline void set_bit(int* address, int pos)
|
||||
{
|
||||
*address |= 1 << pos;
|
||||
}
|
||||
|
||||
inline void set_bits(int* address, int bits)
|
||||
{
|
||||
*address |= bits;
|
||||
}
|
||||
}
|
45
BigBaseV2/src/util/mobile.hpp
Normal file
45
BigBaseV2/src/util/mobile.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include "core/enums.hpp"
|
||||
#include "script_global.hpp"
|
||||
#include "misc.hpp"
|
||||
|
||||
namespace big::mobile
|
||||
{
|
||||
namespace mors_mutual
|
||||
{
|
||||
auto vehicle_global = script_global(1585844);
|
||||
|
||||
bool fix_index(int veh_idx); // forward declare func
|
||||
inline int fix_all()
|
||||
{
|
||||
int fixed_count = 0;
|
||||
|
||||
for (int i = 0; i < *vehicle_global.as<int*>(); i++)
|
||||
if (fix_index(i))
|
||||
fixed_count++;
|
||||
|
||||
return fixed_count;
|
||||
}
|
||||
|
||||
inline bool fix_index(int veh_idx)
|
||||
{
|
||||
bool can_be_fixed = misc::has_bits_set(
|
||||
vehicle_global.at(veh_idx, 142).at(103).as<int*>(),
|
||||
eVehicleFlags::DESTROYED | eVehicleFlags::HAS_INSURANCE
|
||||
);
|
||||
|
||||
if (can_be_fixed)
|
||||
{
|
||||
misc::clear_bits(
|
||||
vehicle_global.at(veh_idx, 142).at(103).as<int*>(),
|
||||
eVehicleFlags::DESTROYED | eVehicleFlags::IMPOUNDED | eVehicleFlags::UNK3
|
||||
);
|
||||
misc::set_bits(
|
||||
vehicle_global.at(veh_idx, 142).at(103).as<int*>(),
|
||||
eVehicleFlags::UNK0 | eVehicleFlags::UNK2
|
||||
);
|
||||
}
|
||||
return can_be_fixed;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user