Compare commits

..

No commits in common. "8b8fbee6ba3580d99fc9bf56d72fed40d7e07ef4" and "a290542f6ed7e6eb02b2840782830457a17573dc" have entirely different histories.

112 changed files with 447 additions and 804 deletions

View file

@ -27,8 +27,6 @@
#include <SDL.h> #include <SDL.h>
#include <imgui_internal.h>
#include <wtypesbase.h> #include <wtypesbase.h>
#include <shellapi.h> #include <shellapi.h>
#include <wtsapi32.h> #include <wtsapi32.h>
@ -421,104 +419,6 @@ Application::drawCheckbox(Containers::StringView label, bool value) {
return ImGui::Checkbox(label.data(), &value); return ImGui::Checkbox(label.data(), &value);
} }
void
Application::drawVector3Drag(Containers::StringView id, Vector3& vec, float speed, Vector3 min, Vector3 max,
const char* x_format, const char* y_format, const char* z_format, ImGuiSliderFlags_ flags)
{
ImGui::PushID(id.cbegin());
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::DragFloat("##X", &vec.x(), speed, min.x(), max.x(), x_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##Y", &vec.y(), speed, min.y(), max.y(), y_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##Z", &vec.z(), speed, min.z(), max.z(), z_format, flags);
ImGui::PopItemWidth();
ImGui::PopID();
}
void
Application::drawVector3dDrag(Containers::StringView id, Vector3d& vec, float speed, Vector3d min, Vector3d max,
const char* x_format, const char* y_format, const char* z_format,
ImGuiSliderFlags_ flags)
{
ImGui::PushID(id.cbegin());
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::DragScalar("##X", ImGuiDataType_Double, &vec.x(), speed, &min.x(), &max.x(), x_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragScalar("##Y", ImGuiDataType_Double, &vec.y(), speed, &min.y(), &max.y(), y_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragScalar("##X", ImGuiDataType_Double, &vec.x(), speed, &min.z(), &max.z(), z_format, flags);
ImGui::PopItemWidth();
ImGui::PopID();
}
void
Application::drawVector3Slider(Containers::StringView id, Vector3& vec, Vector3 min, Vector3 max, const char* x_format,
const char* y_format, const char* z_format, ImGuiSliderFlags_ flags)
{
ImGui::PushID(id.cbegin());
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::SliderFloat("##X", &vec.x(), min.x(), max.x(), x_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::SliderFloat("##Y", &vec.y(), min.y(), max.y(), y_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::SliderFloat("##Z", &vec.z(), min.z(), max.z(), z_format, flags);
ImGui::PopItemWidth();
ImGui::PopID();
}
void
Application::drawVector3dSlider(Containers::StringView id, Vector3d& vec, Vector3d min, Vector3d max,
const char* x_format, const char* y_format, const char* z_format,
ImGuiSliderFlags_ flags)
{
ImGui::PushID(id.cbegin());
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::SliderScalar("##X", ImGuiDataType_Double, &vec.x(), &min.x(), &max.x(), x_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::SliderScalar("##Y", ImGuiDataType_Double, &vec.y(), &min.y(), &max.y(), y_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::SliderScalar("##X", ImGuiDataType_Double, &vec.x(), &min.z(), &max.z(), z_format, flags);
ImGui::PopItemWidth();
ImGui::PopID();
}
void
Application::drawVector2Slider(Containers::StringView id, Vector2& vec, Vector2 min, Vector2 max, const char* x_format,
const char* y_format, ImGuiSliderFlags_ flags)
{
ImGui::PushID(id.cbegin());
ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth());
ImGui::SliderFloat("##X", &vec.x(), min.x(), max.x(), x_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::SliderFloat("##Y", &vec.y(), min.y(), max.y(), y_format, flags);
ImGui::PopItemWidth();
ImGui::PopID();
}
void
Application::drawVector2dSlider(Containers::StringView id, Vector2d& vec, Vector2d min, Vector2d max,
const char* x_format, const char* y_format, ImGuiSliderFlags_ flags)
{
ImGui::PushID(id.cbegin());
ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth());
ImGui::SliderScalar("##X", ImGuiDataType_Double, &vec.x(), &min.x(), &max.x(), x_format, flags);
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::SliderScalar("##Y", ImGuiDataType_Double, &vec.y(), &min.y(), &max.y(), y_format, flags);
ImGui::PopItemWidth();
ImGui::PopID();
}
void void
Application::openUri(Containers::StringView uri) { Application::openUri(Containers::StringView uri) {
if(!conf().isRunningInWine()) { if(!conf().isRunningInWine()) {

View file

@ -34,6 +34,7 @@
#include <SDL_timer.h> #include <SDL_timer.h>
#include <imgui.h> #include <imgui.h>
#include <imgui_internal.h>
#include <efsw/efsw.hpp> #include <efsw/efsw.hpp>
@ -166,23 +167,6 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe
void drawHelpMarker(Containers::StringView text, float wrap_pos = 0.0f); void drawHelpMarker(Containers::StringView text, float wrap_pos = 0.0f);
void drawTooltip(Containers::StringView text, float wrap_pos = 0.0f); void drawTooltip(Containers::StringView text, float wrap_pos = 0.0f);
bool drawCheckbox(Containers::StringView label, bool value); bool drawCheckbox(Containers::StringView label, bool value);
void drawVector3Drag(Containers::StringView id, Vector3& vec, float speed, Vector3 min, Vector3 max,
const char* x_format, const char* y_format, const char* z_format,
ImGuiSliderFlags_ flags = ImGuiSliderFlags_None);
void drawVector3dDrag(Containers::StringView id, Vector3d& vec, float speed, Vector3d min, Vector3d max,
const char* x_format, const char* y_format, const char* z_format,
ImGuiSliderFlags_ flags = ImGuiSliderFlags_None);
void drawVector3Slider(Containers::StringView id, Vector3& vec, Vector3 min, Vector3 max, const char* x_format,
const char* y_format, const char* z_format,
ImGuiSliderFlags_ flags = ImGuiSliderFlags_None);
void drawVector3dSlider(Containers::StringView id, Vector3d& vec, Vector3d min, Vector3d max,
const char* x_format, const char* y_format, const char* z_format,
ImGuiSliderFlags_ flags = ImGuiSliderFlags_None);
void drawVector2Slider(Containers::StringView id, Vector2& vec, Vector2 min, Vector2 max, const char* x_format,
const char* y_format, ImGuiSliderFlags_ flags = ImGuiSliderFlags_None);
void drawVector2dSlider(Containers::StringView id, Vector2d& vec, Vector2d min, Vector2d max,
const char* x_format, const char* y_format,
ImGuiSliderFlags_ flags = ImGuiSliderFlags_None);
template<typename Functor, typename... Args> template<typename Functor, typename... Args>
bool drawUnsafeWidget(Functor func, Args... args) { bool drawUnsafeWidget(Functor func, Args... args) {

View file

@ -19,8 +19,6 @@
#include <Magnum/ImGuiIntegration/Integration.h> #include <Magnum/ImGuiIntegration/Integration.h>
#include <imgui_internal.h>
#include "../Configuration/Configuration.h" #include "../Configuration/Configuration.h"
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../GameData/Accessories.h" #include "../GameData/Accessories.h"
@ -452,17 +450,12 @@ Application::drawDecalEditor(GameObjects::Decal& decal) {
ImGui::SameLine(); ImGui::SameLine();
drawHelpMarker("Right-click for more option, click the coloured square for the full picker."); drawHelpMarker("Right-click for more option, click the coloured square for the full picker.");
std::visit( ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::SliderFloat("##OffsetX", &decal.offset.x(), 0.0f, 1.0f, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector2>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector2Slider("##Offset", arg, Vector2{0.0f}, Vector2{1.0f}, "X: %.3f", "Y: %.3f"); ImGui::SliderFloat("##OffsetY", &decal.offset.y(), 0.0f, 1.0f, "Y: %.3f");
} ImGui::PopItemWidth();
else if constexpr (std::is_same_v<T, Vector2d>) {
drawVector2dSlider("##Offset", arg, Vector2d{0.0}, Vector2d{1.0}, "X: %.3f", "Y: %.3f");
}
}, decal.offset
);
ImGui::SameLine(); ImGui::SameLine();
drawHelpMarker("0.0 = -100 in-game\n1.0 = 100 in-game"); drawHelpMarker("0.0 = -100 in-game\n1.0 = 100 in-game");
@ -496,48 +489,35 @@ Application::drawDecalEditor(GameObjects::Decal& decal) {
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::PushItemWidth(-1.0f); ImGui::PushItemWidth(-1.0f);
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::DragFloat("##PosX", &decal.position.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Drag("##Position", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", ImGui::DragFloat("##PosY", &decal.position.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
"Y: %.3f", "Z: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::DragFloat("##PosZ", &decal.position.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
drawVector3dDrag("##Position", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, "X: %.3f", ImGui::PopItemWidth();
"Y: %.3f", "Z: %.3f");
}
}, decal.position
);
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::DragFloat("##UX", &decal.uAxis.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Drag("##U", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", "Y: %.3f", ImGui::DragFloat("##UY", &decal.uAxis.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
"Z: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::DragFloat("##UZ", &decal.uAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
drawVector3dDrag("##U", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, "X: %.3f", "Y: %.3f", ImGui::PopItemWidth();
"Z: %.3f");
}
}, decal.uAxis
);
std::visit(
[this](auto& arg){
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, Vector3>) {
drawVector3Drag("##V", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", "Y: %.3f",
"Z: %.3f");
}
else if constexpr (std::is_same_v<T, Vector3d>) {
drawVector3dDrag("##V", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, "X: %.3f", "Y: %.3f",
"Z: %.3f");
}
}, decal.vAxis
);
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
ImGui::DragFloat("##VX", &decal.vAxis.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##VY", &decal.vAxis.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
ImGui::PopItemWidth();
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::DragFloat("##VZ", &decal.vAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
ImGui::PopItemWidth();
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::EndGroup(); ImGui::EndGroup();
} }
@ -658,15 +638,15 @@ Application::drawAccessoryEditor(GameObjects::Accessory& accessory, Containers::
ImGui::Separator(); ImGui::Separator();
if(ImGui::BeginListBox("##AccessoryListbox", {-1.0f, 0.0f})) { if(ImGui::BeginListBox("##AccessoryListbox", {-1.0f, 0.0f})) {
for(const auto& [id, acc] : GameData::accessories) { for(const auto& acc : GameData::accessories) {
if(id >= tab * 1000 && id < ((tab + 1) * 1000) && (!size || *size == acc.size)) { if(acc.first >= tab * 1000 && acc.first < ((tab + 1) * 1000) && (!size || *size == acc.second.size)) {
if(ImGui::Selectable(Utility::format("#{:.4d} - {} ({})", id, acc.name, size_labels[acc.size]).data(), if(ImGui::Selectable(Utility::format("#{:.4d} - {} ({})", acc.first, acc.second.name, size_labels[acc.second.size]).data(),
id == accessory.id)) acc.first == accessory.id))
{ {
accessory.id = id; accessory.id = acc.first;
accessory.attachIndex = 0; accessory.attachIndex = 0;
} }
if(id == accessory.id) { if(acc.first == accessory.id) {
ImGui::SetItemDefaultFocus(); ImGui::SetItemDefaultFocus();
} }
} }
@ -726,78 +706,60 @@ Application::drawAccessoryEditor(GameObjects::Accessory& accessory, Containers::
ImGui::PopItemWidth(); ImGui::PopItemWidth();
if(conf().advancedMode()) { if(conf().advancedMode()) {
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::DragFloat("##PosX", &accessory.relativePosition.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Drag("##RelativePosition", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", ImGui::DragFloat("##PosY", &accessory.relativePosition.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
"Y: %.3f", "Z: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::DragFloat("##PosZ", &accessory.relativePosition.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
drawVector3dDrag("##RelativePosition", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, "X: %.3f", ImGui::PopItemWidth();
"Y: %.3f", "Z: %.3f");
}
}, accessory.relativePosition
);
} }
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::SliderFloat("##PosOffsetX", &accessory.relativePositionOffset.x(), -500.0f, +500.0f, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Slider("##OffsetPosition", arg, Vector3{-500.0f}, Vector3{500.0f}, "X: %.3f", "Y: %.3f", ImGui::SliderFloat("##PosOffsetY", &accessory.relativePositionOffset.y(), -500.0f, +500.0f, "Y: %.3f");
"Z: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::SliderFloat("##PosOffsetZ", &accessory.relativePositionOffset.z(), -500.0f, +500.0f, "Z: %.3f");
drawVector3dSlider("##OffsetPosition", arg, Vector3d{-500.0}, Vector3d{500.0}, "X: %.3f", "Y: %.3f", ImGui::PopItemWidth();
"Z: %.3f");
}
}, accessory.relativePositionOffset
);
ImGui::SameLine(); ImGui::SameLine();
drawHelpMarker("+/-500.0 = +/-250 in-game"); drawHelpMarker("+/-500.0 = +/-250 in-game");
if(conf().advancedMode()) { if(conf().advancedMode()) {
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::DragFloat("##RotX", &accessory.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Drag("##RelativeRotation", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "Roll: %.3f", ImGui::DragFloat("##RotY", &accessory.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f");
"Yaw: %.3f", "Pitch: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::DragFloat("##RotZ", &accessory.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f");
drawVector3dDrag("##RelativeRotation", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, ImGui::PopItemWidth();
"Roll: %.3f", "Yaw: %.3f", "Pitch: %.3f");
}
}, accessory.relativePosition
);
} }
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::SliderFloat("##RotOffsetX", &accessory.relativeRotationOffset.x(), -180.0f, +180.0f, "Roll: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Slider("##OffsetRotation", arg, Vector3{-180.0f}, Vector3{180.0f}, "Roll: %.3f", ImGui::SliderFloat("##RotOffsetY", &accessory.relativeRotationOffset.y(), -180.0f, +180.0f, "Yaw: %.3f");
"Yaw: %.3f", "Pitch: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::SliderFloat("##RotOffsetZ", &accessory.relativeRotationOffset.z(), -180.0f, +180.0f, "Pitch: %.3f");
drawVector3dSlider("##OffsetRotation", arg, Vector3d{-180.0}, Vector3d{180.0}, "Roll: %.3f", ImGui::PopItemWidth();
"Yaw: %.3f", "Pitch: %.3f");
}
}, accessory.relativeRotationOffset
);
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::SliderFloat("##ScaleX", &accessory.localScale.x(), -3.0f, +3.0f, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Slider("##Scale", arg, Vector3{-3.0f}, Vector3{3.0f}, "X: %.3f", "Y: %.3f", "Z: %.3f"); ImGui::SliderFloat("##ScaleY", &accessory.localScale.y(), -3.0f, +3.0f, "Y: %.3f");
} ImGui::PopItemWidth();
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3dSlider("##Scale", arg, Vector3d{-3.0}, Vector3d{3.0}, "X: %.3f", "Y: %.3f", "Z: %.3f"); ImGui::SliderFloat("##ScaleZ", &accessory.localScale.z(), -3.0f, +3.0f, "Z: %.3f");
} ImGui::PopItemWidth();
}, accessory.localScale
);
ImGui::SameLine(); ImGui::SameLine();
drawHelpMarker("+/-3.0 = +/-150 in-game"); drawHelpMarker("+/-3.0 = +/-150 in-game");
ImGui::EndGroup(); ImGui::EndGroup();

View file

@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <imgui_internal.h>
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../GameData/ArmourSets.h" #include "../GameData/ArmourSets.h"
#include "../GameData/StyleNames.h" #include "../GameData/StyleNames.h"
@ -269,75 +267,57 @@ Application::drawBLAttachment() {
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginGroup(); ImGui::BeginGroup();
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::DragFloat("##RelPosX", &placement.relativeLocation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Drag("##RelativePosition", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", ImGui::DragFloat("##RelPosY", &placement.relativeLocation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f");
"Y: %.3f", "Z: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::DragFloat("##RelPosZ", &placement.relativeLocation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f");
drawVector3dDrag("##RelativePosition", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, ImGui::PopItemWidth();
"X: %.3f", "Y: %.3f", "Z: %.3f");
}
}, placement.relativeLocation
);
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::SliderFloat("##OffPosX", &placement.offsetLocation.x(), -500.0f, +500.0f, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Slider("##OffsetPosition", arg, Vector3{-500.0f}, Vector3{500.0f}, "X: %.3f", "Y: %.3f", ImGui::SliderFloat("##OffPosY", &placement.offsetLocation.y(), -500.0f, +500.0f, "Y: %.3f");
"Z: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::SliderFloat("##OffPosZ", &placement.offsetLocation.z(), -500.0f, +500.0f, "Z: %.3f");
drawVector3dSlider("##OffsetPosition", arg, Vector3d{-500.0}, Vector3d{500.0}, "X: %.3f", ImGui::PopItemWidth();
"Y: %.3f", "Z: %.3f");
}
}, placement.offsetLocation
);
ImGui::SameLine(); ImGui::SameLine();
drawHelpMarker("+/-500.0 = +/-250 in-game"); drawHelpMarker("+/-500.0 = +/-250 in-game");
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::DragFloat("##RotX", &placement.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Drag("##RelativeRotation", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, ImGui::DragFloat("##RotY", &placement.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f");
"Pitch: %.3f", "Yaw: %.3f", "Roll: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::DragFloat("##RotZ", &placement.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f");
drawVector3dDrag("##RelativeRotation", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, ImGui::PopItemWidth();
"Pitch: %.3f", "Yaw: %.3f", "Roll: %.3f");
}
}, placement.relativeRotation
);
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::SliderFloat("##RotOffsetZ", &placement.offsetRotation.z(), -180.0f, +180.0f, "Roll: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Slider("##OffsetRotation", arg, Vector3{-30.0f, -30.0f, -180.0f}, ImGui::SliderFloat("##RotOffsetX", &placement.offsetRotation.x(), -30.0f, +30.0f, "Pitch: %.3f");
Vector3{30.0f, 30.0f, 180.0f}, "Pitch: %.3f", "Yaw: %.3f", "Roll: %.3f"); ImGui::PopItemWidth();
} ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::SliderFloat("##RotOffsetY", &placement.offsetRotation.y(), -30.0f, +30.0f, "Yaw: %.3f");
drawVector3dSlider("##OffsetRotation", arg, Vector3d{-30.0, -30.0, -180.0}, ImGui::PopItemWidth();
Vector3d{30.0, 30.0, 180.0}, "Pitch: %.3f", "Yaw: %.3f", "Roll: %.3f");
}
}, placement.offsetRotation
);
std::visit( ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
[this](auto& arg){ ImGui::SliderFloat("##ScaleX", &placement.relativeScale.x(), 0.5f, 1.5f, "X: %.3f");
using T = std::decay_t<decltype(arg)>; ImGui::PopItemWidth();
if constexpr (std::is_same_v<T, Vector3>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3Slider("##Scale", arg, Vector3{0.5f}, Vector3{1.5f}, "X: %.3f", "Y: %.3f", "Z: %.3f"); ImGui::SliderFloat("##ScaleY", &placement.relativeScale.y(), 0.5f, 1.5f, "Y: %.3f");
} ImGui::PopItemWidth();
else if constexpr (std::is_same_v<T, Vector3d>) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
drawVector3dSlider("##Scale", arg, Vector3d{0.5}, Vector3d{1.5}, "X: %.3f", "Y: %.3f", "Z: %.3f"); ImGui::SliderFloat("##ScaleZ", &placement.relativeScale.z(), 0.5f, 1.5f, "Z: %.3f");
} ImGui::PopItemWidth();
}, placement.relativeScale
);
ImGui::SameLine(); ImGui::SameLine();
drawHelpMarker("0.5 = 50 in-game\n1.5 = 150 in-game"); drawHelpMarker("0.5 = 50 in-game\n1.5 = 150 in-game");
ImGui::EndGroup(); ImGui::EndGroup();

View file

@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <imgui_internal.h>
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../GameData/StyleNames.h" #include "../GameData/StyleNames.h"

View file

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameData { namespace mbst { namespace GameData {
struct Accessory { struct Accessory {
Containers::StringView name; Containers::StringView name;
@ -258,11 +258,6 @@ static const std::map<std::int32_t, Accessory> accessories{
{1213, {"Pointed Armour 13"_s, Accessory::Size::L}}, {1213, {"Pointed Armour 13"_s, Accessory::Size::L}},
{1214, {"Pointed Armour 14"_s, Accessory::Size::L}}, {1214, {"Pointed Armour 14"_s, Accessory::Size::L}},
{1215, {"Pointed Armour 15"_s, Accessory::Size::L}}, {1215, {"Pointed Armour 15"_s, Accessory::Size::L}},
{1216, {"Pointed Armour 16"_s, Accessory::Size::L}},
{1217, {"Pointed Armour 17"_s, Accessory::Size::L}},
{1218, {"Pointed Armour 18"_s, Accessory::Size::L}},
{1219, {"Pointed Armour 19"_s, Accessory::Size::L}},
{1220, {"Pointed Armour 20"_s, Accessory::Size::L}},
{1251, {"E Limb Cover 01"_s, Accessory::Size::L}}, {1251, {"E Limb Cover 01"_s, Accessory::Size::L}},
{1252, {"E Limb Cover 02"_s, Accessory::Size::L}}, {1252, {"E Limb Cover 02"_s, Accessory::Size::L}},
@ -364,12 +359,6 @@ static const std::map<std::int32_t, Accessory> accessories{
{2104, {"Plating 04"_s, Accessory::Size::L}}, {2104, {"Plating 04"_s, Accessory::Size::L}},
{2105, {"Plating 05"_s, Accessory::Size::L}}, {2105, {"Plating 05"_s, Accessory::Size::L}},
{2126, {"Curved Plating 01"_s, Accessory::Size::L}},
{2127, {"Curved Plating 02"_s, Accessory::Size::L}},
{2128, {"Curved Plating 03"_s, Accessory::Size::L}},
{2129, {"Curved Plating 04"_s, Accessory::Size::L}},
{2130, {"Curved Plating 05"_s, Accessory::Size::L}},
{2151, {"Complex Base 01"_s, Accessory::Size::L}}, {2151, {"Complex Base 01"_s, Accessory::Size::L}},
{2152, {"Complex Base 02"_s, Accessory::Size::L}}, {2152, {"Complex Base 02"_s, Accessory::Size::L}},
{2153, {"Complex Base 03"_s, Accessory::Size::L}}, {2153, {"Complex Base 03"_s, Accessory::Size::L}},
@ -509,17 +498,6 @@ static const std::map<std::int32_t, Accessory> accessories{
{2554, {"Energy Barrel 04"_s, Accessory::Size::XL}}, {2554, {"Energy Barrel 04"_s, Accessory::Size::XL}},
{2555, {"Energy Barrel 05"_s, Accessory::Size::XL}}, {2555, {"Energy Barrel 05"_s, Accessory::Size::XL}},
{2560, {"Wire Head 01"_s, Accessory::Size::M}},
{2561, {"Wire Head 02"_s, Accessory::Size::M}},
{2562, {"Wire Head 03"_s, Accessory::Size::M}},
{2563, {"Wire Head 04"_s, Accessory::Size::M}},
{2564, {"Wire Head 05"_s, Accessory::Size::M}},
{2565, {"Wire Head 06"_s, Accessory::Size::M}},
{2566, {"Wire Head 07"_s, Accessory::Size::M}},
{2567, {"Wire Head 08"_s, Accessory::Size::M}},
{2568, {"Wire Head 09"_s, Accessory::Size::M}},
{2569, {"Wire Head 10"_s, Accessory::Size::M}},
{2601, {"L Bullet Barrel 01"_s, Accessory::Size::XL}}, {2601, {"L Bullet Barrel 01"_s, Accessory::Size::XL}},
{2602, {"L Bullet Barrel 02"_s, Accessory::Size::XL}}, {2602, {"L Bullet Barrel 02"_s, Accessory::Size::XL}},
{2603, {"L Bullet Barrel 03"_s, Accessory::Size::XL}}, {2603, {"L Bullet Barrel 03"_s, Accessory::Size::XL}},
@ -573,18 +551,6 @@ static const std::map<std::int32_t, Accessory> accessories{
{2714, {"Atk Packed Weaponry 03"_s, Accessory::Size::XL}}, {2714, {"Atk Packed Weaponry 03"_s, Accessory::Size::XL}},
{2715, {"Atk Packed Weaponry 04"_s, Accessory::Size::XL}}, {2715, {"Atk Packed Weaponry 04"_s, Accessory::Size::XL}},
{2721, {"Double Pod"_s, Accessory::Size::L}},
{2722, {"Triple Pod"_s, Accessory::Size::L}},
{2723, {"Vertical T Pod"_s, Accessory::Size::L}},
{2724, {"Quadruple Pod"_s, Accessory::Size::L}},
{2725, {"Vertical Q Pod"_s, Accessory::Size::L}},
{2741, {"Grenade 01"_s, Accessory::Size::M}},
{2742, {"Grenade 02"_s, Accessory::Size::M}},
{2743, {"Grenade 03"_s, Accessory::Size::M}},
{2744, {"Grenade 04"_s, Accessory::Size::M}},
{2745, {"Grenade 05"_s, Accessory::Size::M}},
{2751, {"Vent 01"_s, Accessory::Size::M}}, {2751, {"Vent 01"_s, Accessory::Size::M}},
{2752, {"Vent 02"_s, Accessory::Size::M}}, {2752, {"Vent 02"_s, Accessory::Size::M}},
{2753, {"Vent 03"_s, Accessory::Size::M}}, {2753, {"Vent 03"_s, Accessory::Size::M}},
@ -595,33 +561,12 @@ static const std::map<std::int32_t, Accessory> accessories{
{2758, {"Vent 08"_s, Accessory::Size::M}}, {2758, {"Vent 08"_s, Accessory::Size::M}},
{2759, {"Vent 09"_s, Accessory::Size::M}}, {2759, {"Vent 09"_s, Accessory::Size::M}},
{2760, {"Vent 10"_s, Accessory::Size::M}}, {2760, {"Vent 10"_s, Accessory::Size::M}},
{2761, {"Cooling Tile 01"_s, Accessory::Size::L}},
{2762, {"Cooling Tile 02"_s, Accessory::Size::L}},
{2763, {"Cooling Tile 03"_s, Accessory::Size::L}},
{2764, {"Cooling Tile 04"_s, Accessory::Size::L}},
{2765, {"Cooling Tile 05"_s, Accessory::Size::L}},
{2901, {"Complex Construct 01"_s, Accessory::Size::L}}, {2901, {"Complex Construct 01"_s, Accessory::Size::L}},
{2902, {"Complex Construct 02"_s, Accessory::Size::L}}, {2902, {"Complex Construct 02"_s, Accessory::Size::L}},
{2903, {"Complex Construct 03"_s, Accessory::Size::L}}, {2903, {"Complex Construct 03"_s, Accessory::Size::L}},
{2904, {"Complex Construct 04"_s, Accessory::Size::L}}, {2904, {"Complex Construct 04"_s, Accessory::Size::L}},
{2905, {"Complex Construct 05"_s, Accessory::Size::L}}, {2905, {"Complex Construct 05"_s, Accessory::Size::L}},
{2906, {"Grating 01"_s, Accessory::Size::M}},
{2907, {"Grating 02"_s, Accessory::Size::M}},
{2908, {"Grating 03"_s, Accessory::Size::M}},
{2909, {"Grating 04"_s, Accessory::Size::M}},
{2910, {"Grating 05"_s, Accessory::Size::M}},
{2911, {"Wireframe 01"_s, Accessory::Size::L}},
{2912, {"Wireframe 02"_s, Accessory::Size::L}},
{2913, {"Wireframe 03"_s, Accessory::Size::L}},
{2914, {"Wireframe 04"_s, Accessory::Size::L}},
{2915, {"Wireframe 05"_s, Accessory::Size::L}},
{2926, {"Complex Armour 01"_s, Accessory::Size::L}},
{2927, {"Complex Armour 02"_s, Accessory::Size::L}},
{2928, {"Complex Armour 03"_s, Accessory::Size::L}},
{2929, {"Complex Armour 04"_s, Accessory::Size::L}},
{2930, {"Complex Armour 05"_s, Accessory::Size::L}},
{2950, {"Q Mask 01"_s, Accessory::Size::M}}, {2950, {"Q Mask 01"_s, Accessory::Size::M}},
{2951, {"Q Mask 02"_s, Accessory::Size::M}}, {2951, {"Q Mask 02"_s, Accessory::Size::M}},
@ -724,11 +669,6 @@ static const std::map<std::int32_t, Accessory> accessories{
{3358, {"Radar Pod 03"_s, Accessory::Size::M}}, {3358, {"Radar Pod 03"_s, Accessory::Size::M}},
{3359, {"Radar Pod 04"_s, Accessory::Size::M}}, {3359, {"Radar Pod 04"_s, Accessory::Size::M}},
{3360, {"Radar Pod 05"_s, Accessory::Size::M}}, {3360, {"Radar Pod 05"_s, Accessory::Size::M}},
{3361, {"Radar Ring 01"_s, Accessory::Size::XL}},
{3362, {"Radar Ring 02"_s, Accessory::Size::XL}},
{3363, {"Radar Ring 03"_s, Accessory::Size::XL}},
{3364, {"Radar Ring 04"_s, Accessory::Size::XL}},
{3365, {"Radar Ring 05"_s, Accessory::Size::XL}},
{3401, {"Tri Pod 01"_s, Accessory::Size::M}}, {3401, {"Tri Pod 01"_s, Accessory::Size::M}},
{3402, {"Tri Pod 02"_s, Accessory::Size::M}}, {3402, {"Tri Pod 02"_s, Accessory::Size::M}},
@ -740,44 +680,7 @@ static const std::map<std::int32_t, Accessory> accessories{
{3408, {"Signal Pod 03"_s, Accessory::Size::M}}, {3408, {"Signal Pod 03"_s, Accessory::Size::M}},
{3409, {"Signal Pod 04"_s, Accessory::Size::M}}, {3409, {"Signal Pod 04"_s, Accessory::Size::M}},
{3410, {"Signal Pod 05"_s, Accessory::Size::M}}, {3410, {"Signal Pod 05"_s, Accessory::Size::M}},
{3451, {"Track Wheel 01"_s, Accessory::Size::XL}},
{3452, {"Track Wheel 02"_s, Accessory::Size::XL}},
{3453, {"Track Wheel 03"_s, Accessory::Size::XL}},
{3454, {"Track Wheel 04"_s, Accessory::Size::XL}},
{3455, {"Track Wheel 05"_s, Accessory::Size::XL}},
{3456, {"Track Chain 01"_s, Accessory::Size::XL}},
{3457, {"Track Chain 02"_s, Accessory::Size::XL}},
{3458, {"Track Chain 03"_s, Accessory::Size::XL}},
{3459, {"Track Chain 04"_s, Accessory::Size::XL}},
{3460, {"Track Chain 05"_s, Accessory::Size::XL}},
{3461, {"Track Chain 06"_s, Accessory::Size::XL}},
{3462, {"Track Chain 07"_s, Accessory::Size::XL}},
{3463, {"Track Chain 08"_s, Accessory::Size::XL}},
{3464, {"Track Chain 09"_s, Accessory::Size::XL}},
{3465, {"Track Chain 10"_s, Accessory::Size::XL}},
{3466, {"Track Chain 11"_s, Accessory::Size::XL}},
{3467, {"Track Chain 12"_s, Accessory::Size::XL}},
{3468, {"Track Chain 13"_s, Accessory::Size::XL}},
{3469, {"Track Chain 14"_s, Accessory::Size::XL}},
{3470, {"Track Chain 15"_s, Accessory::Size::XL}},
{3500, {"Wire Module 05"_s, Accessory::Size::XL}},
{3501, {"Wire Module 06"_s, Accessory::Size::XL}},
{3502, {"Wire Module 07"_s, Accessory::Size::XL}},
{3503, {"Wire Module 08"_s, Accessory::Size::XL}},
{3504, {"Wire Module 09"_s, Accessory::Size::XL}},
{3505, {"Wire Module 10"_s, Accessory::Size::XL}},
{3506, {"Wire Module 11"_s, Accessory::Size::XL}},
{3507, {"Wire Module 12"_s, Accessory::Size::XL}},
{3508, {"Wire Module 13"_s, Accessory::Size::XL}},
{3509, {"Wire Module 14"_s, Accessory::Size::XL}},
{3510, {"Wire Module 15"_s, Accessory::Size::XL}},
{3511, {"Wire Module 06"_s, Accessory::Size::XL}},
{3512, {"Wire Module 07"_s, Accessory::Size::XL}},
{3513, {"Wire Module 08"_s, Accessory::Size::XL}},
{3514, {"Wire Module 09"_s, Accessory::Size::XL}},
// endregion // endregion
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameData { namespace mbst { namespace GameData {
struct ArmourSet { struct ArmourSet {
Containers::StringView name; Containers::StringView name;
@ -58,4 +58,4 @@ static const std::map<std::int32_t, ArmourSet> armour_sets {
{27, {"Axial Core X-Type"_s, false}}, {27, {"Axial Core X-Type"_s, false}},
}; };
} }}

View file

@ -23,7 +23,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameData { namespace mbst { namespace GameData {
static const std::map<std::int32_t, Containers::StringView> mission_id_map {{ static const std::map<std::int32_t, Containers::StringView> mission_id_map {{
// Story missions // Story missions
@ -59,4 +59,4 @@ static const std::map<std::int32_t, Containers::StringView> mission_id_map {{
{400, "Challenge 3 - Gates of Ascension"_s} {400, "Challenge 3 - Gates of Ascension"_s}
}}; }};
} }}

View file

@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
namespace mbst::GameData { namespace mbst { namespace GameData {
enum MaterialID : std::int32_t { enum MaterialID : std::int32_t {
VerseSteel = 0xC3500, VerseSteel = 0xC3500,
@ -48,4 +48,4 @@ enum MaterialID : std::int32_t {
IsolatedVoidParticle = 0xDBBA5, IsolatedVoidParticle = 0xDBBA5,
}; };
} }}

View file

@ -22,7 +22,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameData { namespace mbst { namespace GameData {
struct StoryProgressPoint { struct StoryProgressPoint {
std::int32_t id{}; std::int32_t id{};
@ -112,4 +112,4 @@ static const Corrade::Containers::Array<StoryProgressPoint> story_progress
} }
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameData { namespace mbst { namespace GameData {
extern const std::map<std::int32_t, Containers::StringView> builtin_style_names extern const std::map<std::int32_t, Containers::StringView> builtin_style_names
#ifdef STYLENAMES_DEFINITION #ifdef STYLENAMES_DEFINITION
@ -162,4 +162,4 @@ extern const std::map<std::int32_t, Containers::StringView> builtin_style_names
#endif #endif
; ;
} }}

View file

@ -25,7 +25,7 @@ using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameData { namespace mbst { namespace GameData {
// region Melee // region Melee
static const std::map<std::int32_t, Containers::StringView> melee_grips { static const std::map<std::int32_t, Containers::StringView> melee_grips {
@ -433,4 +433,4 @@ static const std::map<std::int32_t, Containers::StringView> elauncher_pods {
}; };
// endregion // endregion
} }}

View file

@ -16,8 +16,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <variant>
#include <Corrade/Containers/StaticArray.h> #include <Corrade/Containers/StaticArray.h>
#include <Magnum/Magnum.h> #include <Magnum/Magnum.h>
@ -26,19 +24,17 @@
using namespace Corrade; using namespace Corrade;
using namespace Magnum; using namespace Magnum;
typedef std::variant<Vector3, Vector3d> Vector3Variant; namespace mbst { namespace GameObjects {
namespace mbst::GameObjects {
struct Accessory { struct Accessory {
std::int32_t attachIndex = -1; std::int32_t attachIndex = -1;
std::int32_t id = -1; std::int32_t id = -1;
Containers::StaticArray<2, std::int32_t> styles{ValueInit}; Containers::StaticArray<2, std::int32_t> styles{ValueInit};
Vector3Variant relativePosition{Vector3{}}; Vector3 relativePosition{0.0f};
Vector3Variant relativePositionOffset{Vector3{}}; Vector3 relativePositionOffset{0.0f};
Vector3Variant relativeRotation{Vector3{}}; Vector3 relativeRotation{0.0f};
Vector3Variant relativeRotationOffset{Vector3{}}; Vector3 relativeRotationOffset{0.0f};
Vector3Variant localScale{Vector3{1.0f}}; Vector3 localScale{1.0f};
}; };
} }}

View file

@ -24,7 +24,7 @@
using namespace Corrade; using namespace Corrade;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
struct ArmourPart { struct ArmourPart {
enum class Slot { enum class Slot {
@ -39,4 +39,4 @@ struct ArmourPart {
Containers::Array<Accessory> accessories; Containers::Array<Accessory> accessories;
}; };
} }}

View file

@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <variant> #include <Corrade/Containers/String.h>
#include <Magnum/Magnum.h> #include <Magnum/Magnum.h>
#include <Magnum/Math/Vector3.h> #include <Magnum/Math/Vector3.h>
@ -24,9 +24,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Magnum; using namespace Magnum;
typedef std::variant<Vector3, Vector3d> Vector3Variant; namespace mbst { namespace GameObjects {
namespace mbst::GameObjects {
enum class BulletLauncherAttachmentStyle { enum class BulletLauncherAttachmentStyle {
#define c(enumerator, enumstr) enumerator, #define c(enumerator, enumstr) enumerator,
@ -41,11 +39,11 @@ struct BulletLauncherAttachment {
#undef c #undef c
}; };
Socket socket = Socket::Auto; Socket socket = Socket::Auto;
Vector3Variant relativeLocation; Vector3 relativeLocation;
Vector3Variant offsetLocation; Vector3 offsetLocation;
Vector3Variant relativeRotation; Vector3 relativeRotation;
Vector3Variant offsetRotation; Vector3 offsetRotation;
Vector3Variant relativeScale; Vector3 relativeScale;
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Magnum; using namespace Magnum;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
struct CustomStyle { struct CustomStyle {
Containers::String name; Containers::String name;
@ -50,4 +50,4 @@ struct CustomStyle {
} type = Type::Unknown; } type = Type::Unknown;
}; };
} }}

View file

@ -16,8 +16,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <variant>
#include <Magnum/Magnum.h> #include <Magnum/Magnum.h>
#include <Magnum/Math/Color.h> #include <Magnum/Math/Color.h>
#include <Magnum/Math/Vector2.h> #include <Magnum/Math/Vector2.h>
@ -25,22 +23,19 @@
using namespace Magnum; using namespace Magnum;
typedef std::variant<Vector2, Vector2d> Vector2Variant; namespace mbst { namespace GameObjects {
typedef std::variant<Vector3, Vector3d> Vector3Variant;
namespace mbst::GameObjects {
struct Decal { struct Decal {
std::int32_t id = -1; std::int32_t id = -1;
Color4 colour{0.0f}; Color4 colour{0.0f};
Vector3Variant position{Vector3{}}; Vector3 position{0.0f};
Vector3Variant uAxis{Vector3{}}; Vector3 uAxis{0.0f};
Vector3Variant vAxis{Vector3{}}; Vector3 vAxis{0.0f};
Vector2Variant offset{Vector2{0.5f}}; Vector2 offset{0.5f};
float scale = 0.5f; float scale = 0.5f;
float rotation = 0.0f; float rotation = 0.0f;
bool flip = false; bool flip = false;
bool wrap = false; bool wrap = false;
}; };
} }}

View file

@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
struct Joints { struct Joints {
float neck = 0.0f; float neck = 0.0f;
@ -29,4 +29,4 @@ struct Joints {
float lowerLegs = 0.0f; float lowerLegs = 0.0f;
}; };
} }}

View file

@ -34,7 +34,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
Mass::Mass(Containers::StringView path) { Mass::Mass(Containers::StringView path) {
auto split = Utility::Path::split(path); auto split = Utility::Path::split(path);
@ -402,4 +402,4 @@ Mass::getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t&
} }
} }
} }}

View file

@ -42,7 +42,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Magnum; using namespace Magnum;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
class Mass { class Mass {
public: public:
@ -213,4 +213,4 @@ class Mass {
Containers::String _account; Containers::String _account;
}; };
} }}

View file

@ -29,7 +29,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
Containers::ArrayView<ArmourPart> Containers::ArrayView<ArmourPart>
Mass::armourParts() { Mass::armourParts() {
@ -255,15 +255,15 @@ Mass::getBulletLauncherAttachments() {
} }
auto rel_loc_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELLOC); auto rel_loc_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELLOC);
attachment.relativeLocation = rel_loc_prop->vector; attachment.relativeLocation = Vector3{rel_loc_prop->x, rel_loc_prop->y, rel_loc_prop->z};
auto off_loc_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_OFFLOC); auto off_loc_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_OFFLOC);
attachment.offsetLocation = off_loc_prop->vector; attachment.offsetLocation = Vector3{off_loc_prop->x, off_loc_prop->y, off_loc_prop->z};
auto rel_rot_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELROT); auto rel_rot_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELROT);
attachment.relativeRotation = rel_rot_prop->vector; attachment.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z};
auto off_rot_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_OFFROT); auto off_rot_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_OFFROT);
attachment.offsetRotation = off_rot_prop->vector; attachment.offsetRotation = Vector3{off_rot_prop->x, off_rot_prop->y, off_rot_prop->z};
auto rel_scale_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELSCALE); auto rel_scale_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELSCALE);
attachment.relativeScale = rel_scale_prop->vector; attachment.relativeScale = Vector3{rel_scale_prop->x, rel_scale_prop->y, rel_scale_prop->z};
} }
} }
@ -331,15 +331,25 @@ Mass::writeBulletLauncherAttachments() {
} }
auto rel_loc_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELLOC); auto rel_loc_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELLOC);
rel_loc_prop->vector = attachment.relativeLocation; rel_loc_prop->x = attachment.relativeLocation.x();
rel_loc_prop->y = attachment.relativeLocation.y();
rel_loc_prop->z = attachment.relativeLocation.z();
auto off_loc_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_OFFLOC); auto off_loc_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_OFFLOC);
off_loc_prop->vector = attachment.offsetLocation; off_loc_prop->x = attachment.offsetLocation.x();
off_loc_prop->y = attachment.offsetLocation.y();
off_loc_prop->z = attachment.offsetLocation.z();
auto rel_rot_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELROT); auto rel_rot_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELROT);
rel_rot_prop->vector = attachment.relativeRotation; rel_rot_prop->x = attachment.relativeRotation.x();
rel_rot_prop->y = attachment.relativeRotation.y();
rel_rot_prop->z = attachment.relativeRotation.z();
auto off_rot_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_OFFROT); auto off_rot_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_OFFROT);
off_rot_prop->vector = attachment.offsetRotation; off_rot_prop->x = attachment.offsetRotation.x();
off_rot_prop->y = attachment.offsetRotation.y();
off_rot_prop->z = attachment.offsetRotation.z();
auto rel_scale_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELSCALE); auto rel_scale_prop = attachment_prop->at<Gvas::Types::VectorStructProperty>(MASS_BL_ATTACHMENT_RELSCALE);
rel_scale_prop->vector = attachment.relativeScale; rel_scale_prop->x = attachment.relativeScale.x();
rel_scale_prop->y = attachment.relativeScale.y();
rel_scale_prop->z = attachment.relativeScale.z();
} }
} }
@ -438,4 +448,4 @@ Mass::writeArmourCustomStyle(std::size_t index) {
return writeCustomStyle(_armour.customStyles[index], index, armour_styles); return writeCustomStyle(_armour.customStyles[index], index, armour_styles);
} }
} }}

