feat(CPed): In vehicle property is a bit field, check against bit instead of one value

This commit is contained in:
Yimura 2021-12-20 11:37:23 +01:00
parent 2fa3ebd789
commit d8b7b8801a
4 changed files with 11 additions and 3 deletions

View File

@ -7,7 +7,7 @@ namespace big
if (!g.vehicle.god_mode || g_local_player == nullptr || g_local_player->m_vehicle == nullptr) if (!g.vehicle.god_mode || g_local_player == nullptr || g_local_player->m_vehicle == nullptr)
return; return;
if (g_local_player->m_in_vehicle == 0x0) if (g_local_player->m_in_vehicle & (int)ePedTask::TASK_FOOT)
{ {
g_local_player->m_vehicle->m_deform_god = 0x8C; g_local_player->m_vehicle->m_deform_god = 0x8C;
g_local_player->m_vehicle->m_godmode = 0x1; g_local_player->m_vehicle->m_godmode = 0x1;

View File

@ -101,6 +101,14 @@ namespace big
EXP_TAG_SUBMARINE_BIG = 82, EXP_TAG_SUBMARINE_BIG = 82,
}; };
enum class ePedTask
{
TASK_NONE,
TASK_FOOT = 1 << 4,
TASK_UNK = 1 << 5,
TASK_DRIVING = 1 << 6
};
enum class eRemoteEvent enum class eRemoteEvent
{ {
Bounty = 1294995624, Bounty = 1294995624,

View File

@ -11,7 +11,7 @@ namespace big
ImGui::SetNextWindowPos({ 50, 50 }, ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos({ 50, 50 }, ImGuiCond_FirstUseEver);
if (g.window.handling && ImGui::Begin("Handling", &g.window.handling)) if (g.window.handling && ImGui::Begin("Handling", &g.window.handling))
{ {
if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_in_vehicle == 0x10) if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_in_vehicle & (int)ePedTask::TASK_FOOT)
{ {
ImGui::Text("Please enter a vehicle."); ImGui::Text("Please enter a vehicle.");

View File

@ -21,7 +21,7 @@ namespace big
int vehicle_service::attempt_save() int vehicle_service::attempt_save()
{ {
if (g_local_player == nullptr || g_local_player->m_in_vehicle == 0x10 || g_local_player->m_vehicle == nullptr) if (g_local_player == nullptr || g_local_player->m_in_vehicle & (int)ePedTask::TASK_FOOT || g_local_player->m_vehicle == nullptr)
return -1; return -1;
if (m_handling_backup.find(g_local_player->m_vehicle->m_handling->m_model_hash) != m_handling_backup.end()) if (m_handling_backup.find(g_local_player->m_vehicle->m_handling->m_model_hash) != m_handling_backup.end())
return 0; return 0;