SaveTool: add weapon part mappings and the ability to change parts.

With that, I think I'm ready to push 1.3.2.
This commit is contained in:
Guillaume Jacquemin 2022-04-15 11:05:01 +02:00
parent 1bbbf3cbfd
commit 0fd157f33c
3 changed files with 448 additions and 1 deletions

View file

@ -156,6 +156,7 @@ add_executable(MassBuilderSaveTool WIN32
Maps/LastMissionId.h Maps/LastMissionId.h
Maps/StoryProgress.h Maps/StoryProgress.h
Maps/StyleNames.h Maps/StyleNames.h
Maps/WeaponParts.h
Maps/WeaponTypes.hpp Maps/WeaponTypes.hpp
ToastQueue/ToastQueue.h ToastQueue/ToastQueue.h
ToastQueue/ToastQueue.cpp ToastQueue/ToastQueue.cpp

396
src/Maps/WeaponParts.h Normal file
View file

@ -0,0 +1,396 @@
#pragma once
// 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/>.
#include <map>
#include <Corrade/Containers/StringView.h>
#include <Magnum/Types.h>
using namespace Corrade;
using namespace Magnum;
using namespace Containers::Literals;
// region Melee
static const std::map<Int, Containers::StringView> melee_grips {
{0, "Combat Grip (1H)"_s},
{1, "Knuckle Guard Grip (1H)"_s},
{2, "Dual Guard Grip (1H)"_s},
{3, "Sepal Grip (1H)"_s},
{4, "Warrior Grip (1H)"_s},
{5, "Guardian Grip (1H)"_s},
{6, "Knight Guard Grip (1H)"_s},
{7, "Saber Guard Grip (1H)"_s},
{100, "Combat Side Grip (1H)"_s},
{101, "Hollowed Side Grip (1H)"_s},
{102, "Pulled Back Side Grip (1H)"_s},
{103, "Plated Side Grip (1H)"_s},
{104, "Locked Side Grip (1H)"_s},
{105, "Longpoint Side Grip (1H)"_s},
{200, "Combat Dual Grip (1H)"_s},
{201, "Hollowed Dual Grip (1H)"_s},
{202, "Plated Dual Grip (1H)"_s},
{400, "Combat Twin Grip (1H)"_s},
{401, "Sepal Twin Grip (1H)"_s},
{402, "Hollowed Twin Grip (1H)"_s},
{403, "Knuckle Guard Twin Grip (1H)"_s},
{404, "Arched Twin Grip (1H)"_s},
{1000, "Combat Knuckle (R/L)"_s},
{1001, "Battle Fist (R/L)"_s},
{1002, "Guard Knuckle (R/L)"_s},
{2000, "Combat Polearm (2H)"_s},
{2001, "Dual Guard Polearm (2H)"_s},
{2002, "Sepal Polearm (2H)"_s},
{2003, "Fin Polearm (2H)"_s},
{2004, "Arched Polearm (2H)"_s},
{2100, "Combat Side Polearm (2H)"_s},
{2101, "Plated Side Polearm (2H)"_s},
{2102, "Locked Side Polearm (2H)"_s},
{2103, "Fin Side Polearm (2H)"_s},
{2200, "Combat Dual Polearm (2H)"_s},
{2400, "Combat Twin Blade (2H)"_s},
{2401, "Guard Twin Blade (2H)"_s},
{2402, "Sepal Twin Blade (2H)"_s},
{2403, "Fin Twin Blade (2H)"_s},
{2404, "Arched Twin Blade (2H)"_s},
};
static const std::map<Int, Containers::StringView> melee_assaulters {
{0, "Long Metal Blade"_s},
{1, "Long Assault Blade"_s},
{2, "Long Fin Blade"_s},
{3, "Long Double Blades"_s},
{4, "Long Straight Blade"_s},
{5, "Long Faceted Blade"_s},
{6, "Long Interlocked Blade"_s},
{7, "Long Frontbreak Blade"_s},
{8, "Long Encased Blade"_s},
{9, "Long Flat Gouger"_s},
{10, "Long Curved Blade"_s},
{11, "Long Broad Blade"_s},
{20, "Long Combat Edge"_s},
{21, "Long Attached Edge"_s},
{40, "Katana Blade"_s},
{41, "Custom Katana Blade"_s},
{60, "Energy Blade (Motion)"_s},
{61, "Powered Blade"_s},
{100, "Short Metal Blade"_s},
{101, "Short Assault Blade"_s},
{102, "Short Fin Blade"_s},
{120, "Short Combat Edge"_s},
{160, "Short Energy Blade (Motion)"_s},
{161, "Short Powered Blade"_s},
{180, "Triclaw"_s},
{181, "Straight Triclaw"_s},
{182, "Griphold Claw"_s},
{183, "Energy Claw"_s},
{184, "Openhold Claw"_s},
{185, "Hooktusk Claw"_s},
{200, "Bracer"_s},
{201, "Custom Bracer"_s},
{210, "Expanded Bracer"_s},
{211, "Expanded Custom Bracer"_s},
{300, "Heavy Smasher"_s},
{301, "Heavy Basher"_s},
{302, "Heavy Torch Mace"_s},
{400, "Light Smasher"_s},
{401, "Light Basher"_s},
{402, "Light Torch Mace"_s},
{420, "War Hammer"_s},
{421, "Great Hammer"_s},
{422, "Spiked Hammer"_s},
{423, "Broadhead Hammer"_s},
{440, "Morning Star"_s},
{441, "Spike Ball"_s},
{500, "Combat Lance"_s},
{501, "Gouger Lance"_s},
{510, "Piercer"_s},
{600, "Short Combat Lance"_s},
{605, "Short Combat Drill (Motion)"_s},
{610, "Short Piercer"_s},
{700, "Combat Axe"_s},
{701, "Custom Combat Axe"_s},
{702, "Piercing Axe"_s},
{703, "Frontbreak Axe"_s},
{704, "Maiming Axe"_s},
{705, "Delta Axe"_s},
{800, "Combat Scythe"_s},
{801, "Reaper Blade"_s},
{802, "Clawtooth Scythe"_s},
{803, "Wingpoint Scythe"_s},
{804, "Snakebone Scythe"_s},
{900, "Short Combat Scythe"_s},
{901, "Short Reaper Blade"_s},
{902, "Short Clawtooth Scythe"_s},
{903, "Short Wingpoint Scythe"_s},
{904, "Short Snakebone Scythe"_s},
};
// endregion
// region Shields
static const std::map<Int, Containers::StringView> shield_handles {
{0, "Balanced Handle"_s},
{1, "Expanded Handle"_s},
{2, "Lowguard Handle"_s},
{3, "Longblocker Handle"_s},
{4, "Winged Handle"_s},
{5, "Stopper Handle"_s},
{6, "Layered Handle"_s},
{7, "Riotguard Handle"_s},
{8, "Blitz Handle"_s},
{9, "Foldable Handle"_s},
{10, "Board Handle"_s},
{11, "Knight Handle"_s},
{12, "Cargwall Handle"_s},
{100, "Buckler Handle"_s},
{101, "Star Handle"_s},
};
static const std::map<Int, Containers::StringView> shield_shells {
{0, "Balanced Shell"_s},
{1, "Compass Shell"_s},
{2, "Uppoint Shell"_s},
{3, "Pointed Shell"_s},
{4, "Padded Shell"_s},
{5, "Pincer Shell"_s},
{6, "Fang Shell"_s},
{7, "Holder Shell"_s},
{8, "Composite Shell"_s},
{9, "Mechanical Shell"_s},
{10, "Layered Shell"_s},
{11, "Parted Shell"_s},
{12, "Tapst Shell"_s},
{13, "Sidloc Shell"_s},
{100, "V-Cross Shell"_s},
};
// endregion
// region Bullet Shooters
static const std::map<Int, Containers::StringView> bshooter_triggers {
{0, "BL-Combat Trigger (1H)"_s},
{1, "Light Machine Trigger (1H)"_s},
{2, "Tactical Trigger (1H)"_s},
{3, "Compact Trigger (1H)"_s},
{4, "Longhold Trigger (1H)"_s},
{5, "Downhold Trigger (1H)"_s},
{6, "Cellblock Trigger (1H)"_s},
{100, "BL-Machine Trigger (2H)"_s},
{101, "BL-Short Trigger (2H)"_s},
{102, "Shielded Trigger (2H)"_s},
{103, "Platedframe Trigger (2H)"_s},
{104, "Sidebox Trigger (2H) (Motion)"_s},
};
static const std::map<Int, Containers::StringView> bshooter_barrels {
{0, "BL-Combat Barrel (1 shot)"_s},
{1, "Shock Absorb Barrel (1 shot) (Motion)"_s},
{2, "Muzzlemod Barrel (1 shot)"_s},
{3, "Triangular Barrel (1 shot)"_s},
{4, "Recoilblock Barrel (1 shot) (Motion)"_s},
{100, "Six-Barrel Gatling (Auto) (Motion)"_s},
{101, "Modded Six-Barrel Gatling (Auto) (Motion)"_s},
{102, "Four-Barrel Gatling (Auto) (Motion)"_s},
{103, "Retro Style Gatling (Auto) (Motion)"_s},
{200, "Blast Barrel (Spread)"_s},
{201, "Wideblast Barrel (Spread) (Motion)"_s},
{202, "Pelleter Barrel (Spread) (Motion)"_s},
{203, "Lockhold Barrel (Spread) (Motion)"_s},
{300, "Propulsive Barrel (Detonate)"_s},
{301, "Roundbox Barrel (Detonate)"_s},
{302, "ShieldDet Barrel (Detonate)"_s},
{303, "RecoilDet Barrel (Detonate) (Motion)"_s},
};
// endregion
//region Energy Shooters
static const std::map<Int, Containers::StringView> eshooter_triggers {
{0, "EN-Rifle Trigger (1H)"_s},
{1, "Underarm Trigger (1H)"_s},
{2, "EN-Inverted Trigger (1H)"_s},
{3, "EN-Submachine Trigger (1H) (Motion)"_s},
{4, "EN-Needler Trigger (1H)"_s},
{5, "Angular Trigger (1H)"_s},
{6, "Exposed Trigger (1H)"_s},
{100, "EN-Combat Trigger (2H)"_s},
{101, "EN-Alternate Trigger (2H)"_s},
{102, "Framed Trigger (2H) (Motion)"_s},
{103, "Stabilised Trigger (2H)"_s},
{104, "EN-Heavy Trigger (2H)"_s},
};
static const std::map<Int, Containers::StringView> eshooter_busters {
{0, "EN-Combat Buster (1 shot)"_s},
{1, "Delta Cycler (1 shot) (Motion)"_s},
{2, "EN-Longbarrel Buster (1 shot)"_s},
{3, "Kinetic Buster (1 shot) (Motion)"_s},
{100, "EN-Rifle Buster (Auto)"_s},
{101, "EN-Focus Buster (Auto)"_s},
{102, "Machinist Buster (Auto)"_s},
{103, "EN-Precision Buster (Auto) (Motion)"_s},
{200, "Railcharge Buster (Ray) (Motion)"_s},
{201, "Clawcharge Buster (Ray)"_s},
{202, "Twizelcharge Buster (Ray)"_s},
{203, "Deltacharge Buster (Ray)"_s},
{300, "Subsonic Buster (Wave)"_s},
{301, "Amplifier Buster (Wave) (Motion)"_s},
{302, "Cyclonwave Buster (Wave)"_s},
{303, "Warhorn Buster (Wave) (Motion)"_s},
};
// endregion
// region Bullet Launchers
static const std::map<Int, Containers::StringView> blauncher_pods {
{0, "BL-Delta Pack Launcher (Missile x12)"_s},
{1, "BL-Twin Pack Launcher (Missile x12)"_s},
{2, "Detector Launcher (Missile x12)"_s},
{3, "BL-Triplet Pack Launcher (Missile x12)"_s},
{4, "Shielded Launcher (Missile x12)"_s},
{100, "Warhead Pod (Nuke x2)"_s},
{101, "Warhead Launcher (Nuke x2)"_s},
{102, "Triangular Warhead Pod (Nuke x2)"_s},
{103, "Expanded Warhead Pod (Nuke x2)"_s},
{104, "Shielded Warhead Pod (Nuke x2)"_s},
{200, "Widepack Launcher (Salvo x24)"_s},
{201, "Covered Launcher (Salvo x24)"_s},
{202, "Double Delta Launcher (Salvo x24)"_s},
{203, "Hexagonal Launcher (Salvo x24)"_s},
{204, "Shielded Six Launcher (Salvo x24)"_s},
{300, "Sentinel Cluster Pod (Cluster x40)"_s},
{301, "Pincer Cluster Pod (Cluster x40)"_s},
{302, "Elliptical Cluster Pod (Cluster x40)"_s},
{303, "Sawed Cluster Pod (Cluster x40)"_s},
{304, "Pentagonal Cluster Pod (Cluster x40)"_s},
};
static const std::map<Int, Containers::StringView> blauncher_projectiles {
{0, "Flathead Missile"_s},
{1, "Warhead Missile"_s},
{2, "Pointhead Missile"_s},
{3, "Marker Missile"_s},
{4, "ArB Missile"_s},
};
// endregion
// region Energy Launchers
static const std::map<Int, Containers::StringView> elauncher_generators {
{0, "Fly Unit"_s},
{1, "Assault Unit (Motion)"_s},
{2, "Falcon Unit"_s},
{3, "Drake Unit (Motion)"_s},
{4, "Kingfisher Unit"_s},
{5, "Tri-Edge Unit"_s},
{6, "Flatline Unit"_s},
{7, "Boost Unit"_s},
{8, "Sparrow Unit"_s},
{9, "Guarded Unit"_s},
{10, "Sailtail Unit"_s},
{11, "Tri-Covered Unit"_s},
{12, "Pointy Unit"_s},
{13, "Scope-Like Unit"_s},
{14, "Rotating Unit (Motion)"_s},
{15, "Clamper Unit"_s},
{16, "Quadsat Unit"_s},
{17, "Squ-Rotating Unit (Motion)"_s},
{18, "Bloom Unit"_s},
{19, "Edge-Rotating Unit (Motion)"_s},
{20, "Shipend Unit"_s},
{21, "Revwing Unit"_s},
{22, "Viper Unit"_s},
{23, "EX Unit"_s},
{24, "Aery Unit"_s},
{25, "Carrier Unit"_s},
{26, "Compartment Unit"_s},
{27, "Flatedge Unit"_s},
};
static const std::map<Int, Containers::StringView> elauncher_pods {
{0, "EN-Dual Claw Launcher (Echo) (Motion)"_s},
{1, "EN-Assault Launcher (Echo)"_s},
{2, "EN-Tactical Launcher (Echo)"_s},
{3, "EN-Force Focus Launcher (Echo) (Motion)"_s},
{4, "EN-Needler Launcher (Echo)"_s},
{5, "Spark Launcher (Echo)"_s},
{6, "Pinpoint Launcher (Echo)"_s},
{100, "Raystream Launcher (Beam)"_s},
{101, "Perpetum Launcher (Beam)"_s},
{102, "Scorcher Launcher (Beam)"_s},
{103, "Concentrator Launcher (Beam)"_s},
{104, "Crosshair Launcher (Beam)"_s},
{105, "Powerlined Launcher (Beam)"_s},
{106, "Attached Launcher (Beam)"_s},
{200, "Hilt Launcher (Slash) (Motion)"_s},
{201, "Underangle Launcher (Slash)"_s},
{202, "Crossblade Launcher (Slash)"_s},
{203, "Deltablade Launcher (Slash) (Motion)"_s},
{204, "Spike Launcher (Slash)"_s},
{205, "Tri-Pronged Launcher (Slash) (Motion)"_s},
{206, "Heavyblade Launcher (Slash)"_s},
{300, "Covering Launcher (Photon)"_s},
{301, "Boxhead Launcher (Photon)"_s},
{302, "Stabilised Launcher (Photon)"_s},
{303, "Flatline Launcher (Photon)"_s},
{304, "Shelled Launcher (Photon)"_s},
{305, "Widearm Launcher (Photon)"_s},
{306, "Wingspan Launcher (Photon)"_s},
};
// endregion

View file

@ -17,6 +17,7 @@
#include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5.h"
#include "../Maps/StyleNames.h" #include "../Maps/StyleNames.h"
#include "../Maps/WeaponParts.h"
#include "SaveTool.h" #include "SaveTool.h"
@ -434,7 +435,56 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
auto& part = weapon.parts[_selectedWeaponPart]; auto& part = weapon.parts[_selectedWeaponPart];
ImGui::Text("ID: %i", part.id); const auto* map = [this, &weapon]()-> const std::map<Int, Containers::StringView>* {
switch(weapon.type) {
case WeaponType::Melee:
return _selectedWeaponPart == 0 ? &melee_grips : &melee_assaulters;
case WeaponType::Shield:
return _selectedWeaponPart == 0 ? &shield_handles : &shield_shells;
case WeaponType::BulletShooter:
return _selectedWeaponPart == 0 ? &bshooter_triggers : &bshooter_barrels;
case WeaponType::EnergyShooter:
return _selectedWeaponPart == 0 ? &eshooter_triggers : &eshooter_busters;
case WeaponType::BulletLauncher:
return _selectedWeaponPart == 0 ? &blauncher_pods : &blauncher_projectiles;
case WeaponType::EnergyLauncher:
return _selectedWeaponPart == 0 ? &elauncher_generators : &elauncher_pods;
}
return nullptr;
}();
CORRADE_INTERNAL_ASSERT(map);
if(map->find(part.id) != map->cend()) {
ImGui::TextUnformatted(map->at(part.id).data());
}
else if(part.id == -1) {
ImGui::TextUnformatted("<none>");
}
else{
ImGui::Text("ID: %i", part.id);
}
if(!map->empty()) {
ImGui::SameLine();
if(ImGui::SmallButton("Change")) {
ImGui::OpenPopup("##WeaponPartPopup");
}
if(ImGui::BeginPopup("##WeaponPartPopup")) {
if(ImGui::BeginListBox("##WeaponParts")) {
for(const auto& mapped_part : *map) {
if(ImGui::Selectable(mapped_part.second.data(), mapped_part.first == part.id)) {
part.id = mapped_part.first;
}
}
ImGui::EndListBox();
}
ImGui::EndPopup();
}
}
if(weapon.type == WeaponType::Shield || if(weapon.type == WeaponType::Shield ||
(weapon.type == WeaponType::BulletLauncher && _selectedWeaponPart != 0)) (weapon.type == WeaponType::BulletLauncher && _selectedWeaponPart != 0))
{ {