View file

@ -29,7 +29,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
void void
Mass::getDecals(Containers::ArrayView<Decal> decals, Gvas::Types::ArrayProperty* decal_array) { Mass::getDecals(Containers::ArrayView<Decal> decals, Gvas::Types::ArrayProperty* decal_array) {
@ -42,13 +42,13 @@ Mass::getDecals(Containers::ArrayView<Decal> decals, Gvas::Types::ArrayProperty*
auto colour_prop = decal_prop->at<Gvas::Types::ColourStructProperty>(MASS_DECAL_COLOUR); auto colour_prop = decal_prop->at<Gvas::Types::ColourStructProperty>(MASS_DECAL_COLOUR);
decal.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a}; decal.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
auto pos_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_POSITION); auto pos_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_POSITION);
decal.position = pos_prop->vector; decal.position = Vector3{pos_prop->x, pos_prop->y, pos_prop->z};
auto u_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_UAXIS); auto u_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_UAXIS);
decal.uAxis = u_prop->vector; decal.uAxis = Vector3{u_prop->x, u_prop->y, u_prop->z};
auto v_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_VAXIS); auto v_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_VAXIS);
decal.vAxis = v_prop->vector; decal.vAxis = Vector3{v_prop->x, v_prop->y, v_prop->z};
auto offset_prop = decal_prop->at<Gvas::Types::Vector2DStructProperty>(MASS_DECAL_OFFSET); auto offset_prop = decal_prop->at<Gvas::Types::Vector2DStructProperty>(MASS_DECAL_OFFSET);
decal.offset = offset_prop->vector; decal.offset = Vector2{offset_prop->x, offset_prop->y};
decal.scale = decal_prop->at<Gvas::Types::FloatProperty>(MASS_DECAL_SCALE)->value; decal.scale = decal_prop->at<Gvas::Types::FloatProperty>(MASS_DECAL_SCALE)->value;
decal.rotation = decal_prop->at<Gvas::Types::FloatProperty>(MASS_DECAL_ROTATION)->value; decal.rotation = decal_prop->at<Gvas::Types::FloatProperty>(MASS_DECAL_ROTATION)->value;
decal.flip = decal_prop->at<Gvas::Types::BoolProperty>(MASS_DECAL_FLIP)->value; decal.flip = decal_prop->at<Gvas::Types::BoolProperty>(MASS_DECAL_FLIP)->value;
@ -70,13 +70,20 @@ Mass::writeDecals(Containers::ArrayView<Decal> decals, Gvas::Types::ArrayPropert
colour_prop->b = decal.colour.b(); colour_prop->b = decal.colour.b();
colour_prop->a = decal.colour.a(); colour_prop->a = decal.colour.a();
auto pos_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_POSITION); auto pos_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_POSITION);
pos_prop->vector = decal.position; pos_prop->x = decal.position.x();
pos_prop->y = decal.position.y();
pos_prop->z = decal.position.z();
auto u_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_UAXIS); auto u_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_UAXIS);
u_prop->vector = decal.uAxis; u_prop->x = decal.uAxis.x();
u_prop->y = decal.uAxis.y();
u_prop->z = decal.uAxis.z();
auto v_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_VAXIS); auto v_prop = decal_prop->at<Gvas::Types::VectorStructProperty>(MASS_DECAL_VAXIS);
v_prop->vector = decal.vAxis; v_prop->x = decal.vAxis.x();
v_prop->y = decal.vAxis.y();
v_prop->z = decal.vAxis.z();
auto offset_prop = decal_prop->at<Gvas::Types::Vector2DStructProperty>(MASS_DECAL_OFFSET); auto offset_prop = decal_prop->at<Gvas::Types::Vector2DStructProperty>(MASS_DECAL_OFFSET);
offset_prop->vector = decal.offset; offset_prop->x = decal.offset.x();
offset_prop->y = decal.offset.y();
decal_prop->at<Gvas::Types::FloatProperty>(MASS_DECAL_SCALE)->value = decal.scale; decal_prop->at<Gvas::Types::FloatProperty>(MASS_DECAL_SCALE)->value = decal.scale;
decal_prop->at<Gvas::Types::FloatProperty>(MASS_DECAL_ROTATION)->value = decal.rotation; decal_prop->at<Gvas::Types::FloatProperty>(MASS_DECAL_ROTATION)->value = decal.rotation;
decal_prop->at<Gvas::Types::BoolProperty>(MASS_DECAL_FLIP)->value = decal.flip; decal_prop->at<Gvas::Types::BoolProperty>(MASS_DECAL_FLIP)->value = decal.flip;
@ -98,15 +105,15 @@ Mass::getAccessories(Containers::ArrayView<Accessory> accessories, Gvas::Types::
accessory.styles[j] = acc_styles->at<Gvas::Types::IntProperty>(j)->value; accessory.styles[j] = acc_styles->at<Gvas::Types::IntProperty>(j)->value;
} }
auto rel_pos_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_RELPOS); auto rel_pos_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_RELPOS);
accessory.relativePosition = rel_pos_prop->vector; accessory.relativePosition = Vector3{rel_pos_prop->x, rel_pos_prop->y, rel_pos_prop->z};
auto rel_pos_offset_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_OFFPOS); auto rel_pos_offset_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_OFFPOS);
accessory.relativePositionOffset = rel_pos_offset_prop->vector; accessory.relativePositionOffset = Vector3{rel_pos_offset_prop->x, rel_pos_offset_prop->y, rel_pos_offset_prop->z};
auto rel_rot_prop = acc_prop->at<Gvas::Types::RotatorStructProperty>(MASS_ACCESSORY_RELROT); auto rel_rot_prop = acc_prop->at<Gvas::Types::RotatorStructProperty>(MASS_ACCESSORY_RELROT);
accessory.relativeRotation = rel_rot_prop->vector; accessory.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z};
auto rel_rot_offset_prop = acc_prop->at<Gvas::Types::RotatorStructProperty>(MASS_ACCESSORY_OFFROT); auto rel_rot_offset_prop = acc_prop->at<Gvas::Types::RotatorStructProperty>(MASS_ACCESSORY_OFFROT);
accessory.relativeRotationOffset = rel_rot_offset_prop->vector; accessory.relativeRotationOffset = Vector3{rel_rot_offset_prop->x, rel_rot_offset_prop->y, rel_rot_offset_prop->z};
auto local_scale_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_SCALE); auto local_scale_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_SCALE);
accessory.localScale = local_scale_prop->vector; accessory.localScale = Vector3{local_scale_prop->x, local_scale_prop->y, local_scale_prop->z};
} }
} }
@ -124,16 +131,26 @@ Mass::writeAccessories(Containers::ArrayView<Accessory> accessories, Gvas::Types
acc_styles->at<Gvas::Types::IntProperty>(j)->value = accessory.styles[j]; acc_styles->at<Gvas::Types::IntProperty>(j)->value = accessory.styles[j];
} }
auto rel_pos_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_RELPOS); auto rel_pos_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_RELPOS);
rel_pos_prop->vector = accessory.relativePosition; rel_pos_prop->x = accessory.relativePosition.x();
rel_pos_prop->y = accessory.relativePosition.y();
rel_pos_prop->z = accessory.relativePosition.z();
auto rel_pos_offset_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_OFFPOS); auto rel_pos_offset_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_OFFPOS);
rel_pos_offset_prop->vector = accessory.relativePositionOffset; rel_pos_offset_prop->x = accessory.relativePositionOffset.x();
rel_pos_offset_prop->y = accessory.relativePositionOffset.y();
rel_pos_offset_prop->z = accessory.relativePositionOffset.z();
auto rel_rot_prop = acc_prop->at<Gvas::Types::RotatorStructProperty>(MASS_ACCESSORY_RELROT); auto rel_rot_prop = acc_prop->at<Gvas::Types::RotatorStructProperty>(MASS_ACCESSORY_RELROT);
rel_rot_prop->vector = accessory.relativeRotation; rel_rot_prop->x = accessory.relativeRotation.x();
rel_rot_prop->y = accessory.relativeRotation.y();
rel_rot_prop->z = accessory.relativeRotation.z();
auto rel_rot_offset_prop = acc_prop->at<Gvas::Types::RotatorStructProperty>(MASS_ACCESSORY_OFFROT); auto rel_rot_offset_prop = acc_prop->at<Gvas::Types::RotatorStructProperty>(MASS_ACCESSORY_OFFROT);
rel_rot_offset_prop->vector = accessory.relativeRotationOffset; rel_rot_offset_prop->x = accessory.relativeRotationOffset.x();
rel_rot_offset_prop->y = accessory.relativeRotationOffset.y();
rel_rot_offset_prop->z = accessory.relativeRotationOffset.z();
auto local_scale_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_SCALE); auto local_scale_prop = acc_prop->at<Gvas::Types::VectorStructProperty>(MASS_ACCESSORY_SCALE);
local_scale_prop->vector = accessory.localScale; local_scale_prop->x = accessory.localScale.x();
local_scale_prop->y = accessory.localScale.y();
local_scale_prop->z = accessory.localScale.z();
} }
} }
} }}

