Application: allow wild weapon type switching.

This commit is contained in:
Guillaume Jacquemin 2024-12-12 15:39:52 +01:00
parent 57f1a3ccef
commit 4dfc847113
Signed by: williamjcm
SSH key fingerprint: SHA256:AYLOg+iTV0ElElnlu4vqM4edFazVdRiuQB0Y5LoKc4A

View file

@ -270,6 +270,11 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) {
ImGui::BeginGroup();
drawAlignedText("Equipped:");
if(conf().advancedMode()) {
drawAlignedText("Weapon type:");
drawAlignedText("");
}
if(weapon.type != GameObjects::Weapon::Type::Shield) {
drawAlignedText("Damage type:");
}
@ -288,6 +293,47 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) {
ImGui::BeginGroup();
ImGui::Checkbox("##EquippedCheckbox", &weapon.attached);
if(conf().advancedMode()) {
if(ImGui::RadioButton("Melee##MeleeType", weapon.type == GameObjects::Weapon::Type::Melee)) {
weapon.type = GameObjects::Weapon::Type::Melee;
if(weapon.damageType == GameObjects::Weapon::DamageType::Piercing || weapon.damageType == GameObjects::Weapon::DamageType::Plasma) {
weapon.damageType = GameObjects::Weapon::DamageType::Physical;
}
}
ImGui::SameLine();
if(ImGui::RadioButton("Shield##ShieldType", weapon.type == GameObjects::Weapon::Type::Shield)) {
weapon.type = GameObjects::Weapon::Type::Shield;
}
ImGui::SameLine();
if(ImGui::RadioButton("Bullet shooter##BShooterType", weapon.type == GameObjects::Weapon::Type::BulletShooter)) {
weapon.type = GameObjects::Weapon::Type::BulletShooter;
if(weapon.damageType == GameObjects::Weapon::DamageType::Physical || weapon.damageType == GameObjects::Weapon::DamageType::Plasma) {
weapon.damageType = GameObjects::Weapon::DamageType::Piercing;
}
}
if(ImGui::RadioButton("Energy shooter##EShooterType", weapon.type == GameObjects::Weapon::Type::EnergyShooter)) {
weapon.type = GameObjects::Weapon::Type::EnergyShooter;
if(weapon.damageType == GameObjects::Weapon::DamageType::Physical || weapon.damageType == GameObjects::Weapon::DamageType::Piercing) {
weapon.damageType = GameObjects::Weapon::DamageType::Plasma;
}
}
ImGui::SameLine();
if(ImGui::RadioButton("Bullet launcher##BLauncherType", weapon.type == GameObjects::Weapon::Type::BulletLauncher)) {
weapon.type = GameObjects::Weapon::Type::BulletLauncher;
if(weapon.damageType == GameObjects::Weapon::DamageType::Physical || weapon.damageType == GameObjects::Weapon::DamageType::Plasma) {
weapon.damageType = GameObjects::Weapon::DamageType::Piercing;
}
}
ImGui::SameLine();
if(ImGui::RadioButton("Energy launcher##ELauncherType", weapon.type == GameObjects::Weapon::Type::EnergyLauncher)) {
weapon.type = GameObjects::Weapon::Type::EnergyLauncher;
if(weapon.damageType == GameObjects::Weapon::DamageType::Physical || weapon.damageType == GameObjects::Weapon::DamageType::Piercing) {
weapon.damageType = GameObjects::Weapon::DamageType::Plasma;
}
}
}
if(weapon.type != GameObjects::Weapon::Type::Shield) {
if(weapon.type == GameObjects::Weapon::Type::Melee &&
ImGui::RadioButton("Physical##NoElement", weapon.damageType == GameObjects::Weapon::DamageType::Physical))