Compare commits

...

3 commits

Author SHA1 Message Date
8b8fbee6ba
Gvas,GameObjects,Application: fix UE5 builds. 2024-07-14 19:26:12 +02:00
53c58ba979
Switch to C++17.
Also change namespace definitions to nested ones.
2024-07-14 16:28:17 +02:00
bbf457beb6
GameData: update the accessory list. 2024-07-14 15:32:44 +02:00
112 changed files with 804 additions and 447 deletions

View file

@ -27,6 +27,8 @@
#include <SDL.h>
#include <imgui_internal.h>
#include <wtypesbase.h>
#include <shellapi.h>
#include <wtsapi32.h>
@ -419,6 +421,104 @@ Application::drawCheckbox(Containers::StringView label, bool 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
Application::openUri(Containers::StringView uri) {
if(!conf().isRunningInWine()) {

View file

@ -34,7 +34,6 @@
#include <SDL_timer.h>
#include <imgui.h>
#include <imgui_internal.h>
#include <efsw/efsw.hpp>
@ -167,6 +166,23 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe
void drawHelpMarker(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);
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>
bool drawUnsafeWidget(Functor func, Args... args) {

View file

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

View file

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

View file

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

View file

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

View file

@ -25,7 +25,7 @@
using namespace Corrade;
using namespace Containers::Literals;
namespace mbst { namespace GameData {
namespace mbst::GameData {
struct Accessory {
Containers::StringView name;
@ -258,6 +258,11 @@ static const std::map<std::int32_t, Accessory> accessories{
{1213, {"Pointed Armour 13"_s, Accessory::Size::L}},
{1214, {"Pointed Armour 14"_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}},
{1252, {"E Limb Cover 02"_s, Accessory::Size::L}},
@ -359,6 +364,12 @@ static const std::map<std::int32_t, Accessory> accessories{
{2104, {"Plating 04"_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}},
{2152, {"Complex Base 02"_s, Accessory::Size::L}},
{2153, {"Complex Base 03"_s, Accessory::Size::L}},
@ -498,6 +509,17 @@ static const std::map<std::int32_t, Accessory> accessories{
{2554, {"Energy Barrel 04"_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}},
{2602, {"L Bullet Barrel 02"_s, Accessory::Size::XL}},
{2603, {"L Bullet Barrel 03"_s, Accessory::Size::XL}},
@ -551,6 +573,18 @@ static const std::map<std::int32_t, Accessory> accessories{
{2714, {"Atk Packed Weaponry 03"_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}},
{2752, {"Vent 02"_s, Accessory::Size::M}},
{2753, {"Vent 03"_s, Accessory::Size::M}},
@ -561,12 +595,33 @@ static const std::map<std::int32_t, Accessory> accessories{
{2758, {"Vent 08"_s, Accessory::Size::M}},
{2759, {"Vent 09"_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}},
{2902, {"Complex Construct 02"_s, Accessory::Size::L}},
{2903, {"Complex Construct 03"_s, Accessory::Size::L}},
{2904, {"Complex Construct 04"_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}},
{2951, {"Q Mask 02"_s, Accessory::Size::M}},
@ -669,6 +724,11 @@ static const std::map<std::int32_t, Accessory> accessories{
{3358, {"Radar Pod 03"_s, Accessory::Size::M}},
{3359, {"Radar Pod 04"_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}},
{3402, {"Tri Pod 02"_s, Accessory::Size::M}},
@ -680,7 +740,44 @@ static const std::map<std::int32_t, Accessory> accessories{
{3408, {"Signal Pod 03"_s, Accessory::Size::M}},
{3409, {"Signal Pod 04"_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
};
}}
}

View file

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

View file

@ -23,7 +23,7 @@
using namespace Corrade;
using namespace Containers::Literals;
namespace mbst { namespace GameData {
namespace mbst::GameData {
static const std::map<std::int32_t, Containers::StringView> mission_id_map {{
// 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}
}};
}}
}

View file

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

View file

@ -22,7 +22,7 @@
using namespace Corrade;
using namespace Containers::Literals;
namespace mbst { namespace GameData {
namespace mbst::GameData {
struct StoryProgressPoint {
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 Containers::Literals;
namespace mbst { namespace GameData {
namespace mbst::GameData {
extern const std::map<std::int32_t, Containers::StringView> builtin_style_names
#ifdef STYLENAMES_DEFINITION
@ -162,4 +162,4 @@ extern const std::map<std::int32_t, Containers::StringView> builtin_style_names
#endif
;
}}
}

View file

@ -25,7 +25,7 @@ using namespace Corrade;
using namespace Containers::Literals;
namespace mbst { namespace GameData {
namespace mbst::GameData {
// region Melee
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
}}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -34,7 +34,7 @@
using namespace Containers::Literals;
namespace mbst { namespace GameObjects {
namespace mbst::GameObjects {
Mass::Mass(Containers::StringView 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 Magnum;
namespace mbst { namespace GameObjects {
namespace mbst::GameObjects {
class Mass {
public:
@ -213,4 +213,4 @@ class Mass {
Containers::String _account;
};
}}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -31,7 +31,7 @@
using namespace Corrade;
using namespace Containers::Literals;
namespace mbst { namespace GameObjects {
namespace mbst::GameObjects {
Profile::Profile(Containers::StringView 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;
}
}}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@
#include "ArrayProperty.h"
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
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;
}
}}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,7 +20,7 @@
#include "ColourProperty.h"
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
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;
}
}}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -22,7 +22,7 @@
using namespace Containers::Literals;
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
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;
}
}}
}

View file

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

View file

@ -20,7 +20,7 @@
#include "IntProperty.h"
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
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;
}
}}
}

View file

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

View file

@ -24,7 +24,7 @@
using namespace Containers::Literals;
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
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;
}
}}
}

View file

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

View file

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

View file

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

View file

@ -20,7 +20,7 @@
#include "RotatorProperty.h"
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -28,11 +28,27 @@ RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::St
{
auto prop = Containers::pointer<Types::RotatorStructProperty>();
if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y) || !reader.readFloat(prop->z)) {
if(value_length == 12) { // UE4
float x, y, z;
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;
}
@ -46,11 +62,23 @@ RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::si
return false;
}
bytes_written += writer.writeValueToArray<float>(rotator->x) +
writer.writeValueToArray<float>(rotator->y) +
writer.writeValueToArray<float>(rotator->z);
std::visit(
[&bytes_written, &writer](auto& arg){
using T = std::decay_t<decltype(arg)>;
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;
}
}}
}

View file

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

View file

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

View file

@ -21,7 +21,7 @@
#include "SetProperty.h"
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
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;
}
}}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@
#include "TextProperty.h"
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
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;
}
}}
}