View file

@ -26,7 +26,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
Joints& Joints&
Mass::jointSliders() { Mass::jointSliders() {
@ -408,4 +408,4 @@ Mass::writeFrameCustomStyle(std::size_t index) {
return writeCustomStyle(_frame.customStyles[index], index, frame_styles); return writeCustomStyle(_frame.customStyles[index], index, frame_styles);
} }
} }}

View file

@ -27,7 +27,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
Containers::ArrayView<CustomStyle> Containers::ArrayView<CustomStyle>
Mass::globalStyles() { Mass::globalStyles() {
@ -155,4 +155,4 @@ Mass::writeCustomStyle(const CustomStyle& style, std::size_t index, Gvas::Types:
return true; return true;
} }
} }}

View file

@ -28,7 +28,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
Containers::ArrayView<Weapon> Containers::ArrayView<Weapon>
Mass::meleeWeapons() { Mass::meleeWeapons() {
@ -385,4 +385,4 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView<We
return true; return true;
} }
} }}

View file

@ -31,7 +31,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
Profile::Profile(Containers::StringView path): Profile::Profile(Containers::StringView path):
_profile(path) _profile(path)
@ -318,4 +318,4 @@ Profile::getResource(Containers::StringView container, GameData::MaterialID id)
return it != mats_prop->items.end() ? dynamic_cast<Gvas::Types::ResourceItemValue*>(it->get())->quantity : 0; return it != mats_prop->items.end() ? dynamic_cast<Gvas::Types::ResourceItemValue*>(it->get())->quantity : 0;
} }
} }}

