feat(Vehicle Controller): Added vehicle window controls (#1607)

* feat(Overlay): Added Invisibility indicator and its able to save on unload
* feat(Vehicle Controller): Added vehicle window controls
This commit is contained in:
Sixhei Tartari 2023-07-05 23:51:19 +02:00 committed by GitHub
parent a0beeea767
commit 6ea93ee333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 120 additions and 15 deletions

View File

@ -772,8 +772,9 @@ namespace big
bool show_infinite_mag = false;
bool show_aimbot = false;
bool show_triggerbot = false;
bool show_invisibility = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(ingame_overlay_indicators, show_player_godmode, show_off_radar, show_vehicle_godmode, show_never_wanted, show_always_full_ammo, show_infinite_ammo, show_infinite_mag, show_aimbot, show_triggerbot)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(ingame_overlay_indicators, show_player_godmode, show_off_radar, show_vehicle_godmode, show_never_wanted, show_always_full_ammo, show_infinite_ammo, show_infinite_mag, show_aimbot, show_triggerbot, show_invisibility)
} ingame_overlay_indicators{};
struct vehicle_control
@ -786,7 +787,7 @@ namespace big
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle_control, operation_animation, max_summon_range, render_distance_on_veh)
} vehicle_control{};
NLOHMANN_DEFINE_TYPE_INTRUSIVE(window, background_color, demo, text_color, button_color, frame_color, gui_scale, switched_view, ingame_overlay, vehicle_control)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(window, background_color, demo, text_color, button_color, frame_color, gui_scale, switched_view, ingame_overlay, vehicle_control, ingame_overlay_indicators)
} window{};
struct context_menu

View File

