Compare commits
2 commits
955ec010b8
...
82170b3078
Author | SHA1 | Date | |
---|---|---|---|
82170b3078 | |||
88abf91047 |
8 changed files with 223 additions and 189 deletions
|
@ -138,6 +138,7 @@ add_executable(MassBuilderSaveTool WIN32
|
|||
Maps/ArmourSets.h
|
||||
Maps/ArmourSlots.hpp
|
||||
Maps/DamageTypes.hpp
|
||||
Maps/EffectColourModes.hpp
|
||||
Maps/LastMissionId.h
|
||||
Maps/StoryProgress.h
|
||||
Maps/StyleNames.h
|
||||
|
|
20
src/Maps/EffectColourModes.hpp
Normal file
20
src/Maps/EffectColourModes.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
// 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(Default, "enuWeaponEffectColorMode::NewEnumerator0")
|
||||
c(Custom, "enuWeaponEffectColorMode::NewEnumerator1")
|
||||
#endif
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <Corrade/Containers/Array.h>
|
||||
#include <Corrade/Containers/StaticArray.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
@ -73,7 +74,6 @@ struct ArmourPart {
|
|||
ArmourSlot slot = ArmourSlot::Face;
|
||||
Int id = 0;
|
||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||
UnsignedInt demoDecals = 8;
|
||||
Containers::StaticArray<8, Decal> decals{ValueInit};
|
||||
Containers::StaticArray<8, Accessory> accessories{ValueInit};
|
||||
Containers::Array<Decal> decals;
|
||||
Containers::Array<Accessory> accessories;
|
||||
};
|
||||
|
|
|
@ -174,12 +174,9 @@ void Mass::refreshValues() {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!_demo)
|
||||
{
|
||||
getGlobalStyles();
|
||||
if(_state == State::Invalid) {
|
||||
return;
|
||||
}
|
||||
getGlobalStyles();
|
||||
if(_state == State::Invalid) {
|
||||
return;
|
||||
}
|
||||
|
||||
getTuning();
|
||||
|
@ -232,10 +229,6 @@ auto Mass::state() -> State {
|
|||
return _state;
|
||||
}
|
||||
|
||||
auto Mass::demo() const -> bool {
|
||||
return _demo;
|
||||
}
|
||||
|
||||
auto Mass::dirty() const -> bool {
|
||||
return _dirty;
|
||||
}
|
||||
|
@ -615,55 +608,53 @@ void Mass::getArmourParts() {
|
|||
return;
|
||||
}
|
||||
|
||||
if(decals_array->items.size() != part.decals.size()) {
|
||||
part.demoDecals = decals_array->items.size();
|
||||
_demo = true;
|
||||
}
|
||||
part.decals = Containers::Array<Decal>{decals_array->items.size()};
|
||||
|
||||
getDecals(part.decals, decals_array);
|
||||
|
||||
if(!_demo) {
|
||||
auto accs_array = part_prop->at<ArrayProperty>("Accessories_52_D902DD4241FA0050C2529596255153F3");
|
||||
if(!accs_array) {
|
||||
_demo = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(accs_array->items.size() != part.accessories.size()) {
|
||||
_state = State::Invalid;
|
||||
return;
|
||||
}
|
||||
|
||||
getAccessories(part.accessories, accs_array);
|
||||
auto accs_array = part_prop->at<ArrayProperty>("Accessories_52_D902DD4241FA0050C2529596255153F3");
|
||||
if(!accs_array) {
|
||||
part.accessories = Containers::Array<Accessory>{};
|
||||
continue;
|
||||
}
|
||||
|
||||
if(part.accessories.size() != accs_array->items.size()) {
|
||||
part.accessories = Containers::Array<Accessory>{accs_array->items.size()};
|
||||
}
|
||||
|
||||
getAccessories(part.accessories, accs_array);
|
||||
}
|
||||
}
|
||||
|
||||
auto Mass::writeArmourPart(UnsignedLong index) -> bool {
|
||||
if(index > _armour.parts.size()) {
|
||||
return false;
|
||||
}
|
||||
auto Mass::writeArmourPart(ArmourSlot slot) -> bool {
|
||||
auto& part = *std::find_if(_armour.parts.begin(), _armour.parts.end(), [&slot](const ArmourPart& part){ return slot == part.slot; });
|
||||
|
||||
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
||||
|
||||
auto armour_array = unit_data->at<ArrayProperty>("Armor_10_12E266C44116DDAF57E99ABB575A4B3C");
|
||||
|
||||
auto part_prop = armour_array->at<GenericStructProperty>(index);
|
||||
|
||||
auto& part = _armour.parts[index];
|
||||
|
||||
auto& armour_slot = part_prop->at<ByteProperty>("Slot_3_408BA56F4C9605C7E805CF91B642249C")->enumValue;
|
||||
switch(part.slot) {
|
||||
#define c(enumerator, strenum, name) case ArmourSlot::enumerator: \
|
||||
if((strenum) != armour_slot) { \
|
||||
_lastError = "Armour part slot doesn't match save file."; \
|
||||
return false; \
|
||||
} \
|
||||
const char* slot_str = nullptr;
|
||||
switch(slot) {
|
||||
#define c(enumerator, strenum, name) case ArmourSlot::enumerator: \
|
||||
slot_str = strenum; \
|
||||
break;
|
||||
#include "../Maps/ArmourSlots.hpp"
|
||||
#undef c
|
||||
}
|
||||
|
||||
GenericStructProperty* part_prop = nullptr;
|
||||
|
||||
for(UnsignedInt i = 0; i < armour_array->items.size(); i++) {
|
||||
part_prop = armour_array->at<GenericStructProperty>(i);
|
||||
if(slot_str != part_prop->at<StringProperty>("Slot_3_408BA56F4C9605C7E805CF91B642249C")->value) {
|
||||
part_prop = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if(!part_prop) {
|
||||
return false;
|
||||
}
|
||||
|
||||
part_prop->at<IntProperty>("ID_5_ACD101864D3481DE96EDACACC09BDD25")->value = part.id;
|
||||
|
||||
auto part_styles = part_prop->at<ArrayProperty>("Styles_47_3E31870441DFD7DB8BEE5C85C26B365B");
|
||||
|
@ -672,72 +663,11 @@ auto Mass::writeArmourPart(UnsignedLong index) -> bool {
|
|||
}
|
||||
|
||||
auto decals_array = part_prop->at<ArrayProperty>("Decals_42_F358794A4F18497970F56BA9627D3603");
|
||||
for(UnsignedInt i = 0; i < decals_array->items.size(); i++) {
|
||||
auto decal_prop = decals_array->at<GenericStructProperty>(i);
|
||||
auto& decal = part.decals[i];
|
||||
writeDecals(part.decals, decals_array);
|
||||
|
||||
decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9")->value = decal.id;
|
||||
auto colour_prop = decal_prop->at<ColourStructProperty>("Color_8_1B0B9D2B43DA6AAB9FA549B374D3E606");
|
||||
colour_prop->r = decal.colour.r();
|
||||
colour_prop->g = decal.colour.g();
|
||||
colour_prop->b = decal.colour.b();
|
||||
colour_prop->a = decal.colour.a();
|
||||
auto pos_prop = decal_prop->at<VectorStructProperty>("Position_41_022C8FE84E1AAFE587261E88F2C72250");
|
||||
pos_prop->x = decal.position.x();
|
||||
pos_prop->y = decal.position.y();
|
||||
pos_prop->z = decal.position.z();
|
||||
auto u_prop = decal_prop->at<VectorStructProperty>("UAxis_37_EBEB715F45491AECACCC07A1AE4646D1");
|
||||
u_prop->x = decal.uAxis.x();
|
||||
u_prop->y = decal.uAxis.y();
|
||||
u_prop->z = decal.uAxis.z();
|
||||
auto v_prop = decal_prop->at<VectorStructProperty>("VAxis_39_C31EB2664EE202CAECFBBB84100B5E35");
|
||||
v_prop->x = decal.vAxis.x();
|
||||
v_prop->y = decal.vAxis.y();
|
||||
v_prop->z = decal.vAxis.z();
|
||||
auto offset_prop = decal_prop->at<Vector2DStructProperty>("Offset_29_B02BBBB74FC60F5EDBEBAB8020738020");
|
||||
offset_prop->x = decal.offset.x();
|
||||
offset_prop->y = decal.offset.y();
|
||||
decal_prop->at<FloatProperty>("Scale_32_959D1C2747AFD8D62808468235CBBA40")->value = decal.scale;
|
||||
decal_prop->at<FloatProperty>("Rotation_27_12D7C314493D203D5C2326A03C5F910F")->value = decal.rotation;
|
||||
decal_prop->at<BoolProperty>("Flip_35_CECCFB184CCD9412BD93FE9A8B656BE1")->value = decal.flip;
|
||||
decal_prop->at<BoolProperty>("Wrap_43_A7C68CDF4A92AF2ECDA53F953EE7CA62")->value = decal.wrap;
|
||||
}
|
||||
|
||||
if(!_demo) {
|
||||
if(part.accessories.size() != 0) {
|
||||
auto accs_array = part_prop->at<ArrayProperty>("Accessories_52_D902DD4241FA0050C2529596255153F3");
|
||||
|
||||
for(UnsignedInt i = 0; i < accs_array->items.size(); i++) {
|
||||
auto acc_prop = accs_array->at<GenericStructProperty>(i);
|
||||
|
||||
auto& accessory = part.accessories[i];
|
||||
|
||||
acc_prop->at<IntProperty>("AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20")->value = accessory.attachIndex;
|
||||
acc_prop->at<IntProperty>("ID_4_5757B32647BAE263266259B8A7DFFFC1")->value = accessory.id;
|
||||
auto acc_styles = acc_prop->at<ArrayProperty>("Styles_7_91DEB0F24E24D13FC9472882C11D0DFD");
|
||||
for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) {
|
||||
acc_styles->at<IntProperty>(j)->value = accessory.styles[j];
|
||||
}
|
||||
auto rel_pos_prop = acc_prop->at<VectorStructProperty>("RelativePosition_14_BE8FB2A94074F34B3EDA6683B227D3A1");
|
||||
rel_pos_prop->x = accessory.relativePosition.x();
|
||||
rel_pos_prop->y = accessory.relativePosition.y();
|
||||
rel_pos_prop->z = accessory.relativePosition.z();
|
||||
auto rel_pos_offset_prop = acc_prop->at<VectorStructProperty>("RelativePositionOffset_15_98FD0CE74E44BBAFC2D46FB4CA4E0ED6");
|
||||
rel_pos_offset_prop->x = accessory.relativePositionOffset.x();
|
||||
rel_pos_offset_prop->y = accessory.relativePositionOffset.y();
|
||||
rel_pos_offset_prop->z = accessory.relativePositionOffset.z();
|
||||
auto rel_rot_prop = acc_prop->at<RotatorStructProperty>("RelativeRotation_20_C78C73274E6E78E7878F8C98ECA342C0");
|
||||
rel_rot_prop->x = accessory.relativeRotation.x();
|
||||
rel_rot_prop->y = accessory.relativeRotation.y();
|
||||
rel_rot_prop->z = accessory.relativeRotation.z();
|
||||
auto rel_rot_offset_prop = acc_prop->at<RotatorStructProperty>("RelativeRotationOffset_21_E07FA0EC46728B7BA763C6861249ABAA");
|
||||
rel_rot_offset_prop->x = accessory.relativeRotationOffset.x();
|
||||
rel_rot_offset_prop->y = accessory.relativeRotationOffset.y();
|
||||
rel_rot_offset_prop->z = accessory.relativeRotationOffset.z();
|
||||
auto local_scale_prop = acc_prop->at<VectorStructProperty>("LocalScale_24_DC2D93A742A41A46E7E61D988F15ED53");
|
||||
local_scale_prop->x = accessory.localScale.x();
|
||||
local_scale_prop->y = accessory.localScale.y();
|
||||
local_scale_prop->z = accessory.localScale.z();
|
||||
}
|
||||
writeAccessories(part.accessories, accs_array);
|
||||
}
|
||||
|
||||
return _mass->saveToFile();
|
||||
|
@ -873,12 +803,12 @@ void Mass::getGlobalStyles() {
|
|||
|
||||
auto global_styles = unit_data->at<ArrayProperty>("GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B");
|
||||
if(!global_styles) {
|
||||
_state = State::Invalid;
|
||||
_globalStyles = Containers::Array<CustomStyle>{0};
|
||||
return;
|
||||
}
|
||||
|
||||
if(global_styles->items.size() != _globalStyles.size()) {
|
||||
_state = State::Invalid;
|
||||
_globalStyles = Containers::Array<CustomStyle>{global_styles->items.size()};
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -946,6 +876,10 @@ auto Mass::techs() -> Containers::ArrayView<Int> {
|
|||
return _tuning.techIds;
|
||||
}
|
||||
|
||||
auto Mass::account() -> const std::string& {
|
||||
return _account;
|
||||
}
|
||||
|
||||
auto Mass::updateAccount(const std::string& new_account) -> bool {
|
||||
_account = new_account;
|
||||
|
||||
|
@ -1032,6 +966,39 @@ void Mass::getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_a
|
|||
}
|
||||
}
|
||||
|
||||
void Mass::writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array) {
|
||||
for(UnsignedInt i = 0; i < decal_array->items.size(); i++) {
|
||||
auto decal_prop = decal_array->at<GenericStructProperty>(i);
|
||||
auto& decal = decals[i];
|
||||
|
||||
decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9")->value = decal.id;
|
||||
auto colour_prop = decal_prop->at<ColourStructProperty>("Color_8_1B0B9D2B43DA6AAB9FA549B374D3E606");
|
||||
colour_prop->r = decal.colour.r();
|
||||
colour_prop->g = decal.colour.g();
|
||||
colour_prop->b = decal.colour.b();
|
||||
colour_prop->a = decal.colour.a();
|
||||
auto pos_prop = decal_prop->at<VectorStructProperty>("Position_41_022C8FE84E1AAFE587261E88F2C72250");
|
||||
pos_prop->x = decal.position.x();
|
||||
pos_prop->y = decal.position.y();
|
||||
pos_prop->z = decal.position.z();
|
||||
auto u_prop = decal_prop->at<VectorStructProperty>("UAxis_37_EBEB715F45491AECACCC07A1AE4646D1");
|
||||
u_prop->x = decal.uAxis.x();
|
||||
u_prop->y = decal.uAxis.y();
|
||||
u_prop->z = decal.uAxis.z();
|
||||
auto v_prop = decal_prop->at<VectorStructProperty>("VAxis_39_C31EB2664EE202CAECFBBB84100B5E35");
|
||||
v_prop->x = decal.vAxis.x();
|
||||
v_prop->y = decal.vAxis.y();
|
||||
v_prop->z = decal.vAxis.z();
|
||||
auto offset_prop = decal_prop->at<Vector2DStructProperty>("Offset_29_B02BBBB74FC60F5EDBEBAB8020738020");
|
||||
offset_prop->x = decal.offset.x();
|
||||
offset_prop->y = decal.offset.y();
|
||||
decal_prop->at<FloatProperty>("Scale_32_959D1C2747AFD8D62808468235CBBA40")->value = decal.scale;
|
||||
decal_prop->at<FloatProperty>("Rotation_27_12D7C314493D203D5C2326A03C5F910F")->value = decal.rotation;
|
||||
decal_prop->at<BoolProperty>("Flip_35_CECCFB184CCD9412BD93FE9A8B656BE1")->value = decal.flip;
|
||||
decal_prop->at<BoolProperty>("Wrap_43_A7C68CDF4A92AF2ECDA53F953EE7CA62")->value = decal.wrap;
|
||||
}
|
||||
}
|
||||
|
||||
void Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accessory_array) {
|
||||
for(UnsignedInt i = 0; i < accessory_array->items.size(); i++) {
|
||||
auto acc_prop = accessory_array->at<GenericStructProperty>(i);
|
||||
|
@ -1056,6 +1023,40 @@ void Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayPro
|
|||
}
|
||||
}
|
||||
|
||||
void Mass::writeAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accs_array) {
|
||||
for(UnsignedInt i = 0; i < accs_array->items.size(); i++) {
|
||||
auto acc_prop = accs_array->at<GenericStructProperty>(i);
|
||||
auto& accessory = accessories[i];
|
||||
|
||||
acc_prop->at<IntProperty>("AttachIndex_2_4AFCF6024E4BA7426C6B9F80B8179D20")->value = accessory.attachIndex;
|
||||
acc_prop->at<IntProperty>("ID_4_5757B32647BAE263266259B8A7DFFFC1")->value = accessory.id;
|
||||
auto acc_styles = acc_prop->at<ArrayProperty>("Styles_7_91DEB0F24E24D13FC9472882C11D0DFD");
|
||||
for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) {
|
||||
acc_styles->at<IntProperty>(j)->value = accessory.styles[j];
|
||||
}
|
||||
auto rel_pos_prop = acc_prop->at<VectorStructProperty>("RelativePosition_14_BE8FB2A94074F34B3EDA6683B227D3A1");
|
||||
rel_pos_prop->x = accessory.relativePosition.x();
|
||||
rel_pos_prop->y = accessory.relativePosition.y();
|
||||
rel_pos_prop->z = accessory.relativePosition.z();
|
||||
auto rel_pos_offset_prop = acc_prop->at<VectorStructProperty>("RelativePositionOffset_15_98FD0CE74E44BBAFC2D46FB4CA4E0ED6");
|
||||
rel_pos_offset_prop->x = accessory.relativePositionOffset.x();
|
||||
rel_pos_offset_prop->y = accessory.relativePositionOffset.y();
|
||||
rel_pos_offset_prop->z = accessory.relativePositionOffset.z();
|
||||
auto rel_rot_prop = acc_prop->at<RotatorStructProperty>("RelativeRotation_20_C78C73274E6E78E7878F8C98ECA342C0");
|
||||
rel_rot_prop->x = accessory.relativeRotation.x();
|
||||
rel_rot_prop->y = accessory.relativeRotation.y();
|
||||
rel_rot_prop->z = accessory.relativeRotation.z();
|
||||
auto rel_rot_offset_prop = acc_prop->at<RotatorStructProperty>("RelativeRotationOffset_21_E07FA0EC46728B7BA763C6861249ABAA");
|
||||
rel_rot_offset_prop->x = accessory.relativeRotationOffset.x();
|
||||
rel_rot_offset_prop->y = accessory.relativeRotationOffset.y();
|
||||
rel_rot_offset_prop->z = accessory.relativeRotationOffset.z();
|
||||
auto local_scale_prop = acc_prop->at<VectorStructProperty>("LocalScale_24_DC2D93A742A41A46E7E61D988F15ED53");
|
||||
local_scale_prop->x = accessory.localScale.x();
|
||||
local_scale_prop->y = accessory.localScale.y();
|
||||
local_scale_prop->z = accessory.localScale.z();
|
||||
}
|
||||
}
|
||||
|
||||
void Mass::getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array) {
|
||||
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
||||
if(!unit_data) {
|
||||
|
@ -1104,26 +1105,21 @@ void Mass::getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> we
|
|||
|
||||
auto part_decals = part_prop->at<ArrayProperty>("Decals_13_8B81112B453D7230C0CDE982185E14F1");
|
||||
if(part_decals->items.size() != part.decals.size()) {
|
||||
_demo = true;
|
||||
part.demoDecals = part_decals->items.size();
|
||||
part.decals = Containers::Array<Decal>{part_decals->items.size()};
|
||||
}
|
||||
|
||||
getDecals(part.decals, part_decals);
|
||||
|
||||
if(!_demo) {
|
||||
auto part_accs = part_prop->at<ArrayProperty>("Accessories_21_3878DE8B4ED0EA0DB725E98BCDC20E0C");
|
||||
if(!part_accs) {
|
||||
_demo = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(part_accs->items.size() != part.accessories.size()) {
|
||||
_state = State::Invalid;
|
||||
return;
|
||||
}
|
||||
|
||||
getAccessories(part.accessories, part_accs);
|
||||
auto part_accs = part_prop->at<ArrayProperty>("Accessories_21_3878DE8B4ED0EA0DB725E98BCDC20E0C");
|
||||
if(!part_accs) {
|
||||
part.accessories = Containers::Array<Accessory>{0};
|
||||
continue;
|
||||
}
|
||||
|
||||
if(part_accs->items.size() != part.accessories.size()) {
|
||||
part.accessories = Containers::Array<Accessory>{part_accs->items.size()};
|
||||
}
|
||||
getAccessories(part.accessories, part_accs);
|
||||
}
|
||||
|
||||
auto custom_styles = weapon_prop->at<ArrayProperty>("Styles_10_8C3C82444B986AD7A99595AD4985912D");
|
||||
|
@ -1149,7 +1145,14 @@ void Mass::getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> we
|
|||
Utility::Warning{} << "Invalid damage type enum value in getWeaponType().";
|
||||
}
|
||||
weapon.dualWield = weapon_prop->at<BoolProperty>("DualWield_20_B2EB2CEA4A6A233DC7575996B6DD1222")->value;
|
||||
weapon.effectColourMode = weapon_prop->at<ByteProperty>("ColorEfxMode_24_D254BCF943E852BF9ADB8AAA8FD80014")->enumValue;
|
||||
auto& effect_colour_mode = weapon_prop->at<ByteProperty>("ColorEfxMode_24_D254BCF943E852BF9ADB8AAA8FD80014")->enumValue;
|
||||
#define c(enumerator, strenum) if(effect_colour_mode == (strenum)) { weapon.effectColourMode = EffectColourMode::enumerator; } else
|
||||
#include "../Maps/EffectColourModes.hpp"
|
||||
#undef c
|
||||
{
|
||||
_state = State::Invalid;
|
||||
Utility::Warning{} << "Invalid effect colour mode in getWeaponType().";
|
||||
}
|
||||
auto effect_colour = weapon_prop->at<ColourStructProperty>("ColorEfx_26_D921B62946C493E487455A831F4520AC");
|
||||
weapon.effectColour = Color4{effect_colour->r, effect_colour->g, effect_colour->b, effect_colour->a};
|
||||
}
|
||||
|
@ -1204,51 +1207,19 @@ auto Mass::writeWeaponType(const char* prop_name, Containers::ArrayView<Weapon>
|
|||
}
|
||||
|
||||
auto part_decals = part_prop->at<ArrayProperty>("Decals_13_8B81112B453D7230C0CDE982185E14F1");
|
||||
for(UnsignedInt k = 0; k < part_decals->items.size(); k++) {
|
||||
auto decal_prop = part_decals->at<GenericStructProperty>(k);
|
||||
auto& decal = part.decals[k];
|
||||
writeDecals(part.decals, part_decals);
|
||||
|
||||
decal_prop->at<IntProperty>("ID_3_694C0B35404D8A3168AEC89026BC8CF9")->value = decal.id;
|
||||
auto colour_prop = decal_prop->at<ColourStructProperty>("Color_8_1B0B9D2B43DA6AAB9FA549B374D3E606");
|
||||
colour_prop->r = decal.colour.r();
|
||||
colour_prop->g = decal.colour.g();
|
||||
colour_prop->b = decal.colour.b();
|
||||
colour_prop->a = decal.colour.a();
|
||||
auto pos_prop = decal_prop->at<VectorStructProperty>("Position_41_022C8FE84E1AAFE587261E88F2C72250");
|
||||
pos_prop->x = decal.position.x();
|
||||
pos_prop->y = decal.position.y();
|
||||
pos_prop->z = decal.position.z();
|
||||
auto u_prop = decal_prop->at<VectorStructProperty>("UAxis_37_EBEB715F45491AECACCC07A1AE4646D1");
|
||||
u_prop->x = decal.uAxis.x();
|
||||
u_prop->y = decal.uAxis.y();
|
||||
u_prop->z = decal.uAxis.z();
|
||||
auto v_prop = decal_prop->at<VectorStructProperty>("VAxis_39_C31EB2664EE202CAECFBBB84100B5E35");
|
||||
v_prop->x = decal.vAxis.x();
|
||||
v_prop->y = decal.vAxis.y();
|
||||
v_prop->z = decal.vAxis.z();
|
||||
auto offset_prop = decal_prop->at<Vector2DStructProperty>("Offset_29_B02BBBB74FC60F5EDBEBAB8020738020");
|
||||
offset_prop->x = decal.offset.x();
|
||||
offset_prop->y = decal.offset.y();
|
||||
decal_prop->at<FloatProperty>("Scale_32_959D1C2747AFD8D62808468235CBBA40")->value = decal.scale;
|
||||
decal_prop->at<FloatProperty>("Rotation_27_12D7C314493D203D5C2326A03C5F910F")->value = decal.rotation;
|
||||
decal_prop->at<BoolProperty>("Flip_35_CECCFB184CCD9412BD93FE9A8B656BE1")->value = decal.flip;
|
||||
decal_prop->at<BoolProperty>("Wrap_43_A7C68CDF4A92AF2ECDA53F953EE7CA62")->value = decal.wrap;
|
||||
auto part_accs = part_prop->at<ArrayProperty>("Accessories_21_3878DE8B4ED0EA0DB725E98BCDC20E0C");
|
||||
if(!part_accs) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!_demo) {
|
||||
auto part_accs = part_prop->at<ArrayProperty>("Accessories_21_3878DE8B4ED0EA0DB725E98BCDC20E0C");
|
||||
if(!part_accs) {
|
||||
_demo = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(part_accs->items.size() != part.accessories.size()) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
getAccessories(part.accessories, part_accs);
|
||||
if(part_accs->items.size() != part.accessories.size()) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
writeAccessories(part.accessories, part_accs);
|
||||
}
|
||||
|
||||
auto custom_styles = weapon_prop->at<ArrayProperty>("Styles_10_8C3C82444B986AD7A99595AD4985912D");
|
||||
|
@ -1275,7 +1246,13 @@ auto Mass::writeWeaponType(const char* prop_name, Containers::ArrayView<Weapon>
|
|||
Utility::Warning{} << "Invalid damage type enum value in writeWeaponType().";
|
||||
}
|
||||
weapon_prop->at<BoolProperty>("DualWield_20_B2EB2CEA4A6A233DC7575996B6DD1222")->value = weapon.dualWield;
|
||||
weapon_prop->at<ByteProperty>("ColorEfxMode_24_D254BCF943E852BF9ADB8AAA8FD80014")->enumValue = weapon.effectColourMode;
|
||||
switch(weapon.effectColourMode) {
|
||||
#define c(enumerator, enumstr) case EffectColourMode::enumerator: \
|
||||
weapon_prop->at<ByteProperty>("ColorEfxMode_24_D254BCF943E852BF9ADB8AAA8FD80014")->enumValue = enumstr; \
|
||||
break;
|
||||
#include "../Maps/EffectColourModes.hpp"
|
||||
#undef c
|
||||
}
|
||||
auto effect_colour = weapon_prop->at<ColourStructProperty>("ColorEfx_26_D921B62946C493E487455A831F4520AC");
|
||||
effect_colour->r = weapon.effectColour.r();
|
||||
effect_colour->g = weapon.effectColour.g();
|
||||
|
|
|
@ -69,8 +69,6 @@ class Mass {
|
|||
|
||||
auto state() -> State;
|
||||
|
||||
auto demo() const -> bool;
|
||||
|
||||
auto dirty() const -> bool;
|
||||
void setDirty(bool dirty = true);
|
||||
|
||||
|
@ -92,7 +90,7 @@ class Mass {
|
|||
|
||||
auto armourParts() -> Containers::ArrayView<ArmourPart>;
|
||||
void getArmourParts();
|
||||
auto writeArmourPart(UnsignedLong index) -> bool;
|
||||
auto writeArmourPart(ArmourSlot slot) -> bool;
|
||||
|
||||
auto armourCustomStyles() -> Containers::ArrayView<CustomStyle>;
|
||||
void getArmourCustomStyles();
|
||||
|
@ -145,7 +143,10 @@ class Mass {
|
|||
auto setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool;
|
||||
|
||||
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(const char* prop_name, Containers::ArrayView<Weapon> weapon_array);
|
||||
auto writeWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array) -> bool;
|
||||
|
@ -160,7 +161,6 @@ class Mass {
|
|||
std::string _folder;
|
||||
std::string _filename;
|
||||
State _state = State::Empty;
|
||||
bool _demo = false;
|
||||
|
||||
bool _dirty = false;
|
||||
|
||||
|
@ -191,7 +191,7 @@ class Mass {
|
|||
Containers::StaticArray<4, Weapon> energyLaunchers;
|
||||
} _weapons;
|
||||
|
||||
Containers::StaticArray<16, CustomStyle> _globalStyles;
|
||||
Containers::Array<CustomStyle> _globalStyles;
|
||||
|
||||
struct {
|
||||
Int engineId;
|
||||
|
|
|
@ -48,6 +48,11 @@ enum class DamageType {
|
|||
Shock = 4,
|
||||
};
|
||||
|
||||
enum class EffectColourMode {
|
||||
Default = 0,
|
||||
Custom = 1,
|
||||
};
|
||||
|
||||
struct Weapon {
|
||||
Weapon() = default;
|
||||
|
||||
|
@ -64,6 +69,6 @@ struct Weapon {
|
|||
bool attached = false;
|
||||
DamageType damageType = DamageType::Physical;
|
||||
bool dualWield = false;
|
||||
std::string effectColourMode;
|
||||
EffectColourMode effectColourMode = EffectColourMode::Default;
|
||||
Color4 effectColour{0.0f};
|
||||
};
|
||||
|
|
|
@ -16,6 +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/Array.h>
|
||||
#include <Corrade/Containers/StaticArray.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
@ -27,9 +28,39 @@ using namespace Corrade;
|
|||
using namespace Magnum;
|
||||
|
||||
struct WeaponPart {
|
||||
WeaponPart() = default;
|
||||
|
||||
WeaponPart(const WeaponPart& other) {
|
||||
id = other.id;
|
||||
styles = other.styles;
|
||||
decals = Containers::Array<Decal>{other.decals.size()};
|
||||
for(UnsignedInt i = 0; i < decals.size(); i++) {
|
||||
decals[i] = other.decals[i];
|
||||
}
|
||||
accessories = Containers::Array<Accessory>{other.accessories.size()};
|
||||
for(UnsignedInt i = 0; i < accessories.size(); i++) {
|
||||
accessories[i] = other.accessories[i];
|
||||
}
|
||||
}
|
||||
WeaponPart& operator=(const WeaponPart& other) {
|
||||
id = other.id;
|
||||
styles = other.styles;
|
||||
decals = Containers::Array<Decal>{other.decals.size()};
|
||||
for(UnsignedInt i = 0; i < decals.size(); i++) {
|
||||
decals[i] = other.decals[i];
|
||||
}
|
||||
accessories = Containers::Array<Accessory>{other.accessories.size()};
|
||||
for(UnsignedInt i = 0; i < accessories.size(); i++) {
|
||||
accessories[i] = other.accessories[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
WeaponPart(WeaponPart&& other) = default;
|
||||
WeaponPart& operator=(WeaponPart&& other) = default;
|
||||
|
||||
Int id = 0;
|
||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||
UnsignedInt demoDecals = 8;
|
||||
Containers::StaticArray<8, Decal> decals{ValueInit};
|
||||
Containers::StaticArray<8, Accessory> accessories{ValueInit};
|
||||
Containers::Array<Decal> decals{};
|
||||
Containers::Array<Accessory> accessories{};
|
||||
};
|
||||
|
|
|
@ -133,7 +133,7 @@ void SaveTool::drawMassViewer() {
|
|||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if(!_currentMass->demo() && ImGui::BeginTabItem("Global styles")) {
|
||||
if(!_currentMass->globalStyles().size() != 0 && ImGui::BeginTabItem("Global styles")) {
|
||||
drawGlobalStyles();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ void SaveTool::drawArmour() {
|
|||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::TextUnformatted("Showing/editing decal");
|
||||
for(UnsignedLong j = 0; j < part.demoDecals; j++) {
|
||||
for(UnsignedLong j = 0; j < part.decals.size(); j++) {
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(std::to_string(j + 1).c_str(), &_selectedArmourDecals[i], j);
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ void SaveTool::drawArmour() {
|
|||
|
||||
ImGui::PopID();
|
||||
|
||||
if(!_currentMass->demo()) {
|
||||
if(!part.accessories.size()) {
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::PushID("Accessory");
|
||||
|
@ -576,7 +576,7 @@ void SaveTool::drawArmour() {
|
|||
ImGui::Separator();
|
||||
|
||||
if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) {
|
||||
_currentMass->writeArmourPart(i);
|
||||
_currentMass->writeArmourPart(part.slot);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -947,15 +947,15 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
if(weapon.type == WeaponType::Melee) {
|
||||
ImGui::Checkbox("##DualWield", &weapon.dualWield);
|
||||
|
||||
if(ImGui::RadioButton("Default##Default", weapon.effectColourMode == "enuWeaponEffectColorMode::NewEnumerator0")) {
|
||||
weapon.effectColourMode = "enuWeaponEffectColorMode::NewEnumerator0";
|
||||
if(ImGui::RadioButton("Default##Default", weapon.effectColourMode == EffectColourMode::Default)) {
|
||||
weapon.effectColourMode = EffectColourMode::Default;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if(ImGui::RadioButton("Custom##Custom", weapon.effectColourMode == "enuWeaponEffectColorMode::NewEnumerator1")) {
|
||||
weapon.effectColourMode = "enuWeaponEffectColorMode::NewEnumerator1";
|
||||
if(ImGui::RadioButton("Custom##Custom", weapon.effectColourMode == EffectColourMode::Custom)) {
|
||||
weapon.effectColourMode = EffectColourMode::Custom;
|
||||
}
|
||||
|
||||
bool custom_effect = (weapon.effectColourMode == "enuWeaponEffectColorMode::NewEnumerator1");
|
||||
bool custom_effect = (weapon.effectColourMode == EffectColourMode::Custom);
|
||||
if(!custom_effect) {
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
|
@ -1016,7 +1016,7 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::TextUnformatted("Showing/editing decal");
|
||||
for(UnsignedLong i = 0; i < part.demoDecals; i++) {
|
||||
for(UnsignedLong i = 0; i < part.decals.size(); i++) {
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(std::to_string(i + 1).c_str(), &_selectedWeaponDecal, i);
|
||||
}
|
||||
|
@ -1025,7 +1025,7 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
|
||||
ImGui::PopID();
|
||||
|
||||
if(_currentMass->demo() == false) {
|
||||
if(part.accessories.size() != 0) {
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::PushID("Accessory");
|
||||
|
|
Loading…
Reference in a new issue