View file

@ -26,7 +26,7 @@
using namespace Corrade; using namespace Corrade;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
class Profile { class Profile {
public: public:
@ -89,4 +89,4 @@ class Profile {
Containers::String _lastError; Containers::String _lastError;
}; };
} }}

View file

@ -16,7 +16,7 @@
#include "Weapon.h" #include "Weapon.h"
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
Weapon::Weapon(const Weapon& other) { Weapon::Weapon(const Weapon& other) {
name = other.name; name = other.name;
@ -51,4 +51,4 @@ Weapon::operator=(const Weapon& other) {
return *this; return *this;
} }
} }}

View file

@ -29,7 +29,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Magnum; using namespace Magnum;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
struct Weapon { struct Weapon {
Weapon() = default; Weapon() = default;
@ -63,4 +63,4 @@ struct Weapon {
Color4 effectColour{0.0f}; Color4 effectColour{0.0f};
}; };
} }}

View file

@ -24,7 +24,7 @@
using namespace Corrade; using namespace Corrade;
namespace mbst::GameObjects { namespace mbst { namespace GameObjects {
struct WeaponPart { struct WeaponPart {
WeaponPart() = default; WeaponPart() = default;
@ -64,4 +64,4 @@ struct WeaponPart {
Containers::Array<Accessory> accessories{}; Containers::Array<Accessory> accessories{};
}; };
} }}

View file

@ -27,7 +27,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
using PropertyArray = Containers::Array<Types::UnrealPropertyBase::ptr>; using PropertyArray = Containers::Array<Types::UnrealPropertyBase::ptr>;
using PropertyArrayView = Containers::ArrayView<Types::UnrealPropertyBase::ptr>; using PropertyArrayView = Containers::ArrayView<Types::UnrealPropertyBase::ptr>;
@ -50,4 +50,4 @@ class AbstractUnrealCollectionProperty {
PropertySerialiser& serialiser) = 0; PropertySerialiser& serialiser) = 0;
}; };
} }}