@ -1910,6 +1910,15 @@ enum class eDoorId
VEH_EXT_BOOT
};
enum class eWindowId
{
WINDOW_INVALID_ID = -1,
FRONT_LEFT_WINDOW = 0,
FRONT_RIGHT_WINDOW = 1,
REAR_LEFT_WINDOW = 2,
REAR_RIGHT_WINDOW = 3,
};
enum class eVehicleSeats
{
DRIVER = -1,
@ -1920,15 +1929,11 @@ enum class eVehicleSeats
OUTSIDE_RIGHT,
};
enum class eCombatAbilityLevel{
enum class eCombatAbilityLevel
{
POOR,
AVERAGE,
PROFESSIONAL
};
NLOHMANN_JSON_SERIALIZE_ENUM(eCombatAbilityLevel,
{
{eCombatAbilityLevel::POOR, "poor"},
{eCombatAbilityLevel::AVERAGE, "average"},
{eCombatAbilityLevel::PROFESSIONAL, "professional"}
})
NLOHMANN_JSON_SERIALIZE_ENUM(eCombatAbilityLevel, {{eCombatAbilityLevel::POOR, "poor"}, {eCombatAbilityLevel::AVERAGE, "average"}, {eCombatAbilityLevel::PROFESSIONAL, "professional"}})

View File

@ -125,6 +125,14 @@ namespace big
vehicle::operate_vehicle_door(m_controlled_vehicle.handle, door, open);
}
void vehicle_control::operate_window(eWindowId window, bool open)
{
if (g.window.vehicle_control.operation_animation)
animated_vehicle_operation(self::ped);
vehicle::operate_vehicle_window(m_controlled_vehicle.handle, window, open);
}
void vehicle_control::operate_lights(bool headlights, bool highbeams)
{
if (g.window.vehicle_control.operation_animation)

View File

@ -3,10 +3,11 @@
namespace big
{
constexpr auto MAX_VEHICLE_DOORS = 6;
constexpr auto MAX_VEHICLE_DOORS = 6;
constexpr auto MAX_VEHICLE_WINDOWS = 4;
constexpr auto MAX_VEHICLE_LOCK_STATES = 11;
constexpr auto VEH_OP_ANIM_DICT = "ANIM@MP_PLAYER_INTMENU@KEY_FOB@";
constexpr auto VEH_OP_ANIM = "FOB_CLICK";
constexpr auto VEH_OP_ANIM_DICT = "ANIM@MP_PLAYER_INTMENU@KEY_FOB@";
constexpr auto VEH_OP_ANIM = "FOB_CLICK";
struct vehicle_door
{
@ -17,6 +18,11 @@ namespace big
bool valid;
};
struct vehicle_window
{
eWindowId id;
};
struct controlled_vehicle
{
@ -24,6 +30,7 @@ namespace big
CVehicle* ptr;
char model_name[100];
vehicle_door doors[6];
vehicle_window windows[4];
int doorCount;
eVehicleLockState lockstate;
bool engine;
@ -32,8 +39,7 @@ namespace big
bool radio;
int radiochannel;
int convertibelstate;
int headlights,
highbeams;
int headlights, highbeams;
};
class vehicle_control
@ -62,6 +68,7 @@ namespace big
void animated_vehicle_operation(Ped ped);
void operate_door(eDoorId, bool);
void operate_window(eWindowId, bool);
void operate_lights(bool headlights, bool highbeams);
void operate_neons(int index, bool toggle);
void summon_vehicle();

View File

@ -746,6 +746,35 @@ namespace big::vehicle
return success;
}
inline bool operate_vehicle_window(Vehicle veh, eWindowId windowId, bool open)
{
bool success = false;
if (ENTITY::DOES_ENTITY_EXIST(veh))
{
for (int i = 0; i < 4; i++)
{
if (windowId == eWindowId::WINDOW_INVALID_ID)
{
if (open)
VEHICLE::ROLL_DOWN_WINDOWS(veh);
else
VEHICLE::ROLL_UP_WINDOW(veh, i);
}
if ((int)windowId == i)
{
if (open)
VEHICLE::ROLL_DOWN_WINDOW(veh, i);
else
VEHICLE::ROLL_UP_WINDOW(veh, i);
success = true;
}
}
}
return success;
}
inline bool operate_vehicle_headlights(Vehicle veh, bool lights, bool highbeams)
{
if (ENTITY::DOES_ENTITY_EXIST(veh))

View File

@ -58,6 +58,9 @@ namespace big
if (g.window.ingame_overlay_indicators.show_triggerbot)
components::overlay_indicator("Triggerbot", g.weapons.triggerbot);
if (g.window.ingame_overlay_indicators.show_invisibility)
components::overlay_indicator("Invisibility", g.self.invisibility);
}
if (g.window.ingame_overlay.show_position && g_local_player)

View File

@ -69,13 +69,16 @@ namespace big
ImGui::Checkbox("Show Vehicle Godmode", &g.window.ingame_overlay_indicators.show_vehicle_godmode);
ImGui::Checkbox("Show Never Wanted", &g.window.ingame_overlay_indicators.show_never_wanted);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Show Infinite Ammo", &g.window.ingame_overlay_indicators.show_infinite_ammo);
ImGui::Checkbox("Show Always Full Ammo", &g.window.ingame_overlay_indicators.show_always_full_ammo);
ImGui::Checkbox("Show Infinite Magazine", &g.window.ingame_overlay_indicators.show_infinite_mag);
ImGui::Checkbox("Show Aimbot", &g.window.ingame_overlay_indicators.show_aimbot);
ImGui::Checkbox("Show Triggerbot", &g.window.ingame_overlay_indicators.show_triggerbot);
ImGui::Checkbox("Show Invisibility", &g.window.ingame_overlay_indicators.show_invisibility);
ImGui::EndGroup();
ImGui::TreePop();

View File

@ -93,7 +93,7 @@ namespace big
}
ImGui::SameLine(300);
const auto button_label = g_vehicle_control_service.m_controlled_vehicle.doors[i].open ? "CLOSE"_T : "OPEN"_T;
if (components::button(button_label))
{
@ -109,6 +109,48 @@ namespace big
ImGui::EndGroup();
}
void render_windows_tab()
{
const char* const windownames[4]{
"Front left",
"Front right",
"Back left",
"Back right",
};
ImGui::BeginGroup();
ImGui::Spacing();
ImGui::SetNextItemWidth(200);
components::button("Roll Down All", [] {
g_vehicle_control_service.operate_window(eWindowId::WINDOW_INVALID_ID, true);
});
ImGui::SameLine();
components::button("Roll Up All", [] {
g_vehicle_control_service.operate_window(eWindowId::WINDOW_INVALID_ID, false);
});
ImGui::EndGroup();
ImGui::Spacing();
ImGui::Separator();
ImGui::BeginGroup();
for (int i = 0; i < 4; i++)
{
ImGui::SetNextItemWidth(200);
ImGui::PushID(i);
ImGui::Text(windownames[i]);
ImGui::SameLine(300);
components::button("Roll Down", [i] {
g_vehicle_control_service.operate_window((eWindowId)i, true);
});
ImGui::SameLine();
components::button("Roll Up", [i] {
g_vehicle_control_service.operate_window((eWindowId)i, false);
});
ImGui::PopID();
}
}
void render_lights_tab()
{
const char* const neonnames[4]{
@ -321,6 +363,13 @@ namespace big
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Windows"))
{
render_windows_tab();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Lights"))
{
render_lights_tab();