2021-06-11 19:24:52 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// MassBuilderSaveTool
|
2022-01-30 11:36:56 +01:00
|
|
|
// Copyright (C) 2021-2022 Guillaume Jacquemin
|
2021-06-11 19:24:52 +02:00
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
#include <Corrade/Containers/Optional.h>
|
|
|
|
#include <Corrade/Containers/Pointer.h>
|
2021-08-28 20:21:13 +02:00
|
|
|
#include <Corrade/Containers/StaticArray.h>
|
|
|
|
|
2021-06-20 14:06:36 +02:00
|
|
|
#include <Magnum/Magnum.h>
|
2021-09-27 17:52:47 +02:00
|
|
|
#include <Magnum/Math/Color.h>
|
|
|
|
#include <Magnum/Math/Vector2.h>
|
|
|
|
#include <Magnum/Math/Vector3.h>
|
|
|
|
|
2022-02-09 13:36:33 +01:00
|
|
|
#include "Joints.h"
|
|
|
|
#include "CustomStyle.h"
|
|
|
|
#include "Decal.h"
|
|
|
|
#include "Accessory.h"
|
|
|
|
#include "ArmourPart.h"
|
|
|
|
#include "WeaponPart.h"
|
|
|
|
#include "Weapon.h"
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
#include "../UESaveFile/UESaveFile.h"
|
2021-06-20 14:06:36 +02:00
|
|
|
|
2021-08-28 20:21:13 +02:00
|
|
|
using namespace Corrade;
|
2021-06-20 14:06:36 +02:00
|
|
|
using namespace Magnum;
|
|
|
|
|
2021-10-17 10:52:57 +02:00
|
|
|
struct ArrayProperty;
|
|
|
|
|
2021-06-11 19:24:52 +02:00
|
|
|
class Mass {
|
|
|
|
public:
|
2021-08-28 20:20:09 +02:00
|
|
|
enum class State : UnsignedByte {
|
|
|
|
Empty, Invalid, Valid
|
|
|
|
};
|
|
|
|
|
2021-08-19 20:33:59 +02:00
|
|
|
explicit Mass(const std::string& path);
|
2021-06-11 19:24:52 +02:00
|
|
|
|
|
|
|
Mass(const Mass&) = delete;
|
|
|
|
Mass& operator=(const Mass&) = delete;
|
|
|
|
|
|
|
|
Mass(Mass&&) = default;
|
|
|
|
Mass& operator=(Mass&&) = default;
|
|
|
|
|
|
|
|
static auto lastError() -> std::string const&;
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
static auto getNameFromFile(const std::string& path) -> Containers::Optional<std::string>;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-08-28 20:20:09 +02:00
|
|
|
void refreshValues();
|
|
|
|
|
2021-06-11 19:24:52 +02:00
|
|
|
auto filename() -> std::string const&;
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto name() -> Containers::Optional<std::string> const&;
|
|
|
|
auto setName(std::string new_name) -> bool;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-08-28 20:20:09 +02:00
|
|
|
auto state() -> State;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-10-04 18:18:53 +02:00
|
|
|
auto demo() const -> bool;
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
auto dirty() const -> bool;
|
|
|
|
void setDirty(bool dirty = true);
|
|
|
|
|
2021-10-04 18:18:53 +02:00
|
|
|
auto jointSliders() -> Joints&;
|
|
|
|
void getJointSliders();
|
|
|
|
auto writeJointSliders() -> bool;
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto frameStyles() -> Containers::ArrayView<Int>;
|
2021-10-04 18:18:53 +02:00
|
|
|
void getFrameStyles();
|
|
|
|
auto writeFrameStyles() -> bool;
|
2021-08-28 20:21:13 +02:00
|
|
|
|
2021-10-04 18:18:53 +02:00
|
|
|
auto eyeFlareColour() -> Color4&;
|
|
|
|
void getEyeFlareColour();
|
|
|
|
auto writeEyeFlareColour() -> bool;
|
2021-09-27 17:52:47 +02:00
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto frameCustomStyles() -> Containers::ArrayView<CustomStyle>;
|
2021-10-04 18:18:53 +02:00
|
|
|
void getFrameCustomStyles();
|
|
|
|
auto writeFrameCustomStyle(UnsignedLong index) -> bool;
|
2021-10-02 14:52:48 +02:00
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto armourParts() -> Containers::ArrayView<ArmourPart>;
|
2021-10-04 18:18:53 +02:00
|
|
|
void getArmourParts();
|
2021-10-11 17:17:14 +02:00
|
|
|
auto writeArmourPart(UnsignedLong index) -> bool;
|
2021-10-03 16:32:47 +02:00
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto armourCustomStyles() -> Containers::ArrayView<CustomStyle>;
|
2021-10-04 18:18:53 +02:00
|
|
|
void getArmourCustomStyles();
|
|
|
|
auto writeArmourCustomStyle(UnsignedLong index) -> bool;
|
2021-10-02 14:52:48 +02:00
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto meleeWeapons() -> Containers::ArrayView<Weapon>;
|
2021-10-17 08:37:12 +02:00
|
|
|
void getMeleeWeapons();
|
|
|
|
auto writeMeleeWeapons() -> bool;
|
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto shields() -> Containers::ArrayView<Weapon>;
|
2021-10-17 08:37:12 +02:00
|
|
|
void getShields();
|
|
|
|
auto writeShields() -> bool;
|
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto bulletShooters() -> Containers::ArrayView<Weapon>;
|
2021-10-17 08:37:12 +02:00
|
|
|
void getBulletShooters();
|
|
|
|
auto writeBulletShooters() -> bool;
|
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto energyShooters() -> Containers::ArrayView<Weapon>;
|
2021-10-17 08:37:12 +02:00
|
|
|
void getEnergyShooters();
|
|
|
|
auto writeEnergyShooters() -> bool;
|
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto bulletLaunchers() -> Containers::ArrayView<Weapon>;
|
2021-10-17 08:37:12 +02:00
|
|
|
void getBulletLaunchers();
|
|
|
|
auto writeBulletLaunchers() -> bool;
|
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto energyLaunchers() -> Containers::ArrayView<Weapon>;
|
2021-10-17 08:37:12 +02:00
|
|
|
void getEnergyLaunchers();
|
|
|
|
auto writeEnergyLaunchers() -> bool;
|
|
|
|
|
2021-10-17 15:29:16 +02:00
|
|
|
auto globalStyles() -> Containers::ArrayView<CustomStyle>;
|
2021-10-04 18:18:53 +02:00
|
|
|
void getGlobalStyles();
|
|
|
|
auto writeGlobalStyle(UnsignedLong index) -> bool;
|
2021-10-02 14:52:48 +02:00
|
|
|
|
2021-12-02 15:27:00 +01:00
|
|
|
void getTuning();
|
|
|
|
|
|
|
|
auto engine() -> Int&;
|
|
|
|
auto gears() -> Containers::ArrayView<Int>;
|
|
|
|
|
|
|
|
auto os() -> Int&;
|
|
|
|
auto modules() -> Containers::ArrayView<Int>;
|
|
|
|
|
|
|
|
auto architecture() -> Int&;
|
|
|
|
auto techs() -> Containers::ArrayView<Int>;
|
|
|
|
|
2021-06-11 19:24:52 +02:00
|
|
|
auto updateSteamId(const std::string& steam_id) -> bool;
|
|
|
|
|
|
|
|
private:
|
2021-10-17 15:28:54 +02:00
|
|
|
void getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayProperty* style_array);
|
2021-10-17 10:52:57 +02:00
|
|
|
auto setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool;
|
2021-10-02 14:52:48 +02:00
|
|
|
|
2021-10-18 14:53:35 +02:00
|
|
|
void getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array);
|
|
|
|
void getAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accessory_array);
|
|
|
|
|
2021-10-17 08:37:12 +02:00
|
|
|
void getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array);
|
2021-10-29 10:23:34 +02:00
|
|
|
auto writeWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array) -> bool;
|
2021-10-17 08:37:12 +02:00
|
|
|
|
2021-12-02 15:27:00 +01:00
|
|
|
void getTuningCategory(const char* big_node_prop_name, Int& big_node_id,
|
|
|
|
const char* small_nodes_prop_name, Containers::ArrayView<Int> small_nodes_ids);
|
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
Containers::Optional<UESaveFile> _mass;
|
2021-08-28 20:20:09 +02:00
|
|
|
|
2021-06-11 19:24:52 +02:00
|
|
|
static std::string _lastError;
|
|
|
|
|
2021-08-19 20:33:59 +02:00
|
|
|
std::string _folder;
|
|
|
|
std::string _filename;
|
2021-08-28 20:20:09 +02:00
|
|
|
State _state = State::Empty;
|
2021-10-04 18:18:53 +02:00
|
|
|
bool _demo = false;
|
2021-08-28 20:21:13 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
bool _dirty = false;
|
|
|
|
|
|
|
|
Containers::Optional<std::string> _name = Containers::NullOpt;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
Joints joints{};
|
|
|
|
|
|
|
|
Containers::StaticArray<4, Int> styles{ValueInit};
|
|
|
|
|
|
|
|
Color4 eyeFlare{0.0f};
|
|
|
|
|
2021-10-02 14:51:39 +02:00
|
|
|
Containers::StaticArray<16, CustomStyle> customStyles;
|
2021-09-27 17:52:47 +02:00
|
|
|
} _frame;
|
|
|
|
|
|
|
|
struct {
|
2021-10-02 19:22:52 +02:00
|
|
|
Containers::StaticArray<38, ArmourPart> parts;
|
2021-09-27 17:52:47 +02:00
|
|
|
|
2021-10-02 14:51:39 +02:00
|
|
|
Containers::StaticArray<16, CustomStyle> customStyles;
|
2021-09-27 17:52:47 +02:00
|
|
|
} _armour;
|
|
|
|
|
|
|
|
struct {
|
2021-10-16 11:36:31 +02:00
|
|
|
Containers::StaticArray<8, Weapon> melee;
|
2021-09-27 17:52:47 +02:00
|
|
|
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::StaticArray<16, CustomStyle> _globalStyles;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
Int engineId;
|
|
|
|
Containers::StaticArray<7, Int> gearIds;
|
|
|
|
|
|
|
|
Int osId;
|
|
|
|
Containers::StaticArray<7, Int> moduleIds;
|
|
|
|
|
|
|
|
Int archId;
|
|
|
|
Containers::StaticArray<7, Int> techIds;
|
|
|
|
} _tuning;
|
2021-09-10 16:13:29 +02:00
|
|
|
|
2021-09-27 17:52:47 +02:00
|
|
|
std::string _steamId;
|
2021-06-11 19:24:52 +02:00
|
|
|
};
|