From 388fe7c259fd71418fbe67c101a14d0b45f44eeb Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 7 Mar 2016 11:28:10 +0100 Subject: [PATCH 1/3] Fixed some stuff on the player HUD --- resources/Schema/Entities/PlayerHUD.xml | 356 +++++++++++++----------- 1 file changed, 195 insertions(+), 161 deletions(-) diff --git a/resources/Schema/Entities/PlayerHUD.xml b/resources/Schema/Entities/PlayerHUD.xml index e3e9165b..cf07bc56 100644 --- a/resources/Schema/Entities/PlayerHUD.xml +++ b/resources/Schema/Entities/PlayerHUD.xml @@ -31,116 +31,6 @@ - - - - - - - - - 1 - - - - - Textures/HUD/HealthHudTriMain.png - - - - - - - - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - - 1 - - - - 100/100 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - @@ -154,40 +44,7 @@ Textures/Core/UnitHexagon.png - - - - - - - - - - - 2 - - - - - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - + false @@ -197,15 +54,16 @@ - - 3 - + + 3 + Textures/Core/UnitHexagon_Rotated.png + false @@ -222,6 +80,7 @@ Textures/Core/UnitHexagon.png + false @@ -231,16 +90,17 @@ - - 4 - 1 + + 4 + Textures/Core/UnitHexagon_Rotated.png + false @@ -257,6 +117,43 @@ Textures/Core/UnitHexagon.png + false + + + + + + + + + + + + + + 2 + + + Textures/Core/UnitHexagon_Rotated.png + + false + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + false @@ -266,15 +163,16 @@ - - 1 - + + 1 + Textures/Core/UnitHexagon_Rotated.png + false @@ -291,6 +189,7 @@ Textures/Core/UnitHexagon.png + false @@ -300,14 +199,15 @@ - 1 + Textures/Core/UnitHexagon_Rotated.png + false @@ -377,23 +277,157 @@ - - - Models/Widgets/Arrows/Arrow5.mesh - + + + Models/Widgets/Arrows/Arrow5.mesh + - - - + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + 1 + + + + + Textures/HealthHUD3.png + + + + + + + + + + + + + + + + + + + + + + + + Textures/Icons/Boosts/Assault-01.png + + false + + + + + + + + + + + + + + + + + Textures/Icons/Boosts/Defender-01.png + + false + + + + + + + + + + + + + + + + + Textures/Icons/Boosts/Sniper-01.png + + false + + + + + + + + + + + + + + + + + + + + Textures/Icons/Abilities/Superman-01.png + + false + + + + + + + + + + + + From 99d663d5a226866d431a09e3e128f28f8acd718e Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 7 Mar 2016 13:55:37 +0100 Subject: [PATCH 2/3] ShiftIcon should now track ability depending on what ability the player has and change icon accordingly. --- .../Game/Systems/AbilityCooldownHUDSystem.h | 1 + src/Game/Systems/AbilityCooldownHUDSystem.cpp | 48 +++++++++++++++---- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/include/Game/Systems/AbilityCooldownHUDSystem.h b/include/Game/Systems/AbilityCooldownHUDSystem.h index 610b4dc2..f2710ce3 100644 --- a/include/Game/Systems/AbilityCooldownHUDSystem.h +++ b/include/Game/Systems/AbilityCooldownHUDSystem.h @@ -12,6 +12,7 @@ public: { } virtual void Update(double dt) override; +private: }; #endif \ No newline at end of file diff --git a/src/Game/Systems/AbilityCooldownHUDSystem.cpp b/src/Game/Systems/AbilityCooldownHUDSystem.cpp index ccb12a97..e2734b47 100644 --- a/src/Game/Systems/AbilityCooldownHUDSystem.cpp +++ b/src/Game/Systems/AbilityCooldownHUDSystem.cpp @@ -11,21 +11,53 @@ void AbilityCooldownHUDSystem::Update(double dt) for (auto& abilityHUDC : *abilityHUDs) { EntityWrapper entity = EntityWrapper(m_World, abilityHUDC.EntityID); EntityWrapper abilityEntity = entity.FirstParentWithComponent("DashAbility"); - if (!abilityEntity.Valid()) - return; + std::string abilityName = ""; + + if (!abilityEntity.Valid()) { + //If we dont have a dash ability on player, we check for Sprint ability + abilityEntity = entity.FirstParentWithComponent("SprintAbility"); + + if (!abilityEntity.Valid()) { + //If we dont have a sprint ability on player, we check for shield ability + abilityEntity = entity.FirstParentWithComponent("ShieldAbility"); + + if (!abilityEntity.Valid()) { + //If we dont have a shield ability, we return, since we cannot do anything. + return; + } else { + //If we have a shield ability, we set the right icon + abilityName = "ShieldAbility"; + if (entity.HasComponent("Sprite")) { + (std::string&)entity["Sprite"]["DiffuseTexture"] = "Textures\\Icons\\Abilities\\SheildDots-01.png"; + } + } + } else { + //If we do have a sprint ability, we change the icon + abilityName = "SprintAbility"; + if (entity.HasComponent("Sprite")) { + (std::string&)entity["Sprite"]["DiffuseTexture"] = "Textures\\Icons\\Abilities\\Dash-01.png"; + } + } + } else { + //If we have a dash ability, we set the icon to the correct one. + abilityName = "DashAbility"; + if (entity.HasComponent("Sprite")) { + (std::string&)entity["Sprite"]["DiffuseTexture"] = "Textures\\Icons\\Abilities\\Superman-01.png"; + } + } + EntityWrapper cooldownTextEntity = entity.FirstChildByName("Cooldown"); - double maxAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownMaxTimer"]; - double currentAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownTimer"]; - + double maxAbilityCD = (double)abilityEntity[abilityName]["CoolDownMaxTimer"]; + double currentAbilityCD = (double)abilityEntity[abilityName]["CoolDownTimer"]; currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0; - if(cooldownTextEntity.Valid()) { - if(cooldownTextEntity.HasComponent("Text")) - { + if (cooldownTextEntity.Valid()) { + if (cooldownTextEntity.HasComponent("Text")) { std::string t = (std::string&)cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3); } } + if (entity.HasComponent("Fill")) { entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD; } From 47ece6a5bf7ac1b5f7feb2d15a26e7a97ff38401 Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 7 Mar 2016 14:42:50 +0100 Subject: [PATCH 3/3] Changed shield component to track Active, so it and sprint glow full if they are active. Changed how reflections are calculated with light. --- assets | 2 +- resources/Schema/Components/ShieldAbility.xml | 2 +- resources/Schema/Components/ShieldAbility.xsd | 4 +-- resources/Shaders/ForwardPlus.frag.glsl | 2 +- .../Shaders/ForwardPlusShieldCheck.frag.glsl | 2 +- src/Game/Systems/AbilityCooldownHUDSystem.cpp | 29 +++++++++++++++---- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/assets b/assets index 0ae73657..52ea74c5 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 0ae736570b5600c2ad05f556ccaec4f5341c2b06 +Subproject commit 52ea74c5d5996ebcd7b064e0a8be469c9f07926e diff --git a/resources/Schema/Components/ShieldAbility.xml b/resources/Schema/Components/ShieldAbility.xml index 49fcf0c0..d66dca31 100644 --- a/resources/Schema/Components/ShieldAbility.xml +++ b/resources/Schema/Components/ShieldAbility.xml @@ -1,4 +1,4 @@ - 2.0 + false \ No newline at end of file diff --git a/resources/Schema/Components/ShieldAbility.xsd b/resources/Schema/Components/ShieldAbility.xsd index 5cf2145c..bbb30c82 100644 --- a/resources/Schema/Components/ShieldAbility.xsd +++ b/resources/Schema/Components/ShieldAbility.xsd @@ -9,8 +9,8 @@ - - This is the cooldown on shield + + If the shield is active or not diff --git a/resources/Shaders/ForwardPlus.frag.glsl b/resources/Shaders/ForwardPlus.frag.glsl index aa45d118..8f0f7deb 100644 --- a/resources/Shaders/ForwardPlus.frag.glsl +++ b/resources/Shaders/ForwardPlus.frag.glsl @@ -171,7 +171,7 @@ void main() vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed); color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)); float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0; - vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a; + vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)); color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal; //vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color; diff --git a/resources/Shaders/ForwardPlusShieldCheck.frag.glsl b/resources/Shaders/ForwardPlusShieldCheck.frag.glsl index 35db495b..5995facb 100644 --- a/resources/Shaders/ForwardPlusShieldCheck.frag.glsl +++ b/resources/Shaders/ForwardPlusShieldCheck.frag.glsl @@ -178,7 +178,7 @@ void main() vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed); color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)); float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0; - vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a; + vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)); color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal; //vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color; diff --git a/src/Game/Systems/AbilityCooldownHUDSystem.cpp b/src/Game/Systems/AbilityCooldownHUDSystem.cpp index e2734b47..07461f95 100644 --- a/src/Game/Systems/AbilityCooldownHUDSystem.cpp +++ b/src/Game/Systems/AbilityCooldownHUDSystem.cpp @@ -47,19 +47,36 @@ void AbilityCooldownHUDSystem::Update(double dt) } EntityWrapper cooldownTextEntity = entity.FirstChildByName("Cooldown"); + //TODO: Fix so this track correctly for shield and sprint depending on how they work. + double maxAbilityCD, currentAbilityCD; - double maxAbilityCD = (double)abilityEntity[abilityName]["CoolDownMaxTimer"]; - double currentAbilityCD = (double)abilityEntity[abilityName]["CoolDownTimer"]; - currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0; + if (abilityName == "DashAbility") { + maxAbilityCD = (double)abilityEntity[abilityName]["CoolDownMaxTimer"]; + currentAbilityCD = (double)abilityEntity[abilityName]["CoolDownTimer"]; + currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0; - if (cooldownTextEntity.Valid()) { - if (cooldownTextEntity.HasComponent("Text")) { - std::string t = (std::string&)cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3); + if (cooldownTextEntity.Valid()) { + if (cooldownTextEntity.HasComponent("Text")) { + std::string t = (std::string&)cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3); + } } } + if (abilityName == "ShieldAbility") { + maxAbilityCD = 0.0; + currentAbilityCD = 1 - (bool)abilityEntity[abilityName]["Active"]; + } + + if (abilityName == "SprintAbility") { + maxAbilityCD = 0.0; + currentAbilityCD = 1 - (bool)abilityEntity[abilityName]["Active"]; + } + if (entity.HasComponent("Fill")) { entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD; } + + + } }