View file

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

View file

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

View file

@ -20,7 +20,7 @@
#include "Vector2DProperty.h"
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type,
@ -29,11 +29,27 @@ Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::S
{
auto prop = Containers::pointer<Types::Vector2DStructProperty>();
if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y)) {
if(value_length == 8) { // UE4
float x, y;
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;
}
@ -47,10 +63,21 @@ Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s
return false;
}
bytes_written += writer.writeValueToArray<float>(vector->x) +
writer.writeValueToArray<float>(vector->y);
std::visit(
[&bytes_written, &writer](auto& arg){
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;
}
}}
}

View file

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

View file

@ -21,7 +21,7 @@
#include "VectorProperty.h"
namespace Gvas { namespace Serialisers {
namespace Gvas::Serialisers {
Types::UnrealPropertyBase::ptr
VectorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length,
@ -29,11 +29,27 @@ VectorProperty::deserialiseProperty(Containers::StringView name, Containers::Str
{
auto prop = Containers::pointer<Types::VectorStructProperty>();
if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y) || !reader.readFloat(prop->z)) {
if(value_length == 12) { // UE4
float x, y, z;
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;
}
@ -47,11 +63,23 @@ VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::siz
return false;
}
bytes_written += writer.writeValueToArray<float>(vector->x) +
writer.writeValueToArray<float>(vector->y) +
writer.writeValueToArray<float>(vector->z);
std::visit(
[&bytes_written, &writer](auto& arg){
using T = std::decay_t<decltype(arg)>;
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;
}
}}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@
using namespace Corrade;
namespace Gvas { namespace Types {
namespace Gvas::Types {
struct ColourStructProperty : public StructProperty {
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;
};
}}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@
using namespace Corrade;
namespace Gvas { namespace Types {
namespace Gvas::Types {
struct IntProperty : public UnrealProperty<std::int32_t> {
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;
namespace Gvas { namespace Types {
namespace Gvas::Types {
struct MapProperty : public UnrealPropertyBase {
using ptr = Containers::Pointer<MapProperty>;
@ -46,4 +46,4 @@ struct MapProperty : public UnrealPropertyBase {
Containers::Array<KeyValuePair> map;
};
}}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@
#include <cstdint>
namespace mbst { namespace ImportExport { namespace Keys {
namespace mbst::ImportExport::Keys {
enum CustomStyle: std::uint8_t {
Name = 0, // type: string
@ -33,4 +33,4 @@ enum CustomStyle: std::uint8_t {
PatternScale = 9, // type: float
};
}}}
}

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