View file

@ -26,7 +26,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
using StringArrayView = Containers::ArrayView<const Containers::String>; using StringArrayView = Containers::ArrayView<const Containers::String>;
@ -46,4 +46,4 @@ class AbstractUnrealProperty {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0; BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0;
}; };
} }}

View file

@ -27,7 +27,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class AbstractUnrealStruct { class AbstractUnrealStruct {
public: public:
@ -43,4 +43,4 @@ class AbstractUnrealStruct {
std::size_t& bytes_written) = 0; std::size_t& bytes_written) = 0;
}; };
} }}

View file

@ -23,7 +23,7 @@
#include "ArrayProperty.h" #include "ArrayProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -76,4 +76,4 @@ ArrayProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size
return ret; return ret;
} }
} }}

View file

@ -24,7 +24,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class ArrayProperty : public UnrealProperty<Types::ArrayProperty> { class ArrayProperty : public UnrealProperty<Types::ArrayProperty> {
public: public:
@ -38,4 +38,4 @@ class ArrayProperty : public UnrealProperty<Types::ArrayProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "BoolProperty.h" #include "BoolProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
StringArrayView StringArrayView
BoolProperty::types() { BoolProperty::types() {
@ -70,4 +70,4 @@ BoolProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes
return true; return true;
} }
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class BoolProperty : public AbstractUnrealProperty { class BoolProperty : public AbstractUnrealProperty {
public: public:
@ -41,4 +41,4 @@ class BoolProperty : public AbstractUnrealProperty {
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "ByteProperty.h" #include "ByteProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
StringArrayView StringArrayView
ByteProperty::types() { ByteProperty::types() {
@ -31,7 +31,7 @@ ByteProperty::types() {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
ByteProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, ByteProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
BinaryIo::Reader& reader, PropertySerialiser& serialiser) BinaryIo::Reader& reader, PropertySerialiser& serialiser)
{ {
auto prop = Containers::pointer<Types::ByteProperty>(); auto prop = Containers::pointer<Types::ByteProperty>();
@ -91,4 +91,4 @@ ByteProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes
return true; return true;
} }
} }}

View file

@ -23,7 +23,7 @@
#include "../Types/ByteProperty.h" #include "../Types/ByteProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class ByteProperty : public AbstractUnrealProperty { class ByteProperty : public AbstractUnrealProperty {
public: public:
@ -39,4 +39,4 @@ class ByteProperty : public AbstractUnrealProperty {
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "ColourProperty.h" #include "ColourProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
ColourProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, ColourProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -56,4 +56,4 @@ ColourProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::siz
return true; return true;
} }
} }}

