Mass: change how setCustomStyle() works.
This'll allow usage with weapon styles.
This commit is contained in:
parent
83fe02a8dc
commit
d79debe69f
2 changed files with 45 additions and 15 deletions
|
@ -558,7 +558,19 @@ auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
return setCustomStyle(_frame.customStyles[index], index, "FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA");
|
||||
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
||||
if(!unit_data) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto frame_styles = unit_data->at<ArrayProperty>("FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA");
|
||||
if(!frame_styles) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
return setCustomStyle(_frame.customStyles[index], index, frame_styles);
|
||||
}
|
||||
|
||||
auto Mass::armourParts() -> Containers::StaticArrayView<38, ArmourPart> {
|
||||
|
@ -823,7 +835,19 @@ auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
return setCustomStyle(_armour.customStyles[index], index, "ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E");
|
||||
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
||||
if(!unit_data) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto armour_styles = unit_data->at<ArrayProperty>("ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E");
|
||||
if(!armour_styles) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
return setCustomStyle(_armour.customStyles[index], index, armour_styles);
|
||||
}
|
||||
|
||||
auto Mass::meleeWeapons() -> Containers::StaticArrayView<8, Weapon> {
|
||||
|
@ -926,7 +950,19 @@ auto Mass::writeGlobalStyle(UnsignedLong index) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
return setCustomStyle(_globalStyles[index], index, "GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B");
|
||||
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
||||
if(!unit_data) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto global_styles = unit_data->at<ArrayProperty>("GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B");
|
||||
if(!global_styles) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
return setCustomStyle(_globalStyles[index], index, global_styles);
|
||||
}
|
||||
|
||||
auto Mass::updateSteamId(const std::string& steam_id) -> bool {
|
||||
|
@ -943,20 +979,12 @@ auto Mass::updateSteamId(const std::string& steam_id) -> bool {
|
|||
return _mass->saveToFile();
|
||||
}
|
||||
|
||||
auto Mass::setCustomStyle(const CustomStyle& style, UnsignedLong index, const char* prop_name) -> bool {
|
||||
auto unit_data = _mass->at<GenericStructProperty>("UnitData");
|
||||
if(!unit_data) {
|
||||
_state = State::Invalid;
|
||||
auto Mass::setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool {
|
||||
if(!style_array) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto frame_styles = unit_data->at<ArrayProperty>(prop_name);
|
||||
if(!frame_styles) {
|
||||
_state = State::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto style_prop = frame_styles->at<GenericStructProperty>(index);
|
||||
auto style_prop = style_array->at<GenericStructProperty>(index);
|
||||
|
||||
style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value = style.name;
|
||||
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct ArrayProperty;
|
||||
|
||||
struct Joints {
|
||||
Float neck = 0.0f;
|
||||
Float body = 0.0f;
|
||||
|
@ -197,7 +199,7 @@ class Mass {
|
|||
auto updateSteamId(const std::string& steam_id) -> bool;
|
||||
|
||||
private:
|
||||
auto setCustomStyle(const CustomStyle& style, UnsignedLong index, const char* prop_name) -> bool;
|
||||
auto setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool;
|
||||
|
||||
void getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array);
|
||||
|
||||
|
|
Loading…
Reference in a new issue