Refactored weapons.bin into weapons.json for extensibility and readability. (#1632)

* Refactored weapons.bin into weapons.json for extensibility and human readability.
Added weapon attachments scraping from the meta files (currently is missing a lot of attachments, more than half, requires RPF reading refactoring to fix.)
Added Ammunation to Self -> Weapons, because it's vital you protect yourself, the patriotic way.

* Fixed weapons.xml not properly populating all the components.
Refactored buttons to use components::button.

* Refactored the Attachments code to implicitly trust that the attachments will be there now.
Added proper versioning to the weapons.json file.
Removed debug logging from gta_data_service.cpp.

* Fixed Ammunation buttons.
Added loading message for the new weapons.json system.
Fixed a bug where two components shared the same name, the user could not select the 2nd component.
Fixed Attachments displaying an attachment from a previous weapon if the user changed weapons.

* Fixed Tint Apply button not using the components::button template.
This commit is contained in:
gir489
2023-07-07 18:52:52 -04:00
committed by GitHub
parent f10c698396
commit 6f40a38045
9 changed files with 283 additions and 51 deletions

View File

@ -491,7 +491,7 @@ namespace big
if (ImGui::BeginCombo("##ped_weapon",
selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ? "NO_WEAPONS"_T.data() :
selected_ped_weapon_hash == 0 ? "ALL"_T.data() :
g_gta_data_service->weapon_by_hash(selected_ped_weapon_hash).m_display_name))
g_gta_data_service->weapon_by_hash(selected_ped_weapon_hash).m_display_name.c_str()))
{
if (selected_ped_weapon_type != SPAWN_PED_NO_WEAPONS)
{
@ -509,7 +509,7 @@ namespace big
{
if (selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS || weapon.m_weapon_type == weapon_type_arr[selected_ped_weapon_type])
{
if (ImGui::Selectable(weapon.m_display_name, weapon.m_hash == selected_ped_weapon_hash))
if (ImGui::Selectable(weapon.m_display_name.c_str(), weapon.m_hash == selected_ped_weapon_hash))
{
selected_ped_weapon_hash = weapon.m_hash;
}

View File

@ -186,7 +186,7 @@ namespace big
std::string filter = new_template.m_weapon_model;
std::transform(p_model.begin(), p_model.end(), p_model.begin(), ::tolower);
std::transform(filter.begin(), filter.end(), filter.begin(), ::tolower);
if (p_model.find(filter) != std::string::npos && ImGui::Selectable(p.m_name))
if (p_model.find(filter) != std::string::npos && ImGui::Selectable(p.m_name.c_str()))
{
new_template.m_weapon_model = p.m_name;
}