View file

@ -24,7 +24,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class ColourProperty : public UnrealProperty<Types::ColourStructProperty> { class ColourProperty : public UnrealProperty<Types::ColourStructProperty> {
public: public:
@ -38,4 +38,4 @@ class ColourProperty : public UnrealProperty<Types::ColourStructProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "DateTimeProperty.h" #include "DateTimeProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type,
@ -51,4 +51,4 @@ DateTimeProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/DateTimeStructProperty.h" #include "../Types/DateTimeStructProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class DateTimeProperty : public UnrealProperty<Types::DateTimeStructProperty> { class DateTimeProperty : public UnrealProperty<Types::DateTimeStructProperty> {
public: public:
@ -36,4 +36,4 @@ class DateTimeProperty : public UnrealProperty<Types::DateTimeStructProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "EnumProperty.h" #include "EnumProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
StringArrayView StringArrayView
EnumProperty::types() { EnumProperty::types() {
@ -71,4 +71,4 @@ EnumProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes
return true; return true;
} }
} }}

View file

@ -23,7 +23,7 @@
#include "../Types/EnumProperty.h" #include "../Types/EnumProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class EnumProperty : public AbstractUnrealProperty { class EnumProperty : public AbstractUnrealProperty {
public: public:
@ -39,4 +39,4 @@ class EnumProperty : public AbstractUnrealProperty {
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "FloatProperty.h" #include "FloatProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
StringArrayView StringArrayView
FloatProperty::types() { FloatProperty::types() {
@ -65,4 +65,4 @@ FloatProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& byte
return true; return true;
} }
} }}

View file

@ -23,7 +23,7 @@
#include "../Types/FloatProperty.h" #include "../Types/FloatProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class FloatProperty : public AbstractUnrealProperty { class FloatProperty : public AbstractUnrealProperty {
public: public:
@ -39,4 +39,4 @@ class FloatProperty : public AbstractUnrealProperty {
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -22,7 +22,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
GuidProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, GuidProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -53,4 +53,4 @@ GuidProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/GuidStructProperty.h" #include "../Types/GuidStructProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class GuidProperty : public UnrealProperty<Types::GuidStructProperty> { class GuidProperty : public UnrealProperty<Types::GuidStructProperty> {
public: public:
@ -36,4 +36,4 @@ class GuidProperty : public UnrealProperty<Types::GuidStructProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "IntProperty.h" #include "IntProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
IntProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, IntProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -73,4 +73,4 @@ IntProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/IntProperty.h" #include "../Types/IntProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class IntProperty : public UnrealProperty<Types::IntProperty> { class IntProperty : public UnrealProperty<Types::IntProperty> {
public: public:
@ -36,4 +36,4 @@ class IntProperty : public UnrealProperty<Types::IntProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -24,7 +24,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
MapProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, MapProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -156,4 +156,4 @@ MapProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/MapProperty.h" #include "../Types/MapProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class MapProperty : public UnrealProperty<Types::MapProperty> { class MapProperty : public UnrealProperty<Types::MapProperty> {
public: public:
@ -36,4 +36,4 @@ class MapProperty : public UnrealProperty<Types::MapProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Containers::Literals; using namespace Containers::Literals;
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type,
@ -107,4 +107,4 @@ ResourceProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/ResourceItemValue.h" #include "../Types/ResourceItemValue.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class ResourceProperty : public UnrealProperty<Types::ResourceItemValue> { class ResourceProperty : public UnrealProperty<Types::ResourceItemValue> {
public: public:
@ -36,4 +36,4 @@ class ResourceProperty : public UnrealProperty<Types::ResourceItemValue> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "RotatorProperty.h" #include "RotatorProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -28,25 +28,9 @@ RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::St
{ {
auto prop = Containers::pointer<Types::RotatorStructProperty>(); auto prop = Containers::pointer<Types::RotatorStructProperty>();
if(value_length == 12) { // UE4 if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y) || !reader.readFloat(prop->z)) {
float x, y, z; LOG_ERROR_FORMAT("Couldn't read rotator property {}'s value.", name);
return nullptr;
if(!reader.readFloat(x) || !reader.readFloat(y) || !reader.readFloat(z)) {
LOG_ERROR_FORMAT("Couldn't read rotator property {}'s value.", name);
return nullptr;
}
prop->vector = Vector3{x, y, z};
}
else if(value_length == 24) { // UE5
double x, y, z;
if(!reader.readDouble(x) || !reader.readDouble(y) || !reader.readDouble(z)) {
LOG_ERROR_FORMAT("Couldn't read rotator property {}'s value.", name);
return nullptr;
}
prop->vector = Vector3d{x, y, z};
} }
return prop; return prop;
@ -62,23 +46,11 @@ RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::si
return false; return false;
} }
std::visit( bytes_written += writer.writeValueToArray<float>(rotator->x) +
[&bytes_written, &writer](auto& arg){ writer.writeValueToArray<float>(rotator->y) +
using T = std::decay_t<decltype(arg)>; writer.writeValueToArray<float>(rotator->z);
if constexpr (std::is_same_v<T, Vector3>) {
bytes_written += writer.writeValueToArray<float>(arg.x()) +
writer.writeValueToArray<float>(arg.y()) +
writer.writeValueToArray<float>(arg.z());
}
else if constexpr (std::is_same_v<T, Vector3d>) {
bytes_written += writer.writeValueToArray<double>(arg.x()) +
writer.writeValueToArray<double>(arg.y()) +
writer.writeValueToArray<double>(arg.z());
}
}, rotator->vector
);
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/RotatorStructProperty.h" #include "../Types/RotatorStructProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class RotatorProperty : public UnrealProperty<Types::RotatorStructProperty> { class RotatorProperty : public UnrealProperty<Types::RotatorStructProperty> {
public: public:
@ -36,4 +36,4 @@ class RotatorProperty : public UnrealProperty<Types::RotatorStructProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class AbstractUnrealCollectionProperty; class AbstractUnrealCollectionProperty;
class AbstractUnrealProperty; class AbstractUnrealProperty;
@ -41,4 +41,4 @@ class UnrealProperty;
class Vector2DProperty; class Vector2DProperty;
class VectorProperty; class VectorProperty;
} }}

View file

@ -21,7 +21,7 @@
#include "SetProperty.h" #include "SetProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
SetProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, SetProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -82,4 +82,4 @@ SetProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/SetProperty.h" #include "../Types/SetProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class SetProperty : public UnrealProperty<Types::SetProperty> { class SetProperty : public UnrealProperty<Types::SetProperty> {
public: public:
@ -36,4 +36,4 @@ class SetProperty : public UnrealProperty<Types::SetProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "StringProperty.h" #include "StringProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
StringArrayView StringArrayView
StringProperty::types() { StringProperty::types() {
@ -74,4 +74,4 @@ StringProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& byt
return true; return true;
} }
} }}

View file

@ -23,7 +23,7 @@
#include "../Types/StringProperty.h" #include "../Types/StringProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class StringProperty : public AbstractUnrealProperty { class StringProperty : public AbstractUnrealProperty {
public: public:
@ -39,4 +39,4 @@ class StringProperty : public AbstractUnrealProperty {
PropertySerialiser& serialiser) override; PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -25,7 +25,7 @@
#include "Struct.h" #include "Struct.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
StringArrayView StringArrayView
Struct::types() { Struct::types() {
@ -242,4 +242,4 @@ Struct::writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written
return true; return true;
} }
} }}

View file

@ -25,7 +25,7 @@
#include "../Types/StructProperty.h" #include "../Types/StructProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class Struct : public AbstractUnrealProperty, public AbstractUnrealCollectionProperty { class Struct : public AbstractUnrealProperty, public AbstractUnrealCollectionProperty {
public: public:
@ -52,4 +52,4 @@ class Struct : public AbstractUnrealProperty, public AbstractUnrealCollectionPro
PropertySerialiser& serialiser); PropertySerialiser& serialiser);
}; };
} }}

