#pragma once // MassBuilderSaveTool // Copyright (C) 2021-2022 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 . #include #include #include #include #include #include #include #include #include "Joints.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: enum class State : UnsignedByte { Empty, Invalid, Valid }; explicit Mass(const std::string& path); Mass(const Mass&) = delete; Mass& operator=(const Mass&) = delete; Mass(Mass&&) = default; Mass& operator=(Mass&&) = default; static auto lastError() -> std::string const&; static auto getNameFromFile(const std::string& path) -> Containers::Optional; void refreshValues(); auto filename() -> std::string const&; auto name() -> Containers::Optional const&; auto setName(std::string new_name) -> bool; auto state() -> State; auto demo() const -> bool; auto dirty() const -> bool; void setDirty(bool dirty = true); auto jointSliders() -> Joints&; void getJointSliders(); auto writeJointSliders() -> bool; auto frameStyles() -> Containers::ArrayView; void getFrameStyles(); auto writeFrameStyles() -> bool; auto eyeFlareColour() -> Color4&; void getEyeFlareColour(); auto writeEyeFlareColour() -> bool; auto frameCustomStyles() -> Containers::ArrayView; void getFrameCustomStyles(); auto writeFrameCustomStyle(UnsignedLong index) -> bool; auto armourParts() -> Containers::ArrayView; void getArmourParts(); auto writeArmourPart(UnsignedLong index) -> bool; auto armourCustomStyles() -> Containers::ArrayView; void getArmourCustomStyles(); auto writeArmourCustomStyle(UnsignedLong index) -> bool; auto meleeWeapons() -> Containers::ArrayView; void getMeleeWeapons(); auto writeMeleeWeapons() -> bool; auto shields() -> Containers::ArrayView; void getShields(); auto writeShields() -> bool; auto bulletShooters() -> Containers::ArrayView; void getBulletShooters(); auto writeBulletShooters() -> bool; auto energyShooters() -> Containers::ArrayView; void getEnergyShooters(); auto writeEnergyShooters() -> bool; auto bulletLaunchers() -> Containers::ArrayView; void getBulletLaunchers(); auto writeBulletLaunchers() -> bool; auto energyLaunchers() -> Containers::ArrayView; void getEnergyLaunchers(); auto writeEnergyLaunchers() -> bool; auto globalStyles() -> Containers::ArrayView; void getGlobalStyles(); auto writeGlobalStyle(UnsignedLong index) -> bool; void getTuning(); auto engine() -> Int&; auto gears() -> Containers::ArrayView; auto os() -> Int&; auto modules() -> Containers::ArrayView; auto architecture() -> Int&; auto techs() -> Containers::ArrayView; auto updateSteamId(const std::string& steam_id) -> bool; private: void getCustomStyles(Containers::ArrayView styles, ArrayProperty* style_array); auto setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool; void getDecals(Containers::ArrayView decals, ArrayProperty* decal_array); void getAccessories(Containers::ArrayView accessories, ArrayProperty* accessory_array); void getWeaponType(const char* prop_name, Containers::ArrayView weapon_array); auto writeWeaponType(const char* prop_name, Containers::ArrayView weapon_array) -> bool; void getTuningCategory(const char* big_node_prop_name, Int& big_node_id, const char* small_nodes_prop_name, Containers::ArrayView small_nodes_ids); Containers::Optional _mass; static std::string _lastError; std::string _folder; std::string _filename; State _state = State::Empty; bool _demo = false; bool _dirty = false; Containers::Optional _name = Containers::NullOpt; struct { Joints joints{}; Containers::StaticArray<4, Int> styles{ValueInit}; Color4 eyeFlare{0.0f}; Containers::StaticArray<16, CustomStyle> customStyles; } _frame; struct { Containers::StaticArray<38, ArmourPart> parts; Containers::StaticArray<16, CustomStyle> customStyles; } _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::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; std::string _steamId; };