213 lines
7.1 KiB
C++
213 lines
7.1 KiB
C++
#pragma once
|
|
|
|
// MassBuilderSaveTool
|
|
// Copyright (C) 2021-2023 Guillaume Jacquemin
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#include <Corrade/Containers/Optional.h>
|
|
#include <Corrade/Containers/Pointer.h>
|
|
#include <Corrade/Containers/StaticArray.h>
|
|
#include <Corrade/Containers/String.h>
|
|
#include <Corrade/Containers/StringView.h>
|
|
|
|
#include <Magnum/Magnum.h>
|
|
#include <Magnum/Math/Color.h>
|
|
#include <Magnum/Math/Vector2.h>
|
|
#include <Magnum/Math/Vector3.h>
|
|
|
|
#include "Joints.h"
|
|
#include "BulletLauncherAttachment.h"
|
|
#include "CustomStyle.h"
|
|
#include "Decal.h"
|
|
#include "Accessory.h"
|
|
#include "ArmourPart.h"
|
|
#include "WeaponPart.h"
|
|
#include "Weapon.h"
|
|
|
|
#include "../UESaveFile/UESaveFile.h"
|
|
|
|
using namespace Corrade;
|
|
using namespace Magnum;
|
|
|
|
struct ArrayProperty;
|
|
|
|
class Mass {
|
|
public:
|
|
explicit Mass(Containers::StringView path);
|
|
|
|
Mass(const Mass&) = delete;
|
|
Mass& operator=(const Mass&) = delete;
|
|
|
|
Mass(Mass&&) = default;
|
|
Mass& operator=(Mass&&) = default;
|
|
|
|
Containers::StringView lastError();
|
|
|
|
static Containers::Optional<Containers::String> getNameFromFile(Containers::StringView path);
|
|
|
|
void refreshValues();
|
|
|
|
Containers::StringView filename();
|
|
|
|
Containers::StringView name();
|
|
bool setName(Containers::StringView new_name);
|
|
|
|
enum class State: std::uint8_t {
|
|
Empty, Invalid, Valid
|
|
};
|
|
|
|
State state();
|
|
|
|
bool dirty() const;
|
|
void setDirty(bool dirty = true);
|
|
|
|
Joints& jointSliders();
|
|
void getJointSliders();
|
|
bool writeJointSliders();
|
|
|
|
Containers::ArrayView<std::int32_t> frameStyles();
|
|
void getFrameStyles();
|
|
bool writeFrameStyles();
|
|
|
|
Color4& eyeFlareColour();
|
|
void getEyeFlareColour();
|
|
bool writeEyeFlareColour();
|
|
|
|
Containers::ArrayView<CustomStyle> frameCustomStyles();
|
|
void getFrameCustomStyles();
|
|
bool writeFrameCustomStyle(std::size_t index);
|
|
|
|
Containers::ArrayView<ArmourPart> armourParts();
|
|
void getArmourParts();
|
|
bool writeArmourPart(ArmourSlot slot);
|
|
|
|
BulletLauncherAttachmentStyle& bulletLauncherAttachmentStyle();
|
|
Containers::ArrayView<BulletLauncherAttachment> bulletLauncherAttachments();
|
|
void getBulletLauncherAttachments();
|
|
bool writeBulletLauncherAttachments();
|
|
|
|
Containers::ArrayView<CustomStyle> armourCustomStyles();
|
|
void getArmourCustomStyles();
|
|
bool writeArmourCustomStyle(std::size_t index);
|
|
|
|
Containers::ArrayView<Weapon> meleeWeapons();
|
|
void getMeleeWeapons();
|
|
bool writeMeleeWeapons();
|
|
|
|
Containers::ArrayView<Weapon> shields();
|
|
void getShields();
|
|
bool writeShields();
|
|
|
|
Containers::ArrayView<Weapon> bulletShooters();
|
|
void getBulletShooters();
|
|
bool writeBulletShooters();
|
|
|
|
Containers::ArrayView<Weapon> energyShooters();
|
|
void getEnergyShooters();
|
|
bool writeEnergyShooters();
|
|
|
|
Containers::ArrayView<Weapon> bulletLaunchers();
|
|
void getBulletLaunchers();
|
|
bool writeBulletLaunchers();
|
|
|
|
Containers::ArrayView<Weapon> energyLaunchers();
|
|
void getEnergyLaunchers();
|
|
bool writeEnergyLaunchers();
|
|
|
|
Containers::ArrayView<CustomStyle> globalStyles();
|
|
void getGlobalStyles();
|
|
bool writeGlobalStyle(std::size_t index);
|
|
|
|
void getTuning();
|
|
|
|
std::int32_t& engine();
|
|
Containers::ArrayView<std::int32_t> gears();
|
|
|
|
std::int32_t& os();
|
|
Containers::ArrayView<std::int32_t> modules();
|
|
|
|
std::int32_t& architecture();
|
|
Containers::ArrayView<std::int32_t> techs();
|
|
|
|
Containers::StringView account();
|
|
bool updateAccount(Containers::StringView new_account);
|
|
|
|
private:
|
|
void getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayProperty* style_array);
|
|
bool writeCustomStyle(const CustomStyle& style, std::size_t index, ArrayProperty* style_array);
|
|
|
|
void getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array);
|
|
void writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array);
|
|
|
|
void getAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accessory_array);
|
|
void writeAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accs_array);
|
|
|
|
void getWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array);
|
|
bool writeWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array);
|
|
|
|
void getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& big_node_id,
|
|
Containers::StringView small_nodes_prop_name,
|
|
Containers::ArrayView<std::int32_t> small_nodes_ids);
|
|
|
|
Containers::Optional<UESaveFile> _mass;
|
|
|
|
Containers::String _lastError;
|
|
|
|
Containers::String _folder;
|
|
Containers::String _filename;
|
|
State _state = State::Empty;
|
|
|
|
bool _dirty = false;
|
|
|
|
Containers::Optional<Containers::String> _name = Containers::NullOpt;
|
|
|
|
struct {
|
|
Joints joints{};
|
|
Containers::StaticArray<4, std::int32_t> styles{ValueInit};
|
|
Color4 eyeFlare{0.0f};
|
|
Containers::StaticArray<16, CustomStyle> customStyles;
|
|
} _frame;
|
|
|
|
struct {
|
|
Containers::StaticArray<38, ArmourPart> parts;
|
|
Containers::StaticArray<16, CustomStyle> customStyles;
|
|
BulletLauncherAttachmentStyle blAttachmentStyle = BulletLauncherAttachmentStyle::NotFound;
|
|
Containers::StaticArray<4, BulletLauncherAttachment> blAttachment;
|
|
} _armour;
|
|
|
|
struct {
|
|
Containers::StaticArray<8, Weapon> melee;
|
|
Containers::StaticArray<1, Weapon> shields;
|
|
Containers::StaticArray<4, Weapon> bulletShooters;
|
|
Containers::StaticArray<4, Weapon> energyShooters;
|
|
Containers::StaticArray<4, Weapon> bulletLaunchers;
|
|
Containers::StaticArray<4, Weapon> energyLaunchers;
|
|
} _weapons;
|
|
|
|
Containers::Array<CustomStyle> _globalStyles;
|
|
|
|
struct {
|
|
std::int32_t engineId;
|
|
Containers::StaticArray<7, std::int32_t> gearIds;
|
|
|
|
std::int32_t osId;
|
|
Containers::StaticArray<7, std::int32_t> moduleIds;
|
|
|
|
std::int32_t archId;
|
|
Containers::StaticArray<7, std::int32_t> techIds;
|
|
} _tuning;
|
|
|
|
Containers::String _account;
|
|
};
|