Compare commits
6 commits
e77cce5b42
...
0904384e0d
Author | SHA1 | Date | |
---|---|---|---|
0904384e0d | |||
6f3da0b4a7 | |||
19c00a3ce3 | |||
79762e176e | |||
b5b5b3b38c | |||
e4cfd3834a |
3 changed files with 236 additions and 16 deletions
|
@ -100,6 +100,8 @@ void Mass::refreshValues() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// region MassName
|
||||||
|
{
|
||||||
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB");
|
auto name_prop = unit_data->at<StringProperty>("Name_45_A037C5D54E53456407BDF091344529BB");
|
||||||
|
|
||||||
if(!name_prop) {
|
if(!name_prop) {
|
||||||
|
@ -109,7 +111,10 @@ void Mass::refreshValues() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_name = name_prop->value;
|
_name = name_prop->value;
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region FrameData
|
||||||
{
|
{
|
||||||
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653");
|
auto frame_prop = unit_data->at<GenericStructProperty>("Frame_3_F92B0F6A44A15088AF7F41B9FF290653");
|
||||||
|
|
||||||
|
@ -142,6 +147,11 @@ void Mass::refreshValues() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(frame_styles->items.size() != 4) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(UnsignedInt i = 0; i < 4; i++) {
|
for(UnsignedInt i = 0; i < 4; i++) {
|
||||||
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
|
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +164,130 @@ void Mass::refreshValues() {
|
||||||
|
|
||||||
_frame.eyeFlare = Color4{eye_flare_prop->r, eye_flare_prop->g, eye_flare_prop->b, eye_flare_prop->a};
|
_frame.eyeFlare = Color4{eye_flare_prop->r, eye_flare_prop->g, eye_flare_prop->b, eye_flare_prop->a};
|
||||||
}
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region FrameStyles
|
||||||
|
{
|
||||||
|
auto frame_styles = unit_data->at<ArrayProperty>("FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA");
|
||||||
|
if(!frame_styles) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(frame_styles->items.size() != 16) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// TODO: armour
|
||||||
|
|
||||||
|
// region ArmourStyles
|
||||||
|
{
|
||||||
|
auto armour_styles = unit_data->at<ArrayProperty>("ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E");
|
||||||
|
if(!armour_styles) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(armour_styles->items.size() != 16) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// TODO: weapons
|
||||||
|
|
||||||
|
// region GlobalStyles
|
||||||
|
{
|
||||||
|
auto global_styles = unit_data->at<ArrayProperty>("GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B");
|
||||||
|
if(!global_styles) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(global_styles->items.size() != 16) {
|
||||||
|
_state = State::Invalid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// TODO: tuning
|
||||||
|
|
||||||
auto account_prop = _mass->at<StringProperty>("Account");
|
auto account_prop = _mass->at<StringProperty>("Account");
|
||||||
if(!account_prop) {
|
if(!account_prop) {
|
||||||
|
@ -383,6 +517,48 @@ auto Mass::setEyeFlareColour(Color4 new_colour) -> bool {
|
||||||
return _mass->saveToFile();
|
return _mass->saveToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Mass::frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> {
|
||||||
|
return _frame.customStyles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::setFrameCustomStyle(CustomStyle style, UnsignedLong index) -> bool {
|
||||||
|
if(index > _frame.customStyles.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_frame.customStyles[index] = std::move(style);
|
||||||
|
|
||||||
|
return setCustomStyle(_frame.customStyles[index], index, "FrameStyle_44_04A44C9440363CCEC5443D98BFAF22AA");
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle> {
|
||||||
|
return _armour.customStyles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::setArmourCustomStyle(CustomStyle style, UnsignedLong index) -> bool {
|
||||||
|
if(index > _armour.customStyles.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_armour.customStyles[index] = std::move(style);
|
||||||
|
|
||||||
|
return setCustomStyle(_armour.customStyles[index], index, "ArmorStyle_42_E2F6AC3647788CB366BD469B3B7E899E");
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::globalStyles() -> Containers::StaticArrayView<16, CustomStyle> {
|
||||||
|
return _globalStyles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto Mass::setGlobalStyle(CustomStyle style, UnsignedLong index) -> bool {
|
||||||
|
if(index > _globalStyles.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_globalStyles[index] = std::move(style);
|
||||||
|
|
||||||
|
return setCustomStyle(_globalStyles[index], index, "GlobalStyles_57_6A681C114035241F7BDAAE9B43A8BF1B");
|
||||||
|
}
|
||||||
|
|
||||||
auto Mass::updateSteamId(const std::string& steam_id) -> bool {
|
auto Mass::updateSteamId(const std::string& steam_id) -> bool {
|
||||||
_steamId = steam_id;
|
_steamId = steam_id;
|
||||||
|
|
||||||
|
@ -402,3 +578,37 @@ auto Mass::updateSteamId(const std::string& steam_id) -> bool {
|
||||||
|
|
||||||
return _mass->saveToFile();
|
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;
|
||||||
|
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);
|
||||||
|
|
||||||
|
style_prop->at<StringProperty>("Name_27_1532115A46EF2B2FA283908DF561A86B")->value = style.name;
|
||||||
|
auto colour_prop = style_prop->at<ColourStructProperty>("Color_5_F0D383DF40474C9464AE48A0984A212E");
|
||||||
|
colour_prop->r = style.colour.r();
|
||||||
|
colour_prop->g = style.colour.g();
|
||||||
|
colour_prop->b = style.colour.b();
|
||||||
|
colour_prop->a = style.glow ? 1.0f : 0.0f;
|
||||||
|
style_prop->at<FloatProperty>("Metallic_10_0A4CD1E4482CBF41CA61D0A856DE90B9")->value = style.metallic;
|
||||||
|
style_prop->at<FloatProperty>("Gloss_11_9769599842CC275A401C4282A236E240")->value = style.gloss;
|
||||||
|
|
||||||
|
style_prop->at<IntProperty>("PatternID_14_516DB85641DAF8ECFD2920BE2BDF1311")->value = style.patternId;
|
||||||
|
style_prop->at<FloatProperty>("Opacity_30_53BD060B4DFCA1C92302D6A0F7831131")->value = style.opacity;
|
||||||
|
style_prop->at<FloatProperty>("OffsetX_23_70FC2E814C64BBB82452748D2AF9CD48")->value = style.offset.x();
|
||||||
|
style_prop->at<FloatProperty>("OffsetY_24_5E1F866C4C054D9B2EE337ADC180C17F")->value = style.offset.y();
|
||||||
|
style_prop->at<FloatProperty>("Rotation_25_EC2DFAD84AD0A6BD3FA841ACD52EDD6D")->value = style.rotation;
|
||||||
|
style_prop->at<FloatProperty>("Scale_26_19DF0708409262183E1247B317137671")->value = style.scale;
|
||||||
|
|
||||||
|
return _mass->saveToFile();
|
||||||
|
}
|
||||||
|
|
|
@ -51,11 +51,10 @@ struct CustomStyle {
|
||||||
bool glow = false;
|
bool glow = false;
|
||||||
|
|
||||||
Int patternId = 0;
|
Int patternId = 0;
|
||||||
Float opacity = 0.0f;
|
Float opacity = 0.5f;
|
||||||
Float offsetX = 0.0f;
|
Vector2 offset{0.0f};
|
||||||
Float offsetY = 0.0f;
|
|
||||||
Float rotation = 0.0f;
|
Float rotation = 0.0f;
|
||||||
Float scale = 0.0f;
|
Float scale = 1.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Decal {
|
struct Decal {
|
||||||
|
@ -82,7 +81,7 @@ struct Accessory {
|
||||||
Vector3 localScale{1.0f};
|
Vector3 localScale{1.0f};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Armour {
|
struct ArmourPart {
|
||||||
std::string slot;
|
std::string slot;
|
||||||
Int id = 0;
|
Int id = 0;
|
||||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||||
|
@ -148,9 +147,20 @@ class Mass {
|
||||||
auto eyeFlareColour() const -> Color4 const&;
|
auto eyeFlareColour() const -> Color4 const&;
|
||||||
auto setEyeFlareColour(Color4 new_colour) -> bool;
|
auto setEyeFlareColour(Color4 new_colour) -> bool;
|
||||||
|
|
||||||
|
auto frameCustomStyles() -> Containers::StaticArrayView<16, CustomStyle>;
|
||||||
|
auto setFrameCustomStyle(CustomStyle style, UnsignedLong index) -> bool;
|
||||||
|
|
||||||
|
auto armourCustomStyles() -> Containers::StaticArrayView<16, CustomStyle>;
|
||||||
|
auto setArmourCustomStyle(CustomStyle style, UnsignedLong index) -> bool;
|
||||||
|
|
||||||
|
auto globalStyles() -> Containers::StaticArrayView<16, CustomStyle>;
|
||||||
|
auto setGlobalStyle(CustomStyle style, UnsignedLong index) -> bool;
|
||||||
|
|
||||||
auto updateSteamId(const std::string& steam_id) -> bool;
|
auto updateSteamId(const std::string& steam_id) -> bool;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
auto setCustomStyle(const CustomStyle& style, UnsignedLong index, const char* prop_name) -> bool;
|
||||||
|
|
||||||
Containers::Optional<UESaveFile> _mass;
|
Containers::Optional<UESaveFile> _mass;
|
||||||
|
|
||||||
static std::string _lastError;
|
static std::string _lastError;
|
||||||
|
@ -170,13 +180,13 @@ class Mass {
|
||||||
|
|
||||||
Color4 eyeFlare{0.0f};
|
Color4 eyeFlare{0.0f};
|
||||||
|
|
||||||
Containers::StaticArray<16, CustomStyle> frameCustomStyles;
|
Containers::StaticArray<16, CustomStyle> customStyles;
|
||||||
} _frame;
|
} _frame;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
Containers::StaticArray<38, Armour> parts;
|
Containers::StaticArray<38, ArmourPart> parts;
|
||||||
|
|
||||||
Containers::StaticArray<16, CustomStyle> armourCustomStyles;
|
Containers::StaticArray<16, CustomStyle> customStyles;
|
||||||
} _armour;
|
} _armour;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -439,7 +439,7 @@ void SaveTool::drawMassManager() {
|
||||||
|
|
||||||
ImGui::EndDragDropSource();
|
ImGui::EndDragDropSource();
|
||||||
}
|
}
|
||||||
if((!_unsafeMode && _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
|
if((_unsafeMode || _gameState == GameState::NotRunning) && ImGui::BeginDragDropTarget()) {
|
||||||
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) {
|
if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) {
|
||||||
if(payload->DataSize != sizeof(std::string)) {
|
if(payload->DataSize != sizeof(std::string)) {
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error",
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error",
|
||||||
|
|
Loading…
Reference in a new issue