View file

@ -23,7 +23,7 @@
#include "TextProperty.h" #include "TextProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
TextProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, TextProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -91,4 +91,4 @@ TextProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/TextProperty.h" #include "../Types/TextProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class TextProperty : public UnrealProperty<Types::TextProperty> { class TextProperty : public UnrealProperty<Types::TextProperty> {
public: public:
@ -36,4 +36,4 @@ class TextProperty : public UnrealProperty<Types::TextProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -25,7 +25,7 @@
#include "AbstractUnrealProperty.h" #include "AbstractUnrealProperty.h"
#include "../Types/StructProperty.h" #include "../Types/StructProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
template<typename T> template<typename T>
class UnrealProperty : public AbstractUnrealProperty { class UnrealProperty : public AbstractUnrealProperty {
@ -73,4 +73,4 @@ class UnrealProperty : public AbstractUnrealProperty {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0; BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0;
}; };
} }}

View file

@ -20,7 +20,7 @@
#include "Vector2DProperty.h" #include "Vector2DProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type,
@ -29,25 +29,9 @@ Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::S
{ {
auto prop = Containers::pointer<Types::Vector2DStructProperty>(); auto prop = Containers::pointer<Types::Vector2DStructProperty>();
if(value_length == 8) { // UE4 if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y)) {
float x, y; LOG_ERROR_FORMAT("Couldn't read 2D vector property {}'s value.", name);
return nullptr;
if(!reader.readFloat(x) || !reader.readFloat(y)) {
LOG_ERROR_FORMAT("Couldn't read 2D vector property {}'s value.", name);
return nullptr;
}
prop->vector = Vector2{x, y};
}
else if(value_length == 16) { // UE5
double x, y;
if(!reader.readDouble(x) || !reader.readDouble(y)) {
LOG_ERROR_FORMAT("Couldn't read 2D vector property {}'s value.", name);
return nullptr;
}
prop->vector = Vector2d{x, y};
} }
return prop; return prop;
@ -63,21 +47,10 @@ Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s
return false; return false;
} }
std::visit( bytes_written += writer.writeValueToArray<float>(vector->x) +
[&bytes_written, &writer](auto& arg){ writer.writeValueToArray<float>(vector->y);
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, Vector2>) {
bytes_written += writer.writeValueToArray<float>(arg.x()) +
writer.writeValueToArray<float>(arg.y());
}
else if constexpr (std::is_same_v<T, Vector2d>) {
bytes_written += writer.writeValueToArray<double>(arg.x()) +
writer.writeValueToArray<double>(arg.y());
}
}, vector->vector
);
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/Vector2DStructProperty.h" #include "../Types/Vector2DStructProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class Vector2DProperty : public UnrealProperty<Types::Vector2DStructProperty> { class Vector2DProperty : public UnrealProperty<Types::Vector2DStructProperty> {
public: public:
@ -36,4 +36,4 @@ class Vector2DProperty : public UnrealProperty<Types::Vector2DStructProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -21,7 +21,7 @@
#include "VectorProperty.h" #include "VectorProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
Types::UnrealPropertyBase::ptr Types::UnrealPropertyBase::ptr
VectorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, VectorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -29,25 +29,9 @@ VectorProperty::deserialiseProperty(Containers::StringView name, Containers::Str
{ {
auto prop = Containers::pointer<Types::VectorStructProperty>(); auto prop = Containers::pointer<Types::VectorStructProperty>();
if(value_length == 12) { // UE4 if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y) || !reader.readFloat(prop->z)) {
float x, y, z; LOG_ERROR_FORMAT("Couldn't read vector property {}'s value.", name);
return nullptr;
if(!reader.readFloat(x) || !reader.readFloat(y) || !reader.readFloat(z)) {
LOG_ERROR_FORMAT("Couldn't read vector property {}'s value.", name);
return nullptr;
}
prop->vector = Vector3{x, y, z};
}
else if(value_length == 24) { // UE5
double x, y, z;
if(!reader.readDouble(x) || !reader.readDouble(y) || !reader.readDouble(z)) {
LOG_ERROR_FORMAT("Couldn't read vector property {}'s value.", name);
return nullptr;
}
prop->vector = Vector3d{x, y, z};
} }
return prop; return prop;
@ -63,23 +47,11 @@ VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::siz
return false; return false;
} }
std::visit( bytes_written += writer.writeValueToArray<float>(vector->x) +
[&bytes_written, &writer](auto& arg){ writer.writeValueToArray<float>(vector->y) +
using T = std::decay_t<decltype(arg)>; writer.writeValueToArray<float>(vector->z);
if constexpr (std::is_same_v<T, Vector3>) {
bytes_written += writer.writeValueToArray<float>(arg.x()) +
writer.writeValueToArray<float>(arg.y()) +
writer.writeValueToArray<float>(arg.z());
}
else if constexpr (std::is_same_v<T, Vector3d>) {
bytes_written += writer.writeValueToArray<double>(arg.x()) +
writer.writeValueToArray<double>(arg.y()) +
writer.writeValueToArray<double>(arg.z());
}
}, vector->vector
);
return true; return true;
} }
} }}

View file

@ -22,7 +22,7 @@
#include "../Types/VectorStructProperty.h" #include "../Types/VectorStructProperty.h"
namespace Gvas::Serialisers { namespace Gvas { namespace Serialisers {
class VectorProperty : public UnrealProperty<Types::VectorStructProperty> { class VectorProperty : public UnrealProperty<Types::VectorStructProperty> {
public: public:
@ -36,4 +36,4 @@ class VectorProperty : public UnrealProperty<Types::VectorStructProperty> {
BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; BinaryIo::Writer& writer, PropertySerialiser& serialiser) override;
}; };
} }}

View file

@ -23,7 +23,7 @@
#include "UnrealPropertyBase.h" #include "UnrealPropertyBase.h"
namespace Gvas::Types { namespace Gvas { namespace Types {
struct ArrayProperty : public UnrealPropertyBase { struct ArrayProperty : public UnrealPropertyBase {
using ptr = Containers::Pointer<ArrayProperty>; using ptr = Containers::Pointer<ArrayProperty>;
@ -47,4 +47,4 @@ struct ArrayProperty : public UnrealPropertyBase {
Containers::Array<UnrealPropertyBase::ptr> items; Containers::Array<UnrealPropertyBase::ptr> items;
}; };
} }}

View file

@ -23,7 +23,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct BoolProperty : public UnrealProperty<bool> { struct BoolProperty : public UnrealProperty<bool> {
using ptr = Containers::Pointer<BoolProperty>; using ptr = Containers::Pointer<BoolProperty>;
@ -34,4 +34,4 @@ struct BoolProperty : public UnrealProperty<bool> {
} }
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct ByteProperty : public UnrealProperty<Containers::Array<char>> { struct ByteProperty : public UnrealProperty<Containers::Array<char>> {
using ptr = Containers::Pointer<ByteProperty>; using ptr = Containers::Pointer<ByteProperty>;
@ -41,4 +41,4 @@ struct ByteProperty : public UnrealProperty<Containers::Array<char>> {
Containers::String enumValue; Containers::String enumValue;
}; };
} }}

View file

@ -23,7 +23,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct ColourStructProperty : public StructProperty { struct ColourStructProperty : public StructProperty {
using ptr = Containers::Pointer<ColourStructProperty>; using ptr = Containers::Pointer<ColourStructProperty>;
@ -34,4 +34,4 @@ struct ColourStructProperty : public StructProperty {
float r = 0.0f, g = 0.0f, b = 0.0f, a = 0.0f; float r = 0.0f, g = 0.0f, b = 0.0f, a = 0.0f;
}; };
} }}

View file

@ -23,7 +23,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct DateTimeStructProperty : public StructProperty { struct DateTimeStructProperty : public StructProperty {
using ptr = Containers::Pointer<DateTimeStructProperty>; using ptr = Containers::Pointer<DateTimeStructProperty>;
@ -36,4 +36,4 @@ struct DateTimeStructProperty : public StructProperty {
std::int64_t timestamp = 0; std::int64_t timestamp = 0;
}; };
} }}

View file

@ -24,7 +24,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct EnumProperty : public UnrealProperty<Containers::String> { struct EnumProperty : public UnrealProperty<Containers::String> {
using ptr = Containers::Pointer<EnumProperty>; using ptr = Containers::Pointer<EnumProperty>;
@ -37,4 +37,4 @@ struct EnumProperty : public UnrealProperty<Containers::String> {
Containers::String enumType; Containers::String enumType;
}; };
} }}

View file

@ -23,7 +23,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct FloatProperty : public UnrealProperty<float> { struct FloatProperty : public UnrealProperty<float> {
using ptr = Containers::Pointer<FloatProperty>; using ptr = Containers::Pointer<FloatProperty>;
@ -34,4 +34,4 @@ struct FloatProperty : public UnrealProperty<float> {
} }
}; };
} }}

