Compare commits

...

2 commits

2 changed files with 54 additions and 96 deletions

View file

@ -386,7 +386,7 @@ auto Mass::writeJointSliders() -> bool {
return true; return true;
} }
auto Mass::frameStyles() -> Containers::StaticArrayView<4, Int> { auto Mass::frameStyles() -> Containers::ArrayView<Int> {
return _frame.styles; return _frame.styles;
} }
@ -409,12 +409,12 @@ void Mass::getFrameStyles() {
return; return;
} }
if(frame_styles->items.size() != 4) { if(frame_styles->items.size() != _frame.styles.size()) {
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
for(UnsignedInt i = 0; i < 4; i++) { for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) {
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value; _frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
} }
} }
@ -506,7 +506,7 @@ auto Mass::writeEyeFlareColour() -> bool {
return _mass->saveToFile(); return _mass->saveToFile();
} }
auto Mass::frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> { auto Mass::frameCustomStyles() -> Containers::ArrayView<CustomStyle> {
return _frame.customStyles; return _frame.customStyles;
} }
@ -523,34 +523,12 @@ void Mass::getFrameCustomStyles() {
return; return;
} }
if(frame_styles->items.size() != 16) { if(frame_styles->items.size() != _frame.customStyles.size()) {
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) { getCustomStyles(_frame.customStyles, frame_styles);
auto style_prop = frame_styles->at<GenericStructProperty>(i);
CustomStyle style;
style.name = style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
style.metallic = style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value;
style.gloss = style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value;
style.glow = colour_prop->a == 0.0f ? false : true;
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value;
style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value
};
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value;
_frame.customStyles[i] = std::move(style);
}
} }
auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool { auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool {
@ -573,7 +551,7 @@ auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool {
return setCustomStyle(_frame.customStyles[index], index, frame_styles); return setCustomStyle(_frame.customStyles[index], index, frame_styles);
} }
auto Mass::armourParts() -> Containers::StaticArrayView<38, ArmourPart> { auto Mass::armourParts() -> Containers::ArrayView<ArmourPart> {
return _armour.parts; return _armour.parts;
} }
@ -783,7 +761,7 @@ auto Mass::writeArmourPart(UnsignedLong index) -> bool {
return _mass->saveToFile(); return _mass->saveToFile();
} }
auto Mass::armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> { auto Mass::armourCustomStyles() -> Containers::ArrayView<CustomStyle> {
return _armour.customStyles; return _armour.customStyles;
} }
@ -800,34 +778,12 @@ void Mass::getArmourCustomStyles() {
return; return;
} }
if(armour_styles->items.size() != 16) { if(armour_styles->items.size() != _armour.customStyles.size()) {
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
for(UnsignedInt i = 0; i < armour_styles->items.size(); i++) { getCustomStyles(_armour.customStyles, armour_styles);
auto style_prop = armour_styles->at<GenericStructProperty>(i);
CustomStyle style;
style.name = style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
style.metallic = style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value;
style.gloss = style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value;
style.glow = colour_prop->a == 0.0f ? false : true;
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value;
style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value
};
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value;
_armour.customStyles[i] = std::move(style);
}
} }
auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool { auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool {
@ -850,7 +806,7 @@ auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool {
return setCustomStyle(_armour.customStyles[index], index, armour_styles); return setCustomStyle(_armour.customStyles[index], index, armour_styles);
} }
auto Mass::meleeWeapons() -> Containers::StaticArrayView<8, Weapon> { auto Mass::meleeWeapons() -> Containers::ArrayView<Weapon> {
return _weapons.melee; return _weapons.melee;
} }
@ -858,7 +814,7 @@ void Mass::getMeleeWeapons() {
getWeaponType("WeaponCC_22_0BBEC58C4A0EA1DB9E037B9339EE26A7", _weapons.melee); getWeaponType("WeaponCC_22_0BBEC58C4A0EA1DB9E037B9339EE26A7", _weapons.melee);
} }
auto Mass::shields() -> Containers::StaticArrayView<1, Weapon> { auto Mass::shields() -> Containers::ArrayView<Weapon> {
return _weapons.shields; return _weapons.shields;
} }
@ -866,7 +822,7 @@ void Mass::getShields() {
getWeaponType("Shield_53_839BFD7945481BAEA3E43A9C5CA8E92E", _weapons.shields); getWeaponType("Shield_53_839BFD7945481BAEA3E43A9C5CA8E92E", _weapons.shields);
} }
auto Mass::bulletShooters() -> Containers::StaticArrayView<4, Weapon> { auto Mass::bulletShooters() -> Containers::ArrayView<Weapon> {
return _weapons.bulletShooters; return _weapons.bulletShooters;
} }
@ -874,7 +830,7 @@ void Mass::getBulletShooters() {
getWeaponType("WeaponBS_35_6EF6E0104FD7A138DF47F88CB57A83ED", _weapons.bulletShooters); getWeaponType("WeaponBS_35_6EF6E0104FD7A138DF47F88CB57A83ED", _weapons.bulletShooters);
} }
auto Mass::energyShooters() -> Containers::StaticArrayView<4, Weapon> { auto Mass::energyShooters() -> Containers::ArrayView<Weapon> {
return _weapons.energyShooters; return _weapons.energyShooters;
} }
@ -882,7 +838,7 @@ void Mass::getEnergyShooters() {
getWeaponType("WeaponES_37_1A295D544528623880A0B1AC2C7DEE99", _weapons.energyShooters); getWeaponType("WeaponES_37_1A295D544528623880A0B1AC2C7DEE99", _weapons.energyShooters);
} }
auto Mass::bulletLaunchers() -> Containers::StaticArrayView<4, Weapon> { auto Mass::bulletLaunchers() -> Containers::ArrayView<Weapon> {
return _weapons.bulletLaunchers; return _weapons.bulletLaunchers;
} }
@ -890,7 +846,7 @@ void Mass::getBulletLaunchers() {
getWeaponType("WeaponBL_36_5FD7C41E4613A75B44AB0E90B362846E", _weapons.bulletLaunchers); getWeaponType("WeaponBL_36_5FD7C41E4613A75B44AB0E90B362846E", _weapons.bulletLaunchers);
} }
auto Mass::energyLaunchers() -> Containers::StaticArrayView<4, Weapon> { auto Mass::energyLaunchers() -> Containers::ArrayView<Weapon> {
return _weapons.energyLaunchers; return _weapons.energyLaunchers;
} }
@ -898,7 +854,7 @@ void Mass::getEnergyLaunchers() {
getWeaponType("WeaponEL_38_9D23F3884ACA15902C9E6CA6E4995995", _weapons.energyLaunchers); getWeaponType("WeaponEL_38_9D23F3884ACA15902C9E6CA6E4995995", _weapons.energyLaunchers);
} }
auto Mass::globalStyles() -> Containers::StaticArrayView<16, CustomStyle> { auto Mass::globalStyles() -> Containers::ArrayView<CustomStyle> {
return _globalStyles; return _globalStyles;
} }
@ -915,34 +871,12 @@ void Mass::getGlobalStyles() {
return; return;
} }
if(global_styles->items.size() != 16) { if(global_styles->items.size() != _globalStyles.size()) {
_state = State::Invalid; _state = State::Invalid;
return; return;
} }
for(UnsignedInt i = 0; i < global_styles->items.size(); i++) { getCustomStyles(_globalStyles, global_styles);
auto style_prop = global_styles->at<GenericStructProperty>(i);
CustomStyle style;
style.name = style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
style.metallic = style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value;
style.gloss = style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value;
style.glow = colour_prop->a == 0.0f ? false : true;
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value;
style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value
};
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value;
_globalStyles[i] = std::move(style);
}
} }
auto Mass::writeGlobalStyle(UnsignedLong index) -> bool { auto Mass::writeGlobalStyle(UnsignedLong index) -> bool {
@ -979,6 +913,29 @@ auto Mass::updateSteamId(const std::string& steam_id) -> bool {
return _mass->saveToFile(); return _mass->saveToFile();
} }
void Mass::getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayProperty* style_array) {
for(UnsignedInt i = 0; i < style_array->items.size(); i++) {
auto style_prop = style_array->at<GenericStructProperty>(i);
auto& style = styles[i];
style.name = style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value;
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a};
style.metallic = style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value;
style.gloss = style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value;
style.glow = colour_prop->a == 0.0f ? false : true;
style.patternId = style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value;
style.opacity = style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value;
style.offset = Vector2{
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value,
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value
};
style.rotation = style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value;
style.scale = style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value;
}
}
auto Mass::setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool { auto Mass::setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool {
if(!style_array) { if(!style_array) {
return false; return false;

View file

@ -148,7 +148,7 @@ class Mass {
void getJointSliders(); void getJointSliders();
auto writeJointSliders() -> bool; auto writeJointSliders() -> bool;
auto frameStyles() -> Containers::StaticArrayView<4, Int>; auto frameStyles() -> Containers::ArrayView<Int>;
void getFrameStyles(); void getFrameStyles();
auto writeFrameStyles() -> bool; auto writeFrameStyles() -> bool;
@ -156,49 +156,50 @@ class Mass {
void getEyeFlareColour(); void getEyeFlareColour();
auto writeEyeFlareColour() -> bool; auto writeEyeFlareColour() -> bool;
auto frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle>; auto frameCustomStyles() -> Containers::ArrayView<CustomStyle>;
void getFrameCustomStyles(); void getFrameCustomStyles();
auto writeFrameCustomStyle(UnsignedLong index) -> bool; auto writeFrameCustomStyle(UnsignedLong index) -> bool;
auto armourParts() -> Containers::StaticArrayView<38, ArmourPart>; auto armourParts() -> Containers::ArrayView<ArmourPart>;
void getArmourParts(); void getArmourParts();
auto writeArmourPart(UnsignedLong index) -> bool; auto writeArmourPart(UnsignedLong index) -> bool;
auto armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle>; auto armourCustomStyles() -> Containers::ArrayView<CustomStyle>;
void getArmourCustomStyles(); void getArmourCustomStyles();
auto writeArmourCustomStyle(UnsignedLong index) -> bool; auto writeArmourCustomStyle(UnsignedLong index) -> bool;
auto meleeWeapons() -> Containers::StaticArrayView<8, Weapon>; auto meleeWeapons() -> Containers::ArrayView<Weapon>;
void getMeleeWeapons(); void getMeleeWeapons();
auto writeMeleeWeapons() -> bool; auto writeMeleeWeapons() -> bool;
auto shields() -> Containers::StaticArrayView<1, Weapon>; auto shields() -> Containers::ArrayView<Weapon>;
void getShields(); void getShields();
auto writeShields() -> bool; auto writeShields() -> bool;
auto bulletShooters() -> Containers::StaticArrayView<4, Weapon>; auto bulletShooters() -> Containers::ArrayView<Weapon>;
void getBulletShooters(); void getBulletShooters();
auto writeBulletShooters() -> bool; auto writeBulletShooters() -> bool;
auto energyShooters() -> Containers::StaticArrayView<4, Weapon>; auto energyShooters() -> Containers::ArrayView<Weapon>;
void getEnergyShooters(); void getEnergyShooters();
auto writeEnergyShooters() -> bool; auto writeEnergyShooters() -> bool;
auto bulletLaunchers() -> Containers::StaticArrayView<4, Weapon>; auto bulletLaunchers() -> Containers::ArrayView<Weapon>;
void getBulletLaunchers(); void getBulletLaunchers();
auto writeBulletLaunchers() -> bool; auto writeBulletLaunchers() -> bool;
auto energyLaunchers() -> Containers::StaticArrayView<4, Weapon>; auto energyLaunchers() -> Containers::ArrayView<Weapon>;
void getEnergyLaunchers(); void getEnergyLaunchers();
auto writeEnergyLaunchers() -> bool; auto writeEnergyLaunchers() -> bool;
auto globalStyles() -> Containers::StaticArrayView<16, CustomStyle>; auto globalStyles() -> Containers::ArrayView<CustomStyle>;
void getGlobalStyles(); void getGlobalStyles();
auto writeGlobalStyle(UnsignedLong index) -> bool; auto writeGlobalStyle(UnsignedLong index) -> bool;
auto updateSteamId(const std::string& steam_id) -> bool; auto updateSteamId(const std::string& steam_id) -> bool;
private: private:
void getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayProperty* style_array);
auto setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool; auto setCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool;
void getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array); void getWeaponType(const char* prop_name, Containers::ArrayView<Weapon> weapon_array);