From 6aba2bf8c55f277f0257ff1bd5ba8b676c814728 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 8 Dec 2024 20:29:39 +0100 Subject: [PATCH] Application: allow swapping BS<->ES. This is the only safe swap that won't be a pain in the ass to deal with. The best I can do for other weapons is allowing to change their type, which will come later. --- .../Application_MassViewer_Weapons.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index 125bb6b..a6a6d3f 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -346,6 +346,29 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) { weapon.name = name_buf.data(); } + if(conf().advancedMode()) { + if(weapon.type == GameObjects::Weapon::Type::BulletShooter) { + ImGui::Button("Import energy shooter by dragging it here"); + if(ImGui::BeginDragDropTarget()) { + if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("EShooter")) { + std::uint32_t index = *static_cast(payload->Data); + weapon = _currentMass->energyShooters()[index]; + } + ImGui::EndDragDropTarget(); + } + } + else if(weapon.type == GameObjects::Weapon::Type::EnergyShooter) { + ImGui::Button("Import bullet shooter by dragging it here"); + if(ImGui::BeginDragDropTarget()) { + if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("BShooter")) { + std::uint32_t index = *static_cast(payload->Data); + weapon = _currentMass->bulletShooters()[index]; + } + ImGui::EndDragDropTarget(); + } + } + } + ImGui::BeginGroup(); drawAlignedText("Equipped:");