2022-03-02 14:43:02 +01:00
|
|
|
// MassBuilderSaveTool
|
2023-09-02 18:30:29 +02:00
|
|
|
// Copyright (C) 2021-2023 Guillaume Jacquemin
|
2022-03-02 14:43:02 +01:00
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#include "../FontAwesome/IconsFontAwesome5.h"
|
|
|
|
|
|
|
|
#include "../Maps/ArmourSets.h"
|
|
|
|
#include "../Maps/StyleNames.h"
|
|
|
|
|
2023-11-29 12:33:26 +01:00
|
|
|
#include "Application.h"
|
|
|
|
|
|
|
|
namespace mbst {
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2022-12-03 16:49:39 +01:00
|
|
|
void
|
2023-11-29 12:33:26 +01:00
|
|
|
Application::drawArmour() {
|
|
|
|
if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) {
|
2022-03-02 14:43:02 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
constexpr static Containers::StringView slot_labels[] = {
|
|
|
|
#define c(enumerator, strenum, name) name,
|
|
|
|
#include "../Maps/ArmourSlots.hpp"
|
|
|
|
#undef c
|
|
|
|
};
|
|
|
|
|
|
|
|
auto labels_view = arrayView(slot_labels);
|
|
|
|
|
|
|
|
const static float footer_height_to_reserve = ImGui::GetFrameHeightWithSpacing();
|
|
|
|
|
|
|
|
ImGui::BeginGroup();
|
|
|
|
|
|
|
|
if(ImGui::BeginTable("##SlotsTable", 1,
|
|
|
|
ImGuiTableFlags_ScrollY|ImGuiTableFlags_BordersOuter|ImGuiTableFlags_BordersInnerH,
|
|
|
|
{ImGui::GetContentRegionAvail().x * 0.15f, -footer_height_to_reserve}))
|
|
|
|
{
|
|
|
|
ImGui::TableSetupColumn("##Slots", ImGuiTableColumnFlags_WidthStretch);
|
|
|
|
|
|
|
|
for(std::size_t i = 0; i < labels_view.size(); i++) {
|
|
|
|
ImGui::TableNextRow();
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if(ImGui::Selectable(labels_view[i].data(), _selectedArmourSlot && (*_selectedArmourSlot) == i,
|
|
|
|
ImGuiSelectableFlags_SpanAvailWidth))
|
|
|
|
{
|
|
|
|
_selectedArmourSlot = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndTable();
|
|
|
|
}
|
|
|
|
|
2022-03-02 14:43:02 +01:00
|
|
|
if(ImGui::Button(ICON_FA_UNDO_ALT " Reset all")) {
|
|
|
|
_currentMass->getArmourParts();
|
|
|
|
}
|
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::EndGroup();
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
if(!_selectedArmourSlot) {
|
|
|
|
ImGui::TextUnformatted("No selected armour slot.");
|
2022-03-02 14:43:02 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
auto& part = _currentMass->armourParts()[*_selectedArmourSlot];
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::BeginGroup();
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
if(ImGui::BeginChild("##ArmourEditor", {0.0f, -footer_height_to_reserve})) {
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::SeparatorText("Part");
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-11-29 12:33:26 +01:00
|
|
|
if(GameData::armour_sets.find(part.id) != GameData::armour_sets.cend()) {
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::Text("Set name: %s", GameData::armour_sets.at(part.id).name.data());
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
|
|
|
else {
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::Text("Set ID: %u", part.id);
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::SameLine();
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
if(ImGui::SmallButton("Change")) {
|
|
|
|
ImGui::OpenPopup("##ArmourPartPopup");
|
|
|
|
}
|
|
|
|
if(ImGui::BeginPopup("##ArmourPartPopup")) {
|
2022-03-02 14:43:02 +01:00
|
|
|
if(ImGui::BeginListBox("##ChangePart")) {
|
2023-12-04 15:25:02 +01:00
|
|
|
for(auto& set : GameData::armour_sets) {
|
|
|
|
if(part.slot != GameObjects::ArmourPart::Slot::Neck || set.second.neck_compatible) {
|
|
|
|
if(ImGui::Selectable(set.second.name.data(), set.first == part.id,
|
|
|
|
ImGuiSelectableFlags_SpanAvailWidth))
|
|
|
|
{
|
2022-03-02 14:43:02 +01:00
|
|
|
part.id = set.first;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::EndListBox();
|
|
|
|
}
|
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::EndPopup();
|
|
|
|
}
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::SeparatorText("Styles");
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
for(std::int32_t i = 0; i < 4; i++) {
|
|
|
|
drawAlignedText("Slot %d:", i + 1);
|
2022-03-02 14:43:02 +01:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::PushID(i);
|
|
|
|
if(ImGui::BeginCombo("##Style",
|
|
|
|
getStyleName(part.styles[i], _currentMass->armourCustomStyles()).data()))
|
|
|
|
{
|
2024-03-08 19:27:44 +01:00
|
|
|
for(const auto& style : GameData::builtin_style_names) {
|
2023-12-04 15:25:02 +01:00
|
|
|
if(ImGui::Selectable(getStyleName(style.first, _currentMass->armourCustomStyles()).data(),
|
|
|
|
part.styles[i] == style.first))
|
|
|
|
{
|
|
|
|
part.styles[i] = style.first;
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::EndCombo();
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::PopID();
|
|
|
|
}
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::SeparatorText("Decals");
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
constexpr static float selectable_width = 25.0f;
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
drawAlignedText("Showing/editing decal:");
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {0.5f, 0.0f});
|
|
|
|
for(std::uint32_t i = 0; i < part.decals.size(); i++) {
|
|
|
|
ImGui::SameLine();
|
|
|
|
if(ImGui::Selectable(std::to_string(i + 1).c_str(), _selectedArmourDecals[*_selectedArmourSlot] == int(i),
|
|
|
|
ImGuiSelectableFlags_None, {selectable_width, 0.0f}))
|
|
|
|
{
|
|
|
|
_selectedArmourDecals[*_selectedArmourSlot] = int(i);
|
|
|
|
}
|
|
|
|
if(i != part.decals.size() - 1) {
|
2022-03-02 14:43:02 +01:00
|
|
|
ImGui::SameLine();
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
2023-12-04 15:25:02 +01:00
|
|
|
}
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
drawDecalEditor(part.decals[_selectedArmourDecals[*_selectedArmourSlot]]);
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
if(!part.accessories.isEmpty()) {
|
|
|
|
ImGui::SeparatorText("Accessories");
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
drawAlignedText("Showing/editing accessory:");
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {0.5f, 0.0f});
|
|
|
|
for(std::uint32_t i = 0; i < part.accessories.size(); i++) {
|
|
|
|
ImGui::SameLine();
|
|
|
|
if(ImGui::Selectable((std::string{} + char(i + 65)).c_str(),
|
|
|
|
_selectedArmourAccessories[*_selectedArmourSlot] == int(i),
|
|
|
|
ImGuiSelectableFlags_None, {selectable_width, 0.0f}))
|
|
|
|
{
|
|
|
|
_selectedArmourAccessories[*_selectedArmourSlot] = int(i);
|
|
|
|
}
|
|
|
|
if(i != part.accessories.size() - 1) {
|
2022-03-02 14:43:02 +01:00
|
|
|
ImGui::SameLine();
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
|
|
|
}
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::PopStyleVar();
|
|
|
|
drawAccessoryEditor(part.accessories[_selectedArmourAccessories[*_selectedArmourSlot]],
|
|
|
|
_currentMass->armourCustomStyles());
|
|
|
|
}
|
|
|
|
}
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::EndChild();
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) {
|
|
|
|
_modifiedBySaveTool = true;
|
|
|
|
if(!_currentMass->writeArmourPart(part.slot)) {
|
|
|
|
_modifiedBySaveTool = false;
|
|
|
|
_queue.addToast(Toast::Type::Error, _currentMass->lastError());
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
2023-12-04 15:25:02 +01:00
|
|
|
}
|
2022-03-02 14:43:02 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::EndGroup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Application::drawBLAttachment() {
|
|
|
|
if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) {
|
|
|
|
return;
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
drawAlignedText("Attachment style:"_s);
|
|
|
|
ImGui::SameLine();
|
|
|
|
if(ImGui::RadioButton("Active one",
|
|
|
|
_currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::ActiveOne))
|
2022-03-20 10:17:14 +01:00
|
|
|
{
|
2023-12-04 15:25:02 +01:00
|
|
|
_currentMass->bulletLauncherAttachmentStyle() = GameObjects::BulletLauncherAttachmentStyle::ActiveOne;
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if(ImGui::RadioButton("Active one per slot",
|
|
|
|
_currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::ActiveOnePerSlot))
|
|
|
|
{
|
|
|
|
_currentMass->bulletLauncherAttachmentStyle() = GameObjects::BulletLauncherAttachmentStyle::ActiveOnePerSlot;
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
if(ImGui::RadioButton("All equipped",
|
|
|
|
_currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::AllEquipped))
|
|
|
|
{
|
|
|
|
_currentMass->bulletLauncherAttachmentStyle() = GameObjects::BulletLauncherAttachmentStyle::ActiveOnePerSlot;
|
|
|
|
}
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::Separator();
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
constexpr static float selectable_width = 25.0f;
|
|
|
|
drawAlignedText("Launcher slot:");
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {0.5f, 0.0f});
|
|
|
|
for(auto i = 0u; i < _currentMass->bulletLauncherAttachments().size(); i++) {
|
2022-03-20 10:17:14 +01:00
|
|
|
ImGui::SameLine();
|
2023-12-04 15:25:02 +01:00
|
|
|
if(ImGui::Selectable(std::to_string(i).c_str(), _selectedBLPlacement == i, ImGuiSelectableFlags_None,
|
|
|
|
{selectable_width, 0.0f}))
|
|
|
|
{
|
|
|
|
_selectedBLPlacement = i;
|
|
|
|
}
|
|
|
|
if(i != _currentMass->bulletLauncherAttachments().size() - 1) {
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::PopStyleVar();
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
auto& placement = _currentMass->bulletLauncherAttachments()[_selectedBLPlacement];
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
static const Containers::StringView socket_labels[] = {
|
2022-03-20 10:17:14 +01:00
|
|
|
#define c(enumerator, enumstr, name) name,
|
|
|
|
#include "../Maps/BulletLauncherSockets.hpp"
|
|
|
|
#undef c
|
2023-12-04 15:25:02 +01:00
|
|
|
};
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
drawAlignedText("Socket:");
|
|
|
|
ImGui::SameLine();
|
|
|
|
if(ImGui::BeginCombo("##Socket", socket_labels[std::uint32_t(placement.socket)].data())) {
|
|
|
|
for(std::uint32_t i = 0; i < (sizeof(socket_labels) / sizeof(socket_labels[0])); i++) {
|
|
|
|
if(ImGui::Selectable(socket_labels[i].data(), i == std::uint32_t(placement.socket), ImGuiSelectableFlags_SpanAvailWidth)) {
|
|
|
|
placement.socket = static_cast<GameObjects::BulletLauncherAttachment::Socket>(i);
|
2022-03-20 10:17:14 +01:00
|
|
|
}
|
|
|
|
}
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::EndCombo();
|
|
|
|
}
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
if(placement.socket != GameObjects::BulletLauncherAttachment::Socket::Auto) {
|
|
|
|
ImGui::BeginGroup();
|
|
|
|
drawAlignedText("Relative position:");
|
|
|
|
drawAlignedText("Offset position:");
|
|
|
|
drawAlignedText("Relative rotation:");
|
|
|
|
drawAlignedText("Offset rotation:");
|
|
|
|
drawAlignedText("Scale:");
|
|
|
|
ImGui::EndGroup();
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::SameLine();
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
ImGui::BeginGroup();
|
|
|
|
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
|
|
|
|
ImGui::DragFloat("##RelPosX", &placement.relativeLocation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::DragFloat("##RelPosY", &placement.relativeLocation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::DragFloat("##RelPosZ", &placement.relativeLocation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
|
|
|
|
ImGui::SliderFloat("##OffPosX", &placement.offsetLocation.x(), -500.0f, +500.0f, "X: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::SliderFloat("##OffPosY", &placement.offsetLocation.y(), -500.0f, +500.0f, "Y: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::SliderFloat("##OffPosZ", &placement.offsetLocation.z(), -500.0f, +500.0f, "Z: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine();
|
|
|
|
drawHelpMarker("+/-500.0 = +/-250 in-game");
|
|
|
|
|
|
|
|
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
|
|
|
|
ImGui::DragFloat("##RotX", &placement.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::DragFloat("##RotY", &placement.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::DragFloat("##RotZ", &placement.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
|
|
|
|
ImGui::SliderFloat("##RotOffsetZ", &placement.offsetRotation.z(), -180.0f, +180.0f, "Roll: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::SliderFloat("##RotOffsetX", &placement.offsetRotation.x(), -30.0f, +30.0f, "Pitch: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::SliderFloat("##RotOffsetY", &placement.offsetRotation.y(), -30.0f, +30.0f, "Yaw: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
|
|
|
|
ImGui::SliderFloat("##ScaleX", &placement.relativeScale.x(), 0.5f, 1.5f, "X: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::SliderFloat("##ScaleY", &placement.relativeScale.y(), 0.5f, 1.5f, "Y: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
|
ImGui::SliderFloat("##ScaleZ", &placement.relativeScale.z(), 0.5f, 1.5f, "Z: %.3f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine();
|
|
|
|
drawHelpMarker("0.5 = 50 in-game\n1.5 = 150 in-game");
|
|
|
|
ImGui::EndGroup();
|
|
|
|
}
|
2022-03-20 10:17:14 +01:00
|
|
|
|
2023-12-04 15:25:02 +01:00
|
|
|
_modifiedBySaveTool = true;
|
|
|
|
if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) {
|
2022-03-22 09:59:30 +01:00
|
|
|
_modifiedBySaveTool = true;
|
2023-12-04 15:25:02 +01:00
|
|
|
if(!_currentMass->writeBulletLauncherAttachments()) {
|
2022-03-22 09:59:30 +01:00
|
|
|
_modifiedBySaveTool = false;
|
2022-03-20 10:17:14 +01:00
|
|
|
_queue.addToast(Toast::Type::Error, _currentMass->lastError());
|
|
|
|
}
|
|
|
|
}
|
2022-03-02 14:43:02 +01:00
|
|
|
}
|
|
|
|
|
2022-12-03 16:49:39 +01:00
|
|
|
void
|
2023-11-29 12:33:26 +01:00
|
|
|
Application::drawCustomArmourStyles() {
|
|
|
|
if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) {
|
2022-03-02 14:43:02 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!ImGui::BeginChild("##ArmourStyles")) {
|
|
|
|
ImGui::EndChild();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::TextWrapped("In-game values are multiplied by 100. For example, 0.500 here is equal to 50 in-game.");
|
|
|
|
|
2022-12-05 11:32:18 +01:00
|
|
|
for(std::uint32_t i = 0; i < _currentMass->armourCustomStyles().size(); i++) {
|
2022-11-21 20:47:09 +01:00
|
|
|
ImGui::PushID(int(i));
|
2022-03-02 14:43:02 +01:00
|
|
|
DCSResult result;
|
|
|
|
result = drawCustomStyle(_currentMass->armourCustomStyles()[i]);
|
|
|
|
switch(result) {
|
|
|
|
case DCS_ResetStyle:
|
|
|
|
_currentMass->getArmourCustomStyles();
|
|
|
|
break;
|
|
|
|
case DCS_Save:
|
2022-03-22 09:59:30 +01:00
|
|
|
_modifiedBySaveTool = true;
|
2022-07-06 17:22:55 +02:00
|
|
|
if(!_currentMass->writeArmourCustomStyle(i)) {
|
2022-03-22 09:59:30 +01:00
|
|
|
_modifiedBySaveTool = false;
|
2022-03-02 14:43:02 +01:00
|
|
|
_queue.addToast(Toast::Type::Error, _currentMass->lastError());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ImGui::PopID();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
}
|
2023-11-29 12:33:26 +01:00
|
|
|
|
|
|
|
}
|