Build viewer/editor #13
5 changed files with 47 additions and 8 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
|
|
@ -1145,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};
|
||||
}
|
||||
|
@ -1239,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();
|
||||
|
|
|
@ -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};
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue