Mass: refactor and optimise some parts.
This commit is contained in:
parent
940fe3feee
commit
41cd92352d
13 changed files with 452 additions and 176 deletions
|
@ -124,8 +124,16 @@ add_executable(MassBuilderSaveTool WIN32
|
||||||
Profile/ResourceIDs.h
|
Profile/ResourceIDs.h
|
||||||
MassManager/MassManager.h
|
MassManager/MassManager.h
|
||||||
MassManager/MassManager.cpp
|
MassManager/MassManager.cpp
|
||||||
|
Mass/Accessory.h
|
||||||
|
Mass/ArmourPart.h
|
||||||
|
Mass/CustomStyle.h
|
||||||
|
Mass/Decal.h
|
||||||
|
Mass/Joints.h
|
||||||
Mass/Mass.h
|
Mass/Mass.h
|
||||||
Mass/Mass.cpp
|
Mass/Mass.cpp
|
||||||
|
Mass/Weapon.h
|
||||||
|
Mass/Weapon.cpp
|
||||||
|
Mass/WeaponPart.h
|
||||||
Maps/Accessories.h
|
Maps/Accessories.h
|
||||||
Maps/ArmourSets.h
|
Maps/ArmourSets.h
|
||||||
Maps/ArmourSlots.h
|
Maps/ArmourSlots.h
|
||||||
|
@ -133,6 +141,7 @@ add_executable(MassBuilderSaveTool WIN32
|
||||||
Maps/StoryProgress.h
|
Maps/StoryProgress.h
|
||||||
Maps/StyleNames.h
|
Maps/StyleNames.h
|
||||||
Maps/WeaponTypes.h
|
Maps/WeaponTypes.h
|
||||||
|
Maps/WeaponTypes.hpp
|
||||||
ToastQueue/ToastQueue.h
|
ToastQueue/ToastQueue.h
|
||||||
ToastQueue/ToastQueue.cpp
|
ToastQueue/ToastQueue.cpp
|
||||||
FontAwesome/IconsFontAwesome5.h
|
FontAwesome/IconsFontAwesome5.h
|
||||||
|
|
24
src/Maps/WeaponTypes.hpp
Normal file
24
src/Maps/WeaponTypes.hpp
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// 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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifdef c
|
||||||
|
c(Melee, "enuWeaponTypes::NewEnumerator0", "Melee weapon")
|
||||||
|
c(BulletShooter, "enuWeaponTypes::NewEnumerator1", "Bullet shooter")
|
||||||
|
c(EnergyShooter, "enuWeaponTypes::NewEnumerator2", "Energy shooter")
|
||||||
|
c(BulletLauncher, "enuWeaponTypes::NewEnumerator3", "Bullet launcher")
|
||||||
|
c(EnergyLauncher, "enuWeaponTypes::NewEnumerator4", "Energy launcher")
|
||||||
|
c(Shield, "enuWeaponTypes::NewEnumerator5", "Shield")
|
||||||
|
#endif
|
36
src/Mass/Accessory.h
Normal file
36
src/Mass/Accessory.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <Corrade/Containers/StaticArray.h>
|
||||||
|
|
||||||
|
#include <Magnum/Magnum.h>
|
||||||
|
#include <Magnum/Math/Vector3.h>
|
||||||
|
|
||||||
|
using namespace Corrade;
|
||||||
|
using namespace Magnum;
|
||||||
|
|
||||||
|
struct Accessory {
|
||||||
|
Int attachIndex = -1;
|
||||||
|
Int id = -1;
|
||||||
|
Containers::StaticArray<2, Int> styles{ValueInit};
|
||||||
|
Vector3 relativePosition{0.0f};
|
||||||
|
Vector3 relativePositionOffset{0.0f};
|
||||||
|
Vector3 relativeRotation{0.0f};
|
||||||
|
Vector3 relativeRotationOffset{0.0f};
|
||||||
|
Vector3 localScale{1.0f};
|
||||||
|
};
|
38
src/Mass/ArmourPart.h
Normal file
38
src/Mass/ArmourPart.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <Corrade/Containers/StaticArray.h>
|
||||||
|
|
||||||
|
#include <Magnum/Types.h>
|
||||||
|
|
||||||
|
#include "Decal.h"
|
||||||
|
#include "Accessory.h"
|
||||||
|
|
||||||
|
using namespace Corrade;
|
||||||
|
using namespace Magnum;
|
||||||
|
|
||||||
|
struct ArmourPart {
|
||||||
|
std::string slot;
|
||||||
|
Int id = 0;
|
||||||
|
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||||
|
UnsignedInt demoDecals = 8;
|
||||||
|
Containers::StaticArray<8, Decal> decals{ValueInit};
|
||||||
|
Containers::StaticArray<8, Accessory> accessories{ValueInit};
|
||||||
|
};
|
39
src/Mass/CustomStyle.h
Normal file
39
src/Mass/CustomStyle.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <Magnum/Magnum.h>
|
||||||
|
#include <Magnum/Math/Color.h>
|
||||||
|
#include <Magnum/Math/Vector2.h>
|
||||||
|
|
||||||
|
using namespace Magnum;
|
||||||
|
|
||||||
|
struct CustomStyle {
|
||||||
|
std::string name;
|
||||||
|
Color4 colour{0.0f};
|
||||||
|
Float metallic = 0.5f;
|
||||||
|
Float gloss = 0.5f;
|
||||||
|
bool glow = false;
|
||||||
|
|
||||||
|
Int patternId = 0;
|
||||||
|
Float opacity = 0.5f;
|
||||||
|
Vector2 offset{0.5f};
|
||||||
|
Float rotation = 0.0f;
|
||||||
|
Float scale = 0.5f;
|
||||||
|
};
|
38
src/Mass/Decal.h
Normal file
38
src/Mass/Decal.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <Magnum/Magnum.h>
|
||||||
|
#include <Magnum/Math/Color.h>
|
||||||
|
#include <Magnum/Math/Vector2.h>
|
||||||
|
|
||||||
|
using namespace Magnum;
|
||||||
|
|
||||||
|
struct Decal {
|
||||||
|
Int id = -1;
|
||||||
|
Color4 colour{0.0f};
|
||||||
|
Vector3 position{0.0f};
|
||||||
|
Vector3 uAxis{0.0f};
|
||||||
|
Vector3 vAxis{0.0f};
|
||||||
|
Vector2 offset{0.5f};
|
||||||
|
Float scale = 0.5f;
|
||||||
|
Float rotation = 0.0f;
|
||||||
|
bool flip = false;
|
||||||
|
bool wrap = false;
|
||||||
|
};
|
32
src/Mass/Joints.h
Normal file
32
src/Mass/Joints.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <Magnum/Types.h>
|
||||||
|
|
||||||
|
using namespace Magnum;
|
||||||
|
|
||||||
|
struct Joints {
|
||||||
|
Float neck = 0.0f;
|
||||||
|
Float body = 0.0f;
|
||||||
|
Float shoulders = 0.0f;
|
||||||
|
Float hips = 0.0f;
|
||||||
|
Float upperArms = 0.0f;
|
||||||
|
Float lowerArms = 0.0f;
|
||||||
|
Float upperLegs = 0.0f;
|
||||||
|
Float lowerLegs = 0.0f;
|
||||||
|
};
|
|
@ -1063,7 +1063,14 @@ void Mass::getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> we
|
||||||
auto& weapon = weapon_array[i];
|
auto& weapon = weapon_array[i];
|
||||||
|
|
||||||
weapon.name = weapon_prop->at<StringProperty>("Name_13_7BF0D31F4E50C50C47231BB36A485D92")->value;
|
weapon.name = weapon_prop->at<StringProperty>("Name_13_7BF0D31F4E50C50C47231BB36A485D92")->value;
|
||||||
weapon.type = weapon_prop->at<ByteProperty>("Type_2_35ABA8C3406F8D9BBF14A89CD6BCE976")->enumValue;
|
std::string& weapon_type = weapon_prop->at<ByteProperty>("Type_2_35ABA8C3406F8D9BBF14A89CD6BCE976")->enumValue;
|
||||||
|
#define c(enumerator, strenum, name) if(weapon_type == (strenum)) { weapon.type = WeaponType::enumerator; } else
|
||||||
|
#include "../Maps/WeaponTypes.hpp"
|
||||||
|
#undef c
|
||||||
|
{
|
||||||
|
_state = State::Invalid;
|
||||||
|
Utility::Warning{} << "Invalid weapon type enum value in getWeaponType().";
|
||||||
|
}
|
||||||
|
|
||||||
auto parts_prop = weapon_prop->at<ArrayProperty>("Element_6_8E4617CC4B2C1F1490435599784EC6E0");
|
auto parts_prop = weapon_prop->at<ArrayProperty>("Element_6_8E4617CC4B2C1F1490435599784EC6E0");
|
||||||
weapon.parts = Containers::Array<WeaponPart>{ValueInit, parts_prop->items.size()};
|
weapon.parts = Containers::Array<WeaponPart>{ValueInit, parts_prop->items.size()};
|
||||||
|
@ -1148,7 +1155,13 @@ auto Mass::writeWeaponType(const char* prop_name, Containers::ArrayView<Weapon>
|
||||||
auto& weapon = weapon_array[i];
|
auto& weapon = weapon_array[i];
|
||||||
|
|
||||||
weapon_prop->at<StringProperty>("Name_13_7BF0D31F4E50C50C47231BB36A485D92")->value = weapon.name;
|
weapon_prop->at<StringProperty>("Name_13_7BF0D31F4E50C50C47231BB36A485D92")->value = weapon.name;
|
||||||
weapon_prop->at<ByteProperty>("Type_2_35ABA8C3406F8D9BBF14A89CD6BCE976")->enumValue = weapon.type;
|
switch(weapon.type) {
|
||||||
|
#define c(enumerator, strenum, name) case WeaponType::enumerator: weapon_prop->at<ByteProperty>("Type_2_35ABA8C3406F8D9BBF14A89CD6BCE976")->enumValue = strenum; break;
|
||||||
|
#include "../Maps/WeaponTypes.hpp"
|
||||||
|
#undef c
|
||||||
|
default:
|
||||||
|
Utility::Warning{} << "Invalid weapon type enum value in writeWeaponType().";
|
||||||
|
}
|
||||||
|
|
||||||
auto parts_prop = weapon_prop->at<ArrayProperty>("Element_6_8E4617CC4B2C1F1490435599784EC6E0");
|
auto parts_prop = weapon_prop->at<ArrayProperty>("Element_6_8E4617CC4B2C1F1490435599784EC6E0");
|
||||||
if(parts_prop->items.size() != weapon.parts.size()) {
|
if(parts_prop->items.size() != weapon.parts.size()) {
|
||||||
|
|
122
src/Mass/Mass.h
122
src/Mass/Mass.h
|
@ -27,6 +27,14 @@
|
||||||
#include <Magnum/Math/Vector2.h>
|
#include <Magnum/Math/Vector2.h>
|
||||||
#include <Magnum/Math/Vector3.h>
|
#include <Magnum/Math/Vector3.h>
|
||||||
|
|
||||||
|
#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"
|
#include "../UESaveFile/UESaveFile.h"
|
||||||
|
|
||||||
using namespace Corrade;
|
using namespace Corrade;
|
||||||
|
@ -34,120 +42,6 @@ using namespace Magnum;
|
||||||
|
|
||||||
struct ArrayProperty;
|
struct ArrayProperty;
|
||||||
|
|
||||||
struct Joints {
|
|
||||||
Float neck = 0.0f;
|
|
||||||
Float body = 0.0f;
|
|
||||||
Float shoulders = 0.0f;
|
|
||||||
Float hips = 0.0f;
|
|
||||||
Float upperArms = 0.0f;
|
|
||||||
Float lowerArms = 0.0f;
|
|
||||||
Float upperLegs = 0.0f;
|
|
||||||
Float lowerLegs = 0.0f;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CustomStyle {
|
|
||||||
std::string name;
|
|
||||||
Color4 colour{0.0f};
|
|
||||||
Float metallic = 0.5f;
|
|
||||||
Float gloss = 0.5f;
|
|
||||||
bool glow = false;
|
|
||||||
|
|
||||||
Int patternId = 0;
|
|
||||||
Float opacity = 0.5f;
|
|
||||||
Vector2 offset{0.5f};
|
|
||||||
Float rotation = 0.0f;
|
|
||||||
Float scale = 0.5f;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Decal {
|
|
||||||
Int id = -1;
|
|
||||||
Color4 colour{0.0f};
|
|
||||||
Vector3 position{0.0f};
|
|
||||||
Vector3 uAxis{0.0f};
|
|
||||||
Vector3 vAxis{0.0f};
|
|
||||||
Vector2 offset{0.5f};
|
|
||||||
Float scale = 0.5f;
|
|
||||||
Float rotation = 0.0f;
|
|
||||||
bool flip = false;
|
|
||||||
bool wrap = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Accessory {
|
|
||||||
Int attachIndex = -1;
|
|
||||||
Int id = -1;
|
|
||||||
Containers::StaticArray<2, Int> styles{ValueInit};
|
|
||||||
Vector3 relativePosition{0.0f};
|
|
||||||
Vector3 relativePositionOffset{0.0f};
|
|
||||||
Vector3 relativeRotation{0.0f};
|
|
||||||
Vector3 relativeRotationOffset{0.0f};
|
|
||||||
Vector3 localScale{1.0f};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ArmourPart {
|
|
||||||
std::string slot;
|
|
||||||
Int id = 0;
|
|
||||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
|
||||||
UnsignedInt demoDecals = 8;
|
|
||||||
Containers::StaticArray<8, Decal> decals{ValueInit};
|
|
||||||
Containers::StaticArray<8, Accessory> accessories{ValueInit};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct WeaponPart {
|
|
||||||
Int id = 0;
|
|
||||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
|
||||||
UnsignedInt demoDecals = 8;
|
|
||||||
Containers::StaticArray<8, Decal> decals{ValueInit};
|
|
||||||
Containers::StaticArray<8, Accessory> accessories{ValueInit};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Weapon {
|
|
||||||
Weapon() = default;
|
|
||||||
|
|
||||||
Weapon(const Weapon& other) {
|
|
||||||
name = other.name;
|
|
||||||
type = other.type;
|
|
||||||
parts = Containers::Array<WeaponPart>{other.parts.size()};
|
|
||||||
for(UnsignedInt i = 0; i < parts.size(); i++) {
|
|
||||||
parts[i] = other.parts[i];
|
|
||||||
}
|
|
||||||
customStyles = other.customStyles;
|
|
||||||
attached = other.attached;
|
|
||||||
damageType = other.damageType;
|
|
||||||
dualWield = other.dualWield;
|
|
||||||
effectColourMode = other.effectColourMode;
|
|
||||||
effectColour = other.effectColour;
|
|
||||||
}
|
|
||||||
Weapon& operator=(const Weapon& other) {
|
|
||||||
name = other.name;
|
|
||||||
type = other.type;
|
|
||||||
parts = Containers::Array<WeaponPart>{other.parts.size()};
|
|
||||||
for(UnsignedInt i = 0; i < parts.size(); i++) {
|
|
||||||
parts[i] = other.parts[i];
|
|
||||||
}
|
|
||||||
customStyles = other.customStyles;
|
|
||||||
attached = other.attached;
|
|
||||||
damageType = other.damageType;
|
|
||||||
dualWield = other.dualWield;
|
|
||||||
effectColourMode = other.effectColourMode;
|
|
||||||
effectColour = other.effectColour;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Weapon(Weapon&& other) = default;
|
|
||||||
Weapon& operator=(Weapon&& other) = default;
|
|
||||||
|
|
||||||
std::string name;
|
|
||||||
std::string type;
|
|
||||||
Containers::Array<WeaponPart> parts;
|
|
||||||
Containers::StaticArray<16, CustomStyle> customStyles{ValueInit};
|
|
||||||
bool attached = false;
|
|
||||||
std::string damageType;
|
|
||||||
bool dualWield = false;
|
|
||||||
std::string effectColourMode;
|
|
||||||
Color4 effectColour{0.0f};
|
|
||||||
};
|
|
||||||
|
|
||||||
class Mass {
|
class Mass {
|
||||||
public:
|
public:
|
||||||
enum class State : UnsignedByte {
|
enum class State : UnsignedByte {
|
||||||
|
|
49
src/Mass/Weapon.cpp
Normal file
49
src/Mass/Weapon.cpp
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
// 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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "Weapon.h"
|
||||||
|
|
||||||
|
Weapon::Weapon(const Weapon& other) {
|
||||||
|
name = other.name;
|
||||||
|
type = other.type;
|
||||||
|
parts = Containers::Array<WeaponPart>{other.parts.size()};
|
||||||
|
for(UnsignedInt i = 0; i < parts.size(); i++) {
|
||||||
|
parts[i] = other.parts[i];
|
||||||
|
}
|
||||||
|
customStyles = other.customStyles;
|
||||||
|
attached = other.attached;
|
||||||
|
damageType = other.damageType;
|
||||||
|
dualWield = other.dualWield;
|
||||||
|
effectColourMode = other.effectColourMode;
|
||||||
|
effectColour = other.effectColour;
|
||||||
|
}
|
||||||
|
|
||||||
|
Weapon& Weapon::operator=(const Weapon& other) {
|
||||||
|
name = other.name;
|
||||||
|
type = other.type;
|
||||||
|
parts = Containers::Array<WeaponPart>{other.parts.size()};
|
||||||
|
for(UnsignedInt i = 0; i < parts.size(); i++) {
|
||||||
|
parts[i] = other.parts[i];
|
||||||
|
}
|
||||||
|
customStyles = other.customStyles;
|
||||||
|
attached = other.attached;
|
||||||
|
damageType = other.damageType;
|
||||||
|
dualWield = other.dualWield;
|
||||||
|
effectColourMode = other.effectColourMode;
|
||||||
|
effectColour = other.effectColour;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
61
src/Mass/Weapon.h
Normal file
61
src/Mass/Weapon.h
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <Corrade/Containers/Array.h>
|
||||||
|
#include <Corrade/Containers/StaticArray.h>
|
||||||
|
|
||||||
|
#include <Magnum/Magnum.h>
|
||||||
|
#include <Magnum/Math/Color.h>
|
||||||
|
|
||||||
|
#include "WeaponPart.h"
|
||||||
|
#include "CustomStyle.h"
|
||||||
|
|
||||||
|
using namespace Corrade;
|
||||||
|
using namespace Magnum;
|
||||||
|
|
||||||
|
enum class WeaponType {
|
||||||
|
Melee = 0,
|
||||||
|
Shield = 5,
|
||||||
|
BulletShooter = 1,
|
||||||
|
EnergyShooter = 2,
|
||||||
|
BulletLauncher = 3,
|
||||||
|
EnergyLauncher = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Weapon {
|
||||||
|
|
||||||
|
Weapon() = default;
|
||||||
|
|
||||||
|
Weapon(const Weapon& other);
|
||||||
|
Weapon& operator=(const Weapon& other);
|
||||||
|
|
||||||
|
Weapon(Weapon&& other) = default;
|
||||||
|
Weapon& operator=(Weapon&& other) = default;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
WeaponType type = WeaponType::Melee;
|
||||||
|
Containers::Array<WeaponPart> parts;
|
||||||
|
Containers::StaticArray<16, CustomStyle> customStyles{ValueInit};
|
||||||
|
bool attached = false;
|
||||||
|
std::string damageType;
|
||||||
|
bool dualWield = false;
|
||||||
|
std::string effectColourMode;
|
||||||
|
Color4 effectColour{0.0f};
|
||||||
|
};
|
35
src/Mass/WeaponPart.h
Normal file
35
src/Mass/WeaponPart.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <Corrade/Containers/StaticArray.h>
|
||||||
|
|
||||||
|
#include <Magnum/Types.h>
|
||||||
|
|
||||||
|
#include "Decal.h"
|
||||||
|
#include "Accessory.h"
|
||||||
|
|
||||||
|
using namespace Corrade;
|
||||||
|
using namespace Magnum;
|
||||||
|
|
||||||
|
struct WeaponPart {
|
||||||
|
Int id = 0;
|
||||||
|
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||||
|
UnsignedInt demoDecals = 8;
|
||||||
|
Containers::StaticArray<8, Decal> decals{ValueInit};
|
||||||
|
Containers::StaticArray<8, Accessory> accessories{ValueInit};
|
||||||
|
};
|
|
@ -790,64 +790,67 @@ void SaveTool::drawWeapons() {
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if(drawUnsafeWidget([](){ return ImGui::Button(ICON_FA_SAVE " Save changes to weapon category"); })) {
|
if(drawUnsafeWidget([](){ return ImGui::Button(ICON_FA_SAVE " Save changes to weapon category"); })) {
|
||||||
if(current_weapon->type == "enuWeaponTypes::NewEnumerator0") {
|
switch(current_weapon->type) {
|
||||||
if(!_currentMass->writeMeleeWeapons()) {
|
case WeaponType::Melee:
|
||||||
_queue.addToast(Toast::Type::Error, "Couldn't save melee weapons");
|
if(!_currentMass->writeMeleeWeapons()) {
|
||||||
}
|
_queue.addToast(Toast::Type::Error, "Couldn't save melee weapons");
|
||||||
}
|
}
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator5") {
|
break;
|
||||||
if(!_currentMass->writeShields()) {
|
case WeaponType::Shield:
|
||||||
_queue.addToast(Toast::Type::Error, "Couldn't save shields");
|
if(!_currentMass->writeShields()) {
|
||||||
}
|
_queue.addToast(Toast::Type::Error, "Couldn't save shields");
|
||||||
}
|
}
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator1") {
|
break;
|
||||||
if(!_currentMass->writeBulletShooters()) {
|
case WeaponType::BulletShooter:
|
||||||
_queue.addToast(Toast::Type::Error, "Couldn't save bullet shooters");
|
if(!_currentMass->writeBulletShooters()) {
|
||||||
}
|
_queue.addToast(Toast::Type::Error, "Couldn't save bullet shooters");
|
||||||
}
|
}
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator2") {
|
break;
|
||||||
if(!_currentMass->writeEnergyShooters()) {
|
case WeaponType::EnergyShooter:
|
||||||
_queue.addToast(Toast::Type::Error, "Couldn't save energy shooters");
|
if(!_currentMass->writeEnergyShooters()) {
|
||||||
}
|
_queue.addToast(Toast::Type::Error, "Couldn't save energy shooters");
|
||||||
}
|
}
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator3") {
|
break;
|
||||||
if(!_currentMass->writeBulletLaunchers()) {
|
case WeaponType::BulletLauncher:
|
||||||
_queue.addToast(Toast::Type::Error, "Couldn't save bullet launchers");
|
if(!_currentMass->writeBulletLaunchers()) {
|
||||||
}
|
_queue.addToast(Toast::Type::Error, "Couldn't save bullet launchers");
|
||||||
}
|
}
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator4") {
|
break;
|
||||||
if(!_currentMass->writeEnergyLaunchers()) {
|
case WeaponType::EnergyLauncher:
|
||||||
_queue.addToast(Toast::Type::Error, "Couldn't save energy launchers");
|
if(!_currentMass->writeEnergyLaunchers()) {
|
||||||
}
|
_queue.addToast(Toast::Type::Error, "Couldn't save energy launchers");
|
||||||
}
|
}
|
||||||
else {
|
break;
|
||||||
_queue.addToast(Toast::Type::Error, "Unknown weapon type");
|
default:
|
||||||
|
_queue.addToast(Toast::Type::Error, "Unknown weapon type");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
if(ImGui::Button(ICON_FA_UNDO_ALT " Reset weapon category")) {
|
if(ImGui::Button(ICON_FA_UNDO_ALT " Reset weapon category")) {
|
||||||
if(current_weapon->type == "enuWeaponTypes::NewEnumerator0") {
|
switch(current_weapon->type) {
|
||||||
_currentMass->getMeleeWeapons();
|
case WeaponType::Melee:
|
||||||
}
|
_currentMass->getMeleeWeapons();
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator5") {
|
break;
|
||||||
_currentMass->getShields();
|
case WeaponType::Shield:
|
||||||
}
|
_currentMass->getShields();
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator1") {
|
break;
|
||||||
_currentMass->getBulletShooters();
|
case WeaponType::BulletShooter:
|
||||||
}
|
_currentMass->getBulletShooters();
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator2") {
|
break;
|
||||||
_currentMass->getEnergyShooters();
|
case WeaponType::EnergyShooter:
|
||||||
}
|
_currentMass->getEnergyShooters();
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator3") {
|
break;
|
||||||
_currentMass->getBulletLaunchers();
|
case WeaponType::BulletLauncher:
|
||||||
}
|
_currentMass->getBulletLaunchers();
|
||||||
else if(current_weapon->type == "enuWeaponTypes::NewEnumerator4") {
|
break;
|
||||||
_currentMass->getEnergyLaunchers();
|
case WeaponType::EnergyLauncher:
|
||||||
}
|
_currentMass->getEnergyLaunchers();
|
||||||
else {
|
break;
|
||||||
_queue.addToast(Toast::Type::Error, "Unknown weapon type");
|
default:
|
||||||
|
_queue.addToast(Toast::Type::Error, "Unknown weapon type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,7 +863,12 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::Text("%s: %s", weapon_types.at(weapon.type), weapon.name.c_str());
|
const char* labels[] {
|
||||||
|
#define c(enumerator, strenum, name) name,
|
||||||
|
#include "../Maps/WeaponTypes.hpp"
|
||||||
|
#undef c
|
||||||
|
};
|
||||||
|
ImGui::Text("%s: %s", labels[UnsignedInt(weapon.type)], weapon.name.c_str());
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
@ -880,12 +888,12 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::TextUnformatted("Equipped:");
|
ImGui::TextUnformatted("Equipped:");
|
||||||
|
|
||||||
if(weapon.type != "enuWeaponTypes::NewEnumerator5") {
|
if(weapon.type != WeaponType::Shield) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::TextUnformatted("Damage type:");
|
ImGui::TextUnformatted("Damage type:");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(weapon.type == "enuWeaponTypes::NewEnumerator0") {
|
if(weapon.type == WeaponType::Melee) {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::TextUnformatted("Dual-wield:");
|
ImGui::TextUnformatted("Dual-wield:");
|
||||||
|
|
||||||
|
@ -902,18 +910,18 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::Checkbox("##EquippedCheckbox", &weapon.attached);
|
ImGui::Checkbox("##EquippedCheckbox", &weapon.attached);
|
||||||
|
|
||||||
if(weapon.type != "enuWeaponTypes::NewEnumerator5") {
|
if(weapon.type != WeaponType::Shield) {
|
||||||
if(weapon.type == "enuWeaponTypes::NewEnumerator0" &&
|
if(weapon.type == WeaponType::Melee &&
|
||||||
ImGui::RadioButton("Physical##NoElement", weapon.damageType == "enuDamageProperty::NewEnumerator0"))
|
ImGui::RadioButton("Physical##NoElement", weapon.damageType == "enuDamageProperty::NewEnumerator0"))
|
||||||
{
|
{
|
||||||
weapon.damageType = "enuDamageProperty::NewEnumerator0";
|
weapon.damageType = "enuDamageProperty::NewEnumerator0";
|
||||||
}
|
}
|
||||||
else if((weapon.type == "enuWeaponTypes::NewEnumerator1" || weapon.type == "enuWeaponTypes::NewEnumerator3") &&
|
else if((weapon.type == WeaponType::BulletShooter || weapon.type == WeaponType::BulletLauncher) &&
|
||||||
ImGui::RadioButton("Piercing##NoElement", weapon.damageType == "enuDamageProperty::NewEnumerator1"))
|
ImGui::RadioButton("Piercing##NoElement", weapon.damageType == "enuDamageProperty::NewEnumerator1"))
|
||||||
{
|
{
|
||||||
weapon.damageType = "enuDamageProperty::NewEnumerator1";
|
weapon.damageType = "enuDamageProperty::NewEnumerator1";
|
||||||
}
|
}
|
||||||
else if((weapon.type == "enuWeaponTypes::NewEnumerator2" || weapon.type == "enuWeaponTypes::NewEnumerator4") &&
|
else if((weapon.type == WeaponType::EnergyShooter || weapon.type == WeaponType::EnergyLauncher) &&
|
||||||
ImGui::RadioButton("Plasma##NoElement", weapon.damageType == "enuDamageProperty::NewEnumerator5"))
|
ImGui::RadioButton("Plasma##NoElement", weapon.damageType == "enuDamageProperty::NewEnumerator5"))
|
||||||
{
|
{
|
||||||
weapon.damageType = "enuDamageProperty::NewEnumerator5";
|
weapon.damageType = "enuDamageProperty::NewEnumerator5";
|
||||||
|
@ -932,7 +940,7 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(weapon.type == "enuWeaponTypes::NewEnumerator0") {
|
if(weapon.type == WeaponType::Melee) {
|
||||||
ImGui::Checkbox("##DualWield", &weapon.dualWield);
|
ImGui::Checkbox("##DualWield", &weapon.dualWield);
|
||||||
|
|
||||||
if(ImGui::RadioButton("Default##Default", weapon.effectColourMode == "enuWeaponEffectColorMode::NewEnumerator0")) {
|
if(ImGui::RadioButton("Default##Default", weapon.effectColourMode == "enuWeaponEffectColorMode::NewEnumerator0")) {
|
||||||
|
|
Loading…
Reference in a new issue