Compare commits

..

No commits in common. "4ca6f62d9b46380a7492c808e54a5d8f52cb8cd3" and "d79debe69fd084346126997e184a4da03d6a6394" have entirely different histories.

2 changed files with 96 additions and 54 deletions

View file

@ -386,7 +386,7 @@ auto Mass::writeJointSliders() -> bool {
return true;
}
auto Mass::frameStyles() -> Containers::ArrayView<Int> {
auto Mass::frameStyles() -> Containers::StaticArrayView<4, Int> {
return _frame.styles;
}
@ -409,12 +409,12 @@ void Mass::getFrameStyles() {
return;
}
if(frame_styles->items.size() != _frame.styles.size()) {
if(frame_styles->items.size() != 4) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) {
for(UnsignedInt i = 0; i < 4; i++) {
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
}
}
@ -506,7 +506,7 @@ auto Mass::writeEyeFlareColour() -> bool {
return _mass->saveToFile();
}
auto Mass::frameCustomStyles() -> Containers::ArrayView<CustomStyle> {
auto Mass::frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> {
return _frame.customStyles;
}
@ -523,12 +523,34 @@ void Mass::getFrameCustomStyles() {
return;
}
if(frame_styles->items.size() != _frame.customStyles.size()) {
if(frame_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
getCustomStyles(_frame.customStyles, frame_styles);
for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) {
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 {
@ -551,7 +573,7 @@ auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool {
return setCustomStyle(_frame.customStyles[index], index, frame_styles);
}
auto Mass::armourParts() -> Containers::ArrayView<ArmourPart> {
auto Mass::armourParts() -> Containers::StaticArrayView<38, ArmourPart> {
return _armour.parts;
}
@ -761,7 +783,7 @@ auto Mass::writeArmourPart(UnsignedLong index) -> bool {
return _mass->saveToFile();
}
auto Mass::armourCustomStyles() -> Containers::ArrayView<CustomStyle> {
auto Mass::armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> {
return _armour.customStyles;
}
@ -778,12 +800,34 @@ void Mass::getArmourCustomStyles() {
return;
}
if(armour_styles->items.size() != _armour.customStyles.size()) {
if(armour_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
getCustomStyles(_armour.customStyles, armour_styles);
for(UnsignedInt i = 0; i < armour_styles->items.size(); i++) {
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 {
@ -806,7 +850,7 @@ auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool {
return setCustomStyle(_armour.customStyles[index], index, armour_styles);
}
auto Mass::meleeWeapons() -> Containers::ArrayView<Weapon> {
auto Mass::meleeWeapons() -> Containers::StaticArrayView<8, Weapon> {
return _weapons.melee;
}
@ -814,7 +858,7 @@ void Mass::getMeleeWeapons() {
getWeaponType("WeaponCC_22_0BBEC58C4A0EA1DB9E037B9339EE26A7", _weapons.melee);
}
auto Mass::shields() -> Containers::ArrayView<Weapon> {
auto Mass::shields() -> Containers::StaticArrayView<1, Weapon> {
return _weapons.shields;
}
@ -822,7 +866,7 @@ void Mass::getShields() {
getWeaponType("Shield_53_839BFD7945481BAEA3E43A9C5CA8E92E", _weapons.shields);
}
auto Mass::bulletShooters() -> Containers::ArrayView<Weapon> {
auto Mass::bulletShooters() -> Containers::StaticArrayView<4, Weapon> {
return _weapons.bulletShooters;
}
@ -830,7 +874,7 @@ void Mass::getBulletShooters() {
getWeaponType("WeaponBS_35_6EF6E0104FD7A138DF47F88CB57A83ED", _weapons.bulletShooters);
}
auto Mass::energyShooters() -> Containers::ArrayView<Weapon> {
auto Mass::energyShooters() -> Containers::StaticArrayView<4, Weapon> {
return _weapons.energyShooters;
}
@ -838,7 +882,7 @@ void Mass::getEnergyShooters() {
getWeaponType("WeaponES_37_1A295D544528623880A0B1AC2C7DEE99", _weapons.energyShooters);
}
auto Mass::bulletLaunchers() -> Containers::ArrayView<Weapon> {
auto Mass::bulletLaunchers() -> Containers::StaticArrayView<4, Weapon> {
return _weapons.bulletLaunchers;
}
@ -846,7 +890,7 @@ void Mass::getBulletLaunchers() {
getWeaponType("WeaponBL_36_5FD7C41E4613A75B44AB0E90B362846E", _weapons.bulletLaunchers);
}
auto Mass::energyLaunchers() -> Containers::ArrayView<Weapon> {
auto Mass::energyLaunchers() -> Containers::StaticArrayView<4, Weapon> {
return _weapons.energyLaunchers;
}
@ -854,7 +898,7 @@ void Mass::getEnergyLaunchers() {
getWeaponType("WeaponEL_38_9D23F3884ACA15902C9E6CA6E4995995", _weapons.energyLaunchers);
}
auto Mass::globalStyles() -> Containers::ArrayView<CustomStyle> {
auto Mass::globalStyles() -> Containers::StaticArrayView<16, CustomStyle> {
return _globalStyles;
}
@ -871,12 +915,34 @@ void Mass::getGlobalStyles() {
return;
}
if(global_styles->items.size() != _globalStyles.size()) {
if(global_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
getCustomStyles(_globalStyles, global_styles);
for(UnsignedInt i = 0; i < global_styles->items.size(); i++) {
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 {
@ -913,29 +979,6 @@ auto Mass::updateSteamId(const std::string& steam_id) -> bool {
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 {
if(!style_array) {
return false;

View file

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