Various fixes for Vehicle Extras. (#2019)
This commit is contained in:
parent
e1a2ee21ea
commit
b19cf9c26d
@ -219,10 +219,9 @@ namespace big
|
|||||||
VEHICLE::SET_VEHICLE_EXTRA_COLOURS(vehicle, vehicle_json[pearlescent_color_key], vehicle_json[wheel_color_key]);
|
VEHICLE::SET_VEHICLE_EXTRA_COLOURS(vehicle, vehicle_json[pearlescent_color_key], vehicle_json[wheel_color_key]);
|
||||||
|
|
||||||
std::map<int, bool> vehicle_extras = vehicle_json[vehicle_extras_key];
|
std::map<int, bool> vehicle_extras = vehicle_json[vehicle_extras_key];
|
||||||
for (int i = 0; i <= 20; i++)
|
for (const auto& [extra, extra_enabled] : vehicle_extras)
|
||||||
{
|
{
|
||||||
if (VEHICLE::DOES_EXTRA_EXIST(vehicle, i))
|
VEHICLE::SET_VEHICLE_EXTRA(vehicle, extra, extra_enabled);
|
||||||
VEHICLE::SET_VEHICLE_EXTRA(vehicle, i, vehicle_extras[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vehicle_json[vehicle_livery_key].is_null())
|
if (!vehicle_json[vehicle_livery_key].is_null())
|
||||||
@ -446,10 +445,12 @@ namespace big
|
|||||||
vehicle_json[wheel_color_key] = wheel_color;
|
vehicle_json[wheel_color_key] = wheel_color;
|
||||||
|
|
||||||
std::map<int, bool> vehicle_extras;
|
std::map<int, bool> vehicle_extras;
|
||||||
for (int i = 0; i <= 20; i++)
|
for (int extra_iterator = 0; extra_iterator <= 14; extra_iterator++)
|
||||||
{
|
{
|
||||||
if (VEHICLE::DOES_EXTRA_EXIST(vehicle, i))
|
if (VEHICLE::DOES_EXTRA_EXIST(vehicle, extra_iterator))
|
||||||
vehicle_extras[i] = !VEHICLE::IS_VEHICLE_EXTRA_TURNED_ON(vehicle, i);
|
{
|
||||||
|
vehicle_extras[extra_iterator] = !VEHICLE::IS_VEHICLE_EXTRA_TURNED_ON(vehicle, extra_iterator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vehicle_json[vehicle_extras_key] = vehicle_extras;
|
vehicle_json[vehicle_extras_key] = vehicle_extras;
|
||||||
|
@ -563,21 +563,6 @@ namespace big::vehicle
|
|||||||
return owned_mods;
|
return owned_mods;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::map<int, bool> get_vehicle_extras(Vehicle vehicle)
|
|
||||||
{
|
|
||||||
std::map<int, bool> extras;
|
|
||||||
|
|
||||||
for (int i = 0; i <= 20; i++)
|
|
||||||
{
|
|
||||||
if (VEHICLE::DOES_EXTRA_EXIST(vehicle, i))
|
|
||||||
{
|
|
||||||
extras[i] = VEHICLE::IS_VEHICLE_EXTRA_TURNED_ON(vehicle, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return extras;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void teleport_into_vehicle(Vehicle veh)
|
inline void teleport_into_vehicle(Vehicle veh)
|
||||||
{
|
{
|
||||||
PED::SET_PED_INTO_VEHICLE(self::ped, veh, -1);
|
PED::SET_PED_INTO_VEHICLE(self::ped, veh, -1);
|
||||||
|
@ -18,7 +18,6 @@ namespace big
|
|||||||
static std::map<int, int32_t> owned_mods;
|
static std::map<int, int32_t> owned_mods;
|
||||||
static std::map<int, std::string> slot_display_names;
|
static std::map<int, std::string> slot_display_names;
|
||||||
static std::map<int, std::map<int, std::string>> mod_display_names;
|
static std::map<int, std::map<int, std::string>> mod_display_names;
|
||||||
static std::map<int, bool> vehicle_extras;
|
|
||||||
static std::map<std::string, std::vector<int>> front_wheel_map;
|
static std::map<std::string, std::vector<int>> front_wheel_map;
|
||||||
static std::map<std::string, std::vector<int>> rear_wheel_map;
|
static std::map<std::string, std::vector<int>> rear_wheel_map;
|
||||||
|
|
||||||
@ -62,7 +61,6 @@ namespace big
|
|||||||
Hash model = ENTITY::GET_ENTITY_MODEL(player_vehicle);
|
Hash model = ENTITY::GET_ENTITY_MODEL(player_vehicle);
|
||||||
|
|
||||||
owned_mods = vehicle::get_owned_mods_from_vehicle(player_vehicle);
|
owned_mods = vehicle::get_owned_mods_from_vehicle(player_vehicle);
|
||||||
vehicle_extras = vehicle::get_vehicle_extras(player_vehicle);
|
|
||||||
VEHICLE::SET_VEHICLE_MOD_KIT(player_vehicle, 0);
|
VEHICLE::SET_VEHICLE_MOD_KIT(player_vehicle, 0);
|
||||||
|
|
||||||
std::map<int, std::string> tmp_slot_display_names;
|
std::map<int, std::string> tmp_slot_display_names;
|
||||||
@ -282,22 +280,6 @@ namespace big
|
|||||||
}
|
}
|
||||||
ImGui::EndListBox();
|
ImGui::EndListBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
int item_counter = 0;
|
|
||||||
for (auto& [extra, extra_enabled] : vehicle_extras)
|
|
||||||
{
|
|
||||||
if (item_counter % 5 == 0)
|
|
||||||
ImGui::SameLine();
|
|
||||||
auto name = std::format("Extra #{}", extra);
|
|
||||||
if (ImGui::Checkbox(name.c_str(), &extra_enabled))
|
|
||||||
{
|
|
||||||
g_fiber_pool->queue_job([extra, extra_enabled] {
|
|
||||||
VEHICLE::SET_VEHICLE_EXTRA(player_vehicle, extra, !extra_enabled);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
item_counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
if (selected_slot != -1)
|
if (selected_slot != -1)
|
||||||
@ -444,6 +426,36 @@ namespace big
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int item_counter = 0;
|
||||||
|
for (int extra = MOD_EXTRA_0; extra >= MOD_EXTRA_14; extra--)
|
||||||
|
{
|
||||||
|
if (owned_mods.find(extra) != owned_mods.end())
|
||||||
|
{
|
||||||
|
if (item_counter == 0)
|
||||||
|
{
|
||||||
|
ImGui::SeparatorText("Vehicle Extras");
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
}
|
||||||
|
if ((item_counter % 5) != 0)
|
||||||
|
ImGui::SameLine();
|
||||||
|
int gta_extra_id = (extra - MOD_EXTRA_0) * -1;
|
||||||
|
auto name = std::format("Extra #{}", gta_extra_id);
|
||||||
|
bool is_extra_enabled = owned_mods[extra] == 1;
|
||||||
|
if (ImGui::Checkbox(name.c_str(), &is_extra_enabled))
|
||||||
|
{
|
||||||
|
owned_mods[extra] = is_extra_enabled;
|
||||||
|
g_fiber_pool->queue_job([gta_extra_id, is_extra_enabled] {
|
||||||
|
VEHICLE::SET_VEHICLE_EXTRA(player_vehicle, gta_extra_id, !is_extra_enabled);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
item_counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item_counter != 0)
|
||||||
|
{
|
||||||
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::SeparatorText("NEON_LIGHT_OPTIONS"_T.data());
|
ImGui::SeparatorText("NEON_LIGHT_OPTIONS"_T.data());
|
||||||
|
|
||||||
ImGui::PushID("##headlight_en");
|
ImGui::PushID("##headlight_en");
|
||||||
|
Reference in New Issue
Block a user