From 47ece6a5bf7ac1b5f7feb2d15a26e7a97ff38401 Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 7 Mar 2016 14:42:50 +0100 Subject: [PATCH] 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; } + + + } }