View file

@ -26,7 +26,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct GenericStructProperty : public StructProperty { struct GenericStructProperty : public StructProperty {
using ptr = Containers::Pointer<GenericStructProperty>; using ptr = Containers::Pointer<GenericStructProperty>;
@ -56,4 +56,4 @@ struct GenericStructProperty : public StructProperty {
Containers::Array<UnrealPropertyBase::ptr> properties; Containers::Array<UnrealPropertyBase::ptr> properties;
}; };
} }}

View file

@ -24,7 +24,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct GuidStructProperty : public StructProperty { struct GuidStructProperty : public StructProperty {
using ptr = Containers::Pointer<GuidStructProperty>; using ptr = Containers::Pointer<GuidStructProperty>;
@ -37,4 +37,4 @@ struct GuidStructProperty : public StructProperty {
Containers::StaticArray<16, char> guid{ValueInit}; Containers::StaticArray<16, char> guid{ValueInit};
}; };
} }}

View file

@ -23,7 +23,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct IntProperty : public UnrealProperty<std::int32_t> { struct IntProperty : public UnrealProperty<std::int32_t> {
using ptr = Containers::Pointer<IntProperty>; using ptr = Containers::Pointer<IntProperty>;
@ -34,4 +34,4 @@ struct IntProperty : public UnrealProperty<std::int32_t> {
} }
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct MapProperty : public UnrealPropertyBase { struct MapProperty : public UnrealPropertyBase {
using ptr = Containers::Pointer<MapProperty>; using ptr = Containers::Pointer<MapProperty>;
@ -46,4 +46,4 @@ struct MapProperty : public UnrealPropertyBase {
Containers::Array<KeyValuePair> map; Containers::Array<KeyValuePair> map;
}; };
} }}

View file

@ -23,7 +23,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct NoneProperty : UnrealPropertyBase { struct NoneProperty : UnrealPropertyBase {
using ptr = Containers::Pointer<NoneProperty>; using ptr = Containers::Pointer<NoneProperty>;
@ -35,4 +35,4 @@ struct NoneProperty : UnrealPropertyBase {
} }
}; };
} }}

View file

@ -23,7 +23,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct ResourceItemValue : public StructProperty { struct ResourceItemValue : public StructProperty {
using ptr = Containers::Pointer<ResourceItemValue>; using ptr = Containers::Pointer<ResourceItemValue>;
@ -41,4 +41,4 @@ struct ResourceItemValue : public StructProperty {
std::int32_t quantity = 0; std::int32_t quantity = 0;
}; };
} }}

View file

@ -16,21 +16,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <variant>
#include <Corrade/Containers/Pointer.h> #include <Corrade/Containers/Pointer.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include <Magnum/Math/Vector3.h>
#include "StructProperty.h" #include "StructProperty.h"
using namespace Corrade; using namespace Corrade;
using namespace Magnum;
typedef std::variant<Vector3, Vector3d> Vector3Variant; namespace Gvas { namespace Types {
namespace Gvas::Types {
struct RotatorStructProperty : public StructProperty { struct RotatorStructProperty : public StructProperty {
using ptr = Containers::Pointer<RotatorStructProperty>; using ptr = Containers::Pointer<RotatorStructProperty>;
@ -40,7 +33,7 @@ struct RotatorStructProperty : public StructProperty {
structType = "Rotator"_s; structType = "Rotator"_s;
} }
Vector3Variant vector; float x = 0.0f, y = 0.0f, z = 0.0f;
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct SetProperty : public UnrealPropertyBase { struct SetProperty : public UnrealPropertyBase {
using ptr = Containers::Pointer<SetProperty>; using ptr = Containers::Pointer<SetProperty>;
@ -47,4 +47,4 @@ struct SetProperty : public UnrealPropertyBase {
Containers::Array<UnrealPropertyBase::ptr> items; Containers::Array<UnrealPropertyBase::ptr> items;
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
using namespace Containers::Literals; using namespace Containers::Literals;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct StringProperty : public UnrealProperty<Containers::String> { struct StringProperty : public UnrealProperty<Containers::String> {
using ptr = Containers::Pointer<StringProperty>; using ptr = Containers::Pointer<StringProperty>;
@ -35,4 +35,4 @@ struct StringProperty : public UnrealProperty<Containers::String> {
} }
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct StructProperty : public UnrealPropertyBase { struct StructProperty : public UnrealPropertyBase {
using ptr = Containers::Pointer<StructProperty>; using ptr = Containers::Pointer<StructProperty>;
@ -39,4 +39,4 @@ struct StructProperty : public UnrealPropertyBase {
Containers::String structType; Containers::String structType;
}; };
} }}

View file

@ -25,7 +25,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct TextProperty : public UnrealProperty<Containers::String> { struct TextProperty : public UnrealProperty<Containers::String> {
using ptr = Containers::Pointer<TextProperty>; using ptr = Containers::Pointer<TextProperty>;
@ -40,4 +40,4 @@ struct TextProperty : public UnrealProperty<Containers::String> {
Containers::Array<Containers::String> data; Containers::Array<Containers::String> data;
}; };
} }}

View file

@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
namespace Gvas::Types { namespace Gvas { namespace Types {
struct UnrealPropertyBase; struct UnrealPropertyBase;
template<typename T> template<typename T>
@ -42,4 +42,4 @@ struct TextProperty;
struct Vector2DStructProperty; struct Vector2DStructProperty;
struct VectorStructProperty; struct VectorStructProperty;
} }}

View file

@ -22,7 +22,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
template<typename T> template<typename T>
struct UnrealProperty : public UnrealPropertyBase { struct UnrealProperty : public UnrealPropertyBase {
@ -31,4 +31,4 @@ struct UnrealProperty : public UnrealPropertyBase {
T value; T value;
}; };
} }}

View file

@ -24,7 +24,7 @@
using namespace Corrade; using namespace Corrade;
namespace Gvas::Types { namespace Gvas { namespace Types {
struct UnrealPropertyBase { struct UnrealPropertyBase {
using ptr = Containers::Pointer<UnrealPropertyBase>; using ptr = Containers::Pointer<UnrealPropertyBase>;
@ -36,4 +36,4 @@ struct UnrealPropertyBase {
std::size_t valueLength = 0; std::size_t valueLength = 0;
}; };
} }}

View file

@ -16,21 +16,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <variant>
#include <Corrade/Containers/Pointer.h> #include <Corrade/Containers/Pointer.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include <Magnum/Math/Vector2.h>
#include "StructProperty.h" #include "StructProperty.h"
using namespace Corrade; using namespace Corrade;
using namespace Magnum;
typedef std::variant<Vector2, Vector2d> Vector2Variant; namespace Gvas { namespace Types {
namespace Gvas::Types {
struct Vector2DStructProperty : public StructProperty { struct Vector2DStructProperty : public StructProperty {
using ptr = Containers::Pointer<Vector2DStructProperty>; using ptr = Containers::Pointer<Vector2DStructProperty>;
@ -40,7 +33,7 @@ struct Vector2DStructProperty : public StructProperty {
structType = "Vector2D"_s; structType = "Vector2D"_s;
} }
Vector2Variant vector; float x = 0.0f, y = 0.0f;
}; };
} }}

View file

@ -16,21 +16,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <variant>
#include <Corrade/Containers/Pointer.h> #include <Corrade/Containers/Pointer.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include <Magnum/Math/Vector3.h>
#include "StructProperty.h" #include "StructProperty.h"
using namespace Corrade; using namespace Corrade;
using namespace Magnum;
typedef std::variant<Vector3, Vector3d> Vector3Variant; namespace Gvas { namespace Types {
namespace Gvas::Types {
struct VectorStructProperty : public StructProperty { struct VectorStructProperty : public StructProperty {
using ptr = Containers::Pointer<VectorStructProperty>; using ptr = Containers::Pointer<VectorStructProperty>;
@ -40,7 +33,7 @@ struct VectorStructProperty : public StructProperty {
structType = "Vector"_s; structType = "Vector"_s;
} }
Vector3Variant vector{Vector3{}}; float x = 0.0f, y = 0.0f, z = 0.0f;
}; };
} }}

View file

@ -26,7 +26,7 @@
#include "Export.h" #include "Export.h"
namespace mbst::ImportExport { namespace mbst { namespace ImportExport {
static Containers::String last_export_error; static Containers::String last_export_error;
@ -124,4 +124,4 @@ exportStyle(Containers::StringView mass_name, mbst::GameObjects::CustomStyle& st
return true; return true;
} }
} }}

View file

@ -22,10 +22,10 @@
using namespace Corrade; using namespace Corrade;
namespace mbst::ImportExport { namespace mbst { namespace ImportExport {
auto lastExportError() -> Containers::StringView; auto lastExportError() -> Containers::StringView;
bool exportStyle(Containers::StringView mass_name, GameObjects::CustomStyle& style); bool exportStyle(Containers::StringView mass_name, GameObjects::CustomStyle& style);
} }}

View file

@ -30,7 +30,7 @@
#include "Import.h" #include "Import.h"
namespace mbst::ImportExport { namespace mbst { namespace ImportExport {
static Containers::String last_import_error; static Containers::String last_import_error;
@ -183,4 +183,4 @@ importStyle(Containers::StringView filename) {
return Utility::move(style); return Utility::move(style);
} }
} }}

View file

@ -22,10 +22,10 @@
using namespace Corrade; using namespace Corrade;
namespace mbst::ImportExport { namespace mbst { namespace ImportExport {
auto lastImportError() -> Containers::StringView; auto lastImportError() -> Containers::StringView;
auto importStyle(Containers::StringView filename) -> Containers::Optional<GameObjects::CustomStyle>; auto importStyle(Containers::StringView filename) -> Containers::Optional<GameObjects::CustomStyle>;
} }}

View file

@ -18,19 +18,19 @@
#include <cstdint> #include <cstdint>
namespace mbst::ImportExport::Keys { namespace mbst { namespace ImportExport { namespace Keys {
enum CustomStyle: std::uint8_t { enum CustomStyle: std::uint8_t {
Name = 0, // type: string Name = 0, // type: string
Colour = 1, // type: Magnum::Color4 Colour = 1, // type: Magnum::Color4
Metallic = 2, // type: float Metallic = 2, // type: float
Gloss = 3, // type: float Gloss = 3, // type: float
Glow = 4, // type: bool Glow = 4, // type: bool
PatternId = 5, // type: std::int32_t PatternId = 5, // type: std::int32_t
PatternOpacity = 6, // type: float PatternOpacity = 6, // type: float
PatternOffset = 7, // type: Magnum::Vector2 PatternOffset = 7, // type: Magnum::Vector2
PatternRotation = 8, // type: float PatternRotation = 8, // type: float
PatternScale = 9, // type: float PatternScale = 9, // type: float
}; };
} }}}

Some files were not shown because too many files have changed in this diff Show more