From e7118ce8e5eecefffd7f70587ed48a0a98561706 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 17 Feb 2016 10:52:50 +0100 Subject: [PATCH 01/94] WIP --- include/Engine/Rendering/Skeleton.h | 5 +- resources/Schema/Entities/AnimationTests2.xml | 64 ++++++++++++------ src/Engine/Rendering/Skeleton.cpp | 66 +++++++++++-------- 3 files changed, 84 insertions(+), 51 deletions(-) diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index 28a5ef6a..3a7231d6 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -108,6 +108,8 @@ public: void AccumulateBoneTransforms(bool noRootMotion, std::vector animations, std::map& frameBones, const Bone* bone, glm::mat4 parentMatrix); void AccumulateBoneTransforms(bool noRootMotion, std::vector animations, AnimationOffset animationOffset, std::map& frameBones, const Bone* bone, glm::mat4 parentMatrix); + glm::mat4 AdditiveBlend(JointFrameTransform addTransform, JointFrameTransform transform); + void PrintSkeleton(); void PrintSkeleton(const Bone* parent, int depthCount); std::map Animations; @@ -118,8 +120,7 @@ public: int GetKeyframe(const Animation& animation, double time); private: - - glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset); + JointFrameTransform GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset); std::map m_BonesByName; diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index 413c7e67..7ce357f4 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -29,25 +29,19 @@ - Run - 0.5 - 0.60188997954429357 - -1 + AimRifle + 0.94417153407339605 1 - 0.5 - 0.96957233017255007 + + 0.032904333143131348 0.093923612201312068 1 - - AimRifle - - Models/Characters/Assault/AssaultAnimations.mesh - + @@ -61,8 +55,8 @@ Models/Weapons/Red/AssaultWeaponRed.mesh - - + + @@ -108,23 +102,52 @@ - ShootFastRifle - 0.056234247235838808 + Idle + 0.17120540274882234 1 - 1 - Idl + 0.10000000149011612 + StrafeRigh 0.5 - 1.8308673495784191 - StrafeRigh + 0.518960175468406 0.5 0.32167823998061529 1 + + AimRifle + Models/Characters/Assault/AssaultAnimations.mesh + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Red/AssaultWeaponRed.mesh + + + + + + + + + + + AimRifle + + + Models/Characters/Assault/AssaultAnimations.mesh + + + + + @@ -135,7 +158,8 @@ Models/Weapons/Red/AssaultWeaponRed.mesh - + + diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index e390d694..bd994a08 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -274,26 +274,18 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vectorParent) { - if (offset != glm::mat4(1)) { - boneMatrix = parentMatrix * offset;// *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix)); - } else { - boneMatrix = parentMatrix *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix)); - - } + boneMatrix = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } else { - boneMatrix = offset * glm::inverse(bone->OffsetMatrix); + boneMatrix = glm::inverse(bone->OffsetMatrix); boneMatrices[bone->ID] = parentMatrix; } } else { - glm::vec3 finalPosInterp; - glm::quat finalRotInterp; - glm::vec3 finalScaleInterp; + JointFrameTransform jointFinalTransform; + float totalWeight = 0; for (JointFrameTransform jointTransform : JointTransforms) { @@ -303,26 +295,23 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vectorID] = boneMatrix * bone->OffsetMatrix; } @@ -331,7 +320,20 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector animations, AnimationOffset animationOffset, glm::mat4 childMatrix) { glm::mat4 boneMatrix; - + /* std::vector JointTransforms; for (const AnimationData animationData : animations) { @@ -569,9 +577,9 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v if (bone->Parent != nullptr) { return GetBoneTransform(noRootMotion, bone->Parent, animations, animationOffset, boneMatrix); - } else { + } else {*/ return boneMatrix; - } + // } } From db8bc612bd61c1de7f7543fca13ff2abc8f7b4ec Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 17 Feb 2016 14:55:02 +0100 Subject: [PATCH 02/94] AdditiveBlend now working, needs cleanup --- include/Engine/Rendering/Skeleton.h | 8 +- resources/Schema/Entities/AnimationTests2.xml | 64 ++------- src/Engine/Rendering/Skeleton.cpp | 122 ++++++++++-------- 3 files changed, 79 insertions(+), 115 deletions(-) diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index 3a7231d6..3f9331ca 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -76,9 +76,9 @@ public: }; struct JointFrameTransform { - glm::vec3 PositionInterp = glm::vec3(0); - glm::quat RotationInterp = glm::quat(); - glm::vec3 ScaleInterp = glm::vec3(0); + glm::vec3 Position = glm::vec3(0); + glm::quat Rotation = glm::quat(); + glm::vec3 Scale = glm::vec3(0); float Weight; }; @@ -108,7 +108,7 @@ public: void AccumulateBoneTransforms(bool noRootMotion, std::vector animations, std::map& frameBones, const Bone* bone, glm::mat4 parentMatrix); void AccumulateBoneTransforms(bool noRootMotion, std::vector animations, AnimationOffset animationOffset, std::map& frameBones, const Bone* bone, glm::mat4 parentMatrix); - glm::mat4 AdditiveBlend(JointFrameTransform addTransform, JointFrameTransform transform); + glm::mat4 AdditiveBlend(glm::mat4 differencePose, glm::mat4 targetPose); void PrintSkeleton(); void PrintSkeleton(const Bone* parent, int depthCount); diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index 7ce357f4..c36c5c02 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -29,10 +29,10 @@ - AimRifle - 0.94417153407339605 + Idle + 1.1429797894322036 + 1 1 - 0.032904333143131348 0.093923612201312068 1 @@ -44,24 +44,7 @@ - - - - - R_Arm_Weapon_Joint - - - - Models/Weapons/Red/AssaultWeaponRed.mesh - - - - - - - - - + @@ -103,43 +86,32 @@ Idle - 0.17120540274882234 + 1.1429797894322036 1 0.10000000149011612 StrafeRigh 0.5 - 0.518960175468406 + 0.67154243305829331 0.5 0.32167823998061529 1 AimRifle + Models/Characters/Assault/AssaultAnimations.mesh - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Red/AssaultWeaponRed.mesh - - - - - - + AimRifle + 0.5 Models/Characters/Assault/AssaultAnimations.mesh @@ -148,23 +120,7 @@ - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Red/AssaultWeaponRed.mesh - - - - - - - - - + diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index bd994a08..0e9483d6 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -127,23 +127,23 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vectorID] = parentMatrix; } } else if (JointTransforms.size() == 1) { - boneMatrix = parentMatrix *(glm::translate(JointTransforms.at(0).PositionInterp) * glm::toMat4(JointTransforms.at(0).RotationInterp) * glm::scale(JointTransforms.at(0).ScaleInterp)); + boneMatrix = parentMatrix *(glm::translate(JointTransforms.at(0).Position) * glm::toMat4(JointTransforms.at(0).Rotation) * glm::scale(JointTransforms.at(0).Scale)); boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } else { @@ -178,14 +178,14 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vectorID] = boneMatrix * bone->OffsetMatrix; @@ -321,16 +335,10 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vectorOffsetMatrix) * childMatrix; } } else if (JointTransforms.size() == 1) { - boneMatrix = (glm::translate(JointTransforms.at(0).PositionInterp) * glm::toMat4(JointTransforms.at(0).RotationInterp) * glm::scale(JointTransforms.at(0).ScaleInterp)) * childMatrix; + boneMatrix = (glm::translate(JointTransforms.at(0).Position) * glm::toMat4(JointTransforms.at(0).Rotation) * glm::scale(JointTransforms.at(0).Scale)) * childMatrix; } else { glm::vec3 finalPosInterp; @@ -676,14 +684,14 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v for (JointFrameTransform jointTransform : JointTransforms) { if (jointTransform.Weight == 1.0f) { - finalPosInterp = jointTransform.PositionInterp; - finalRotInterp = jointTransform.RotationInterp; - finalScaleInterp = jointTransform.ScaleInterp; + finalPosInterp = jointTransform.Position; + finalRotInterp = jointTransform.Rotation; + finalScaleInterp = jointTransform.Scale; break; } else { - finalPosInterp += jointTransform.PositionInterp * (jointTransform.Weight/totalWeight); - finalRotInterp *= glm::slerp(glm::quat(), jointTransform.RotationInterp, (jointTransform.Weight/totalWeight)); - finalScaleInterp += jointTransform.ScaleInterp * (jointTransform.Weight/totalWeight); + finalPosInterp += jointTransform.Position * (jointTransform.Weight/totalWeight); + finalRotInterp *= glm::slerp(glm::quat(), jointTransform.Rotation, (jointTransform.Weight/totalWeight)); + finalScaleInterp += jointTransform.Scale * (jointTransform.Weight/totalWeight); } } From debb1881bf70ee2de8d5bd91a4ad564cd1d9fd47 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 17 Feb 2016 15:48:45 +0100 Subject: [PATCH 03/94] BoneAttachment working --- include/Engine/Rendering/Skeleton.h | 2 +- resources/Schema/Entities/BlueRifle | 19 ++++++ src/Engine/Rendering/Skeleton.cpp | 101 +++++++++++++--------------- 3 files changed, 68 insertions(+), 54 deletions(-) create mode 100644 resources/Schema/Entities/BlueRifle diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index 3f9331ca..93f62a37 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -108,7 +108,7 @@ public: void AccumulateBoneTransforms(bool noRootMotion, std::vector animations, std::map& frameBones, const Bone* bone, glm::mat4 parentMatrix); void AccumulateBoneTransforms(bool noRootMotion, std::vector animations, AnimationOffset animationOffset, std::map& frameBones, const Bone* bone, glm::mat4 parentMatrix); - glm::mat4 AdditiveBlend(glm::mat4 differencePose, glm::mat4 targetPose); + glm::mat4 AdditiveBlend(const Bone* bone, AnimationOffset animationOffset, glm::mat4 targetPose); void PrintSkeleton(); void PrintSkeleton(const Bone* parent, int depthCount); diff --git a/resources/Schema/Entities/BlueRifle b/resources/Schema/Entities/BlueRifle new file mode 100644 index 00000000..194c7739 --- /dev/null +++ b/resources/Schema/Entities/BlueRifle @@ -0,0 +1,19 @@ + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index 0e9483d6..4e961a36 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -276,7 +276,11 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vectorParent) { - boneMatrix = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); + + glm::mat4 jointPose = (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); + glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, jointPose); + + boneMatrix = parentMatrix * boneTransform; boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } else { boneMatrix = glm::inverse(bone->OffsetMatrix); @@ -308,22 +312,8 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vectorID] = boneMatrix * bone->OffsetMatrix; @@ -335,10 +325,19 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector animations, AnimationOffset animationOffset, glm::mat4 childMatrix) { glm::mat4 boneMatrix; - /* + std::vector JointTransforms; for (const AnimationData animationData : animations) { @@ -511,23 +509,23 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - jointTransform.PositionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - jointTransform.RotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - jointTransform.ScaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; + jointTransform.Position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; + jointTransform.Rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); + jointTransform.Scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; // Flag for no root motion if (bone == RootBone && noRootMotion) { - jointTransform.PositionInterp.x = 0; - jointTransform.PositionInterp.z = 0; + jointTransform.Position.x = 0; + jointTransform.Position.z = 0; } JointTransforms.push_back(jointTransform); } else { // 1 keyframes for the current bone currentFrame = boneKeyFrames.at(0); - jointTransform.PositionInterp = currentFrame.BoneProperties.Position; - jointTransform.RotationInterp = currentFrame.BoneProperties.Rotation; - jointTransform.ScaleInterp = currentFrame.BoneProperties.Scale; + jointTransform.Position = currentFrame.BoneProperties.Position; + jointTransform.Rotation = currentFrame.BoneProperties.Rotation; + jointTransform.Scale = currentFrame.BoneProperties.Scale; JointTransforms.push_back(jointTransform); } @@ -538,23 +536,20 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v } - glm::mat4 offset = GetOffsetTransform(bone, animationOffset); - if (JointTransforms.size() == 0) { if (bone->Parent) { - if (offset != glm::mat4(1)) { - boneMatrix = offset * childMatrix;// *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix)); - } else { - boneMatrix = ((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix)) * childMatrix; - } + + glm::mat4 jointPose = (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); + glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, jointPose); + + boneMatrix = boneTransform * childMatrix; } else { - boneMatrix = offset * glm::inverse(bone->OffsetMatrix); + boneMatrix = glm::inverse(bone->OffsetMatrix) * childMatrix; } } else { - glm::vec3 finalPosInterp; - glm::quat finalRotInterp; - glm::vec3 finalScaleInterp; + JointFrameTransform jointFinalTransform; + float totalWeight = 0; for (JointFrameTransform jointTransform : JointTransforms) { @@ -564,30 +559,30 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v for (JointFrameTransform jointTransform : JointTransforms) { if (jointTransform.Weight == 1.0f) { - finalPosInterp = jointTransform.PositionInterp; - finalRotInterp = jointTransform.RotationInterp; - finalScaleInterp = jointTransform.ScaleInterp; + jointFinalTransform.Position = jointTransform.Position; + jointFinalTransform.Rotation = jointTransform.Rotation; + jointFinalTransform.Scale = jointTransform.Scale; break; } else { - finalPosInterp += jointTransform.PositionInterp * (jointTransform.Weight/totalWeight); - finalRotInterp *= glm::slerp(glm::quat(), jointTransform.RotationInterp, (jointTransform.Weight/totalWeight)); - finalScaleInterp += jointTransform.ScaleInterp * (jointTransform.Weight/totalWeight); + jointFinalTransform.Position += jointTransform.Position * (jointTransform.Weight/totalWeight); + jointFinalTransform.Rotation *= glm::slerp(glm::quat(), jointTransform.Rotation, (jointTransform.Weight/totalWeight)); + jointFinalTransform.Scale += jointTransform.Scale * (jointTransform.Weight/totalWeight); } } - if (offset != glm::mat4(1)) { - boneMatrix = ((glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) + offset) * childMatrix; - } else { - boneMatrix = (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) * childMatrix; - } + + glm::mat4 jointPose = (glm::translate(jointFinalTransform.Position) * glm::toMat4(jointFinalTransform.Rotation) * glm::scale(jointFinalTransform.Scale)); + glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, jointPose); + + boneMatrix = boneTransform * childMatrix; } if (bone->Parent != nullptr) { return GetBoneTransform(noRootMotion, bone->Parent, animations, animationOffset, boneMatrix); - } else {*/ + } else { return boneMatrix; - // } + } } From 3c9c95cff4d132ef43e23886b3455c4f0745bb95 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 18 Feb 2016 16:34:18 +0100 Subject: [PATCH 04/94] Animation blending improved and Animation Override added --- assets | 2 +- include/Engine/Rendering/ModelJob.h | 9 + include/Engine/Rendering/Skeleton.h | 22 +- resources/Schema/Components/Animation.xml | 6 + resources/Schema/Components/Animation.xsd | 21 ++ resources/Schema/Entities/AnimationTests2.xml | 85 ++++- src/Engine/Rendering/AnimationSystem.cpp | 10 +- src/Engine/Rendering/Renderer.cpp | 1 + src/Engine/Rendering/Skeleton.cpp | 323 ++++++++---------- 9 files changed, 279 insertions(+), 200 deletions(-) diff --git a/assets b/assets index 4d36fdce..1e7adc74 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 4d36fdced7007a594a56b7371bb26861876889aa +Subproject commit 1e7adc749e02144615a20a82c847d3c8df46ee3d diff --git a/include/Engine/Rendering/ModelJob.h b/include/Engine/Rendering/ModelJob.h index ba801f60..773e002e 100644 --- a/include/Engine/Rendering/ModelJob.h +++ b/include/Engine/Rendering/ModelJob.h @@ -133,7 +133,16 @@ struct ModelJob : RenderJob } animationData.time = (double)animationComponent["Time" + std::to_string(i)]; animationData.weight = (double)animationComponent["Weight" + std::to_string(i)]; + + if((int)animationComponent["BlendType" + std::to_string(i)].Enum("Additive") == (int)animationComponent["BlendType" + std::to_string(i)]) { + animationData.blendType = Skeleton::BlendType::Additive; + } else if ((int)animationComponent["BlendType" + std::to_string(i)].Enum("Blend") == (int)animationComponent["BlendType" + std::to_string(i)]) { + animationData.blendType = Skeleton::BlendType::Blend; + } else if ((int)animationComponent["BlendType" + std::to_string(i)].Enum("Override") == (int)animationComponent["BlendType" + std::to_string(i)]) { + animationData.blendType = Skeleton::BlendType::Override; + } + animationData.level = (int)animationComponent["Level" + std::to_string(i)]; Animations.push_back(animationData); } } diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index 93f62a37..f064cc3c 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -68,18 +68,26 @@ public: std::map> JointAnimations; }; + enum class BlendType + { + Additive, + Blend, + Override, + }; struct AnimationData { const Animation* animation; + BlendType blendType; float time; + int level; float weight; }; - struct JointFrameTransform { - glm::vec3 Position = glm::vec3(0); - glm::quat Rotation = glm::quat(); - glm::vec3 Scale = glm::vec3(0); - float Weight; + struct JointFramePose { + BlendType Type; + int Level = 0; + glm::mat4 Pose = glm::mat4(0); + float Weight = 0.0f; }; struct AnimationOffset { @@ -119,8 +127,10 @@ public: glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, glm::mat4 childMatrix); int GetKeyframe(const Animation& animation, double time); + private: - JointFrameTransform GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset); + glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset); + glm::mat4 GetBonePose(const Bone* bone, const Animation* animation, double time, bool noRootMotion); std::map m_BonesByName; diff --git a/resources/Schema/Components/Animation.xml b/resources/Schema/Components/Animation.xml index ae42009d..6f49edb4 100644 --- a/resources/Schema/Components/Animation.xml +++ b/resources/Schema/Components/Animation.xml @@ -1,16 +1,22 @@ + + 0 1.0 0 0 true + + 0 1.0 0 0 true + + 0 1.0 0 0 diff --git a/resources/Schema/Components/Animation.xsd b/resources/Schema/Components/Animation.xsd index f39aac18..e765f8e8 100644 --- a/resources/Schema/Components/Animation.xsd +++ b/resources/Schema/Components/Animation.xsd @@ -3,20 +3,41 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index c36c5c02..8cc3f812 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -29,11 +29,14 @@ - Idle - 1.1429797894322036 + Run 1 + StrafeRight + 0.5 + 0.98334510030765165 + 0.5 + 0.97153983043137671 1 - 0.032904333143131348 0.093923612201312068 1 @@ -44,7 +47,20 @@ - + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + @@ -75,6 +91,7 @@ Models/Core/UnitPlane.mesh + @@ -85,42 +102,80 @@ - Idle - 1.1429797894322036 + Run 1 - 0.10000000149011612 - StrafeRigh + StrafeRight + 0.5 + 0.98334510030765165 0.5 - 0.67154243305829331 - 0.5 - 0.32167823998061529 + 0.89665639003541542 + 1 + ShootFastRifle + + + + 0.099759525382621339 1 AimRifle - + Models/Characters/Assault/AssaultAnimations.mesh - + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + AimRifle - 0.5 + 0.5 + Ru + 0.57926159055711501 Models/Characters/Assault/AssaultAnimations.mesh + true - + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Red/AssaultWeaponRed.mesh + true + + + + + + diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 02d72409..e70c4f36 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -54,13 +54,19 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a e.Entity = entity; e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)]; m_EventBroker->Publish(e); - nextTime -= animation->Duration; + + while(nextTime > animation->Duration) { + nextTime -= animation->Duration; + } } else if (nextTime < 0) { Events::AnimationComplete e; e.Entity = entity; e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)]; m_EventBroker->Publish(e); - nextTime += animation->Duration; + + while (nextTime < 0) { + nextTime += animation->Duration; + } } } diff --git a/src/Engine/Rendering/Renderer.cpp b/src/Engine/Rendering/Renderer.cpp index 173ddb2b..85741be4 100644 --- a/src/Engine/Rendering/Renderer.cpp +++ b/src/Engine/Rendering/Renderer.cpp @@ -124,6 +124,7 @@ void Renderer::Draw(RenderFrame& frame) } m_DrawBloomPass->Draw(m_DrawFinalPass->BloomTexture()); + if (m_DebugTextureToDraw == 0) { m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), m_DrawFinalPass->SceneTextureLowRes(), m_DrawFinalPass->BloomTextureLowRes(), frame.Gamma, frame.Exposure); } diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index 4e961a36..94656848 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -66,7 +66,7 @@ std::vector Skeleton::GetFrameBones(std::vector animat if (animations.size() <= 0 || animationOffset.animation == nullptr) { std::vector finalMatrices; for (auto& b : Bones) { - finalMatrices.push_back(glm::mat4(1));//b.second->OffsetMatrix); + finalMatrices.push_back(glm::mat4(1)); } return finalMatrices; } @@ -85,14 +85,15 @@ std::vector Skeleton::GetFrameBones(std::vector animat void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector animations, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix) { glm::mat4 boneMatrix; - std::vector JointTransforms; + + std::vector JointPoses; for (const AnimationData animationData : animations) { const Animation* animation = animationData.animation; const float time = animationData.time; - JointFrameTransform jointTransform; - jointTransform.Weight = animationData.weight;; + JointFramePose jointPose; + jointPose.Weight = animationData.weight;; if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); @@ -121,31 +122,28 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector 1.0f || progress < 0.0f) { - LOG_INFO("Progress: %f", progress); progress = glm::clamp(progress, 0.0f, 1.0f); } Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - jointTransform.Position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - jointTransform.Rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - jointTransform.Scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; + glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; + glm::quat rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); + glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; // Flag for no root motion if (bone == RootBone && noRootMotion) { - jointTransform.Position.x = 0; - jointTransform.Position.z = 0; + position.x = 0; + position.z = 0; } - JointTransforms.push_back(jointTransform); + jointPose.Pose = (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); + JointPoses.push_back(jointPose); } else { // 1 keyframes for the current bone currentFrame = boneKeyFrames.at(0); - jointTransform.Position = currentFrame.BoneProperties.Position; - jointTransform.Rotation = currentFrame.BoneProperties.Rotation; - jointTransform.Scale = currentFrame.BoneProperties.Scale; - JointTransforms.push_back(jointTransform); - + jointPose.Pose = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); + JointPoses.push_back(jointPose); } } else { // 0 keyframes for the current bone @@ -153,49 +151,41 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vectorParent) { - boneMatrix = parentMatrix * glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix; + + glm::mat4 jointPose = (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); + + boneMatrix = parentMatrix * jointPose; boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } else { boneMatrix = glm::inverse(bone->OffsetMatrix); boneMatrices[bone->ID] = parentMatrix; } - } else if (JointTransforms.size() == 1) { - boneMatrix = parentMatrix *(glm::translate(JointTransforms.at(0).Position) * glm::toMat4(JointTransforms.at(0).Rotation) * glm::scale(JointTransforms.at(0).Scale)); - boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } else { - glm::vec3 finalPosInterp; - glm::quat finalRotInterp; - glm::vec3 finalScaleInterp; float totalWeight = 0; - for (JointFrameTransform jointTransform : JointTransforms) { - totalWeight += jointTransform.Weight; + for (JointFramePose jointFramePose : JointPoses) { + totalWeight += jointFramePose.Weight; } + glm::mat4 finalBlend = glm::mat4(0); - for (JointFrameTransform jointTransform : JointTransforms) { - if (jointTransform.Weight == 1.0f) { - finalPosInterp = jointTransform.Position; - finalRotInterp = jointTransform.Rotation; - finalScaleInterp = jointTransform.Scale; - break; + for (JointFramePose jointFramePose : JointPoses) { + if (jointFramePose.Weight == 1.0f) { + finalBlend = jointFramePose.Pose; } else { - finalPosInterp += jointTransform.Position * (jointTransform.Weight/totalWeight); - finalRotInterp *= glm::slerp(glm::quat(), jointTransform.Rotation, (jointTransform.Weight/totalWeight)); - finalScaleInterp += jointTransform.Scale * (jointTransform.Weight/totalWeight); + finalBlend += jointFramePose.Pose * (jointFramePose.Weight / totalWeight); } - } - boneMatrix = parentMatrix *(glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)); + + boneMatrix = parentMatrix * finalBlend; boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } - - for (auto &child : bone->Children) { AccumulateBoneTransforms(noRootMotion, animations, boneMatrices, child, boneMatrix); } @@ -204,83 +194,25 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector animations, AnimationOffset animationOffset, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix) { glm::mat4 boneMatrix; - - std::vector JointTransforms; + std::vector JointPoses; for (const AnimationData animationData : animations) { - const Animation* animation = animationData.animation; - const float time = animationData.time; - - JointFrameTransform jointTransform; - jointTransform.Weight = animationData.weight;; - - if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { - std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); - - Animation::Keyframe currentFrame; - Animation::Keyframe nextFrame; - - if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone - for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame - if (time >= boneKeyFrames.at(index).Time) { - currentFrame = boneKeyFrames.at(index); - nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size()); - break; - } - } - - float progress; - - if (nextFrame.Index == 0) { - nextFrame = currentFrame; - progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); - } else { - progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); - - } - - - if (progress > 1.0f || progress < 0.0f) { - LOG_INFO("Progress: %f", progress); - progress = glm::clamp(progress, 0.0f, 1.0f); - } - Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; - Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - - jointTransform.Position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - jointTransform.Rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - jointTransform.Scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; - - // Flag for no root motion - if (bone == RootBone && noRootMotion) { - jointTransform.Position.x = 0; - jointTransform.Position.z = 0; - } - - JointTransforms.push_back(jointTransform); - - } else { // 1 keyframes for the current bone - currentFrame = boneKeyFrames.at(0); - jointTransform.Position = currentFrame.BoneProperties.Position; - jointTransform.Rotation = currentFrame.BoneProperties.Rotation; - jointTransform.Scale = currentFrame.BoneProperties.Scale; - JointTransforms.push_back(jointTransform); - - } - } else { // 0 keyframes for the current bone - - } - + if (animationData.animation->JointAnimations.find(bone->ID) != animationData.animation->JointAnimations.end()) { // Does the bone have any keyframes in this animation? + JointFramePose jointPose; + jointPose.Weight = animationData.weight; + jointPose.Type = animationData.blendType; + jointPose.Level = animationData.level; + jointPose.Pose = GetBonePose(bone, animationData.animation, animationData.time, noRootMotion); + JointPoses.push_back(jointPose); + } } - if (JointTransforms.size() == 0) { + if (JointPoses.size() == 0) { // No keyframes for the current bone if (bone->Parent) { - glm::mat4 jointPose = (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, jointPose); - - boneMatrix = parentMatrix * boneTransform; + boneMatrix = parentMatrix * boneTransform; boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } else { boneMatrix = glm::inverse(bone->OffsetMatrix); @@ -288,33 +220,31 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector maxLevel ? jointPose.Level : maxLevel; } - for (JointFrameTransform jointTransform : JointTransforms) { - if (jointTransform.Weight == 1.0f) { - jointFinalTransform.Position = jointTransform.Position; - jointFinalTransform.Rotation = jointTransform.Rotation; - jointFinalTransform.Scale = jointTransform.Scale; - break; - } else { - jointFinalTransform.Position += jointTransform.Position * (jointTransform.Weight/totalWeight); - jointFinalTransform.Rotation *= glm::slerp(glm::quat(), jointTransform.Rotation, (jointTransform.Weight/totalWeight)); - jointFinalTransform.Scale += jointTransform.Scale * (jointTransform.Weight/totalWeight); + for (JointFramePose jointPose : JointPoses) { + if (jointPose.Type == BlendType::Override) { + finalOverride += jointPose.Pose * jointPose.Weight; //Blend Overrides then apply to final blend + } else if(jointPose.Type == BlendType::Blend) { + finalBlend += jointPose.Pose * jointPose.Weight; + } else if (jointPose.Type == BlendType::Additive) { + //Soon } - } + if(finalOverride != glm::mat4(0)) { + finalBlend = finalOverride; + } - glm::mat4 jointPose = (glm::translate(jointFinalTransform.Position) * glm::toMat4(jointFinalTransform.Rotation) * glm::scale(jointFinalTransform.Scale)); - glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, jointPose); - + glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, finalBlend); boneMatrix = parentMatrix * boneTransform; boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } @@ -329,18 +259,14 @@ glm::mat4 Skeleton::AdditiveBlend(const Bone* bone, AnimationOffset animationOff { AnimationOffset refOffset = animationOffset; refOffset.time = 0.5f; // reference pose is at 0.5s for now - JointFrameTransform refOffsetTransform = GetOffsetTransform(bone, refOffset); - JointFrameTransform srcOffsetTransform = GetOffsetTransform(bone, animationOffset); - - glm::mat4 srcPose = (glm::translate(srcOffsetTransform.Position) * glm::toMat4(srcOffsetTransform.Rotation) * glm::scale(srcOffsetTransform.Scale)); - glm::mat4 refPose = (glm::translate(refOffsetTransform.Position) * glm::toMat4(refOffsetTransform.Rotation) * glm::scale(refOffsetTransform.Scale)); - + glm::mat4 refPose = GetOffsetTransform(bone, refOffset); + glm::mat4 srcPose = GetOffsetTransform(bone, animationOffset); glm::mat4 differencePose = srcPose * glm::inverse(refPose); glm::mat4 finalPose = differencePose * targetPose; return finalPose; } -Skeleton::JointFrameTransform Skeleton::GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset) +glm::mat4 Skeleton::GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset) { const Animation* animation = animationOffset.animation; float time = animationOffset.time; @@ -371,7 +297,6 @@ Skeleton::JointFrameTransform Skeleton::GetOffsetTransform(const Bone* bone, Ani progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); } else { progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); - } progress = glm::clamp(progress, 0.0f, 1.0f); @@ -392,13 +317,70 @@ Skeleton::JointFrameTransform Skeleton::GetOffsetTransform(const Bone* bone, Ani } } + return (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale));; +} - JointFrameTransform jointTransform; - jointTransform.Position = position; - jointTransform.Rotation = rotation; - jointTransform.Scale = scale; - return jointTransform; +glm::mat4 Skeleton::GetBonePose(const Bone* bone, const Animation* animation, double time, bool noRootMotion) +{ + glm::mat4 boneMatrix; + + std::vector JointPoses; + + + if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { + std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); + + Animation::Keyframe currentFrame; + Animation::Keyframe nextFrame; + + if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone + for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame + if (time >= boneKeyFrames.at(index).Time) { + currentFrame = boneKeyFrames.at(index); + nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size()); + break; + } + } + + float progress; + + if (nextFrame.Index == 0) { + nextFrame = currentFrame; + progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); + } else { + progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); + + } + + + if (progress > 1.0f || progress < 0.0f) { + progress = glm::clamp(progress, 0.0f, 1.0f); + } + Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; + Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; + + glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; + glm::quat rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); + glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; + + // Flag for no root motion + if (bone == RootBone && noRootMotion) { + position.x = 0; + position.z = 0; + } + + boneMatrix = (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); + + } else { // 1 keyframes for the current bone + currentFrame = boneKeyFrames.at(0); + boneMatrix = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); + } + } //else { // 0 keyframes for the current bone + + // } + + return boneMatrix; } glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix) @@ -467,14 +449,14 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v { glm::mat4 boneMatrix; - std::vector JointTransforms; + std::vector JointPoses; for (const AnimationData animationData : animations) { const Animation* animation = animationData.animation; const float time = animationData.time; - JointFrameTransform jointTransform; - jointTransform.Weight = animationData.weight;; + JointFramePose jointPose; + jointPose.Weight = animationData.weight;; if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); @@ -503,31 +485,28 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v if (progress > 1.0f || progress < 0.0f) { - LOG_INFO("Progress: %f", progress); progress = glm::clamp(progress, 0.0f, 1.0f); } Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - jointTransform.Position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - jointTransform.Rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - jointTransform.Scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; + glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; + glm::quat rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); + glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; // Flag for no root motion if (bone == RootBone && noRootMotion) { - jointTransform.Position.x = 0; - jointTransform.Position.z = 0; + position.x = 0; + position.z = 0; } - JointTransforms.push_back(jointTransform); + jointPose.Pose = (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); + JointPoses.push_back(jointPose); } else { // 1 keyframes for the current bone currentFrame = boneKeyFrames.at(0); - jointTransform.Position = currentFrame.BoneProperties.Position; - jointTransform.Rotation = currentFrame.BoneProperties.Rotation; - jointTransform.Scale = currentFrame.BoneProperties.Scale; - JointTransforms.push_back(jointTransform); - + jointPose.Pose = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); + JointPoses.push_back(jointPose); } } else { // 0 keyframes for the current bone @@ -536,7 +515,7 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v } - if (JointTransforms.size() == 0) { + if (JointPoses.size() == 0) { if (bone->Parent) { glm::mat4 jointPose = (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); @@ -548,33 +527,24 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v } } else { - JointFrameTransform jointFinalTransform; - float totalWeight = 0; - for (JointFrameTransform jointTransform : JointTransforms) { - totalWeight += jointTransform.Weight; + for (JointFramePose jointFramePose : JointPoses) { + totalWeight += jointFramePose.Weight; } + glm::mat4 finalBlend = glm::mat4(0); - for (JointFrameTransform jointTransform : JointTransforms) { - if (jointTransform.Weight == 1.0f) { - jointFinalTransform.Position = jointTransform.Position; - jointFinalTransform.Rotation = jointTransform.Rotation; - jointFinalTransform.Scale = jointTransform.Scale; - break; + for (JointFramePose jointFramePose : JointPoses) { + if (jointFramePose.Weight == 1.0f) { + finalBlend = jointFramePose.Pose; } else { - jointFinalTransform.Position += jointTransform.Position * (jointTransform.Weight/totalWeight); - jointFinalTransform.Rotation *= glm::slerp(glm::quat(), jointTransform.Rotation, (jointTransform.Weight/totalWeight)); - jointFinalTransform.Scale += jointTransform.Scale * (jointTransform.Weight/totalWeight); + finalBlend += jointFramePose.Pose * (jointFramePose.Weight / totalWeight); } - } - glm::mat4 jointPose = (glm::translate(jointFinalTransform.Position) * glm::toMat4(jointFinalTransform.Rotation) * glm::scale(jointFinalTransform.Scale)); - glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, jointPose); - + glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, finalBlend); boneMatrix = boneTransform * childMatrix; } @@ -589,7 +559,7 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, glm::mat4 childMatrix) { glm::mat4 boneMatrix; - std::vector JointTransforms; + /* std::vector JointTransforms; for (const AnimationData animationData : animations) { const Animation* animation = animationData.animation; @@ -625,7 +595,6 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v if (progress > 1.0f || progress < 0.0f) { - LOG_INFO("Progress: %f", progress); progress = glm::clamp(progress, 0.0f, 1.0f); } Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; @@ -688,18 +657,20 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v finalRotInterp *= glm::slerp(glm::quat(), jointTransform.Rotation, (jointTransform.Weight/totalWeight)); finalScaleInterp += jointTransform.Scale * (jointTransform.Weight/totalWeight); } + } boneMatrix = (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) * childMatrix; } - if (bone->Parent != nullptr) { return GetBoneTransform(noRootMotion, bone->Parent, animations, boneMatrix); } else { return boneMatrix; - } + }*/ + +return boneMatrix; } int Skeleton::GetBoneID(std::string name) From abd36c81f8d6182a75c118bed855d935e9ec968b Mon Sep 17 00:00:00 2001 From: viktorljung Date: Mon, 22 Feb 2016 15:58:38 +0100 Subject: [PATCH 05/94] Added BlendTree that stores and blends multiple animations --- include/Engine/Rendering/BlendTree.h | 75 +++++ include/Engine/Rendering/ModelJob.h | 39 +-- include/Engine/Rendering/Skeleton.h | 17 +- resources/Schema/Components.xsd | 3 + resources/Schema/Components/Animation.xml | 26 +- resources/Schema/Components/Animation.xsd | 43 +-- resources/Schema/Components/Blend.xml | 6 + resources/Schema/Components/Blend.xsd | 14 + resources/Schema/Components/BlendAdditive.xml | 5 + resources/Schema/Components/BlendAdditive.xsd | 13 + resources/Schema/Components/BlendOverride.xml | 6 + resources/Schema/Components/BlendOverride.xsd | 14 + resources/Schema/Entities/AnimationTests2.xml | 156 ++++----- resources/Schema/Types/Entity.xsd | 3 + src/Engine/Rendering/AnimationSystem.cpp | 33 +- src/Engine/Rendering/BlendTree.cpp | 255 ++++++++++++++ src/Engine/Rendering/BoneAttachmentSystem.cpp | 13 +- src/Engine/Rendering/DrawFinalPass.cpp | 40 ++- src/Engine/Rendering/PickingPass.cpp | 20 +- src/Engine/Rendering/Skeleton.cpp | 313 ++++++------------ 20 files changed, 641 insertions(+), 453 deletions(-) create mode 100644 include/Engine/Rendering/BlendTree.h create mode 100644 resources/Schema/Components/Blend.xml create mode 100644 resources/Schema/Components/Blend.xsd create mode 100644 resources/Schema/Components/BlendAdditive.xml create mode 100644 resources/Schema/Components/BlendAdditive.xsd create mode 100644 resources/Schema/Components/BlendOverride.xml create mode 100644 resources/Schema/Components/BlendOverride.xsd create mode 100644 src/Engine/Rendering/BlendTree.cpp diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h new file mode 100644 index 00000000..431cb8b2 --- /dev/null +++ b/include/Engine/Rendering/BlendTree.h @@ -0,0 +1,75 @@ +#ifndef BlendTree_h__ +#define BlendTree_h__ + +#include "Common.h" +#include "../GLM.h" +#include "Skeleton.h" +#include "../Core/EntityWrapper.h" +#include "../Core/World.h" +#include + +class BlendTree +{ +public: + enum class NodeType + { + Additive, + Blend, + Override, + Animation, + }; + + + struct Node + { + std::string Name; + Node* Parent = nullptr; + Node* Child[2] = { nullptr, nullptr }; + NodeType Type; + std::vector Pose; + float Weight = 0.f; + + Node* Next() { + Node* next = this; + + if (next->Child[1] == nullptr) { + // Node has no right child + next = this; + while (next->Parent != nullptr && next == next->Parent->Child[1]) { + next = next->Parent; + } + next = next->Parent; + } else { + // Find the leftmost node in the right subtree + next = next->Child[1]; + while (next->Child[0] != nullptr) { + next = next->Child[0]; + } + } + + return next; + + } + }; + + + + + + BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton); + ~BlendTree(); + + std::vector GetBoneTransforms(Skeleton* skeleton); + + void PrintTree(); + +private: + Node* m_Root = nullptr; + + void FillTree(Node* parentNode, EntityWrapper parentEntity, Skeleton* skeleton); + BlendTree::Node* FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity, Skeleton* skeleton); + + void Blend(Skeleton* skeleton, std::vector& pose); +}; + +#endif diff --git a/include/Engine/Rendering/ModelJob.h b/include/Engine/Rendering/ModelJob.h index 773e002e..212a3888 100644 --- a/include/Engine/Rendering/ModelJob.h +++ b/include/Engine/Rendering/ModelJob.h @@ -15,6 +15,7 @@ #include "../Core/Transform.h" #include "Skeleton.h" #include "ShaderProgram.h" +#include "BlendTree.h" struct ModelJob : RenderJob { @@ -122,41 +123,11 @@ struct ModelJob : RenderJob Skeleton = Model->m_RawModel->m_Skeleton; if (Skeleton != nullptr) { - if (world->HasComponent(Entity, "Animation")) { - auto animationComponent = world->GetComponent(Entity, "Animation"); - - for (int i = 1; i <= 3; i++) { - ::Skeleton::AnimationData animationData; - animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(animationComponent["AnimationName" + std::to_string(i)]); - if (animationData.animation == nullptr) { - continue; - } - animationData.time = (double)animationComponent["Time" + std::to_string(i)]; - animationData.weight = (double)animationComponent["Weight" + std::to_string(i)]; - - if((int)animationComponent["BlendType" + std::to_string(i)].Enum("Additive") == (int)animationComponent["BlendType" + std::to_string(i)]) { - animationData.blendType = Skeleton::BlendType::Additive; - } else if ((int)animationComponent["BlendType" + std::to_string(i)].Enum("Blend") == (int)animationComponent["BlendType" + std::to_string(i)]) { - animationData.blendType = Skeleton::BlendType::Blend; - } else if ((int)animationComponent["BlendType" + std::to_string(i)].Enum("Override") == (int)animationComponent["BlendType" + std::to_string(i)]) { - animationData.blendType = Skeleton::BlendType::Override; - } - - animationData.level = (int)animationComponent["Level" + std::to_string(i)]; - Animations.push_back(animationData); - } - } - - if (world->HasComponent(Entity, "AnimationOffset")) { - auto animationOffsetComponent = world->GetComponent(Entity, "AnimationOffset"); - AnimationOffset.animation = model->m_RawModel->m_Skeleton->GetAnimation(animationOffsetComponent["AnimationName"]); - AnimationOffset.time = (double)animationOffsetComponent["Time"]; - } else { - AnimationOffset.animation = nullptr; - } + + EntityWrapper entityWrapper = EntityWrapper(world, modelComponent.EntityID); + BlendTree = new ::BlendTree(entityWrapper, Skeleton); } } - }; unsigned int TextureID; @@ -178,7 +149,7 @@ struct ModelJob : RenderJob std::vector<::Skeleton::AnimationData> Animations; ::Skeleton::AnimationOffset AnimationOffset; - + ::BlendTree* BlendTree = nullptr; glm::vec4 DiffuseColor; glm::vec4 SpecularColor; diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index f064cc3c..58021416 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -74,6 +74,7 @@ public: Blend, Override, }; + struct AnimationData { const Animation* animation; @@ -108,26 +109,24 @@ public: int GetBoneID(std::string name); - std::vector GetFrameBones(std::vector animations, AnimationOffset animationOffset, bool noRootMotion = false); - std::vector GetFrameBones(std::vector animations, bool noRootMotion = false); + std::vector GetFrameBones(); + + std::vector GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion = false); + void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, bool additive, const Bone* bone, glm::mat4 parentMatrix); const Animation* GetAnimation(std::string name); - - void AccumulateBoneTransforms(bool noRootMotion, std::vector animations, std::map& frameBones, const Bone* bone, glm::mat4 parentMatrix); - void AccumulateBoneTransforms(bool noRootMotion, std::vector animations, AnimationOffset animationOffset, std::map& frameBones, const Bone* bone, glm::mat4 parentMatrix); - glm::mat4 AdditiveBlend(const Bone* bone, AnimationOffset animationOffset, glm::mat4 targetPose); - void PrintSkeleton(); - void PrintSkeleton(const Bone* parent, int depthCount); std::map Animations; glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix); glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, AnimationOffset animationOffset, glm::mat4 childMatrix); glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, glm::mat4 childMatrix); - int GetKeyframe(const Animation& animation, double time); + std::vector BlendPoses(std::vector pose1, std::vector pose2, float weight); + std::vector OverridePose(std::vector overridePose, std::vector targetPose); + private: glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset); glm::mat4 GetBonePose(const Bone* bone, const Animation* animation, double time, bool noRootMotion); diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index f950e8c8..d81c3852 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -39,4 +39,7 @@ + + + \ No newline at end of file diff --git a/resources/Schema/Components/Animation.xml b/resources/Schema/Components/Animation.xml index 6f49edb4..45ee8428 100644 --- a/resources/Schema/Components/Animation.xml +++ b/resources/Schema/Components/Animation.xml @@ -1,24 +1,8 @@ - - - 0 - 1.0 - 0 - 0 - true - - - 0 - 1.0 - 0 - 0 - true - - - 0 - 1.0 - 0 - 0 - true + + + 0 + true + false \ No newline at end of file diff --git a/resources/Schema/Components/Animation.xsd b/resources/Schema/Components/Animation.xsd index e765f8e8..5e82c333 100644 --- a/resources/Schema/Components/Animation.xsd +++ b/resources/Schema/Components/Animation.xsd @@ -2,48 +2,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - \ No newline at end of file diff --git a/resources/Schema/Components/Blend.xml b/resources/Schema/Components/Blend.xml new file mode 100644 index 00000000..f949a102 --- /dev/null +++ b/resources/Schema/Components/Blend.xml @@ -0,0 +1,6 @@ + + + + + 0.5 + \ No newline at end of file diff --git a/resources/Schema/Components/Blend.xsd b/resources/Schema/Components/Blend.xsd new file mode 100644 index 00000000..95fc8f49 --- /dev/null +++ b/resources/Schema/Components/Blend.xsd @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/Schema/Components/BlendAdditive.xml b/resources/Schema/Components/BlendAdditive.xml new file mode 100644 index 00000000..758917f9 --- /dev/null +++ b/resources/Schema/Components/BlendAdditive.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/resources/Schema/Components/BlendAdditive.xsd b/resources/Schema/Components/BlendAdditive.xsd new file mode 100644 index 00000000..ab931d52 --- /dev/null +++ b/resources/Schema/Components/BlendAdditive.xsd @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/Schema/Components/BlendOverride.xml b/resources/Schema/Components/BlendOverride.xml new file mode 100644 index 00000000..a9f2095a --- /dev/null +++ b/resources/Schema/Components/BlendOverride.xml @@ -0,0 +1,6 @@ + + + + + 1.0 + \ No newline at end of file diff --git a/resources/Schema/Components/BlendOverride.xsd b/resources/Schema/Components/BlendOverride.xsd new file mode 100644 index 00000000..27fc01ed --- /dev/null +++ b/resources/Schema/Components/BlendOverride.xsd @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index 8cc3f812..ace71800 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -26,42 +26,6 @@ - - - - Run - 1 - StrafeRight - 0.5 - 0.98334510030765165 - 0.5 - 0.97153983043137671 - 1 - 0.093923612201312068 - 1 - - - Models/Characters/Assault/AssaultAnimations.mesh - - - - - - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - @@ -99,35 +63,19 @@ - + - - Run - 1 - StrafeRight - 0.5 - 0.98334510030765165 - 0.5 - 0.89665639003541542 - 1 - ShootFastRifle - - - - 0.099759525382621339 - 1 - - - AimRifle - - + + BlendOverride + AimAdditive + Models/Characters/Assault/AssaultAnimations.mesh - + R_Arm_Weapon_Joint @@ -136,45 +84,79 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - AimRifle - 0.5 - Ru - 0.57926159055711501 - - - Models/Characters/Assault/AssaultAnimations.mesh - true - - - - - - - + - - R_Arm_Weapon_Joint - - - Models/Weapons/Red/AssaultWeaponRed.mesh - true - + + AimRifle + + 0.5 + true + + + + + ShootRifleAnimation + BlendWalkRun + + + + + + + + RunAnimtaion + WalkAnimation + 1 + + + + + + + + Run + + 1 + + + + + + + + + Walk + + 1 + + + + + + + + + + + ShootFastRifle + + 1 + + + + + + + diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index ffe3421a..19eded09 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -43,6 +43,9 @@ + + + diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index e70c4f36..1b260b08 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -2,57 +2,56 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt) { - if(!entity.HasComponent("Model")) { - return; - } + + EntityWrapper parent = entity.FirstParentWithComponent("Model"); Model* model; try { - model = ResourceManager::Load<::Model, true>(entity["Model"]["Resource"]); + model = ResourceManager::Load<::Model, true>(parent["Model"]["Resource"]); } catch (const std::exception&) { return; } - + Skeleton* skeleton = model->m_RawModel->m_Skeleton; - if(skeleton == nullptr) { + if (skeleton == nullptr) { return; } - for (int i = 1; i <= 3; i++) { - const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName" + std::to_string(i)]); + for (int i = 1; i <= 1; i++) { + const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName"]); if (animation == nullptr) { continue;; } - double animationSpeed = (double)animationComponent["Speed" + std::to_string(i)]; + double animationSpeed = (double)animationComponent["Speed"]; if (animationSpeed != 0.0) { - double nextTime = (double)animationComponent["Time" + std::to_string(i)] + animationSpeed * dt; + double nextTime = (double)animationComponent["Time"] + animationSpeed * dt; - if (!(bool)animationComponent["Loop" + std::to_string(i)]) { + if (!(bool)animationComponent["Loop"]) { if (nextTime > animation->Duration) { nextTime = animation->Duration; Events::AnimationComplete e; e.Entity = entity; - e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)]; + e.Name = (std::string)animationComponent["AnimationName"]; m_EventBroker->Publish(e); } else if (nextTime < 0) { Events::AnimationComplete e; e.Entity = entity; - e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)]; + e.Name = (std::string)animationComponent["AnimationName"]; m_EventBroker->Publish(e); nextTime = 0; } - (double&)animationComponent["Speed" + std::to_string(i)] = 0.0; + (double&)animationComponent["Speed"] = 0.0; } else { if (nextTime > animation->Duration) { Events::AnimationComplete e; e.Entity = entity; - e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)]; + e.Name = (std::string)animationComponent["AnimationName"]; m_EventBroker->Publish(e); while(nextTime > animation->Duration) { @@ -61,7 +60,7 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a } else if (nextTime < 0) { Events::AnimationComplete e; e.Entity = entity; - e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)]; + e.Name = (std::string)animationComponent["AnimationName"]; m_EventBroker->Publish(e); while (nextTime < 0) { @@ -70,7 +69,7 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a } } - (double&)animationComponent["Time" + std::to_string(i)] = nextTime; + (double&)animationComponent["Time"] = nextTime; } } } diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp new file mode 100644 index 00000000..43d1d5fd --- /dev/null +++ b/src/Engine/Rendering/BlendTree.cpp @@ -0,0 +1,255 @@ +#include "Rendering/BlendTree.h" + +BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) +{ + auto itPair = ModelEntity.World->GetChildren(ModelEntity.ID); + if (itPair.first == itPair.second) { + return; + } + + + if (ModelEntity.HasComponent("Animation")) { + const Skeleton::Animation* animation = skeleton->GetAnimation(ModelEntity["Animation"]["AnimationName"]); + if (animation == nullptr) { + return; + } + + m_Root = new Node(); + m_Root->Name = ModelEntity.Name(); + m_Root->Pose = skeleton->GetFrameBones(animation, (double)ModelEntity["Animation"]["Time"], (bool)ModelEntity["Animation"]["Additive"]); + m_Root->Parent = nullptr; + m_Root->Type = NodeType::Animation; + + } else if (ModelEntity.HasComponent("Blend")) { + m_Root = new Node(); + m_Root->Name = ModelEntity.Name(); + m_Root->Parent = nullptr; + m_Root->Type = NodeType::Blend; + m_Root->Weight = (double)ModelEntity["Blend"]["Weight"]; + m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose1"], ModelEntity, skeleton); + m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose2"], ModelEntity, skeleton); + + } else if (ModelEntity.HasComponent("BlendOverride")) { + m_Root = new Node(); + m_Root->Name = ModelEntity.Name(); + m_Root->Parent = nullptr; + m_Root->Type = NodeType::Override; + m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendOverride"]["Master"], ModelEntity, skeleton); + m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendOverride"]["Slave"], ModelEntity, skeleton); + + } else if (ModelEntity.HasComponent("BlendAdditive")) { + m_Root = new Node(); + m_Root->Name = ModelEntity.Name(); + m_Root->Parent = nullptr; + m_Root->Type = NodeType::Additive; + m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendAdditive"]["Adder"], ModelEntity, skeleton); + m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendAdditive"]["Receiver"], ModelEntity, skeleton); + } + + + + // PrintTree(); +} + +BlendTree::~BlendTree() +{ + +} + +void BlendTree::PrintTree() +{ + Node* currentNode = m_Root; + LOG_INFO("\n\n"); + + while(currentNode->Child[0] != nullptr) { + currentNode = currentNode->Child[0]; + } + + while (currentNode != nullptr) + { + LOG_INFO("%s", currentNode->Name.c_str()); + currentNode = currentNode->Next(); + } + + +} + + + +void BlendTree::FillTree(Node* parentNode, EntityWrapper parentEntity, Skeleton* skeleton) +{ + auto itPair = parentEntity.World->GetChildren(parentEntity.ID); + if (itPair.first == itPair.second) { + return; // no children + } + + unsigned int childIndex = 0; + for (auto it = itPair.first; it != itPair.second; ++it) { + + EntityWrapper childEntity = EntityWrapper(parentEntity.World, it->second); + + if(!childEntity.Valid()) { + continue; + } + + if (childEntity.HasComponent("Animation")) { + const Skeleton::Animation* animation = skeleton->GetAnimation(childEntity["Animation"]["AnimationName"]); + if(animation == nullptr) { + continue; + } + + Node* node = new Node(); + node->Name = childEntity.Name(); + node->Pose = skeleton->GetFrameBones(animation, (double)childEntity["Animation"]["Time"], (bool)childEntity["Animation"]["Additive"]); + node->Parent = parentNode; + node->Type = NodeType::Animation; + parentNode->Child[childIndex] = node; + childIndex++; + FillTree(node, childEntity, skeleton); + + } else if (childEntity.HasComponent("Blend")) { + Node* node = new Node(); + node->Name = childEntity.Name(); + node->Parent = parentNode; + node->Type = NodeType::Blend; + node->Weight = (double)childEntity["Blend"]["Weight"]; + parentNode->Child[childIndex] = node; + childIndex++; + FillTree(node, childEntity, skeleton); + + } else if (childEntity.HasComponent("BlendOverride")) { + Node* node = new Node(); + node->Name = childEntity.Name(); + node->Parent = parentNode; + node->Type = NodeType::Override; + parentNode->Child[childIndex] = node; + childIndex++; + FillTree(node, childEntity, skeleton); + + } else if (childEntity.HasComponent("BlendAdditive")) { + Node* node = new Node(); + node->Name = childEntity.Name(); + node->Parent = parentNode; + node->Type = NodeType::Additive; + parentNode->Child[childIndex] = node; + childIndex++; + FillTree(node, childEntity, skeleton); + } + } +} + + +BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity, Skeleton* skeleton) +{ + EntityWrapper childEntity = parentEntity.FirstChildByName(name); + + if (!childEntity.Valid()) { + return nullptr; + } + + if (childEntity.HasComponent("Animation")) { + const Skeleton::Animation* animation = skeleton->GetAnimation(childEntity["Animation"]["AnimationName"]); + if (animation == nullptr) { + return nullptr; + } + + Node* node = new Node(); + node->Name = childEntity.Name(); + node->Pose = skeleton->GetFrameBones(animation, (double)childEntity["Animation"]["Time"], (bool)childEntity["Animation"]["Additive"]); + node->Parent = parentNode; + node->Type = NodeType::Animation; + return node; + + } else if (childEntity.HasComponent("Blend")) { + Node* node = new Node(); + node->Name = childEntity.Name(); + node->Parent = parentNode; + node->Type = NodeType::Blend; + node->Weight = (double)childEntity["Blend"]["Weight"]; + node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity, skeleton); + node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity, skeleton); + return node; + } else if (childEntity.HasComponent("BlendOverride")) { + Node* node = new Node(); + node->Name = childEntity.Name(); + node->Parent = parentNode; + node->Type = NodeType::Override; + node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Master"], childEntity, skeleton); + node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Slave"], childEntity, skeleton); + return node; + } else if (childEntity.HasComponent("BlendAdditive")) { + Node* node = new Node(); + node->Name = childEntity.Name(); + node->Parent = parentNode; + node->Type = NodeType::Additive; + node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Adder"], childEntity, skeleton); + node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Receiver"], childEntity, skeleton); + return node; + } + + return nullptr; +} + +void BlendTree::Blend(Skeleton* skeleton, std::vector& pose) +{ + Node* currentNode; + Node* start = m_Root; + while (start->Child[0] != nullptr) { + start = start->Child[0]; + } + + currentNode = start; + LOG_INFO("\n\n"); + while (m_Root->Pose.size() == 0) { + if(currentNode->Pose.size() == 0) { + if(currentNode->Child[0]->Pose.size() != 0 && currentNode->Child[1]->Pose.size() != 0) { + + switch (currentNode->Type) { + case BlendTree::NodeType::Additive: + currentNode->Pose = skeleton->BlendPoses(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose, currentNode->Weight); + break; + case BlendTree::NodeType::Blend: + currentNode->Pose = skeleton->BlendPoses(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose, currentNode->Weight); + break; + case BlendTree::NodeType::Override: + currentNode->Pose = skeleton->OverridePose(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); + break; + case BlendTree::NodeType::Animation: + // do nothing + break; + } + + + LOG_INFO("Blending %s and %s", currentNode->Child[0]->Name.c_str(), currentNode->Child[1]->Name.c_str()); + } + } + + + + currentNode = currentNode->Next(); + + if (currentNode == nullptr) { + currentNode = start; + } + + } + + pose = m_Root->Pose; +} + +std::vector BlendTree::GetBoneTransforms(Skeleton* skeleton) +{ + if (skeleton == nullptr || m_Root == nullptr) { + std::vector pose; + for (auto& b : skeleton->Bones) { + pose.push_back(glm::mat4(1)); + } + return pose; + } + + std::vector pose; + Blend(skeleton, pose); + + return pose; +} + diff --git a/src/Engine/Rendering/BoneAttachmentSystem.cpp b/src/Engine/Rendering/BoneAttachmentSystem.cpp index 3effaf2c..a4d381d1 100644 --- a/src/Engine/Rendering/BoneAttachmentSystem.cpp +++ b/src/Engine/Rendering/BoneAttachmentSystem.cpp @@ -40,15 +40,10 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp glm::mat4 boneTransform; if (parent.HasComponent("Animation")) { - for (int i = 1; i <= 3; i++) { - ::Skeleton::AnimationData animationData; - animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["Animation"]["AnimationName" + std::to_string(i)]); - if (animationData.animation == nullptr) { - continue; - } - animationData.time = (double)parent["Animation"]["Time" + std::to_string(i)]; - animationData.weight = (double)parent["Animation"]["Weight" + std::to_string(i)]; - + ::Skeleton::AnimationData animationData; + animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["Animation"]["AnimationName"]); + if (animationData.animation != nullptr) { + animationData.time = (double)parent["Animation"]["Time"]; Animations.push_back(animationData); } } diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index 11db71f0..43722a61 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -338,11 +338,12 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& //bind textures BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob); std::vector frameBones; - if (explosionEffectJob->AnimationOffset.animation != nullptr) { + /*if (explosionEffectJob->AnimationOffset.animation != nullptr) { frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); } else { frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations); - } + }*/ + frameBones = explosionEffectJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { m_ExplosionEffectProgram->Bind(); @@ -365,11 +366,12 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob); GLERROR("asdasd"); std::vector frameBones; - if (explosionEffectJob->AnimationOffset.animation != nullptr) { + /*if (explosionEffectJob->AnimationOffset.animation != nullptr) { frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); } else { frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations); - } + }*/ + frameBones = explosionEffectJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { @@ -410,11 +412,12 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& //bind textures BindModelTextures(forwardSkinnedHandle, modelJob); std::vector frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /* if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->BlendTree->GetBoneTransforms(modelJob->Skeleton); glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { @@ -438,11 +441,12 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& BindModelTextures(forwardSplatMapSkinnedHandle, modelJob); GLERROR("asdasd"); std::vector frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /* if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->BlendTree->GetBoneTransforms(modelJob->Skeleton); glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { @@ -486,11 +490,12 @@ void DrawFinalPass::DrawShieldToStencilBuffer(std::listViewMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); std::vector frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /*if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { m_ShieldToStencilProgram->Bind(); @@ -544,11 +549,12 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list frameBones; - if (explosionEffectJob->AnimationOffset.animation != nullptr) { + /* if (explosionEffectJob->AnimationOffset.animation != nullptr) { frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); } else { frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations); - } + }*/ + frameBones = explosionEffectJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); if (GLERROR("Animation")) { @@ -583,11 +589,12 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /* if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); @@ -619,11 +626,12 @@ void DrawFinalPass::DrawToDepthBuffer(std::list>& job glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); std::vector frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /*if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { diff --git a/src/Engine/Rendering/PickingPass.cpp b/src/Engine/Rendering/PickingPass.cpp index fa1b3ca3..479cb762 100644 --- a/src/Engine/Rendering/PickingPass.cpp +++ b/src/Engine/Rendering/PickingPass.cpp @@ -103,11 +103,12 @@ void PickingPass::Draw(RenderScene& scene) if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) { std::vector frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /*if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } @@ -160,11 +161,12 @@ void PickingPass::Draw(RenderScene& scene) glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); std::vector frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /* if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { m_PickingProgram->Bind(); @@ -215,11 +217,12 @@ void PickingPass::Draw(RenderScene& scene) glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); std::vector frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /* if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { @@ -276,11 +279,12 @@ void PickingPass::Draw(RenderScene& scene) if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) { std::vector frameBones; - if (modelJob->AnimationOffset.animation != nullptr) { + /*if (modelJob->AnimationOffset.animation != nullptr) { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); } else { frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - } + }*/ + frameBones = modelJob->Skeleton->GetFrameBones(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index 94656848..4745b36d 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -41,29 +41,17 @@ const Skeleton::Animation* Skeleton::GetAnimation(std::string name) } } -std::vector Skeleton::GetFrameBones(std::vector animations, bool noRootMotion /*= false*/) +std::vector Skeleton::GetFrameBones() { - if (animations.size() <= 0) { - std::vector finalMatrices; - for (auto& b : Bones) { - finalMatrices.push_back(glm::mat4(1));//b.second->OffsetMatrix); - } - return finalMatrices; - } - - std::map frameBones; - AccumulateBoneTransforms(true, animations, frameBones, RootBone, glm::mat4(1)); - std::vector finalMatrices; - for (auto &kv : frameBones) { - finalMatrices.push_back(kv.second); + for (auto& b : Bones) { + finalMatrices.push_back(glm::mat4(1)); } return finalMatrices; } - -std::vector Skeleton::GetFrameBones(std::vector animations, AnimationOffset animationOffset, bool noRootMotion /*= false*/) +std::vector Skeleton::GetFrameBones(const Animation* animation, const double time, bool additive, bool noRootMotion /*= false*/) { - if (animations.size() <= 0 || animationOffset.animation == nullptr) { + if (animation == nullptr) { std::vector finalMatrices; for (auto& b : Bones) { finalMatrices.push_back(glm::mat4(1)); @@ -71,9 +59,9 @@ std::vector Skeleton::GetFrameBones(std::vector animat return finalMatrices; } - + std::map frameBones; - AccumulateBoneTransforms(true, animations, animationOffset, frameBones, RootBone, glm::mat4(1)); + AccumulateBoneTransforms(true, animation, time, frameBones, additive, RootBone, glm::mat4(1)); std::vector finalMatrices; for (auto &kv : frameBones) { @@ -82,175 +70,74 @@ std::vector Skeleton::GetFrameBones(std::vector animat return finalMatrices; } -void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector animations, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix) +void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, bool additive, const Bone* bone, glm::mat4 parentMatrix) { - glm::mat4 boneMatrix; - - std::vector JointPoses; - - for (const AnimationData animationData : animations) { - const Animation* animation = animationData.animation; - const float time = animationData.time; - - JointFramePose jointPose; - jointPose.Weight = animationData.weight;; - - if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { - std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); - - Animation::Keyframe currentFrame; - Animation::Keyframe nextFrame; - - if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone - for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame - if (time >= boneKeyFrames.at(index).Time) { - currentFrame = boneKeyFrames.at(index); - nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size()); - break; - } - } - - float progress; - - if (nextFrame.Index == 0) { - nextFrame = currentFrame; - progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); - } else { - progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); - - } - - - if (progress > 1.0f || progress < 0.0f) { - progress = glm::clamp(progress, 0.0f, 1.0f); - } - Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; - Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - - glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - glm::quat rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; - - // Flag for no root motion - if (bone == RootBone && noRootMotion) { - position.x = 0; - position.z = 0; - } - - jointPose.Pose = (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); - JointPoses.push_back(jointPose); - - } else { // 1 keyframes for the current bone - currentFrame = boneKeyFrames.at(0); - jointPose.Pose = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); - JointPoses.push_back(jointPose); - } - } else { // 0 keyframes for the current bone - - } - + if (additive) { + time += 1.0/60.0; // first frame is a reference frame } + glm::mat4 boneMatrix; - if (JointPoses.size() == 0) { - if (bone->Parent) { - glm::mat4 jointPose = (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); + if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { + std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); - boneMatrix = parentMatrix * jointPose; - boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; - } else { - boneMatrix = glm::inverse(bone->OffsetMatrix); - boneMatrices[bone->ID] = parentMatrix; - } - } else { + Animation::Keyframe currentFrame; + Animation::Keyframe nextFrame; - float totalWeight = 0; + if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone + for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame + if (time >= boneKeyFrames.at(index).Time) { + currentFrame = boneKeyFrames.at(index); + nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size()); + break; + } + } - for (JointFramePose jointFramePose : JointPoses) { - totalWeight += jointFramePose.Weight; - } + float progress; - glm::mat4 finalBlend = glm::mat4(0); - - for (JointFramePose jointFramePose : JointPoses) { - if (jointFramePose.Weight == 1.0f) { - finalBlend = jointFramePose.Pose; + if (nextFrame.Index == 0) { + nextFrame = currentFrame; + progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); } else { - finalBlend += jointFramePose.Pose * (jointFramePose.Weight / totalWeight); + progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); + } + + progress = glm::clamp(progress, 0.0f, 1.0f); + Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; + Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; + + glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; + glm::quat rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); + glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; + + // Flag for no root motion + if (bone == RootBone && noRootMotion) { + position.x = 0; + position.z = 0; + } + + boneMatrix = parentMatrix * (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); + boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix; + + } else { // 1 keyframes for the current bone + currentFrame = boneKeyFrames.at(0); + boneMatrix = parentMatrix * (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); + boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix; } - - - boneMatrix = parentMatrix * finalBlend; - boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; - } - - for (auto &child : bone->Children) { - AccumulateBoneTransforms(noRootMotion, animations, boneMatrices, child, boneMatrix); - } -} - -void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector animations, AnimationOffset animationOffset, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix) -{ - glm::mat4 boneMatrix; - std::vector JointPoses; - - for (const AnimationData animationData : animations) { - if (animationData.animation->JointAnimations.find(bone->ID) != animationData.animation->JointAnimations.end()) { // Does the bone have any keyframes in this animation? - JointFramePose jointPose; - jointPose.Weight = animationData.weight; - jointPose.Type = animationData.blendType; - jointPose.Level = animationData.level; - jointPose.Pose = GetBonePose(bone, animationData.animation, animationData.time, noRootMotion); - JointPoses.push_back(jointPose); - } - } - - - if (JointPoses.size() == 0) { // No keyframes for the current bone + } else { // 0 keyframes for the current bone if (bone->Parent) { - glm::mat4 jointPose = (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); - glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, jointPose); - boneMatrix = parentMatrix * boneTransform; - boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; + boneMatrix = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); + boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix; } else { boneMatrix = glm::inverse(bone->OffsetMatrix); boneMatrices[bone->ID] = parentMatrix; } - } else { - - - glm::mat4 finalBlend = glm::mat4(0); - glm::mat4 finalOverride = glm::mat4(0); - - int maxLevel = 0; - for (JointFramePose jointPose : JointPoses) { - maxLevel = jointPose.Level > maxLevel ? jointPose.Level : maxLevel; - } - - - for (JointFramePose jointPose : JointPoses) { - if (jointPose.Type == BlendType::Override) { - finalOverride += jointPose.Pose * jointPose.Weight; //Blend Overrides then apply to final blend - } else if(jointPose.Type == BlendType::Blend) { - finalBlend += jointPose.Pose * jointPose.Weight; - } else if (jointPose.Type == BlendType::Additive) { - //Soon - } - } - - if(finalOverride != glm::mat4(0)) { - finalBlend = finalOverride; - } - - glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, finalBlend); - boneMatrix = parentMatrix * boneTransform; - boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } for (auto &child : bone->Children) { - AccumulateBoneTransforms(noRootMotion, animations, animationOffset, boneMatrices, child, boneMatrix); + AccumulateBoneTransforms(noRootMotion, animation, time, boneMatrices, additive, child, boneMatrix); } } @@ -444,7 +331,6 @@ glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animatio } } - glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, AnimationOffset animationOffset, glm::mat4 childMatrix) { glm::mat4 boneMatrix; @@ -555,7 +441,6 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v } } - glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, glm::mat4 childMatrix) { glm::mat4 boneMatrix; @@ -673,6 +558,50 @@ glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::v return boneMatrix; } + +std::vector Skeleton::BlendPoses(std::vector pose1, std::vector pose2, float weight) +{ + std::vector finalPose; + + if(pose1.size() != pose2.size()) { + LOG_ERROR("Number of bones does not match"); + return finalPose; + } + + for (int i = 0; i < pose1.size(); i++) { + glm::mat4 blendedPose = glm::mat4(0); + + blendedPose += pose1[i] * weight; + + blendedPose += pose2[i] * (1.f - weight); + + finalPose.push_back(blendedPose); + } + + return finalPose; +} + + +std::vector Skeleton::OverridePose(std::vector overridePose, std::vector targetPose) +{ + std::vector finalPose; + + if (overridePose.size() != targetPose.size()) { + LOG_ERROR("Number of bones does not match"); + return finalPose; + } + + for (int i = 0; i < overridePose.size(); i++) { + if(overridePose[i] != glm::mat4(1)) { + finalPose.push_back(overridePose[i]); + } else { + finalPose.push_back(targetPose[i]); + } + } + + return finalPose; +} + int Skeleton::GetBoneID(std::string name) { if (m_BonesByName.find(name) == m_BonesByName.end()) { @@ -681,47 +610,3 @@ int Skeleton::GetBoneID(std::string name) return m_BonesByName.at(name)->ID; } } - -void Skeleton::PrintSkeleton() -{ - if (LOG_LEVEL < LOG_LEVEL_DEBUG) { - return; - } - PrintSkeleton(RootBone, 0); -} - -void Skeleton::PrintSkeleton(const Bone* bone, int depthCount) -{ - std::stringstream ss; - ss << std::string(depthCount, ' '); - ss << bone->ID << ": " << bone->Name; - std::cout << ss.str() << std::endl; - - depthCount++; - - for (auto &child : bone->Children) { - PrintSkeleton(child, depthCount); - } -} - -int Skeleton::GetKeyframe(const Animation& animation, double time) -{ - -/* - if (time < 0) { - time = 0; - } - if (time >= animation.Duration) { - return animation..size() - 1; - } - - for (int keyframe = 0; keyframe < animation.Keyframes.size(); ++keyframe) { - if (animation.Keyframes[keyframe].Time > time) { - return (keyframe - 1) % animation.Keyframes.size(); - } - } -*/ - - - return 0; -} From 127edb4e604605610418ff4a6d33f06b6f9d0d8c Mon Sep 17 00:00:00 2001 From: viktorljung Date: Mon, 22 Feb 2016 17:47:30 +0100 Subject: [PATCH 06/94] Fixed some memory leaks --- include/Engine/Rendering/ModelJob.h | 4 ++-- resources/Schema/Entities/AnimationTests2.xml | 10 ++++++---- src/Engine/Rendering/BlendTree.cpp | 18 ++++++++++++++++++ src/Engine/Rendering/Skeleton.cpp | 4 +++- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/include/Engine/Rendering/ModelJob.h b/include/Engine/Rendering/ModelJob.h index 212a3888..c10d6389 100644 --- a/include/Engine/Rendering/ModelJob.h +++ b/include/Engine/Rendering/ModelJob.h @@ -125,7 +125,7 @@ struct ModelJob : RenderJob if (Skeleton != nullptr) { EntityWrapper entityWrapper = EntityWrapper(world, modelComponent.EntityID); - BlendTree = new ::BlendTree(entityWrapper, Skeleton); + BlendTree = std::shared_ptr<::BlendTree>(new ::BlendTree(entityWrapper, Skeleton)); } } }; @@ -149,7 +149,7 @@ struct ModelJob : RenderJob std::vector<::Skeleton::AnimationData> Animations; ::Skeleton::AnimationOffset AnimationOffset; - ::BlendTree* BlendTree = nullptr; + std::shared_ptr<::BlendTree> BlendTree = nullptr; glm::vec4 DiffuseColor; glm::vec4 SpecularColor; diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index ace71800..659ece9a 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -68,6 +68,7 @@ BlendOverride AimAdditive + 1 Models/Characters/Assault/AssaultAnimations.mesh @@ -93,7 +94,7 @@ AimRifle - + 0.5 true @@ -106,6 +107,7 @@ ShootRifleAnimation BlendWalkRun + 0 @@ -124,7 +126,7 @@ Run - + 1 @@ -135,7 +137,7 @@ Walk - + 1 @@ -148,7 +150,7 @@ ShootFastRifle - + 1 diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 43d1d5fd..e5fb21a4 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -53,7 +53,25 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) BlendTree::~BlendTree() { + Node* currentNode = m_Root; + while (currentNode->Child[0] != nullptr) { + currentNode = currentNode->Child[0]; + } + + std::list m_NodesToRemove; + + while (currentNode != nullptr) { + currentNode = currentNode->Next(); + m_NodesToRemove.push_back(currentNode); + } + + for (auto it = m_NodesToRemove.begin(); it != m_NodesToRemove.end(); it++) { + if ((*it) != nullptr) { + delete (*it); + (*it) = nullptr; + } + } } void BlendTree::PrintTree() diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index 4745b36d..6a409d3c 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -591,12 +591,14 @@ std::vector Skeleton::OverridePose(std::vector overridePos return finalPose; } - for (int i = 0; i < overridePose.size(); i++) { + for (int i = 0; i < targetPose.size(); i++) { if(overridePose[i] != glm::mat4(1)) { finalPose.push_back(overridePose[i]); } else { finalPose.push_back(targetPose[i]); } + + //finalPose.push_back(overridePose[i]); } return finalPose; From 606a9bf94f25cf3c2bd4fa93b7a4c7a7c3ac4964 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Tue, 23 Feb 2016 17:06:41 +0100 Subject: [PATCH 07/94] BlendTree now working but has some memory leaks --- include/Engine/Rendering/BlendTree.h | 5 +- include/Engine/Rendering/Skeleton.h | 14 +- resources/Schema/Components/BlendOverride.xml | 1 - resources/Schema/Components/BlendOverride.xsd | 1 - resources/Schema/Entities/AnimationTests2.xml | 112 ++++++----- src/Engine/Rendering/BlendTree.cpp | 64 ++++--- src/Engine/Rendering/Skeleton.cpp | 181 ++++++++++++------ 7 files changed, 243 insertions(+), 135 deletions(-) diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index 431cb8b2..694776a1 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -26,7 +26,8 @@ public: Node* Parent = nullptr; Node* Child[2] = { nullptr, nullptr }; NodeType Type; - std::vector Pose; + std::map Pose; + //std::vector Pose; float Weight = 0.f; Node* Next() { @@ -69,7 +70,7 @@ private: void FillTree(Node* parentNode, EntityWrapper parentEntity, Skeleton* skeleton); BlendTree::Node* FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity, Skeleton* skeleton); - void Blend(Skeleton* skeleton, std::vector& pose); + void Blend(Skeleton* skeleton, std::map& pose); }; #endif diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index 58021416..e380b6f2 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -111,7 +111,7 @@ public: std::vector GetFrameBones(); - std::vector GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion = false); + std::map GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion = false); void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, bool additive, const Bone* bone, glm::mat4 parentMatrix); const Animation* GetAnimation(std::string name); @@ -124,11 +124,17 @@ public: glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, glm::mat4 childMatrix); - std::vector BlendPoses(std::vector pose1, std::vector pose2, float weight); - std::vector OverridePose(std::vector overridePose, std::vector targetPose); + std::map BlendPoses(std::map pose1, std::map pose2, float weight); + std::map OverridePose(std::map overridePose, std::map targetPose); + std::map BlendPoseAdditive(std::map additivePose, std::map targetPose); + + std::vector GetFinalPose(std::map& boneMatrices); + void AccumulateFinalPose(std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix); + + void AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone); private: - glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset); + glm::mat4 GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time); glm::mat4 GetBonePose(const Bone* bone, const Animation* animation, double time, bool noRootMotion); std::map m_BonesByName; diff --git a/resources/Schema/Components/BlendOverride.xml b/resources/Schema/Components/BlendOverride.xml index a9f2095a..c44a2d22 100644 --- a/resources/Schema/Components/BlendOverride.xml +++ b/resources/Schema/Components/BlendOverride.xml @@ -2,5 +2,4 @@ - 1.0 \ No newline at end of file diff --git a/resources/Schema/Components/BlendOverride.xsd b/resources/Schema/Components/BlendOverride.xsd index 27fc01ed..8cf6dbd6 100644 --- a/resources/Schema/Components/BlendOverride.xsd +++ b/resources/Schema/Components/BlendOverride.xsd @@ -7,7 +7,6 @@ - diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index 659ece9a..40761b13 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -65,11 +65,10 @@ - - BlendOverride - AimAdditive - 1 - + + AimAdditive + BlendOverride + Models/Characters/Assault/AssaultAnimations.mesh @@ -93,9 +92,8 @@ - AimRifle - - 0.5 + AimRifleA + true @@ -106,57 +104,79 @@ ShootRifleAnimation - BlendWalkRun - 0 + MovementBlend - - - - RunAnimtaion - WalkAnimation - 1 - - - - - - - - Run - - 1 - - - - - - - - - Walk - - 1 - - - - - - - - ShootFastRifle - + ShootFastRifleU + 1 + + + + BlendWalkRun + StrafeAnimation + 1 + + + + + + + + StrafeRightF + + 1 + + + + + + + + + RunAnimtaion + WalkAnimation + 0.43000054359436035 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + + 1 + + + + + + + + + diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index e5fb21a4..a5f10188 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -130,6 +130,7 @@ void BlendTree::FillTree(Node* parentNode, EntityWrapper parentEntity, Skeleton* node->Name = childEntity.Name(); node->Parent = parentNode; node->Type = NodeType::Blend; + (double&)childEntity["Blend"]["Weight"] = glm::clamp((float)(double)childEntity["Blend"]["Weight"], 0.f, 1.f); node->Weight = (double)childEntity["Blend"]["Weight"]; parentNode->Child[childIndex] = node; childIndex++; @@ -183,6 +184,7 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E node->Name = childEntity.Name(); node->Parent = parentNode; node->Type = NodeType::Blend; + (double&)childEntity["Blend"]["Weight"] = glm::clamp((float)(double)childEntity["Blend"]["Weight"], 0.f, 1.f); node->Weight = (double)childEntity["Blend"]["Weight"]; node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity, skeleton); node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity, skeleton); @@ -208,7 +210,7 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E return nullptr; } -void BlendTree::Blend(Skeleton* skeleton, std::vector& pose) +void BlendTree::Blend(Skeleton* skeleton, std::map& pose) { Node* currentNode; Node* start = m_Root; @@ -220,30 +222,37 @@ void BlendTree::Blend(Skeleton* skeleton, std::vector& pose) LOG_INFO("\n\n"); while (m_Root->Pose.size() == 0) { if(currentNode->Pose.size() == 0) { - if(currentNode->Child[0]->Pose.size() != 0 && currentNode->Child[1]->Pose.size() != 0) { + if (currentNode->Child[0] != nullptr && currentNode->Child[1] != nullptr) { + if (currentNode->Child[0]->Pose.size() != 0 && currentNode->Child[1]->Pose.size() != 0) { - switch (currentNode->Type) { - case BlendTree::NodeType::Additive: - currentNode->Pose = skeleton->BlendPoses(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose, currentNode->Weight); - break; - case BlendTree::NodeType::Blend: - currentNode->Pose = skeleton->BlendPoses(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose, currentNode->Weight); - break; - case BlendTree::NodeType::Override: - currentNode->Pose = skeleton->OverridePose(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); - break; - case BlendTree::NodeType::Animation: - // do nothing - break; + switch (currentNode->Type) { + case BlendTree::NodeType::Additive: + currentNode->Pose = skeleton->BlendPoseAdditive(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); + break; + case BlendTree::NodeType::Blend: + currentNode->Pose = skeleton->BlendPoses(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose, currentNode->Weight); + break; + case BlendTree::NodeType::Override: + currentNode->Pose = skeleton->OverridePose(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); + break; + case BlendTree::NodeType::Animation: + // do nothing + break; + } + + LOG_INFO("Blending %s and %s", currentNode->Child[0]->Name.c_str(), currentNode->Child[1]->Name.c_str()); + } + } else if (currentNode->Child[0] != nullptr) { + if (currentNode->Child[0]->Pose.size() != 0) { + currentNode->Pose = currentNode->Child[0]->Pose; + } + } else if (currentNode->Child[1] != nullptr) { + if (currentNode->Child[1]->Pose.size() != 0) { + currentNode->Pose = currentNode->Child[1]->Pose; } - - - LOG_INFO("Blending %s and %s", currentNode->Child[0]->Name.c_str(), currentNode->Child[1]->Name.c_str()); } } - - currentNode = currentNode->Next(); if (currentNode == nullptr) { @@ -257,17 +266,20 @@ void BlendTree::Blend(Skeleton* skeleton, std::vector& pose) std::vector BlendTree::GetBoneTransforms(Skeleton* skeleton) { + std::vector finalPose; if (skeleton == nullptr || m_Root == nullptr) { - std::vector pose; - for (auto& b : skeleton->Bones) { - pose.push_back(glm::mat4(1)); + + for (int i = 0; i < skeleton->Bones.size(); i++) { + finalPose.push_back(glm::mat4(1)); } - return pose; + return finalPose; } - std::vector pose; + std::map pose; Blend(skeleton, pose); - return pose; + finalPose = skeleton->GetFinalPose(pose); + + return finalPose; } diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index 6a409d3c..e951b3c5 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -49,25 +49,26 @@ std::vector Skeleton::GetFrameBones() } return finalMatrices; } -std::vector Skeleton::GetFrameBones(const Animation* animation, const double time, bool additive, bool noRootMotion /*= false*/) +std::map Skeleton::GetFrameBones(const Animation* animation, const double time, bool additive, bool noRootMotion /*= false*/) { if (animation == nullptr) { - std::vector finalMatrices; + std::map finalMatrices; for (auto& b : Bones) { - finalMatrices.push_back(glm::mat4(1)); + finalMatrices[b.second->ID] = glm::mat4(1); } return finalMatrices; } std::map frameBones; - AccumulateBoneTransforms(true, animation, time, frameBones, additive, RootBone, glm::mat4(1)); - std::vector finalMatrices; - for (auto &kv : frameBones) { - finalMatrices.push_back(kv.second); + if(!additive) { + AccumulateBoneTransforms(true, animation, time, frameBones, additive, RootBone, glm::mat4(1)); + } else { + AdditiveBoneTransforms(animation, time, frameBones, RootBone); } - return finalMatrices; + + return frameBones; } void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, bool additive, const Bone* bone, glm::mat4 parentMatrix) @@ -77,7 +78,7 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* anim } glm::mat4 boneMatrix; - + if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); @@ -118,21 +119,21 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* anim position.z = 0; } - boneMatrix = parentMatrix * (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); - boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix; + boneMatrix = (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); + boneMatrices[bone->ID] = boneMatrix;// *bone->OffsetMatrix; } else { // 1 keyframes for the current bone currentFrame = boneKeyFrames.at(0); - boneMatrix = parentMatrix * (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); - boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix; + boneMatrix = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); + boneMatrices[bone->ID] = boneMatrix;// *bone->OffsetMatrix; } } else { // 0 keyframes for the current bone if (bone->Parent) { - boneMatrix = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); - boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix; + //boneMatrix = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); + //boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix; } else { - boneMatrix = glm::inverse(bone->OffsetMatrix); - boneMatrices[bone->ID] = parentMatrix; + //boneMatrix = glm::inverse(bone->OffsetMatrix); + //boneMatrices[bone->ID] = parentMatrix; } } @@ -142,22 +143,36 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* anim } -glm::mat4 Skeleton::AdditiveBlend(const Bone* bone, AnimationOffset animationOffset, glm::mat4 targetPose) +void Skeleton::AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone) { - AnimationOffset refOffset = animationOffset; - refOffset.time = 0.5f; // reference pose is at 0.5s for now - glm::mat4 refPose = GetOffsetTransform(bone, refOffset); - glm::mat4 srcPose = GetOffsetTransform(bone, animationOffset); - glm::mat4 differencePose = srcPose * glm::inverse(refPose); - glm::mat4 finalPose = differencePose * targetPose; - return finalPose; + if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { + glm::mat4 refPose = GetAdditiveBonePose(bone, animation, 0.0); + glm::mat4 srcPose = GetAdditiveBonePose(bone, animation, time); + glm::mat4 boneMatrix = srcPose * glm::inverse(refPose); + boneMatrices[bone->ID] = boneMatrix; + } + + for (auto &child : bone->Children) { + AdditiveBoneTransforms(animation, time, boneMatrices, child); + } } -glm::mat4 Skeleton::GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset) -{ - const Animation* animation = animationOffset.animation; - float time = animationOffset.time; + +glm::mat4 Skeleton::AdditiveBlend(const Bone* bone, AnimationOffset animationOffset, glm::mat4 targetPose) +{ +/* + AnimationOffset refOffset = animationOffset; + refOffset.time = 0.5f; // reference pose is at 0.5s for now + glm::mat4 refPose = GetAdditiveBonePose(bone, refOffset); + glm::mat4 srcPose = GetAdditiveBonePose(bone, animationOffset); + glm::mat4 differencePose = srcPose * glm::inverse(refPose); + glm::mat4 finalPose = differencePose * targetPose;*/ + return glm::mat4(); +} + +glm::mat4 Skeleton::GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time) +{ glm::vec3 position = glm::vec3(0); glm::quat rotation = glm::quat(); glm::vec3 scale = glm::vec3(1); @@ -559,51 +574,107 @@ return boneMatrix; } -std::vector Skeleton::BlendPoses(std::vector pose1, std::vector pose2, float weight) +std::map Skeleton::BlendPoses(std::map pose1, std::map pose2, float weight) { - std::vector finalPose; + std::map finalPose; - if(pose1.size() != pose2.size()) { - LOG_ERROR("Number of bones does not match"); - return finalPose; - } - - for (int i = 0; i < pose1.size(); i++) { + for (auto& b : Bones) { + int boneID = b.second->ID; glm::mat4 blendedPose = glm::mat4(0); - blendedPose += pose1[i] * weight; - - blendedPose += pose2[i] * (1.f - weight); - - finalPose.push_back(blendedPose); + if(pose1.find(boneID) != pose1.end() && pose2.find(boneID) != pose2.end()) { + blendedPose += pose1.at(boneID) * weight; + blendedPose += pose2.at(boneID) * (1.f - weight); + finalPose[boneID] = blendedPose; + } else if(pose1.find(boneID) != pose1.end()) { + finalPose[boneID] = pose1.at(boneID); + } else if (pose2.find(boneID) != pose2.end()) { + finalPose[boneID] = pose2.at(boneID); + } } return finalPose; } -std::vector Skeleton::OverridePose(std::vector overridePose, std::vector targetPose) +std::map Skeleton::OverridePose(std::map overridePose, std::map targetPose) { - std::vector finalPose; + std::map finalPose; - if (overridePose.size() != targetPose.size()) { - LOG_ERROR("Number of bones does not match"); - return finalPose; - } - - for (int i = 0; i < targetPose.size(); i++) { - if(overridePose[i] != glm::mat4(1)) { - finalPose.push_back(overridePose[i]); - } else { - finalPose.push_back(targetPose[i]); + for (auto& b : Bones) { + int boneID = b.second->ID; + if (overridePose.find(boneID) != overridePose.end()) { + finalPose[boneID] = overridePose.at(boneID); + } else if (targetPose.find(boneID) != targetPose.end()) { + finalPose[boneID] = targetPose.at(boneID); } + } + return finalPose; +} - //finalPose.push_back(overridePose[i]); + +std::map Skeleton::BlendPoseAdditive(std::map additivePose, std::map targetPose) +{ + std::map finalPose; + + for (auto& b : Bones) { + int boneID = b.second->ID; + glm::mat4 blendedPose = glm::mat4(1); + + if (additivePose.find(boneID) != additivePose.end() && targetPose.find(boneID) != targetPose.end()) { + blendedPose = additivePose.at(boneID) * targetPose.at(boneID); + finalPose[boneID] = blendedPose; + + } else if (additivePose.find(boneID) != additivePose.end()) { + finalPose[boneID] = additivePose.at(boneID); + } else if (targetPose.find(boneID) != targetPose.end()) { + finalPose[boneID] = targetPose.at(boneID); + } } return finalPose; } +std::vector Skeleton::GetFinalPose(std::map& boneMatrices) +{ + std::vector finalPose; + + AccumulateFinalPose(boneMatrices, RootBone, glm::mat4(1)); + + + for(auto& b : boneMatrices) { + finalPose.push_back(b.second); + } + + return finalPose; +} + +void Skeleton::AccumulateFinalPose(std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix) +{ + + glm::mat4 boneMatrix; + + + if (boneMatrices.find(bone->ID) != boneMatrices.end()) { + + boneMatrix = parentMatrix * boneMatrices.at(bone->ID); + boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; + + } else { + if (bone->Parent) { + boneMatrix = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); + boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; + } else { + boneMatrix = glm::inverse(bone->OffsetMatrix); + boneMatrices[bone->ID] = parentMatrix; + } + } + + for (auto &child : bone->Children) { + AccumulateFinalPose(boneMatrices, child, boneMatrix); + } +} + int Skeleton::GetBoneID(std::string name) { if (m_BonesByName.find(name) == m_BonesByName.end()) { From c9c5e9841d23223f9af6c26073f427f9dafb2eca Mon Sep 17 00:00:00 2001 From: antc13 Date: Thu, 25 Feb 2016 10:55:14 +0100 Subject: [PATCH 08/94] New Map WIP, Map2 version 2 is with models on both sides. --- assets | 2 +- .../Schema/Entities/AmmoPickupWithModel.xml | 38 + .../Schema/Entities/HealthPickupWithModel.xml | 38 + resources/Schema/Entities/NewMap2.xml | 2913 +++++++++++ resources/Schema/Entities/NewMap2version2.xml | 4416 +++++++++++++++++ resources/Schema/Entities/RedSideModels.xml | 1522 ++++++ 6 files changed, 8928 insertions(+), 1 deletion(-) create mode 100644 resources/Schema/Entities/AmmoPickupWithModel.xml create mode 100644 resources/Schema/Entities/HealthPickupWithModel.xml create mode 100644 resources/Schema/Entities/NewMap2.xml create mode 100644 resources/Schema/Entities/NewMap2version2.xml create mode 100644 resources/Schema/Entities/RedSideModels.xml diff --git a/assets b/assets index 1e7adc74..0964372b 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 1e7adc749e02144615a20a82c847d3c8df46ee3d +Subproject commit 0964372b1dbb6c41a9d4b4a540ed55544b39f69d diff --git a/resources/Schema/Entities/AmmoPickupWithModel.xml b/resources/Schema/Entities/AmmoPickupWithModel.xml new file mode 100644 index 00000000..6c7ed50a --- /dev/null +++ b/resources/Schema/Entities/AmmoPickupWithModel.xml @@ -0,0 +1,38 @@ + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/HealthPickupWithModel.xml b/resources/Schema/Entities/HealthPickupWithModel.xml new file mode 100644 index 00000000..8465e922 --- /dev/null +++ b/resources/Schema/Entities/HealthPickupWithModel.xml @@ -0,0 +1,38 @@ + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/NewMap2.xml b/resources/Schema/Entities/NewMap2.xml new file mode 100644 index 00000000..ad2ae770 --- /dev/null +++ b/resources/Schema/Entities/NewMap2.xml @@ -0,0 +1,2913 @@ + + + + + + + + + + + + + + + + + + Models/Props/GroundTest.mesh + + + + + + + + + Models/Props/Walls/SciFiWallTop.mesh + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + true + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall1.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall2.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallSmall3.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall4.mesh + + + + + + + + + + + + Models/Props/HighgroundTest1.mesh + + + + + + + + + + Models/Props/HighgroundTest2.mesh + + + + + + + + + + + Models/Props/HighgroundTest3.mesh + + + + + + + + + + + Models/Props/HighgroundTest4.mesh + + + + + + + + + + + Models/Props/HighgroundTest5.mesh + + + + + + + + + + Models/Props/HighgroundTest6.mesh + + + + + + + + + + + Models/Props/HighgroundTest7.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest8.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest9.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest10.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest6.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest1.mesh + + + + + + + + + + + + Models/Props/HighgroundTest2.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest3.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest4.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest5.mesh + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 2 + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointBlue.mesh + + + + + + + + + + + + + 4 + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 3 + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 2 + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 1.5498908015879351 + 1 + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointRed.mesh + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + 10 + + + + + + + + + + 10 + + + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + + + + + + Schema/Entities/PlayerRed.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + + + Schema/Entities/Player.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + diff --git a/resources/Schema/Entities/NewMap2version2.xml b/resources/Schema/Entities/NewMap2version2.xml new file mode 100644 index 00000000..d1964a84 --- /dev/null +++ b/resources/Schema/Entities/NewMap2version2.xml @@ -0,0 +1,4416 @@ + + + + + + + + + + + + + + + + + + Models/Props/GroundTest.mesh + + + + + + + + + Models/Props/Walls/SciFiWallTop.mesh + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + true + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall1.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall2.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallSmall3.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall4.mesh + + + + + + + + + + + + Models/Props/HighgroundTest1.mesh + + + + + + + + + + Models/Props/HighgroundTest2.mesh + + + + + + + + + + + Models/Props/HighgroundTest3.mesh + + + + + + + + + + + Models/Props/HighgroundTest4.mesh + + + + + + + + + + + Models/Props/HighgroundTest5.mesh + + + + + + + + + + Models/Props/HighgroundTest6.mesh + + + + + + + + + + + Models/Props/HighgroundTest7.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest8.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest9.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest10.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest6.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest1.mesh + + + + + + + + + + + + Models/Props/HighgroundTest2.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest3.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest4.mesh + + + + + + + + + + + + + Models/Props/HighgroundTest5.mesh + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 2 + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 2 + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointBlue.mesh + + + + + + + + + + + + + 4 + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 3 + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 2 + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 1.5498908015879351 + 1 + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointRed.mesh + + + + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + 10 + + + + + + + + + + 10 + + + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + + + + + + Schema/Entities/PlayerRed.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + + + Schema/Entities/Player.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + diff --git a/resources/Schema/Entities/RedSideModels.xml b/resources/Schema/Entities/RedSideModels.xml new file mode 100644 index 00000000..afa478ec --- /dev/null +++ b/resources/Schema/Entities/RedSideModels.xml @@ -0,0 +1,1522 @@ + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 2 + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/HealthPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + From c97d0d938138886e8d0fc4d41abd950b6bcf304f Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 25 Feb 2016 11:30:09 +0100 Subject: [PATCH 09/94] Fixed memory leaks and cleaned up Skeleton and BlendTree --- include/Engine/Rendering/BlendTree.h | 13 +- include/Engine/Rendering/ModelJob.h | 3 - include/Engine/Rendering/Skeleton.h | 59 +-- resources/Schema/Entities/AnimationTests2.xml | 372 +++++++++++++++++- resources/Schema/Entities/yeeee.xml | 122 ++++++ src/Engine/Rendering/BlendTree.cpp | 137 ++----- src/Engine/Rendering/BoneAttachmentSystem.cpp | 8 +- src/Engine/Rendering/DrawFinalPass.cpp | 56 +-- src/Engine/Rendering/PickingPass.cpp | 28 +- src/Engine/Rendering/Skeleton.cpp | 353 +++-------------- 10 files changed, 606 insertions(+), 545 deletions(-) create mode 100644 resources/Schema/Entities/yeeee.xml diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index 694776a1..8d192cfe 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -60,17 +60,22 @@ public: BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton); ~BlendTree(); - std::vector GetBoneTransforms(Skeleton* skeleton); + + std::vector GetFinalPose() { return m_FinalPose; } + + void PrintTree(); private: + Skeleton* m_Skeleton = nullptr; Node* m_Root = nullptr; - void FillTree(Node* parentNode, EntityWrapper parentEntity, Skeleton* skeleton); - BlendTree::Node* FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity, Skeleton* skeleton); + std::vector m_FinalPose; + std::vector AccumulateFinalPose(); + BlendTree::Node* FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity); - void Blend(Skeleton* skeleton, std::map& pose); + void Blend(std::map& pose); }; #endif diff --git a/include/Engine/Rendering/ModelJob.h b/include/Engine/Rendering/ModelJob.h index c10d6389..4ea7a1f6 100644 --- a/include/Engine/Rendering/ModelJob.h +++ b/include/Engine/Rendering/ModelJob.h @@ -146,9 +146,6 @@ struct ModelJob : RenderJob glm::vec4 Color; const ::Model* Model = nullptr; ::Skeleton* Skeleton = nullptr; - std::vector<::Skeleton::AnimationData> Animations; - ::Skeleton::AnimationOffset AnimationOffset; - std::shared_ptr<::BlendTree> BlendTree = nullptr; glm::vec4 DiffuseColor; diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index e380b6f2..fa5a329d 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -68,34 +68,6 @@ public: std::map> JointAnimations; }; - enum class BlendType - { - Additive, - Blend, - Override, - }; - - struct AnimationData - { - const Animation* animation; - BlendType blendType; - float time; - int level; - float weight; - }; - - struct JointFramePose { - BlendType Type; - int Level = 0; - glm::mat4 Pose = glm::mat4(0); - float Weight = 0.0f; - }; - - struct AnimationOffset { - const Animation* animation; - float time; - }; - Skeleton() { } ~Skeleton(); @@ -106,36 +78,23 @@ public: // Attach a new bone to the skeleton // Returns: New bone index int CreateBone(int ID, int parentID, std::string name, glm::mat4 offsetMatrix); - int GetBoneID(std::string name); - - std::vector GetFrameBones(); + const Animation* GetAnimation(std::string name); std::map GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion = false); - void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, bool additive, const Bone* bone, glm::mat4 parentMatrix); - - const Animation* GetAnimation(std::string name); - glm::mat4 AdditiveBlend(const Bone* bone, AnimationOffset animationOffset, glm::mat4 targetPose); - - std::map Animations; - glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix); - glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, AnimationOffset animationOffset, glm::mat4 childMatrix); - glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, glm::mat4 childMatrix); - - - std::map BlendPoses(std::map pose1, std::map pose2, float weight); - std::map OverridePose(std::map overridePose, std::map targetPose); - std::map BlendPoseAdditive(std::map additivePose, std::map targetPose); - + std::map BlendPoses(const std::map& pose1, const std::map& pose2, float weight); + std::map OverridePose(const std::map& overridePose, const std::map& targetPose); + std::map BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose); std::vector GetFinalPose(std::map& boneMatrices); - void AccumulateFinalPose(std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix); - - void AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone); - + + std::map Animations; private: glm::mat4 GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time); glm::mat4 GetBonePose(const Bone* bone, const Animation* animation, double time, bool noRootMotion); + void AccumulateFinalPose(std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix); + void AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone); + void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix); std::map m_BonesByName; diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index 40761b13..4779bbaf 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -58,6 +58,7 @@ + @@ -113,7 +114,7 @@ ShootFastRifleU - + 1 @@ -134,7 +135,7 @@ StrafeRightF - + 1 @@ -155,7 +156,7 @@ RunF - + 1 @@ -166,7 +167,370 @@ WalkF - + + 1 + + + + + + + + + + + + + + + + + AimAdditive + BlendOverride + + + Models/Characters/Assault/AssaultAnimations.mesh + + + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + AimRifleA + + true + + + + + + + + + ShootRifleAnimation + MovementBlend + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + BlendWalkRun + StrafeAnimation + 1 + + + + + + + + StrafeRightF + + 1 + + + + + + + + + RunAnimtaion + WalkAnimation + 0.43000054359436035 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + + 1 + + + + + + + + + + + + + + + + + AimAdditive + BlendOverride + + + Models/Characters/Assault/AssaultAnimations.mesh + + + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + AimRifleA + + true + + + + + + + + + ShootRifleAnimation + MovementBlend + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + BlendWalkRun + StrafeAnimation + 1 + + + + + + + + StrafeRightF + + 1 + + + + + + + + + RunAnimtaion + WalkAnimation + 0.43000054359436035 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + + 1 + + + + + + + + + + + + + + + + + AimAdditive + BlendOverride + + + Models/Characters/Assault/AssaultAnimations.mesh + + + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + AimRifleA + + true + + + + + + + + + ShootRifleAnimation + MovementBlend + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + BlendWalkRun + StrafeAnimation + 1 + + + + + + + + StrafeRightF + + 1 + + + + + + + + + RunAnimtaion + WalkAnimation + 0.43000054359436035 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + 1 diff --git a/resources/Schema/Entities/yeeee.xml b/resources/Schema/Entities/yeeee.xml new file mode 100644 index 00000000..d3853b8f --- /dev/null +++ b/resources/Schema/Entities/yeeee.xml @@ -0,0 +1,122 @@ + + + + + + AimAdditive + BlendOverride + + + Models/Characters/Assault/AssaultAnimations.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + AimRifleA + + true + + + + + + + + + ShootRifleAnimation + MovementBlend + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + BlendWalkRun + StrafeAnimation + 1 + + + + + + + + StrafeRightF + + 1 + + + + + + + + + RunAnimtaion + WalkAnimation + 0.43000054359436035 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + + 1 + + + + + + + + + + + + + + diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index a5f10188..1d628a06 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -2,6 +2,10 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) { + + m_Skeleton = skeleton; + + auto itPair = ModelEntity.World->GetChildren(ModelEntity.ID); if (itPair.first == itPair.second) { return; @@ -16,7 +20,7 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) m_Root = new Node(); m_Root->Name = ModelEntity.Name(); - m_Root->Pose = skeleton->GetFrameBones(animation, (double)ModelEntity["Animation"]["Time"], (bool)ModelEntity["Animation"]["Additive"]); + m_Root->Pose = m_Skeleton->GetFrameBones(animation, (double)ModelEntity["Animation"]["Time"], (bool)ModelEntity["Animation"]["Additive"]); m_Root->Parent = nullptr; m_Root->Type = NodeType::Animation; @@ -26,26 +30,27 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) m_Root->Parent = nullptr; m_Root->Type = NodeType::Blend; m_Root->Weight = (double)ModelEntity["Blend"]["Weight"]; - m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose1"], ModelEntity, skeleton); - m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose2"], ModelEntity, skeleton); + m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose1"], ModelEntity); + m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose2"], ModelEntity); } else if (ModelEntity.HasComponent("BlendOverride")) { m_Root = new Node(); m_Root->Name = ModelEntity.Name(); m_Root->Parent = nullptr; m_Root->Type = NodeType::Override; - m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendOverride"]["Master"], ModelEntity, skeleton); - m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendOverride"]["Slave"], ModelEntity, skeleton); + m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendOverride"]["Master"], ModelEntity); + m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendOverride"]["Slave"], ModelEntity); } else if (ModelEntity.HasComponent("BlendAdditive")) { m_Root = new Node(); m_Root->Name = ModelEntity.Name(); m_Root->Parent = nullptr; m_Root->Type = NodeType::Additive; - m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendAdditive"]["Adder"], ModelEntity, skeleton); - m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendAdditive"]["Receiver"], ModelEntity, skeleton); + m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendAdditive"]["Adder"], ModelEntity); + m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendAdditive"]["Receiver"], ModelEntity); } + m_FinalPose = AccumulateFinalPose(); // PrintTree(); @@ -62,15 +67,12 @@ BlendTree::~BlendTree() std::list m_NodesToRemove; while (currentNode != nullptr) { - currentNode = currentNode->Next(); m_NodesToRemove.push_back(currentNode); + currentNode = currentNode->Next(); } for (auto it = m_NodesToRemove.begin(); it != m_NodesToRemove.end(); it++) { - if ((*it) != nullptr) { - delete (*it); - (*it) = nullptr; - } + delete (*it); } } @@ -89,92 +91,26 @@ void BlendTree::PrintTree() currentNode = currentNode->Next(); } - + } - - -void BlendTree::FillTree(Node* parentNode, EntityWrapper parentEntity, Skeleton* skeleton) +BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity) { - auto itPair = parentEntity.World->GetChildren(parentEntity.ID); - if (itPair.first == itPair.second) { - return; // no children - } - - unsigned int childIndex = 0; - for (auto it = itPair.first; it != itPair.second; ++it) { - - EntityWrapper childEntity = EntityWrapper(parentEntity.World, it->second); - - if(!childEntity.Valid()) { - continue; - } - - if (childEntity.HasComponent("Animation")) { - const Skeleton::Animation* animation = skeleton->GetAnimation(childEntity["Animation"]["AnimationName"]); - if(animation == nullptr) { - continue; - } - - Node* node = new Node(); - node->Name = childEntity.Name(); - node->Pose = skeleton->GetFrameBones(animation, (double)childEntity["Animation"]["Time"], (bool)childEntity["Animation"]["Additive"]); - node->Parent = parentNode; - node->Type = NodeType::Animation; - parentNode->Child[childIndex] = node; - childIndex++; - FillTree(node, childEntity, skeleton); - - } else if (childEntity.HasComponent("Blend")) { - Node* node = new Node(); - node->Name = childEntity.Name(); - node->Parent = parentNode; - node->Type = NodeType::Blend; - (double&)childEntity["Blend"]["Weight"] = glm::clamp((float)(double)childEntity["Blend"]["Weight"], 0.f, 1.f); - node->Weight = (double)childEntity["Blend"]["Weight"]; - parentNode->Child[childIndex] = node; - childIndex++; - FillTree(node, childEntity, skeleton); - - } else if (childEntity.HasComponent("BlendOverride")) { - Node* node = new Node(); - node->Name = childEntity.Name(); - node->Parent = parentNode; - node->Type = NodeType::Override; - parentNode->Child[childIndex] = node; - childIndex++; - FillTree(node, childEntity, skeleton); - - } else if (childEntity.HasComponent("BlendAdditive")) { - Node* node = new Node(); - node->Name = childEntity.Name(); - node->Parent = parentNode; - node->Type = NodeType::Additive; - parentNode->Child[childIndex] = node; - childIndex++; - FillTree(node, childEntity, skeleton); - } - } -} - - -BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity, Skeleton* skeleton) -{ - EntityWrapper childEntity = parentEntity.FirstChildByName(name); + EntityWrapper childEntity = parentEntity.FirstChildByName(name); // Make first level child by name if (!childEntity.Valid()) { return nullptr; } if (childEntity.HasComponent("Animation")) { - const Skeleton::Animation* animation = skeleton->GetAnimation(childEntity["Animation"]["AnimationName"]); + const Skeleton::Animation* animation = m_Skeleton->GetAnimation(childEntity["Animation"]["AnimationName"]); if (animation == nullptr) { return nullptr; } Node* node = new Node(); node->Name = childEntity.Name(); - node->Pose = skeleton->GetFrameBones(animation, (double)childEntity["Animation"]["Time"], (bool)childEntity["Animation"]["Additive"]); + node->Pose = m_Skeleton->GetFrameBones(animation, (double)childEntity["Animation"]["Time"], (bool)childEntity["Animation"]["Additive"]); node->Parent = parentNode; node->Type = NodeType::Animation; return node; @@ -186,31 +122,32 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E node->Type = NodeType::Blend; (double&)childEntity["Blend"]["Weight"] = glm::clamp((float)(double)childEntity["Blend"]["Weight"], 0.f, 1.f); node->Weight = (double)childEntity["Blend"]["Weight"]; - node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity, skeleton); - node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity, skeleton); + node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity); + node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity); return node; } else if (childEntity.HasComponent("BlendOverride")) { Node* node = new Node(); node->Name = childEntity.Name(); node->Parent = parentNode; node->Type = NodeType::Override; - node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Master"], childEntity, skeleton); - node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Slave"], childEntity, skeleton); + node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Master"], childEntity); + node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Slave"], childEntity); return node; } else if (childEntity.HasComponent("BlendAdditive")) { Node* node = new Node(); node->Name = childEntity.Name(); node->Parent = parentNode; node->Type = NodeType::Additive; - node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Adder"], childEntity, skeleton); - node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Receiver"], childEntity, skeleton); + node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Adder"], childEntity); + node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Receiver"], childEntity); return node; } + return nullptr; } -void BlendTree::Blend(Skeleton* skeleton, std::map& pose) +void BlendTree::Blend(std::map& pose) { Node* currentNode; Node* start = m_Root; @@ -219,7 +156,7 @@ void BlendTree::Blend(Skeleton* skeleton, std::map& pose) } currentNode = start; - LOG_INFO("\n\n"); + while (m_Root->Pose.size() == 0) { if(currentNode->Pose.size() == 0) { if (currentNode->Child[0] != nullptr && currentNode->Child[1] != nullptr) { @@ -227,20 +164,18 @@ void BlendTree::Blend(Skeleton* skeleton, std::map& pose) switch (currentNode->Type) { case BlendTree::NodeType::Additive: - currentNode->Pose = skeleton->BlendPoseAdditive(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); + currentNode->Pose = m_Skeleton->BlendPoseAdditive(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); break; case BlendTree::NodeType::Blend: - currentNode->Pose = skeleton->BlendPoses(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose, currentNode->Weight); + currentNode->Pose = m_Skeleton->BlendPoses(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose, currentNode->Weight); break; case BlendTree::NodeType::Override: - currentNode->Pose = skeleton->OverridePose(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); + currentNode->Pose = m_Skeleton->OverridePose(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); break; case BlendTree::NodeType::Animation: // do nothing break; } - - LOG_INFO("Blending %s and %s", currentNode->Child[0]->Name.c_str(), currentNode->Child[1]->Name.c_str()); } } else if (currentNode->Child[0] != nullptr) { if (currentNode->Child[0]->Pose.size() != 0) { @@ -264,21 +199,21 @@ void BlendTree::Blend(Skeleton* skeleton, std::map& pose) pose = m_Root->Pose; } -std::vector BlendTree::GetBoneTransforms(Skeleton* skeleton) +std::vector BlendTree::AccumulateFinalPose() { std::vector finalPose; - if (skeleton == nullptr || m_Root == nullptr) { + if (m_Skeleton == nullptr || m_Root == nullptr) { - for (int i = 0; i < skeleton->Bones.size(); i++) { + for (int i = 0; i < m_Skeleton->Bones.size(); i++) { finalPose.push_back(glm::mat4(1)); } return finalPose; } std::map pose; - Blend(skeleton, pose); + Blend(pose); - finalPose = skeleton->GetFinalPose(pose); + finalPose = m_Skeleton->GetFinalPose(pose); return finalPose; } diff --git a/src/Engine/Rendering/BoneAttachmentSystem.cpp b/src/Engine/Rendering/BoneAttachmentSystem.cpp index a4d381d1..0e259f4b 100644 --- a/src/Engine/Rendering/BoneAttachmentSystem.cpp +++ b/src/Engine/Rendering/BoneAttachmentSystem.cpp @@ -35,7 +35,7 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp return; } - std::vector<::Skeleton::AnimationData> Animations; + /* std::vector<::Skeleton::AnimationData> Animations; ::Skeleton::AnimationOffset AnimationOffset; glm::mat4 boneTransform; @@ -72,7 +72,7 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp glm::decompose(boneTransform, scale, rotation, translation, skew, perspective); glm::vec3 angles = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation)); -/* +/ * angles.y = asin(-boneTransform[0][2]); if (cos(angles.y) != 0) { @@ -81,7 +81,7 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp } else { angles.x = atan2(-boneTransform[2][0], boneTransform[1][1]); angles.z = 0; - }*/ + }* / if ((bool)entity["BoneAttachment"]["InheritPosition"]) { (glm::vec3&)entity["Transform"]["Position"] = translation + (glm::vec3)entity["BoneAttachment"]["PositionOffset"]; @@ -91,5 +91,5 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp } if ((bool)entity["BoneAttachment"]["InheritScale"]) { (glm::vec3&)entity["Transform"]["Scale"] = scale * (glm::vec3)entity["BoneAttachment"]["ScaleOffset"]; - } + }*/ } diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index 43722a61..b139f2ba 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -338,12 +338,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& //bind textures BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob); std::vector frameBones; - /*if (explosionEffectJob->AnimationOffset.animation != nullptr) { - frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); - } else { - frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations); - }*/ - frameBones = explosionEffectJob->Skeleton->GetFrameBones(); + frameBones = explosionEffectJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { m_ExplosionEffectProgram->Bind(); @@ -366,12 +361,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob); GLERROR("asdasd"); std::vector frameBones; - /*if (explosionEffectJob->AnimationOffset.animation != nullptr) { - frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); - } else { - frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations); - }*/ - frameBones = explosionEffectJob->Skeleton->GetFrameBones(); + frameBones = explosionEffectJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { @@ -412,12 +402,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& //bind textures BindModelTextures(forwardSkinnedHandle, modelJob); std::vector frameBones; - /* if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->BlendTree->GetBoneTransforms(modelJob->Skeleton); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { @@ -441,12 +426,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& BindModelTextures(forwardSplatMapSkinnedHandle, modelJob); GLERROR("asdasd"); std::vector frameBones; - /* if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->BlendTree->GetBoneTransforms(modelJob->Skeleton); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { @@ -490,12 +470,7 @@ void DrawFinalPass::DrawShieldToStencilBuffer(std::listViewMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); std::vector frameBones; - /*if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->Skeleton->GetFrameBones(); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { m_ShieldToStencilProgram->Bind(); @@ -549,12 +524,7 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list frameBones; - /* if (explosionEffectJob->AnimationOffset.animation != nullptr) { - frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); - } else { - frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations); - }*/ - frameBones = explosionEffectJob->Skeleton->GetFrameBones(); + frameBones = explosionEffectJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); if (GLERROR("Animation")) { @@ -589,12 +559,7 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list frameBones; - /* if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->Skeleton->GetFrameBones(); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); @@ -626,12 +591,7 @@ void DrawFinalPass::DrawToDepthBuffer(std::list>& job glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); std::vector frameBones; - /*if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->Skeleton->GetFrameBones(); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { diff --git a/src/Engine/Rendering/PickingPass.cpp b/src/Engine/Rendering/PickingPass.cpp index 479cb762..64483755 100644 --- a/src/Engine/Rendering/PickingPass.cpp +++ b/src/Engine/Rendering/PickingPass.cpp @@ -103,12 +103,7 @@ void PickingPass::Draw(RenderScene& scene) if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) { std::vector frameBones; - /*if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->Skeleton->GetFrameBones(); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } @@ -161,12 +156,7 @@ void PickingPass::Draw(RenderScene& scene) glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); std::vector frameBones; - /* if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->Skeleton->GetFrameBones(); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { m_PickingProgram->Bind(); @@ -217,12 +207,7 @@ void PickingPass::Draw(RenderScene& scene) glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); std::vector frameBones; - /* if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->Skeleton->GetFrameBones(); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { @@ -279,12 +264,7 @@ void PickingPass::Draw(RenderScene& scene) if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) { std::vector frameBones; - /*if (modelJob->AnimationOffset.animation != nullptr) { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); - } else { - frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); - }*/ - frameBones = modelJob->Skeleton->GetFrameBones(); + frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index e951b3c5..077e9d02 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -1,55 +1,6 @@ #include "Rendering/Skeleton.h" -int Skeleton::CreateBone(int ID, int parentID, std::string name, glm::mat4 offsetMatrix) -{ - if (m_BonesByName.find(name) != m_BonesByName.end()) { - return m_BonesByName.at(name)->ID; - } else { - Bone* bone; - - if (parentID == -1) { - bone = new Bone(ID, nullptr, name, offsetMatrix); - RootBone = bone; - } else { - Bone* parent = Bones[parentID]; - bone = new Bone(ID, parent, name, offsetMatrix); - parent->Children.push_back(bone); - } - - Bones[ID] = bone; - m_BonesByName[name] = bone; - return ID; - } -} - -Skeleton::~Skeleton() -{ - for (auto &kv : Bones) { - delete kv.second; - } -} - - - -const Skeleton::Animation* Skeleton::GetAnimation(std::string name) -{ - auto it = Animations.find(name); - if (it != Animations.end()) { - return const_cast(&it->second); - } else { - return nullptr; - } -} - -std::vector Skeleton::GetFrameBones() -{ - std::vector finalMatrices; - for (auto& b : Bones) { - finalMatrices.push_back(glm::mat4(1)); - } - return finalMatrices; -} -std::map Skeleton::GetFrameBones(const Animation* animation, const double time, bool additive, bool noRootMotion /*= false*/) +std::map Skeleton::GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion /*= false*/) { if (animation == nullptr) { std::map finalMatrices; @@ -63,7 +14,7 @@ std::map Skeleton::GetFrameBones(const Animation* animation, con std::map frameBones; if(!additive) { - AccumulateBoneTransforms(true, animation, time, frameBones, additive, RootBone, glm::mat4(1)); + AccumulateBoneTransforms(true, animation, time, frameBones, RootBone, glm::mat4(1)); } else { AdditiveBoneTransforms(animation, time, frameBones, RootBone); } @@ -71,12 +22,8 @@ std::map Skeleton::GetFrameBones(const Animation* animation, con return frameBones; } -void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, bool additive, const Bone* bone, glm::mat4 parentMatrix) +void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix) { - if (additive) { - time += 1.0/60.0; // first frame is a reference frame - } - glm::mat4 boneMatrix; @@ -138,7 +85,7 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* anim } for (auto &child : bone->Children) { - AccumulateBoneTransforms(noRootMotion, animation, time, boneMatrices, additive, child, boneMatrix); + AccumulateBoneTransforms(noRootMotion, animation, time, boneMatrices, child, boneMatrix); } } @@ -157,20 +104,6 @@ void Skeleton::AdditiveBoneTransforms(const Animation* animation, double time, s } } - - -glm::mat4 Skeleton::AdditiveBlend(const Bone* bone, AnimationOffset animationOffset, glm::mat4 targetPose) -{ -/* - AnimationOffset refOffset = animationOffset; - refOffset.time = 0.5f; // reference pose is at 0.5s for now - glm::mat4 refPose = GetAdditiveBonePose(bone, refOffset); - glm::mat4 srcPose = GetAdditiveBonePose(bone, animationOffset); - glm::mat4 differencePose = srcPose * glm::inverse(refPose); - glm::mat4 finalPose = differencePose * targetPose;*/ - return glm::mat4(); -} - glm::mat4 Skeleton::GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time) { glm::vec3 position = glm::vec3(0); @@ -227,9 +160,6 @@ glm::mat4 Skeleton::GetBonePose(const Bone* bone, const Animation* animation, do { glm::mat4 boneMatrix; - std::vector JointPoses; - - if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); @@ -346,235 +276,7 @@ glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animatio } } -glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, AnimationOffset animationOffset, glm::mat4 childMatrix) -{ - glm::mat4 boneMatrix; - - std::vector JointPoses; - - for (const AnimationData animationData : animations) { - const Animation* animation = animationData.animation; - const float time = animationData.time; - - JointFramePose jointPose; - jointPose.Weight = animationData.weight;; - - if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { - std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); - - Animation::Keyframe currentFrame; - Animation::Keyframe nextFrame; - - if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone - for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame - if (time >= boneKeyFrames.at(index).Time) { - currentFrame = boneKeyFrames.at(index); - nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size()); - break; - } - } - - float progress; - - if (nextFrame.Index == 0) { - nextFrame = currentFrame; - progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); - } else { - progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); - - } - - - if (progress > 1.0f || progress < 0.0f) { - progress = glm::clamp(progress, 0.0f, 1.0f); - } - Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; - Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - - glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - glm::quat rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; - - // Flag for no root motion - if (bone == RootBone && noRootMotion) { - position.x = 0; - position.z = 0; - } - - jointPose.Pose = (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); - JointPoses.push_back(jointPose); - - } else { // 1 keyframes for the current bone - currentFrame = boneKeyFrames.at(0); - jointPose.Pose = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); - JointPoses.push_back(jointPose); - } - } else { // 0 keyframes for the current bone - - } - - } - - - if (JointPoses.size() == 0) { - if (bone->Parent) { - - glm::mat4 jointPose = (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); - glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, jointPose); - - boneMatrix = boneTransform * childMatrix; - } else { - boneMatrix = glm::inverse(bone->OffsetMatrix) * childMatrix; - } - } else { - - float totalWeight = 0; - - for (JointFramePose jointFramePose : JointPoses) { - totalWeight += jointFramePose.Weight; - } - - glm::mat4 finalBlend = glm::mat4(0); - - for (JointFramePose jointFramePose : JointPoses) { - if (jointFramePose.Weight == 1.0f) { - finalBlend = jointFramePose.Pose; - } else { - finalBlend += jointFramePose.Pose * (jointFramePose.Weight / totalWeight); - } - } - - - glm::mat4 boneTransform = AdditiveBlend(bone, animationOffset, finalBlend); - boneMatrix = boneTransform * childMatrix; - } - - if (bone->Parent != nullptr) { - return GetBoneTransform(noRootMotion, bone->Parent, animations, animationOffset, boneMatrix); - } else { - return boneMatrix; - } -} - -glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector animations, glm::mat4 childMatrix) -{ - glm::mat4 boneMatrix; - /* std::vector JointTransforms; - - for (const AnimationData animationData : animations) { - const Animation* animation = animationData.animation; - const float time = animationData.time; - - JointFrameTransform jointTransform; - jointTransform.Weight = animationData.weight;; - - if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { - std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); - - Animation::Keyframe currentFrame; - Animation::Keyframe nextFrame; - - if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone - for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame - if (time >= boneKeyFrames.at(index).Time) { - currentFrame = boneKeyFrames.at(index); - nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size()); - break; - } - } - - float progress; - - if (nextFrame.Index == 0) { - nextFrame = currentFrame; - progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); - } else { - progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); - - } - - - if (progress > 1.0f || progress < 0.0f) { - progress = glm::clamp(progress, 0.0f, 1.0f); - } - Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; - Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - - jointTransform.Position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - jointTransform.Rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - jointTransform.Scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; - - // Flag for no root motion - if (bone == RootBone && noRootMotion) { - jointTransform.Position.x = 0; - jointTransform.Position.z = 0; - } - - JointTransforms.push_back(jointTransform); - - } else { // 1 keyframes for the current bone - currentFrame = boneKeyFrames.at(0); - jointTransform.Position = currentFrame.BoneProperties.Position; - jointTransform.Rotation = currentFrame.BoneProperties.Rotation; - jointTransform.Scale = currentFrame.BoneProperties.Scale; - JointTransforms.push_back(jointTransform); - - } - } else { // 0 keyframes for the current bone - - } - - } - - if (JointTransforms.size() <= 0) { - if (bone->Parent) { - boneMatrix = glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix * childMatrix; - } else { - boneMatrix = glm::inverse(bone->OffsetMatrix) * childMatrix; - } - } else if (JointTransforms.size() == 1) { - boneMatrix = (glm::translate(JointTransforms.at(0).Position) * glm::toMat4(JointTransforms.at(0).Rotation) * glm::scale(JointTransforms.at(0).Scale)) * childMatrix; - } else { - - glm::vec3 finalPosInterp; - glm::quat finalRotInterp; - glm::vec3 finalScaleInterp; - float totalWeight = 0; - - for (JointFrameTransform jointTransform : JointTransforms) { - totalWeight += jointTransform.Weight; - } - - - for (JointFrameTransform jointTransform : JointTransforms) { - if (jointTransform.Weight == 1.0f) { - finalPosInterp = jointTransform.Position; - finalRotInterp = jointTransform.Rotation; - finalScaleInterp = jointTransform.Scale; - break; - } else { - finalPosInterp += jointTransform.Position * (jointTransform.Weight/totalWeight); - finalRotInterp *= glm::slerp(glm::quat(), jointTransform.Rotation, (jointTransform.Weight/totalWeight)); - finalScaleInterp += jointTransform.Scale * (jointTransform.Weight/totalWeight); - } - - } - - boneMatrix = (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) * childMatrix; - } - - - if (bone->Parent != nullptr) { - return GetBoneTransform(noRootMotion, bone->Parent, animations, boneMatrix); - } else { - return boneMatrix; - }*/ - -return boneMatrix; -} - - -std::map Skeleton::BlendPoses(std::map pose1, std::map pose2, float weight) +std::map Skeleton::BlendPoses(const std::map& pose1, const std::map& pose2, float weight) { std::map finalPose; @@ -596,8 +298,7 @@ std::map Skeleton::BlendPoses(std::map pose1, st return finalPose; } - -std::map Skeleton::OverridePose(std::map overridePose, std::map targetPose) +std::map Skeleton::OverridePose(const std::map& overridePose, const std::map& targetPose) { std::map finalPose; @@ -612,8 +313,7 @@ std::map Skeleton::OverridePose(std::map overrid return finalPose; } - -std::map Skeleton::BlendPoseAdditive(std::map additivePose, std::map targetPose) +std::map Skeleton::BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose) { std::map finalPose; @@ -683,3 +383,42 @@ int Skeleton::GetBoneID(std::string name) return m_BonesByName.at(name)->ID; } } + +int Skeleton::CreateBone(int ID, int parentID, std::string name, glm::mat4 offsetMatrix) +{ + if (m_BonesByName.find(name) != m_BonesByName.end()) { + return m_BonesByName.at(name)->ID; + } else { + Bone* bone; + + if (parentID == -1) { + bone = new Bone(ID, nullptr, name, offsetMatrix); + RootBone = bone; + } else { + Bone* parent = Bones[parentID]; + bone = new Bone(ID, parent, name, offsetMatrix); + parent->Children.push_back(bone); + } + + Bones[ID] = bone; + m_BonesByName[name] = bone; + return ID; + } +} + +Skeleton::~Skeleton() +{ + for (auto &kv : Bones) { + delete kv.second; + } +} + +const Skeleton::Animation* Skeleton::GetAnimation(std::string name) +{ + auto it = Animations.find(name); + if (it != Animations.end()) { + return const_cast(&it->second); + } else { + return nullptr; + } +} \ No newline at end of file From af034673f6244002820bf459556ad43c0e65a4c5 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 26 Feb 2016 10:17:47 +0100 Subject: [PATCH 10/94] BoneAttachments now working and BlendTrees are created in the AnimationSystem --- include/Engine/Rendering/AnimationSystem.h | 15 +- include/Engine/Rendering/BlendTree.h | 4 +- .../Engine/Rendering/BoneAttachmentSystem.h | 1 + include/Engine/Rendering/ModelJob.h | 5 +- include/Engine/Rendering/Skeleton.h | 28 +-- include/Game/Systems/LifetimeSystem.h | 2 +- resources/Schema/Entities/AnimationTests2.xml | 234 ++++++++++-------- src/Engine/Rendering/AnimationSystem.cpp | 89 +++++-- src/Engine/Rendering/BlendTree.cpp | 13 +- src/Engine/Rendering/BoneAttachmentSystem.cpp | 77 ++---- src/Engine/Rendering/DrawFinalPass.cpp | 69 +++--- src/Engine/Rendering/PickingPass.cpp | 24 +- src/Engine/Rendering/Skeleton.cpp | 16 +- 13 files changed, 308 insertions(+), 269 deletions(-) diff --git a/include/Engine/Rendering/AnimationSystem.h b/include/Engine/Rendering/AnimationSystem.h index dbe4b3fc..d05dc765 100644 --- a/include/Engine/Rendering/AnimationSystem.h +++ b/include/Engine/Rendering/AnimationSystem.h @@ -9,20 +9,17 @@ #include "Rendering/Model.h" #include "Rendering/EAnimationComplete.h" #include "Rendering/Skeleton.h" -#include +#include "Rendering/BlendTree.h" -class AnimationSystem : public PureSystem +class AnimationSystem : public ImpureSystem { public: - AnimationSystem(SystemParams params) - : System(params) - , PureSystem("Animation") - { - - } + AnimationSystem(SystemParams params); ~AnimationSystem() { } - virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt) override; + virtual void Update(double dt) override; private: + void CreateBlendTrees(); + void UpdateAnimations(double dt); }; diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index 8d192cfe..a472465b 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -62,7 +62,7 @@ public: std::vector GetFinalPose() { return m_FinalPose; } - + glm::mat4 GetBoneTransform(int boneID); void PrintTree(); @@ -72,6 +72,8 @@ private: Node* m_Root = nullptr; std::vector m_FinalPose; + std::map m_FinalBoneTransforms; + std::vector AccumulateFinalPose(); BlendTree::Node* FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity); diff --git a/include/Engine/Rendering/BoneAttachmentSystem.h b/include/Engine/Rendering/BoneAttachmentSystem.h index 55c2a1c8..2791d877 100644 --- a/include/Engine/Rendering/BoneAttachmentSystem.h +++ b/include/Engine/Rendering/BoneAttachmentSystem.h @@ -8,6 +8,7 @@ #include "Core/ResourceManager.h" #include "Rendering/Model.h" #include "Rendering/Skeleton.h" +#include "Rendering/BlendTree.h" //Needs to be a higher orderlevel than AnimationSystem class BoneAttachmentSystem : public PureSystem diff --git a/include/Engine/Rendering/ModelJob.h b/include/Engine/Rendering/ModelJob.h index 4ea7a1f6..adc21c6f 100644 --- a/include/Engine/Rendering/ModelJob.h +++ b/include/Engine/Rendering/ModelJob.h @@ -125,7 +125,10 @@ struct ModelJob : RenderJob if (Skeleton != nullptr) { EntityWrapper entityWrapper = EntityWrapper(world, modelComponent.EntityID); - BlendTree = std::shared_ptr<::BlendTree>(new ::BlendTree(entityWrapper, Skeleton)); + + if(Skeleton->BlendTrees.find(entityWrapper) != Skeleton->BlendTrees.end()) { + BlendTree = Skeleton->BlendTrees.at(entityWrapper); + } } } }; diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index fa5a329d..ffa08452 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -6,27 +6,9 @@ #include "../GLM.h" #include #include +#include "../Core/EntityWrapper.h" -//struct Bone -//{ -// Bone(std::string name, glm::mat4 offsetMatrix) -// : Name(name) -// , OffsetMatrix(offsetMatrix) -// { } -// -// ~Bone() -// { -// for (auto kv : Children) { -// delete kv.second; -// } -// } -// -// std::string Name; -// glm::mat4 OffsetMatrix; -// glm::mat4 LocalMatrix; -// -// std::map Children; -//}; +class BlendTree; class Skeleton { @@ -75,6 +57,8 @@ public: std::map Bones; + std::unordered_map> BlendTrees; + // Attach a new bone to the skeleton // Returns: New bone index int CreateBone(int ID, int parentID, std::string name, glm::mat4 offsetMatrix); @@ -86,13 +70,13 @@ public: std::map BlendPoses(const std::map& pose1, const std::map& pose2, float weight); std::map OverridePose(const std::map& overridePose, const std::map& targetPose); std::map BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose); - std::vector GetFinalPose(std::map& boneMatrices); + void GetFinalPose(std::map& boneMatrices, std::vector& finalPose, std::map& boneTransforms); std::map Animations; private: glm::mat4 GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time); glm::mat4 GetBonePose(const Bone* bone, const Animation* animation, double time, bool noRootMotion); - void AccumulateFinalPose(std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix); + void AccumulateFinalPose(std::map& boneMatrices, std::map& boneTransforms, const Bone* bone, glm::mat4 parentMatrix); void AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone); void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix); diff --git a/include/Game/Systems/LifetimeSystem.h b/include/Game/Systems/LifetimeSystem.h index 6dee644d..d19308d5 100644 --- a/include/Game/Systems/LifetimeSystem.h +++ b/include/Game/Systems/LifetimeSystem.h @@ -10,7 +10,7 @@ public: : System(params) , PureSystem("Lifetime") { - LOG_INFO("ASDASDASSA"); + } virtual void Update(double dt) override; diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index 4779bbaf..ca7c705d 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -9,19 +9,22 @@ - + + - + + 0.10000047832727432 + Models/Widgets/Lights/DirectionalLightWidget.mesh - + @@ -30,36 +33,22 @@ - 10 + 8 + 0.20000000298023224 - + - - - - - - 10 - - - - - - - - + Models/Core/UnitPlane.mesh - - - + @@ -85,7 +74,9 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh + + @@ -94,7 +85,6 @@ AimRifleA - true @@ -114,7 +104,7 @@ ShootFastRifleU - + 1 @@ -123,63 +113,28 @@ - - BlendWalkRun - StrafeAnimation - 1 - + + RunF + + 1 + - - - - - StrafeRightF - - 1 - - - - - - - - - RunAnimtaion - WalkAnimation - 0.43000054359436035 - - - - - - - - RunF - - 1 - - - - - - - - - WalkF - - 1 - - - - - - - - + + + + + 3 + + + + + + + @@ -206,7 +161,9 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh + + @@ -215,7 +172,8 @@ AimRifleA - + + 0.5 true @@ -235,7 +193,7 @@ ShootFastRifleU - + 1 @@ -247,7 +205,7 @@ BlendWalkRun StrafeAnimation - 1 + 0 @@ -255,8 +213,8 @@ - StrafeRightF - + StrafeLeftF + 1 @@ -268,7 +226,7 @@ RunAnimtaion WalkAnimation - 0.43000054359436035 + 1 @@ -277,7 +235,7 @@ RunF - + 1 @@ -288,7 +246,7 @@ WalkF - + 1 @@ -301,6 +259,20 @@ + + + + + 3 + 0.80000001192092896 + 0.30000001192092896 + + + + + + + @@ -327,7 +299,9 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh + + @@ -336,7 +310,7 @@ AimRifleA - + true @@ -355,8 +329,8 @@ - ShootFastRifleU - + ShootRifleU + 1 @@ -368,7 +342,7 @@ BlendWalkRun StrafeAnimation - 1 + 0 @@ -377,7 +351,7 @@ StrafeRightF - + 1 @@ -398,7 +372,7 @@ RunF - + 1 @@ -409,7 +383,7 @@ WalkF - + 1 @@ -422,6 +396,19 @@ + + + + + 3 + 0.30000001192092896 + + + + + + + @@ -448,7 +435,9 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh + + @@ -457,7 +446,7 @@ AimRifleA - + true @@ -473,17 +462,6 @@ - - - - ShootFastRifleU - - 1 - - - - - @@ -498,7 +476,7 @@ StrafeRightF - + 1 @@ -510,7 +488,7 @@ RunAnimtaion WalkAnimation - 0.43000054359436035 + 1 @@ -518,8 +496,8 @@ - RunF - + CrouchWalkF + 1 @@ -530,7 +508,7 @@ WalkF - + 1 @@ -541,10 +519,50 @@ + + + + ReloadSwitchU + + 1 + + + + + + + + + + 3 + + + + + + + + + + + Models/Core/UnitSphere.mesh + + + + + 3 + + + + + + + + diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 1b260b08..9a74da29 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -1,66 +1,109 @@ #include "Rendering/AnimationSystem.h" -void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt) +AnimationSystem::AnimationSystem(SystemParams params) + : System(params) { - - EntityWrapper parent = entity.FirstParentWithComponent("Model"); - Model* model; - try { - model = ResourceManager::Load<::Model, true>(parent["Model"]["Resource"]); - } catch (const std::exception&) { +} + +void AnimationSystem::Update(double dt) +{ + UpdateAnimations(dt); + CreateBlendTrees(); +} + +void AnimationSystem::CreateBlendTrees() +{ + auto modelComponents = m_World->GetComponents("Model"); + if (modelComponents == nullptr) { return; } - Skeleton* skeleton = model->m_RawModel->m_Skeleton; - if (skeleton == nullptr) { + for (auto& modelC : *modelComponents) { + EntityWrapper entity = EntityWrapper(m_World, modelC.EntityID); + + Model* model; + try { + model = ResourceManager::Load<::Model, true>(entity["Model"]["Resource"]); + } catch (const std::exception&) { + continue;; + } + + Skeleton* skeleton = model->m_RawModel->m_Skeleton; + if (skeleton == nullptr) { + continue; + } + + skeleton->BlendTrees[entity] = std::shared_ptr(new BlendTree(entity, skeleton)); + } +} + +void AnimationSystem::UpdateAnimations(double dt) +{ + auto animationComponents = m_World->GetComponents("Animation"); + if(animationComponents == nullptr) { return; } - for (int i = 1; i <= 1; i++) { - const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName"]); + for (auto& animationC : *animationComponents) { + EntityWrapper entity = EntityWrapper(m_World, animationC.EntityID); + EntityWrapper parent = entity.FirstParentWithComponent("Model"); + + Model* model; + try { + model = ResourceManager::Load<::Model, true>(parent["Model"]["Resource"]); + } catch (const std::exception&) { + return; + } + + Skeleton* skeleton = model->m_RawModel->m_Skeleton; + if (skeleton == nullptr) { + return; + } + + const Skeleton::Animation* animation = skeleton->GetAnimation(animationC["AnimationName"]); if (animation == nullptr) { continue;; } - double animationSpeed = (double)animationComponent["Speed"]; + double animationSpeed = (double)animationC["Speed"]; if (animationSpeed != 0.0) { - double nextTime = (double)animationComponent["Time"] + animationSpeed * dt; + double nextTime = (double)animationC["Time"] + animationSpeed * dt; - if (!(bool)animationComponent["Loop"]) { + if (!(bool)animationC["Loop"]) { if (nextTime > animation->Duration) { nextTime = animation->Duration; Events::AnimationComplete e; e.Entity = entity; - e.Name = (std::string)animationComponent["AnimationName"]; + e.Name = (std::string)animationC["AnimationName"]; m_EventBroker->Publish(e); } else if (nextTime < 0) { Events::AnimationComplete e; e.Entity = entity; - e.Name = (std::string)animationComponent["AnimationName"]; + e.Name = (std::string)animationC["AnimationName"]; m_EventBroker->Publish(e); nextTime = 0; } - (double&)animationComponent["Speed"] = 0.0; - + (double&)animationC["Speed"] = 0.0; + } else { if (nextTime > animation->Duration) { Events::AnimationComplete e; e.Entity = entity; - e.Name = (std::string)animationComponent["AnimationName"]; + e.Name = (std::string)animationC["AnimationName"]; m_EventBroker->Publish(e); - while(nextTime > animation->Duration) { + while (nextTime > animation->Duration) { nextTime -= animation->Duration; } } else if (nextTime < 0) { Events::AnimationComplete e; e.Entity = entity; - e.Name = (std::string)animationComponent["AnimationName"]; + e.Name = (std::string)animationC["AnimationName"]; m_EventBroker->Publish(e); while (nextTime < 0) { @@ -69,8 +112,8 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a } } - (double&)animationComponent["Time"] = nextTime; + (double&)animationC["Time"] = nextTime; } - } + } } diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 1d628a06..0d87665f 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -76,6 +76,17 @@ BlendTree::~BlendTree() } } + +glm::mat4 BlendTree::GetBoneTransform(int boneID) +{ + if(m_FinalBoneTransforms.find(boneID) != m_FinalBoneTransforms.end()) { + return m_FinalBoneTransforms.at(boneID); + } else { + return glm::mat4(1); + } + +} + void BlendTree::PrintTree() { Node* currentNode = m_Root; @@ -213,7 +224,7 @@ std::vector BlendTree::AccumulateFinalPose() std::map pose; Blend(pose); - finalPose = m_Skeleton->GetFinalPose(pose); + m_Skeleton->GetFinalPose(pose, finalPose, m_FinalBoneTransforms); return finalPose; } diff --git a/src/Engine/Rendering/BoneAttachmentSystem.cpp b/src/Engine/Rendering/BoneAttachmentSystem.cpp index 0e259f4b..43dc8634 100644 --- a/src/Engine/Rendering/BoneAttachmentSystem.cpp +++ b/src/Engine/Rendering/BoneAttachmentSystem.cpp @@ -8,10 +8,13 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp return; } - auto parent = entity.FirstParentWithComponent("Animation"); - if (!parent.HasComponent("Model")) { + auto parent = entity.FirstParentWithComponent("Model"); + + if(!parent.Valid()) { return; } + + Model* model; try { model = ResourceManager::Load<::Model, true>(parent["Model"]["Resource"]); @@ -35,61 +38,29 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp return; } - /* std::vector<::Skeleton::AnimationData> Animations; - ::Skeleton::AnimationOffset AnimationOffset; - glm::mat4 boneTransform; + if (skeleton->BlendTrees.find(parent) != skeleton->BlendTrees.end()) { - if (parent.HasComponent("Animation")) { - ::Skeleton::AnimationData animationData; - animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["Animation"]["AnimationName"]); - if (animationData.animation != nullptr) { - animationData.time = (double)parent["Animation"]["Time"]; - Animations.push_back(animationData); - } - } - if (parent.HasComponent("AnimationOffset")) { - AnimationOffset.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["AnimationOffset"]["AnimationName"]); - AnimationOffset.time = (double)parent["AnimationOffset"]["Time"]; + glm::mat4 boneTransform = skeleton->BlendTrees.at(parent)->GetBoneTransform(id); - if(AnimationOffset.animation != nullptr) { - boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, AnimationOffset, glm::mat4(1)); - } else { - boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, glm::mat4(1)); - } + glm::vec3 scale; + glm::quat rotation; + glm::vec3 translation; + glm::vec3 skew; + glm::vec4 perspective; + glm::decompose(boneTransform, scale, rotation, translation, skew, perspective); + + glm::vec3 angles = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation)); - } else { - boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, glm::mat4(1)); + if ((bool)entity["BoneAttachment"]["InheritPosition"]) { + (glm::vec3&)entity["Transform"]["Position"] = translation + (glm::vec3)entity["BoneAttachment"]["PositionOffset"]; + } + if ((bool)entity["BoneAttachment"]["InheritOrientation"]) { + (glm::vec3&)entity["Transform"]["Orientation"] = angles + (glm::vec3)entity["BoneAttachment"]["OrientationOffset"]; + } + if ((bool)entity["BoneAttachment"]["InheritScale"]) { + (glm::vec3&)entity["Transform"]["Scale"] = scale * (glm::vec3)entity["BoneAttachment"]["ScaleOffset"]; + } } - - - glm::vec3 scale; - glm::quat rotation; - glm::vec3 translation; - glm::vec3 skew; - glm::vec4 perspective; - glm::decompose(boneTransform, scale, rotation, translation, skew, perspective); - - glm::vec3 angles = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation)); -/ * - - angles.y = asin(-boneTransform[0][2]); - if (cos(angles.y) != 0) { - angles.x = atan2(boneTransform[1][2], boneTransform[2][2]); - angles.z = atan2(boneTransform[0][1], boneTransform[0][0]); - } else { - angles.x = atan2(-boneTransform[2][0], boneTransform[1][1]); - angles.z = 0; - }* / - - if ((bool)entity["BoneAttachment"]["InheritPosition"]) { - (glm::vec3&)entity["Transform"]["Position"] = translation + (glm::vec3)entity["BoneAttachment"]["PositionOffset"]; - } - if ((bool)entity["BoneAttachment"]["InheritOrientation"]) { - (glm::vec3&)entity["Transform"]["Orientation"] = angles + (glm::vec3)entity["BoneAttachment"]["OrientationOffset"]; - } - if ((bool)entity["BoneAttachment"]["InheritScale"]) { - (glm::vec3&)entity["Transform"]["Scale"] = scale * (glm::vec3)entity["BoneAttachment"]["ScaleOffset"]; - }*/ } diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index b139f2ba..7360d064 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -337,9 +337,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene); //bind textures BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob); - std::vector frameBones; - frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + if (explosionEffectJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = explosionEffectJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } } else { m_ExplosionEffectProgram->Bind(); GLERROR("Bind ExplosionEffect program"); @@ -360,10 +362,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& //bind textures BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob); GLERROR("asdasd"); - std::vector frameBones; - frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); - + if (explosionEffectJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = explosionEffectJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } } else { m_ExplosionEffectSplatMapProgram->Bind(); GLERROR("Bind ExplosionEffectSplatMap program"); @@ -401,10 +404,12 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& BindModelUniforms(forwardSkinnedHandle, modelJob, scene); //bind textures BindModelTextures(forwardSkinnedHandle, modelJob); - std::vector frameBones; - frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + if (modelJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = modelJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } } else { m_ForwardPlusProgram->Bind(); GLERROR("Bind ForwardPlusProgram"); @@ -425,10 +430,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& //bind textures BindModelTextures(forwardSplatMapSkinnedHandle, modelJob); GLERROR("asdasd"); - std::vector frameBones; - frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); - + if (modelJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = modelJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } } else { m_ForwardPlusSplatMapProgram->Bind(); GLERROR("Bind SplatMap program"); @@ -469,9 +475,11 @@ void DrawFinalPass::DrawShieldToStencilBuffer(std::listMatrix)); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); - std::vector frameBones; - frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + if (modelJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = modelJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } } else { m_ShieldToStencilProgram->Bind(); GLuint shaderHandle = m_ShieldToStencilProgram->GetHandle(); @@ -523,10 +531,11 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list frameBones; - frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); - + if (explosionEffectJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = explosionEffectJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } if (GLERROR("Animation")) { continue; } @@ -558,10 +567,11 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list frameBones; - frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); - + if (modelJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = modelJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } //draw glBindVertexArray(modelJob->Model->VAO); @@ -590,10 +600,11 @@ void DrawFinalPass::DrawToDepthBuffer(std::list>& job glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); - std::vector frameBones; - frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); - + if (modelJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = modelJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } } else { m_FillDepthBufferProgram->Bind(); GLuint shaderHandle = m_FillDepthBufferProgram->GetHandle(); diff --git a/src/Engine/Rendering/PickingPass.cpp b/src/Engine/Rendering/PickingPass.cpp index 64483755..4d156e46 100644 --- a/src/Engine/Rendering/PickingPass.cpp +++ b/src/Engine/Rendering/PickingPass.cpp @@ -100,12 +100,10 @@ void PickingPass::Draw(RenderScene& scene) glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); - if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) { - + if (modelJob->BlendTree != nullptr) { std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); - } } else { m_PickingProgram->Bind(); @@ -155,9 +153,11 @@ void PickingPass::Draw(RenderScene& scene) glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); - std::vector frameBones; - frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + if (modelJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = modelJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } } else { m_PickingProgram->Bind(); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); @@ -206,9 +206,11 @@ void PickingPass::Draw(RenderScene& scene) glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); - std::vector frameBones; - frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + if (modelJob->BlendTree != nullptr) { + std::vector frameBones; + frameBones = modelJob->BlendTree->GetFinalPose(); + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } } else { m_PickingProgram->Bind(); @@ -261,12 +263,10 @@ void PickingPass::Draw(RenderScene& scene) glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); - if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) { - + if (modelJob->BlendTree != nullptr) { std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); - } } else { m_PickingProgram->Bind(); diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index 077e9d02..4583de92 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -94,7 +94,7 @@ void Skeleton::AdditiveBoneTransforms(const Animation* animation, double time, s { if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { glm::mat4 refPose = GetAdditiveBonePose(bone, animation, 0.0); - glm::mat4 srcPose = GetAdditiveBonePose(bone, animation, time); + glm::mat4 srcPose = GetAdditiveBonePose(bone, animation, time + 1.0/60.0); glm::mat4 boneMatrix = srcPose * glm::inverse(refPose); boneMatrices[bone->ID] = boneMatrix; } @@ -335,21 +335,17 @@ std::map Skeleton::BlendPoseAdditive(const std::map Skeleton::GetFinalPose(std::map& boneMatrices) +void Skeleton::GetFinalPose(std::map& boneMatrices, std::vector& finalPose, std::map& boneTransforms) { - std::vector finalPose; - - AccumulateFinalPose(boneMatrices, RootBone, glm::mat4(1)); - + AccumulateFinalPose(boneMatrices, boneTransforms, RootBone, glm::mat4(1)); for(auto& b : boneMatrices) { finalPose.push_back(b.second); } - return finalPose; } -void Skeleton::AccumulateFinalPose(std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix) +void Skeleton::AccumulateFinalPose(std::map& boneMatrices, std::map& boneTransforms, const Bone* bone, glm::mat4 parentMatrix) { glm::mat4 boneMatrix; @@ -370,8 +366,10 @@ void Skeleton::AccumulateFinalPose(std::map& boneMatrices, const } } + boneTransforms[bone->ID] = boneMatrix; + for (auto &child : bone->Children) { - AccumulateFinalPose(boneMatrices, child, boneMatrix); + AccumulateFinalPose(boneMatrices, boneTransforms, child, boneMatrix); } } From 5bc0483f491417ad7cbbcba7de7e8760176c98c8 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Mon, 29 Feb 2016 15:51:37 +0100 Subject: [PATCH 11/94] Removed AnimationOffset and improved BlendTree --- include/Engine/Core/EntityWrapper.h | 1 + include/Engine/Rendering/BlendTree.h | 2 +- resources/Schema/Components.xsd | 1 - .../Schema/Components/AnimationOffset.xml | 5 - .../Schema/Components/AnimationOffset.xsd | 17 - resources/Schema/Entities/AnimationTests2.xml | 1190 +++++++++++------ resources/Schema/Types/Entity.xsd | 1 - src/Engine/Core/EntityWrapper.cpp | 25 + src/Engine/Rendering/AnimationSystem.cpp | 20 +- src/Engine/Rendering/BlendTree.cpp | 44 +- 10 files changed, 847 insertions(+), 459 deletions(-) delete mode 100644 resources/Schema/Components/AnimationOffset.xml delete mode 100644 resources/Schema/Components/AnimationOffset.xsd diff --git a/include/Engine/Core/EntityWrapper.h b/include/Engine/Core/EntityWrapper.h index b0e65d9e..aa4cae6b 100644 --- a/include/Engine/Core/EntityWrapper.h +++ b/include/Engine/Core/EntityWrapper.h @@ -28,6 +28,7 @@ struct EntityWrapper void AttachComponent(const char* componentName); EntityWrapper Parent(); EntityWrapper FirstChildByName(const std::string& name); + EntityWrapper FirstLevelChildByName(const std::string& name); EntityWrapper FirstParentWithComponent(const std::string& componentType); bool IsChildOf(EntityWrapper potentialParent); bool Valid() const; diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index a472465b..5b38080d 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -63,7 +63,7 @@ public: std::vector GetFinalPose() { return m_FinalPose; } glm::mat4 GetBoneTransform(int boneID); - + bool IsValid() { return (m_Root == nullptr ? false : true); } void PrintTree(); diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index fc72762e..a30a4e2c 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -33,7 +33,6 @@ - diff --git a/resources/Schema/Components/AnimationOffset.xml b/resources/Schema/Components/AnimationOffset.xml deleted file mode 100644 index 4aef8219..00000000 --- a/resources/Schema/Components/AnimationOffset.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/resources/Schema/Components/AnimationOffset.xsd b/resources/Schema/Components/AnimationOffset.xsd deleted file mode 100644 index c3430cc2..00000000 --- a/resources/Schema/Components/AnimationOffset.xsd +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Aim animation offset for the skeleton - - - - - - - - - \ No newline at end of file diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index ca7c705d..84663233 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -2,6 +2,10 @@ + + 0.5 + 2.2999999523162842 + @@ -42,25 +46,15 @@ - - - - Models/Core/UnitPlane.mesh - - - - - - - - AimAdditive - BlendOverride + Aim + FinalBlend - Models/Characters/Assault/AssaultAnimations.mesh + 4 + Models/Characters/Assault/Assaulttest.mesh @@ -74,56 +68,13 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - + - + - - - - AimRifleA - true - - - - - - - - - ShootRifleAnimation - MovementBlend - - - - - - - - ShootFastRifleU - - 1 - - - - - - - - - RunF - - 1 - - - - - - - @@ -135,380 +86,63 @@ - - - - - - AimAdditive - BlendOverride - - - Models/Characters/Assault/AssaultAnimations.mesh - - - - - - - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - - - + AimRifleA - - 0.5 + + false true - + - ShootRifleAnimation + WeaponBlend MovementBlend - - - - ShootFastRifleU - - 1 - - - - - - + - BlendWalkRun - StrafeAnimation - 0 - - - - - - - - StrafeLeftF - - 1 - - - - - - - - - RunAnimtaion - WalkAnimation - 1 - - - - - - - - RunF - - 1 - - - - - - - - - WalkF - - 1 - - - - - - - - - - - - - - - - 3 - 0.80000001192092896 - 0.30000001192092896 - - - - - - - - - - - - - AimAdditive - BlendOverride - - - Models/Characters/Assault/AssaultAnimations.mesh - - - - - - - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - - - - - - AimRifleA - - true - - - - - - - - - ShootRifleAnimation - MovementBlend - - - - - - - - ShootRifleU - - 1 - - - - - - - - - BlendWalkRun - StrafeAnimation - 0 - - - - - - - - StrafeRightF - - 1 - - - - - - - - - RunAnimtaion - WalkAnimation - 0.43000054359436035 - - - - - - - - RunF - - 1 - - - - - - - - - WalkF - - 1 - - - - - - - - - - - - - - - - 3 - 0.30000001192092896 - - - - - - - - - - - - - AimAdditive - BlendOverride - - - Models/Characters/Assault/AssaultAnimations.mesh - - - - - - - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - - - - - - AimRifleA - - true - - - - - - - - - ShootRifleAnimation - MovementBlend - - - - - - - - BlendWalkRun - StrafeAnimation + ShootBlend + Reload 1 - - - - StrafeRightF - - 1 - - - - - - + - RunAnimtaion - WalkAnimation + ShootFast + ShootSlow 1 - + - CrouchWalkF - + ShootFastRifleU + 1 - + - WalkF - + ShootRifleU + 1 @@ -517,25 +151,229 @@ + + + + ReloadSwitchU + + 1 + + + + + - + - - ReloadSwitchU - - 1 - + + StandCrouchBlend + Jump + 1 + - + + + + + StandMovement + CrouchMovement + 1 + + + + + + + + Walk + StrafeBlend + 1 + + + + + + + + CrouchWalkF + + 1 + + + + + + + + + Left + Right + 1 + + + + + + + + CrouchStrafeLeftF + + 1 + + + + + + + + + CrouchStrafeRightF + + 1 + + + + + + + + + + + + + RunWalkBlend + StrafeBlend + 1 + + + + + + + + Run + Walk + 0 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + + 1 + + + + + + + + + + + Left + Right + 0 + + + + + + + + StrafeLeftF + + 1 + + + + + + + + + StrafeRightF + + 1 + + + + + + + + + + + + + + + JumpF + + 1 + + + + + + + + + + + + Aim + FinalBlend + + + Models/Characters/Assault/Assaulttest.mesh + + + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + - 3 @@ -544,24 +382,554 @@ + + + + AimRifleA + false + true + + + + + + + + + WeaponBlend + MovementBlend + + + + + + + + ShootBlend + Reload + 1 + + + + + + + + ShootFast + ShootSlow + 1 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootRifleU + + 1 + + + + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + + + StandCrouchBlend + Jump + 1 + + + + + + + + StandMovement + CrouchMovement + 1 + + + + + + + + Walk + StrafeBlend + 1 + + + + + + + + CrouchWalkF + + 1 + + + + + + + + + Left + Right + 1 + + + + + + + + CrouchStrafeLeftF + + 1 + + + + + + + + + CrouchStrafeRightF + + 1 + + + + + + + + + + + + + RunWalkBlend + StrafeBlend + 1 + + + + + + + + Run + Walk + 1 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + + 1 + + + + + + + + + + + Left + Right + 1 + + + + + + + + StrafeLeftF + + 1 + + + + + + + + + StrafeRightF + + 1 + + + + + + + + + + + + + + + JumpF + + 1 + + + + + + + + + - + + + Aim + FinalBlend + - Models/Core/UnitSphere.mesh - + Models/Characters/Assault/Assaulttest.mesh + - - - 3 - - - + - + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + + + 3 + + + + + + + + + + + AimRifleA + + false + true + + + + + + + + + WeaponBlend + MovementBlend + + + + + + + + ShootBlend + Reload + 1 + + + + + + + + ShootFast + ShootSlow + 1 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootRifleU + + 1 + + + + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + + + StandCrouchBlend + Jump + 1 + + + + + + + + StandMovement + CrouchMovement + 0 + + + + + + + + Walk + StrafeBlend + 1 + + + + + + + + CrouchWalkF + + 1 + + + + + + + + + Left + Right + 1 + + + + + + + + CrouchStrafeLeftF + + 1 + + + + + + + + + CrouchStrafeRightF + + 1 + + + + + + + + + + + + + RunWalkBlend + StrafeBlend + 1 + + + + + + + + Run + Walk + 1 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + + 1 + + + + + + + + + + + Left + Right + 1 + + + + + + + + StrafeLeftF + + 1 + + + + + + + + + StrafeRightF + + 1 + + + + + + + + + + + + + + + JumpF + + 1 + + + + + + + + + + diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index 4fba7420..b0fbd279 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -49,7 +49,6 @@ - diff --git a/src/Engine/Core/EntityWrapper.cpp b/src/Engine/Core/EntityWrapper.cpp index 4b45b8d0..78bca235 100644 --- a/src/Engine/Core/EntityWrapper.cpp +++ b/src/Engine/Core/EntityWrapper.cpp @@ -39,6 +39,31 @@ EntityWrapper EntityWrapper::FirstChildByName(const std::string& name) return firstChildByNameRecursive(name, this->ID); } + +EntityWrapper EntityWrapper::FirstLevelChildByName(const std::string& name) +{ + EntityID parent = this->ID; + if (!this->World->ValidEntity(parent)) { + return EntityWrapper::Invalid; + } + + auto itPair = this->World->GetChildren(parent); + if (itPair.first == itPair.second) { + return EntityWrapper::Invalid; + } + + for (auto it = itPair.first; it != itPair.second; ++it) { + std::string itName = this->World->GetName(it->second); + if (itName == name) { + return EntityWrapper(this->World, it->second); + } else if (it->second != EntityID_Invalid) { + continue; + } + } + + return EntityWrapper::Invalid; +} + EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& componentType) { EntityWrapper entity = *this; diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 9a74da29..5bc64535 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -34,7 +34,16 @@ void AnimationSystem::CreateBlendTrees() continue; } - skeleton->BlendTrees[entity] = std::shared_ptr(new BlendTree(entity, skeleton)); + if (entity.HasComponent("Blend") || entity.HasComponent("BlendOverride") || + entity.HasComponent("BlendAdditive") || entity.HasComponent("Animation")) + { + std::shared_ptr blendTree = std::shared_ptr(new BlendTree(entity, skeleton)); + + if(blendTree->IsValid()) { + skeleton->BlendTrees[entity] = blendTree; + } + + } } } @@ -47,11 +56,16 @@ void AnimationSystem::UpdateAnimations(double dt) for (auto& animationC : *animationComponents) { EntityWrapper entity = EntityWrapper(m_World, animationC.EntityID); - EntityWrapper parent = entity.FirstParentWithComponent("Model"); + EntityWrapper modelEntity; + if(!entity.HasComponent("Model")) { + modelEntity = entity.FirstParentWithComponent("Model"); + } else { + modelEntity = entity; + } Model* model; try { - model = ResourceManager::Load<::Model, true>(parent["Model"]["Resource"]); + model = ResourceManager::Load<::Model, true>(modelEntity["Model"]["Resource"]); } catch (const std::exception&) { return; } diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 0d87665f..0305af19 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -6,11 +6,6 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) m_Skeleton = skeleton; - auto itPair = ModelEntity.World->GetChildren(ModelEntity.ID); - if (itPair.first == itPair.second) { - return; - } - if (ModelEntity.HasComponent("Animation")) { const Skeleton::Animation* animation = skeleton->GetAnimation(ModelEntity["Animation"]["AnimationName"]); @@ -59,20 +54,21 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) BlendTree::~BlendTree() { Node* currentNode = m_Root; + if (currentNode != nullptr) { + while (currentNode->Child[0] != nullptr) { + currentNode = currentNode->Child[0]; + } - while (currentNode->Child[0] != nullptr) { - currentNode = currentNode->Child[0]; - } + std::list m_NodesToRemove; - std::list m_NodesToRemove; + while (currentNode != nullptr) { + m_NodesToRemove.push_back(currentNode); + currentNode = currentNode->Next(); + } - while (currentNode != nullptr) { - m_NodesToRemove.push_back(currentNode); - currentNode = currentNode->Next(); - } - - for (auto it = m_NodesToRemove.begin(); it != m_NodesToRemove.end(); it++) { - delete (*it); + for (auto it = m_NodesToRemove.begin(); it != m_NodesToRemove.end(); it++) { + delete (*it); + } } } @@ -107,7 +103,7 @@ void BlendTree::PrintTree() BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity) { - EntityWrapper childEntity = parentEntity.FirstChildByName(name); // Make first level child by name + EntityWrapper childEntity = parentEntity.FirstLevelChildByName(name); // Make first level child by name if (!childEntity.Valid()) { return nullptr; @@ -133,8 +129,16 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E node->Type = NodeType::Blend; (double&)childEntity["Blend"]["Weight"] = glm::clamp((float)(double)childEntity["Blend"]["Weight"], 0.f, 1.f); node->Weight = (double)childEntity["Blend"]["Weight"]; - node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity); - node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity); + if (node->Weight < 1.f && node->Weight > 0.f) { + node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity); + node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity); + } else if (node->Weight == 1.f) { + node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity); + } else if (node->Weight == 0.f) { + node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity); + } + + return node; } else if (childEntity.HasComponent("BlendOverride")) { Node* node = new Node(); @@ -213,7 +217,7 @@ void BlendTree::Blend(std::map& pose) std::vector BlendTree::AccumulateFinalPose() { std::vector finalPose; - if (m_Skeleton == nullptr || m_Root == nullptr) { + if (m_Skeleton == nullptr || m_Root == nullptr || (m_Root->Child[0] == nullptr && m_Root->Child[1] == nullptr)) { for (int i = 0; i < m_Skeleton->Bones.size(); i++) { finalPose.push_back(glm::mat4(1)); From 141c58005fb58886a612ef14627019637495a95d Mon Sep 17 00:00:00 2001 From: antc13 Date: Tue, 1 Mar 2016 15:28:22 +0100 Subject: [PATCH 12/94] Changing Models WIP --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 10a61165..022890f8 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 10a611659ddaadfea6a560e707d395834855a979 +Subproject commit 022890f8f522eb0a88f5ebc7cda9af0b235e438a From 07ccb9c04195ea45f2882fce2b92dbc071559a16 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 2 Mar 2016 13:30:04 +0100 Subject: [PATCH 13/94] AutoAnimationBlend on unique node working but scale is not working correctly --- include/Engine/Rendering/AnimationSystem.h | 54 +- include/Engine/Rendering/BlendTree.h | 12 +- include/Engine/Rendering/EAnimationBlend.h | 21 + .../Engine/Rendering/EAutoAnimationBlend.h | 21 + include/Engine/Rendering/Skeleton.h | 2 +- resources/Schema/Entities/AnimationTests2.xml | 1175 ++++++++--------- resources/Schema/Entities/Skeleton.xml | 233 ++-- resources/Schema/Entities/derp.xml | 298 +++++ src/Engine/Core/Util/Logging.cpp | 4 +- src/Engine/Rendering/AnimationSystem.cpp | 227 +++- src/Engine/Rendering/BlendTree.cpp | 88 +- src/Engine/Rendering/Renderer.cpp | 2 +- src/Engine/Rendering/Skeleton.cpp | 16 +- 13 files changed, 1404 insertions(+), 749 deletions(-) create mode 100644 include/Engine/Rendering/EAnimationBlend.h create mode 100644 include/Engine/Rendering/EAutoAnimationBlend.h create mode 100644 resources/Schema/Entities/derp.xml diff --git a/include/Engine/Rendering/AnimationSystem.h b/include/Engine/Rendering/AnimationSystem.h index d05dc765..1ea076fd 100644 --- a/include/Engine/Rendering/AnimationSystem.h +++ b/include/Engine/Rendering/AnimationSystem.h @@ -3,13 +3,19 @@ #include "GLM.h" -#include "Common.h" -#include "Core/System.h" -#include "Core/ResourceManager.h" +#include "../Common.h" +#include "../Core/System.h" +#include "../Core/ResourceManager.h" #include "Rendering/Model.h" #include "Rendering/EAnimationComplete.h" #include "Rendering/Skeleton.h" #include "Rendering/BlendTree.h" +#include "Rendering/EAnimationBlend.h" +#include "Rendering/EAutoAnimationBlend.h" +#include "../Input/EInputCommand.h" +#include "../Core/EntityWrapper.h" + +#include "imgui/imgui.h" class AnimationSystem : public ImpureSystem { @@ -20,7 +26,49 @@ public: private: void CreateBlendTrees(); void UpdateAnimations(double dt); + void UpdateWeights(double dt); + void AnimationComplete(EntityWrapper animationEntity); + EventRelay m_EAnimationBlend; + bool OnAnimationBlend(Events::AnimationBlend& e); + EventRelay m_EAutoAnimationBlend; + bool OnAutoAnimationBlend(Events::AutoAnimationBlend& e); + + + EventRelay m_EInputCommand; + bool OnInputCommand(const Events::InputCommand& e); + + struct BlendJob + { + EntityWrapper BlendEntity = EntityWrapper::Invalid; + double StartWeight; + double GoalWeight; + double Duration; + double CurrentTime = 0.0; + }; + + struct QueuedBlendJob : BlendJob + { + EntityWrapper AnimationEntity = EntityWrapper::Invalid; + }; + + struct AutoBlendJob + { + EntityWrapper RootNode = EntityWrapper::Invalid; + double Duration; + double CurrentTime = 0.0; + BlendTree::AutoBlendInfo BlendInfo; + }; + + std::list m_AutoBlendJobs; + std::list m_BlendJobs; + std::list m_QueuedBlendJobs; + + char m_AnimationName1[20] = "Run"; + float m_BlendTime1 = 0.5f; + + char m_AnimationName2[20] = "Jump"; + float m_BlendTime2 = 0.5f; }; #endif \ No newline at end of file diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index 5b38080d..b19fbe4f 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -23,12 +23,13 @@ public: struct Node { std::string Name; + EntityWrapper Entity; Node* Parent = nullptr; Node* Child[2] = { nullptr, nullptr }; NodeType Type; std::map Pose; //std::vector Pose; - float Weight = 0.f; + double Weight = 0.0; Node* Next() { Node* next = this; @@ -54,7 +55,12 @@ public: }; - + struct AutoBlendInfo + { + std::string NodeName; + double progress; + std::unordered_map StartWeights; + }; BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton); @@ -66,6 +72,7 @@ public: bool IsValid() { return (m_Root == nullptr ? false : true); } void PrintTree(); + BlendTree::AutoBlendInfo AutoBlendStep(AutoBlendInfo blendInfo); private: Skeleton* m_Skeleton = nullptr; @@ -76,6 +83,7 @@ private: std::vector AccumulateFinalPose(); BlendTree::Node* FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity); + std::vector FindNodesByName(std::string name); void Blend(std::map& pose); }; diff --git a/include/Engine/Rendering/EAnimationBlend.h b/include/Engine/Rendering/EAnimationBlend.h new file mode 100644 index 00000000..880a2fd0 --- /dev/null +++ b/include/Engine/Rendering/EAnimationBlend.h @@ -0,0 +1,21 @@ +#ifndef Events_AnimationBlend_h__ +#define Events_AnimationBlend_h__ + +#include "../Core/EventBroker.h" +#include "../Core/EntityWrapper.h" + +namespace Events +{ + +struct AnimationBlend : Event +{ + EntityWrapper BlendEntity = EntityWrapper::Invalid; + double GoalWeight; + double Duration; + + EntityWrapper AnimationEntity = EntityWrapper::Invalid; +}; + +} + +#endif diff --git a/include/Engine/Rendering/EAutoAnimationBlend.h b/include/Engine/Rendering/EAutoAnimationBlend.h new file mode 100644 index 00000000..b148664f --- /dev/null +++ b/include/Engine/Rendering/EAutoAnimationBlend.h @@ -0,0 +1,21 @@ +#ifndef Events_AutoAnimationBlend_h__ +#define Events_AutoAnimationBlend_h__ + +#include "../Core/EventBroker.h" +#include "../Core/EntityWrapper.h" + +namespace Events +{ + +struct AutoAnimationBlend : Event +{ + EntityWrapper RootNode = EntityWrapper::Invalid; + std::string NodeName; + double Duration; + + EntityWrapper AnimationEntity = EntityWrapper::Invalid; +}; + +} + +#endif diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index ffa08452..e812bf12 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -67,7 +67,7 @@ public: std::map GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion = false); glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix); - std::map BlendPoses(const std::map& pose1, const std::map& pose2, float weight); + std::map BlendPoses(const std::map& pose1, const std::map& pose2, double weight); std::map OverridePose(const std::map& overridePose, const std::map& targetPose); std::map BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose); void GetFinalPose(std::map& boneMatrices, std::vector& finalPose, std::map& boneTransforms); diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index 84663233..fa2a8463 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -3,8 +3,8 @@ - 0.5 - 2.2999999523162842 + 0.40000000596046448 + 3 @@ -21,7 +21,7 @@ - 0.10000047832727432 + 0.80000001192092896 Models/Widgets/Lights/DirectionalLightWidget.mesh @@ -53,8 +53,8 @@ FinalBlend - 4 - Models/Characters/Assault/Assaulttest.mesh + 5 + Models/Characters/Defender/DefenderRed.mesh @@ -68,9 +68,9 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - + - + @@ -112,7 +112,7 @@ ShootBlend Reload - 1 + 0 @@ -131,7 +131,7 @@ ShootFastRifleU - + 1 @@ -142,7 +142,7 @@ ShootRifleU - + 1 @@ -155,8 +155,8 @@ ReloadSwitchU - - 1 + + false @@ -169,598 +169,7 @@ StandCrouchBlend Jump - 1 - - - - - - - - StandMovement - CrouchMovement - 1 - - - - - - - - Walk - StrafeBlend - 1 - - - - - - - - CrouchWalkF - - 1 - - - - - - - - - Left - Right - 1 - - - - - - - - CrouchStrafeLeftF - - 1 - - - - - - - - - CrouchStrafeRightF - - 1 - - - - - - - - - - - - - RunWalkBlend - StrafeBlend - 1 - - - - - - - - Run - Walk - 0 - - - - - - - - RunF - - 1 - - - - - - - - - WalkF - - 1 - - - - - - - - - - - Left - Right - 0 - - - - - - - - StrafeLeftF - - 1 - - - - - - - - - StrafeRightF - - 1 - - - - - - - - - - - - - - - JumpF - - 1 - - - - - - - - - - - - - - - Aim - FinalBlend - - - Models/Characters/Assault/Assaulttest.mesh - - - - - - - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - - - - - - 3 - - - - - - - - - - - AimRifleA - false - true - - - - - - - - - WeaponBlend - MovementBlend - - - - - - - - ShootBlend - Reload - 1 - - - - - - - - ShootFast - ShootSlow - 1 - - - - - - - - ShootFastRifleU - - 1 - - - - - - - - - ShootRifleU - - 1 - - - - - - - - - - - ReloadSwitchU - - 1 - - - - - - - - - - - StandCrouchBlend - Jump - 1 - - - - - - - - StandMovement - CrouchMovement - 1 - - - - - - - - Walk - StrafeBlend - 1 - - - - - - - - CrouchWalkF - - 1 - - - - - - - - - Left - Right - 1 - - - - - - - - CrouchStrafeLeftF - - 1 - - - - - - - - - CrouchStrafeRightF - - 1 - - - - - - - - - - - - - RunWalkBlend - StrafeBlend - 1 - - - - - - - - Run - Walk - 1 - - - - - - - - RunF - - 1 - - - - - - - - - WalkF - - 1 - - - - - - - - - - - Left - Right - 1 - - - - - - - - StrafeLeftF - - 1 - - - - - - - - - StrafeRightF - - 1 - - - - - - - - - - - - - - - JumpF - - 1 - - - - - - - - - - - - - - - Aim - FinalBlend - - - Models/Characters/Assault/Assaulttest.mesh - - - - - - - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - - - - - - 3 - - - - - - - - - - - AimRifleA - - false - true - - - - - - - - - WeaponBlend - MovementBlend - - - - - - - - ShootBlend - Reload - 1 - - - - - - - - ShootFast - ShootSlow - 1 - - - - - - - - ShootFastRifleU - - 1 - - - - - - - - - ShootRifleU - - 1 - - - - - - - - - - - ReloadSwitchU - - 1 - - - - - - - - - - - StandCrouchBlend - Jump - 1 + 0.48000049591064453 @@ -789,7 +198,7 @@ CrouchWalkF - + 1 @@ -810,7 +219,7 @@ CrouchStrafeLeftF - + 1 @@ -821,7 +230,7 @@ CrouchStrafeRightF - + 1 @@ -837,7 +246,7 @@ RunWalkBlend StrafeBlend - 1 + 0 @@ -847,7 +256,7 @@ Run Walk - 1 + 0 @@ -856,8 +265,7 @@ RunF - - 1 + @@ -867,7 +275,7 @@ WalkF - + 1 @@ -881,7 +289,7 @@ Left Right - 1 + 0 @@ -890,7 +298,7 @@ StrafeLeftF - + 1 @@ -901,7 +309,7 @@ StrafeRightF - + 1 @@ -918,8 +326,8 @@ JumpF - - 1 + + false @@ -929,8 +337,541 @@ + + + + + + + + + + + R_Arm_Weapon_Joint + + + + Models/Core/UnitCube.mesh + + true + + + + + + + + + + + + + R_Hand + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + R_Arm + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + R_Shoulder + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Neck + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Spine_3 + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Spine_2 + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Spine_1 + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Hip + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Leg_Top + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Leg_Bottom + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Foot + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Toe + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Shoulder + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Arm + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Hand + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Shoulder_Armor_Joint + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Chin + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Head + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + Perietal + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + L_Elbow + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + R_Leg_Bottom + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + R_Elbow + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + R_Leg_Top + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + R_Foot + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + R_Toe + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + R_Shoulder_Armor_Joint + + true + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + + + + + + diff --git a/resources/Schema/Entities/Skeleton.xml b/resources/Schema/Entities/Skeleton.xml index b8deb2eb..76674dec 100644 --- a/resources/Schema/Entities/Skeleton.xml +++ b/resources/Schema/Entities/Skeleton.xml @@ -18,9 +18,9 @@ true - + - + @@ -29,16 +29,17 @@ R_Hand - + + true Models/Core/UnitCube.mesh - - - + + + @@ -47,16 +48,17 @@ R_Arm - + + true Models/Core/UnitCube.mesh - - - + + + @@ -65,16 +67,17 @@ R_Shoulder - + + true Models/Core/UnitCube.mesh - - - + + + @@ -83,16 +86,17 @@ Neck - + + true Models/Core/UnitCube.mesh - - - + + + @@ -101,16 +105,17 @@ Spine_3 - + + true Models/Core/UnitCube.mesh - - - + + + @@ -119,16 +124,17 @@ Spine_2 - + + true Models/Core/UnitCube.mesh - - - + + + @@ -137,16 +143,17 @@ Spine_1 - + + true Models/Core/UnitCube.mesh - - - + + + @@ -155,15 +162,17 @@ Hip - + + true Models/Core/UnitCube.mesh - - + + + @@ -172,16 +181,17 @@ L_Leg_Top - + + true Models/Core/UnitCube.mesh - + - + @@ -190,16 +200,17 @@ L_Leg_Bottom - + + true Models/Core/UnitCube.mesh - + - + @@ -208,16 +219,17 @@ L_Foot - + + true Models/Core/UnitCube.mesh - - - + + + @@ -226,16 +238,17 @@ L_Toe - + + true Models/Core/UnitCube.mesh - - - + + + @@ -244,16 +257,17 @@ L_Shoulder - + + true Models/Core/UnitCube.mesh - - - + + + @@ -262,16 +276,17 @@ L_Arm - + + true Models/Core/UnitCube.mesh - - - + + + @@ -280,16 +295,17 @@ L_Hand - + + true Models/Core/UnitCube.mesh - - - + + + @@ -298,16 +314,17 @@ L_Shoulder_Armor_Joint - + + true Models/Core/UnitCube.mesh - - - + + + @@ -316,16 +333,17 @@ Chin - + + true Models/Core/UnitCube.mesh - - - + + + @@ -334,16 +352,17 @@ Head - + + true Models/Core/UnitCube.mesh - - - + + + @@ -352,16 +371,17 @@ Perietal - + + true Models/Core/UnitCube.mesh - - - + + + @@ -370,16 +390,17 @@ L_Elbow - + + true Models/Core/UnitCube.mesh - - - + + + @@ -388,16 +409,17 @@ R_Leg_Bottom - + + true Models/Core/UnitCube.mesh - - - + + + @@ -406,16 +428,17 @@ R_Elbow - + + true Models/Core/UnitCube.mesh - - - + + + @@ -424,16 +447,17 @@ R_Leg_Top - + + true Models/Core/UnitCube.mesh - - - + + + @@ -442,16 +466,17 @@ R_Foot - + + true Models/Core/UnitCube.mesh - - - + + + @@ -460,16 +485,17 @@ R_Toe - + + true Models/Core/UnitCube.mesh - - - + + + @@ -478,16 +504,17 @@ R_Shoulder_Armor_Joint - + + true Models/Core/UnitCube.mesh - - - + + + diff --git a/resources/Schema/Entities/derp.xml b/resources/Schema/Entities/derp.xml new file mode 100644 index 00000000..b8735335 --- /dev/null +++ b/resources/Schema/Entities/derp.xml @@ -0,0 +1,298 @@ + + + + + + Aim + FinalBlend + + + 4 + Models/Characters/Sniper/SniperBlue.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + + + 3 + + + + + + + + + + + AimRifleA + + false + true + + + + + + + + + WeaponBlend + MovementBlend + + + + + + + + ShootBlend + Reload + 1 + + + + + + + + ShootFast + ShootSlow + 1 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootRifleU + + 1 + + + + + + + + + + + ReloadSwitchU + + false + + + + + + + + + + + StandCrouchBlend + Jump + 1 + + + + + + + + StandMovement + CrouchMovement + 1 + + + + + + + + Walk + StrafeBlend + 1 + + + + + + + + CrouchWalkF + + 1 + + + + + + + + + Left + Right + 1 + + + + + + + + CrouchStrafeLeftF + + 1 + + + + + + + + + CrouchStrafeRightF + + 1 + + + + + + + + + + + + + RunWalkBlend + StrafeBlend + 1 + + + + + + + + Run + Walk + 1 + + + + + + + + RunF + + 1 + + + + + + + + + WalkF + + 1 + + + + + + + + + + + Left + Right + 0 + + + + + + + + StrafeLeftF + + 1 + + + + + + + + + StrafeRightF + + 1 + + + + + + + + + + + + + + + JumpF + + false + + + + + + + + + + + + diff --git a/src/Engine/Core/Util/Logging.cpp b/src/Engine/Core/Util/Logging.cpp index 63a6f380..e5427965 100644 --- a/src/Engine/Core/Util/Logging.cpp +++ b/src/Engine/Core/Util/Logging.cpp @@ -33,8 +33,8 @@ void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int va_end(args); if (logLevel == LOG_LEVEL_ERROR) { - std::cerr << file << ":" << line << " " << func << std::endl; - std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl; + /*std::cerr << file << ":" << line << " " << func << std::endl; + std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;*/ } else { std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl; } diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 5bc64535..11a21881 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -3,13 +3,21 @@ AnimationSystem::AnimationSystem(SystemParams params) : System(params) { - + EVENT_SUBSCRIBE_MEMBER(m_EAnimationBlend, &AnimationSystem::OnAnimationBlend); + EVENT_SUBSCRIBE_MEMBER(m_EAutoAnimationBlend, &AnimationSystem::OnAutoAnimationBlend); + EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &AnimationSystem::OnInputCommand); } void AnimationSystem::Update(double dt) { + ImGui::InputText("AnimationName1", &m_AnimationName1[0], sizeof(m_AnimationName1)); + ImGui::SliderFloat("Blendtime1", &m_BlendTime1, 0.f, 10.f); + ImGui::InputText("AnimationName2", &m_AnimationName2[0], sizeof(m_AnimationName2)); + ImGui::SliderFloat("Blendtime2", &m_BlendTime2, 0.f, 10.f); + UpdateAnimations(dt); CreateBlendTrees(); + UpdateWeights(dt); } void AnimationSystem::CreateBlendTrees() @@ -94,16 +102,17 @@ void AnimationSystem::UpdateAnimations(double dt) e.Entity = entity; e.Name = (std::string)animationC["AnimationName"]; m_EventBroker->Publish(e); + AnimationComplete(entity); + (double&)animationC["Speed"] = 0.0; } else if (nextTime < 0) { Events::AnimationComplete e; e.Entity = entity; e.Name = (std::string)animationC["AnimationName"]; m_EventBroker->Publish(e); + AnimationComplete(entity); nextTime = 0; + (double&)animationC["Speed"] = 0.0; } - - (double&)animationC["Speed"] = 0.0; - } else { if (nextTime > animation->Duration) { Events::AnimationComplete e; @@ -131,3 +140,213 @@ void AnimationSystem::UpdateAnimations(double dt) } } + +void AnimationSystem::UpdateWeights(double dt) +{ + /* for (auto it = m_BlendJobs.begin(); it != m_BlendJobs.end(); it++) { + if (!it->BlendEntity.Valid()) { + it = m_BlendJobs.erase(it); + continue; + } + + if (it->BlendEntity.HasComponent("Blend")) { + it->CurrentTime += dt; + double progress = it->CurrentTime / it->Duration; + progress = glm::clamp(progress, 0.0, 1.0); + + double weight = ((it->GoalWeight - it->StartWeight) * progress) + it->StartWeight; + (double&)it->BlendEntity["Blend"]["Weight"] = weight; + + if(weight == it->GoalWeight) { + it = m_BlendJobs.erase(it); + } + } + }*/ + + + for (auto it = m_AutoBlendJobs.begin(); it != m_AutoBlendJobs.end();) { + it->CurrentTime += dt; + + if (!it->RootNode.Valid()) { + it = m_AutoBlendJobs.erase(it); + continue; + } + + if (!it->RootNode.HasComponent("Model")) { + it = m_AutoBlendJobs.erase(it); + continue; + } + + Model* model; + try { + model = ResourceManager::Load<::Model, true>(it->RootNode["Model"]["Resource"]); + } catch (const std::exception&) { + continue; + } + + Skeleton* skeleton = model->m_RawModel->m_Skeleton; + if (skeleton == nullptr) { + continue; + } + + std::shared_ptr blendTree; + if(skeleton->BlendTrees.find(it->RootNode) != skeleton->BlendTrees.end()) { + blendTree = skeleton->BlendTrees.at(it->RootNode); + } else { + it = m_AutoBlendJobs.erase(it); + continue; + } + + + it->BlendInfo.progress = glm::clamp(it->CurrentTime / it->Duration, 0.0, 1.0); + it->BlendInfo = blendTree->AutoBlendStep(it->BlendInfo); + + + if (it->CurrentTime >= it->Duration) { + it = m_AutoBlendJobs.erase(it); + continue; + } + + ++it; + } +} + + +void AnimationSystem::AnimationComplete(EntityWrapper animationEntity) +{ + for (auto it = m_QueuedBlendJobs.begin(); it != m_QueuedBlendJobs.end(); it++) { + if (!it->BlendEntity.Valid() || !it->AnimationEntity.Valid()) { + it = m_QueuedBlendJobs.erase(it); + continue; + } + + if(animationEntity == it->AnimationEntity) { + BlendJob bj; + bj.BlendEntity = it->BlendEntity; + bj.StartWeight = it->StartWeight; + bj.GoalWeight = it->GoalWeight; + bj.Duration = it->Duration; + bj.CurrentTime = 0.0; + m_BlendJobs.push_back(bj); + it = m_QueuedBlendJobs.erase(it); + } + + } + +} + +bool AnimationSystem::OnAnimationBlend(Events::AnimationBlend& e) +{ + if(!e.BlendEntity.Valid()) { + return false; + } + if(!e.BlendEntity.HasComponent("Blend")){ + return false; + } + + if (e.AnimationEntity.Valid()) { + if (e.AnimationEntity.HasComponent("Animation")) { + QueuedBlendJob qbj; + qbj.BlendEntity = e.BlendEntity; + qbj.StartWeight = (double)e.BlendEntity["Blend"]["Weight"]; + qbj.GoalWeight = e.GoalWeight; + qbj.Duration = e.Duration; + qbj.CurrentTime = 0.0; + qbj.AnimationEntity = e.AnimationEntity; + m_QueuedBlendJobs.push_back(qbj); + return true; + } + } + + BlendJob bj; + bj.BlendEntity = e.BlendEntity; + bj.StartWeight = (double)e.BlendEntity["Blend"]["Weight"]; + bj.GoalWeight = e.GoalWeight; + bj.Duration = e.Duration; + bj.CurrentTime = 0.0; + m_BlendJobs.push_back(bj); + + return true; +} + + +bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) +{ + if(!e.RootNode.Valid()) { + return false; + } + + if(!e.RootNode.HasComponent("Model")) { + return false; + } + + AutoBlendJob abj; + abj.RootNode = e.RootNode; + abj.CurrentTime = 0.0; + abj.Duration = e.Duration; + + BlendTree::AutoBlendInfo abInfo; + abInfo.NodeName = e.NodeName; + abInfo.progress = 0.0; + + abj.BlendInfo = abInfo; + + m_AutoBlendJobs.push_back(abj); + + +} + +bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) +{ + + if (e.Value == 1.f) { + if (e.Command == "BlendTest0") { + + + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + + + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + + Events::AutoAnimationBlend aeb; + aeb.Duration = m_BlendTime1; + aeb.NodeName = m_AnimationName1; + aeb.RootNode = entity; + m_EventBroker->Publish(aeb); + + } + } + + } else if (e.Command == "BlendTest1") { + + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + + + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + + Events::AutoAnimationBlend aeb; + aeb.Duration = m_BlendTime2; + aeb.NodeName = m_AnimationName2; + aeb.RootNode = entity; + m_EventBroker->Publish(aeb); + + } + } + } + } +} + diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 0305af19..8ef67f0f 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -14,6 +14,7 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) } m_Root = new Node(); + m_Root->Entity = ModelEntity; m_Root->Name = ModelEntity.Name(); m_Root->Pose = m_Skeleton->GetFrameBones(animation, (double)ModelEntity["Animation"]["Time"], (bool)ModelEntity["Animation"]["Additive"]); m_Root->Parent = nullptr; @@ -21,15 +22,18 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) } else if (ModelEntity.HasComponent("Blend")) { m_Root = new Node(); + m_Root->Entity = ModelEntity; m_Root->Name = ModelEntity.Name(); m_Root->Parent = nullptr; m_Root->Type = NodeType::Blend; m_Root->Weight = (double)ModelEntity["Blend"]["Weight"]; + (double&)ModelEntity["Blend"]["Weight"] = glm::clamp((double)ModelEntity["Blend"]["Weight"], 0.0, 1.0); m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose1"], ModelEntity); m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose2"], ModelEntity); } else if (ModelEntity.HasComponent("BlendOverride")) { m_Root = new Node(); + m_Root->Entity = ModelEntity; m_Root->Name = ModelEntity.Name(); m_Root->Parent = nullptr; m_Root->Type = NodeType::Override; @@ -38,6 +42,7 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) } else if (ModelEntity.HasComponent("BlendAdditive")) { m_Root = new Node(); + m_Root->Entity = ModelEntity; m_Root->Name = ModelEntity.Name(); m_Root->Parent = nullptr; m_Root->Type = NodeType::Additive; @@ -97,8 +102,6 @@ void BlendTree::PrintTree() LOG_INFO("%s", currentNode->Name.c_str()); currentNode = currentNode->Next(); } - - } BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity) @@ -116,6 +119,7 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E } Node* node = new Node(); + node->Entity = childEntity; node->Name = childEntity.Name(); node->Pose = m_Skeleton->GetFrameBones(animation, (double)childEntity["Animation"]["Time"], (bool)childEntity["Animation"]["Additive"]); node->Parent = parentNode; @@ -124,24 +128,26 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E } else if (childEntity.HasComponent("Blend")) { Node* node = new Node(); + node->Entity = childEntity; node->Name = childEntity.Name(); node->Parent = parentNode; node->Type = NodeType::Blend; - (double&)childEntity["Blend"]["Weight"] = glm::clamp((float)(double)childEntity["Blend"]["Weight"], 0.f, 1.f); + (double&)childEntity["Blend"]["Weight"] = glm::clamp((double)childEntity["Blend"]["Weight"], 0.0, 1.0); node->Weight = (double)childEntity["Blend"]["Weight"]; - if (node->Weight < 1.f && node->Weight > 0.f) { + //if (node->Weight < 1.f && node->Weight > 0.f) { node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity); node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity); - } else if (node->Weight == 1.f) { + /* } else if (node->Weight == 1.f) { node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity); } else if (node->Weight == 0.f) { node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity); - } + }*/ return node; } else if (childEntity.HasComponent("BlendOverride")) { Node* node = new Node(); + node->Entity = childEntity; node->Name = childEntity.Name(); node->Parent = parentNode; node->Type = NodeType::Override; @@ -150,6 +156,7 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E return node; } else if (childEntity.HasComponent("BlendAdditive")) { Node* node = new Node(); + node->Entity = childEntity; node->Name = childEntity.Name(); node->Parent = parentNode; node->Type = NodeType::Additive; @@ -162,6 +169,75 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E return nullptr; } + +std::vector BlendTree::FindNodesByName(std::string name) +{ + std::vector Nodes; + Node* currentNode = m_Root; + + while (currentNode->Child[0] != nullptr) { + currentNode = currentNode->Child[0]; + } + + while (currentNode != nullptr) { + if(currentNode->Name == name) { + Nodes.push_back(currentNode); + } + currentNode = currentNode->Next(); + } + return Nodes; +} + + +BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) +{ + std::vector goalNodes = FindNodesByName(blendInfo.NodeName); + + if(goalNodes.size() == 0) { + return blendInfo; + } else if(goalNodes.size() == 1) { + Node* currentNode = goalNodes[0]->Parent; + Node* lastNode = goalNodes[0]; + + while (currentNode != nullptr) + { + + + if(!currentNode->Entity.HasComponent("Blend")) { + return blendInfo; + } + + double startWeight; + if(blendInfo.StartWeights.find(currentNode->Entity) != blendInfo.StartWeights.end()) { + startWeight = blendInfo.StartWeights.at(currentNode->Entity); + } else { + startWeight = currentNode->Weight; + blendInfo.StartWeights[currentNode->Entity] = startWeight; + } + + double goalWeight; + if(currentNode->Child[0] == lastNode) { + goalWeight = 0.0; + } else if (currentNode->Child[1] == lastNode) { + goalWeight = 1.0; + } + + double weight = ((goalWeight - startWeight) * blendInfo.progress) + startWeight; + (double&)currentNode->Entity["Blend"]["Weight"] = weight; + currentNode->Weight = weight; + + lastNode = currentNode; + currentNode = currentNode->Parent; + } + + + } else if(goalNodes.size() >= 2) { + + } + + return blendInfo; +} + void BlendTree::Blend(std::map& pose) { Node* currentNode; diff --git a/src/Engine/Rendering/Renderer.cpp b/src/Engine/Rendering/Renderer.cpp index 251bba2b..fd75911d 100644 --- a/src/Engine/Rendering/Renderer.cpp +++ b/src/Engine/Rendering/Renderer.cpp @@ -142,7 +142,7 @@ void Renderer::Draw(RenderFrame& frame) PerformanceTimer::StopTimer("Renderer-Depth"); } PerformanceTimer::StartTimer("AO generation"); - m_SSAOPass->Draw(m_PickingPass->DepthBuffer(), frame.RenderScenes.front()->Camera); + //m_SSAOPass->Draw(m_PickingPass->DepthBuffer(), frame.RenderScenes.front()->Camera); GLuint ao = m_SSAOPass->SSAOTexture(); PerformanceTimer::StopTimer("AO generation"); for (auto scene : frame.RenderScenes){ diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index 4583de92..b6fea0bb 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -57,7 +57,7 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* anim Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - glm::quat rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); + glm::quat rotation = glm::normalize(glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress)); glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; // Flag for no root motion @@ -71,7 +71,7 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* anim } else { // 1 keyframes for the current bone currentFrame = boneKeyFrames.at(0); - boneMatrix = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); + boneMatrix = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(glm::normalize(currentFrame.BoneProperties.Rotation)) * glm::scale(currentFrame.BoneProperties.Scale)); boneMatrices[bone->ID] = boneMatrix;// *bone->OffsetMatrix; } } else { // 0 keyframes for the current bone @@ -244,7 +244,7 @@ glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animatio } if (progress > 1.0f || progress < 0.0f) { - LOG_INFO("Progress %f", progress); + //LOG_INFO("Progress %f", progress); progress = glm::clamp(progress, 0.0f, 1.0f); } Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; @@ -276,7 +276,7 @@ glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animatio } } -std::map Skeleton::BlendPoses(const std::map& pose1, const std::map& pose2, float weight) +std::map Skeleton::BlendPoses(const std::map& pose1, const std::map& pose2, double weight) { std::map finalPose; @@ -285,8 +285,8 @@ std::map Skeleton::BlendPoses(const std::map& po glm::mat4 blendedPose = glm::mat4(0); if(pose1.find(boneID) != pose1.end() && pose2.find(boneID) != pose2.end()) { - blendedPose += pose1.at(boneID) * weight; - blendedPose += pose2.at(boneID) * (1.f - weight); + blendedPose += pose1.at(boneID) * (float)(1.0 - weight); + blendedPose += pose2.at(boneID) * (float)weight; finalPose[boneID] = blendedPose; } else if(pose1.find(boneID) != pose1.end()) { finalPose[boneID] = pose1.at(boneID); @@ -347,15 +347,11 @@ void Skeleton::GetFinalPose(std::map& boneMatrices, std::vector< void Skeleton::AccumulateFinalPose(std::map& boneMatrices, std::map& boneTransforms, const Bone* bone, glm::mat4 parentMatrix) { - glm::mat4 boneMatrix; - if (boneMatrices.find(bone->ID) != boneMatrices.end()) { - boneMatrix = parentMatrix * boneMatrices.at(bone->ID); boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; - } else { if (bone->Parent) { boneMatrix = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); From c3f24f494d2352604d10ba349a512a51edb67da2 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 2 Mar 2016 13:34:47 +0100 Subject: [PATCH 14/94] fixup! AutoAnimationBlend on unique node working but scale is not working correctly Commited some things that shouldn't have been commited --- src/Engine/Core/Util/Logging.cpp | 4 ++-- src/Engine/Rendering/Renderer.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Engine/Core/Util/Logging.cpp b/src/Engine/Core/Util/Logging.cpp index e5427965..63a6f380 100644 --- a/src/Engine/Core/Util/Logging.cpp +++ b/src/Engine/Core/Util/Logging.cpp @@ -33,8 +33,8 @@ void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int va_end(args); if (logLevel == LOG_LEVEL_ERROR) { - /*std::cerr << file << ":" << line << " " << func << std::endl; - std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;*/ + std::cerr << file << ":" << line << " " << func << std::endl; + std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl; } else { std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl; } diff --git a/src/Engine/Rendering/Renderer.cpp b/src/Engine/Rendering/Renderer.cpp index fd75911d..251bba2b 100644 --- a/src/Engine/Rendering/Renderer.cpp +++ b/src/Engine/Rendering/Renderer.cpp @@ -142,7 +142,7 @@ void Renderer::Draw(RenderFrame& frame) PerformanceTimer::StopTimer("Renderer-Depth"); } PerformanceTimer::StartTimer("AO generation"); - //m_SSAOPass->Draw(m_PickingPass->DepthBuffer(), frame.RenderScenes.front()->Camera); + m_SSAOPass->Draw(m_PickingPass->DepthBuffer(), frame.RenderScenes.front()->Camera); GLuint ao = m_SSAOPass->SSAOTexture(); PerformanceTimer::StopTimer("AO generation"); for (auto scene : frame.RenderScenes){ From 1aefa1dec6028ff1ad0290f3442e881d2ba9dc61 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 2 Mar 2016 17:06:51 +0100 Subject: [PATCH 15/94] AutoAnimationBlend now working correctly for unique nodes --- assets | 2 +- include/Engine/Rendering/BlendTree.h | 5 +- include/Engine/Rendering/Skeleton.h | 29 +- resources/Schema/Entities/AnimationTests2.xml | 254 +++++++++--------- src/Engine/Rendering/BlendTree.cpp | 4 +- src/Engine/Rendering/BoneAttachmentSystem.cpp | 13 + src/Engine/Rendering/DrawBloomPass.cpp | 2 + src/Engine/Rendering/SSAOPass.cpp | 4 + src/Engine/Rendering/Skeleton.cpp | 236 +++++----------- 9 files changed, 240 insertions(+), 309 deletions(-) diff --git a/assets b/assets index 10a61165..4e2b71f1 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 10a611659ddaadfea6a560e707d395834855a979 +Subproject commit 4e2b71f13a3026d06ccde2337c41427e73400c80 diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index b19fbe4f..29ad3ca9 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -19,6 +19,7 @@ public: Animation, }; + struct Node { @@ -27,7 +28,7 @@ public: Node* Parent = nullptr; Node* Child[2] = { nullptr, nullptr }; NodeType Type; - std::map Pose; + std::map Pose; //std::vector Pose; double Weight = 0.0; @@ -85,7 +86,7 @@ private: BlendTree::Node* FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity); std::vector FindNodesByName(std::string name); - void Blend(std::map& pose); + void Blend(std::map& pose); }; #endif diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index e812bf12..08e348ab 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -50,11 +50,16 @@ public: std::map> JointAnimations; }; + struct PoseData { + glm::vec3 Translation; + glm::quat Orientation; + glm::vec3 Scale; + }; + Skeleton() { } ~Skeleton(); Bone* RootBone; - std::map Bones; std::unordered_map> BlendTrees; @@ -65,20 +70,20 @@ public: int GetBoneID(std::string name); const Animation* GetAnimation(std::string name); - std::map GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion = false); - glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix); - std::map BlendPoses(const std::map& pose1, const std::map& pose2, double weight); - std::map OverridePose(const std::map& overridePose, const std::map& targetPose); - std::map BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose); - void GetFinalPose(std::map& boneMatrices, std::vector& finalPose, std::map& boneTransforms); + std::map GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion = false); + + std::map BlendPoses(const std::map& pose1, const std::map& pose2, double weight); + std::map OverridePose(const std::map& overridePose, const std::map& targetPose); + std::map BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose); + void GetFinalPose(std::map& boneMatrices, std::vector& finalPose, std::map& boneTransforms); std::map Animations; private: - glm::mat4 GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time); - glm::mat4 GetBonePose(const Bone* bone, const Animation* animation, double time, bool noRootMotion); - void AccumulateFinalPose(std::map& boneMatrices, std::map& boneTransforms, const Bone* bone, glm::mat4 parentMatrix); - void AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone); - void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix); + Skeleton::PoseData GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time); + + void AccumulateFinalPose(std::map& boneMatrices, std::map& poseDatas, std::map& boneTransforms, const Bone* bone, glm::mat4 parentMatrix); + void AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone); + void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, const Bone* bone); std::map m_BonesByName; diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index fa2a8463..aaa6de48 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -66,11 +66,12 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh + - + - + @@ -90,7 +91,7 @@ AimRifleA - + false true @@ -131,7 +132,7 @@ ShootFastRifleU - + 1 @@ -142,7 +143,7 @@ ShootRifleU - + 1 @@ -155,8 +156,8 @@ ReloadSwitchU - - false + + 1 @@ -169,7 +170,7 @@ StandCrouchBlend Jump - 0.48000049591064453 + 0 @@ -198,7 +199,7 @@ CrouchWalkF - + 1 @@ -219,7 +220,7 @@ CrouchStrafeLeftF - + 1 @@ -230,7 +231,7 @@ CrouchStrafeRightF - + 1 @@ -246,7 +247,7 @@ RunWalkBlend StrafeBlend - 0 + 1 @@ -265,7 +266,8 @@ RunF - + + 1 @@ -275,7 +277,7 @@ WalkF - + 1 @@ -289,7 +291,7 @@ Left Right - 0 + 1 @@ -298,7 +300,7 @@ StrafeLeftF - + 1 @@ -309,7 +311,7 @@ StrafeRightF - + 1 @@ -326,8 +328,8 @@ JumpF - - false + + 1 @@ -352,13 +354,13 @@ Models/Core/UnitCube.mesh - + true - + - + @@ -372,12 +374,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -391,12 +393,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -410,12 +412,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -429,12 +431,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -448,12 +450,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -467,12 +469,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -486,12 +488,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -505,12 +507,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -524,12 +526,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -543,12 +545,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -562,12 +564,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -581,12 +583,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -600,12 +602,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -619,12 +621,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -638,12 +640,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -657,12 +659,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -676,12 +678,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -695,12 +697,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -714,12 +716,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -733,12 +735,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -752,12 +754,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -771,12 +773,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -790,12 +792,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -809,12 +811,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -828,12 +830,12 @@ Models/Core/UnitCube.mesh - + - - - + + + @@ -847,12 +849,12 @@ Models/Core/UnitCube.mesh - + - - - + + + diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 8ef67f0f..cb7ffa69 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -238,7 +238,7 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) return blendInfo; } -void BlendTree::Blend(std::map& pose) +void BlendTree::Blend(std::map& pose) { Node* currentNode; Node* start = m_Root; @@ -301,7 +301,7 @@ std::vector BlendTree::AccumulateFinalPose() return finalPose; } - std::map pose; + std::map pose; Blend(pose); m_Skeleton->GetFinalPose(pose, finalPose, m_FinalBoneTransforms); diff --git a/src/Engine/Rendering/BoneAttachmentSystem.cpp b/src/Engine/Rendering/BoneAttachmentSystem.cpp index 43dc8634..191fb3bd 100644 --- a/src/Engine/Rendering/BoneAttachmentSystem.cpp +++ b/src/Engine/Rendering/BoneAttachmentSystem.cpp @@ -50,6 +50,19 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp glm::vec4 perspective; glm::decompose(boneTransform, scale, rotation, translation, skew, perspective); + float lowRange = 0.98f; + float highRange = 1.02f; + if(scale.x < lowRange || scale.y < lowRange || scale.z < lowRange || + scale.x > highRange || scale.y > highRange || scale.z > highRange) { + if (entity.HasComponent("Model")) { + (glm::vec4&)entity["Model"]["Color"] = glm::vec4(1, 0, 0, 1); + } + } else { + if (entity.HasComponent("Model")) { + (glm::vec4&)entity["Model"]["Color"] = glm::vec4(0, 1, 0, 1); + } + } + glm::vec3 angles = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation)); if ((bool)entity["BoneAttachment"]["InheritPosition"]) { diff --git a/src/Engine/Rendering/DrawBloomPass.cpp b/src/Engine/Rendering/DrawBloomPass.cpp index 12777941..73f73cc4 100644 --- a/src/Engine/Rendering/DrawBloomPass.cpp +++ b/src/Engine/Rendering/DrawBloomPass.cpp @@ -45,6 +45,7 @@ void DrawBloomPass::InitializeShaderPrograms() m_GaussianProgram_horiz->AddShader(std::shared_ptr(new VertexShader("Shaders/Gaussian_horiz.vert.glsl"))); m_GaussianProgram_horiz->AddShader(std::shared_ptr(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl"))); m_GaussianProgram_horiz->Compile(); + m_GaussianProgram_horiz->BindFragDataLocation(0, "fragmentColor"); m_GaussianProgram_horiz->Link(); } @@ -53,6 +54,7 @@ void DrawBloomPass::InitializeShaderPrograms() m_GaussianProgram_vert->AddShader(std::shared_ptr(new VertexShader("Shaders/Gaussian_vert.vert.glsl"))); m_GaussianProgram_vert->AddShader(std::shared_ptr(new FragmentShader("Shaders/Gaussian_vert.frag.glsl"))); m_GaussianProgram_vert->Compile(); + m_GaussianProgram_vert->BindFragDataLocation(0, "fragmentColor"); m_GaussianProgram_vert->Link(); } } diff --git a/src/Engine/Rendering/SSAOPass.cpp b/src/Engine/Rendering/SSAOPass.cpp index 9992db70..3b11535f 100644 --- a/src/Engine/Rendering/SSAOPass.cpp +++ b/src/Engine/Rendering/SSAOPass.cpp @@ -56,6 +56,7 @@ void SSAOPass::InitializeShaderProgram() m_SSAOProgram->AddShader(std::shared_ptr(new VertexShader("Shaders/SSAO.vert.glsl"))); m_SSAOProgram->AddShader(std::shared_ptr(new FragmentShader("Shaders/SSAO.frag.glsl"))); m_SSAOProgram->Compile(); + m_SSAOProgram->BindFragDataLocation(0, "AO"); m_SSAOProgram->Link(); } @@ -64,6 +65,7 @@ void SSAOPass::InitializeShaderProgram() m_SSAOViewSpaceZProgram->AddShader(std::shared_ptr(new VertexShader("Shaders/SSAO.vert.glsl"))); m_SSAOViewSpaceZProgram->AddShader(std::shared_ptr(new FragmentShader("Shaders/SSAOViewSpaceZ.frag.glsl"))); m_SSAOViewSpaceZProgram->Compile(); + m_SSAOViewSpaceZProgram->BindFragDataLocation(0, "depthLinear"); m_SSAOViewSpaceZProgram->Link(); } @@ -72,6 +74,7 @@ void SSAOPass::InitializeShaderProgram() m_GaussianProgram_horiz->AddShader(std::shared_ptr(new VertexShader("Shaders/Gaussian_horiz.vert.glsl"))); m_GaussianProgram_horiz->AddShader(std::shared_ptr(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl"))); m_GaussianProgram_horiz->Compile(); + m_GaussianProgram_horiz->BindFragDataLocation(0, "fragmentColor"); m_GaussianProgram_horiz->Link(); } @@ -80,6 +83,7 @@ void SSAOPass::InitializeShaderProgram() m_GaussianProgram_vert->AddShader(std::shared_ptr(new VertexShader("Shaders/Gaussian_vert.vert.glsl"))); m_GaussianProgram_vert->AddShader(std::shared_ptr(new FragmentShader("Shaders/Gaussian_vert.frag.glsl"))); m_GaussianProgram_vert->Compile(); + m_GaussianProgram_vert->BindFragDataLocation(0, "fragmentColor"); m_GaussianProgram_vert->Link(); } } diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index b6fea0bb..c9ae2732 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -1,20 +1,26 @@ #include "Rendering/Skeleton.h" -std::map Skeleton::GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion /*= false*/) +std::map Skeleton::GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion /*= false*/) { if (animation == nullptr) { - std::map finalMatrices; + std::map finalMatrices; for (auto& b : Bones) { - finalMatrices[b.second->ID] = glm::mat4(1); + PoseData poseData; + poseData.Translation = glm::vec3(0); + poseData.Orientation = glm::quat(); + poseData.Scale = glm::vec3(1); + + + finalMatrices[b.second->ID] = poseData; } return finalMatrices; } - std::map frameBones; + std::map frameBones; if(!additive) { - AccumulateBoneTransforms(true, animation, time, frameBones, RootBone, glm::mat4(1)); + AccumulateBoneTransforms(true, animation, time, frameBones, RootBone); } else { AdditiveBoneTransforms(animation, time, frameBones, RootBone); } @@ -22,11 +28,10 @@ std::map Skeleton::GetFrameBones(const Animation* animation, dou return frameBones; } -void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, const Bone* bone, glm::mat4 parentMatrix) +void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map& boneMatrices, const Bone* bone) { - glm::mat4 boneMatrix; + PoseData poseData; - if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); @@ -66,37 +71,38 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* anim position.z = 0; } - boneMatrix = (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); - boneMatrices[bone->ID] = boneMatrix;// *bone->OffsetMatrix; + poseData.Translation = position; + poseData.Orientation = rotation; + poseData.Scale = scale; + boneMatrices[bone->ID] = poseData; } else { // 1 keyframes for the current bone currentFrame = boneKeyFrames.at(0); - boneMatrix = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(glm::normalize(currentFrame.BoneProperties.Rotation)) * glm::scale(currentFrame.BoneProperties.Scale)); - boneMatrices[bone->ID] = boneMatrix;// *bone->OffsetMatrix; - } - } else { // 0 keyframes for the current bone - if (bone->Parent) { - //boneMatrix = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix); - //boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix; - } else { - //boneMatrix = glm::inverse(bone->OffsetMatrix); - //boneMatrices[bone->ID] = parentMatrix; + poseData.Translation = currentFrame.BoneProperties.Position; + poseData.Orientation = currentFrame.BoneProperties.Rotation; + poseData.Scale = currentFrame.BoneProperties.Scale; + boneMatrices[bone->ID] = poseData; } } for (auto &child : bone->Children) { - AccumulateBoneTransforms(noRootMotion, animation, time, boneMatrices, child, boneMatrix); + AccumulateBoneTransforms(noRootMotion, animation, time, boneMatrices, child); } } -void Skeleton::AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone) +void Skeleton::AdditiveBoneTransforms(const Animation* animation, double time, std::map& boneMatrices, const Bone* bone) { if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { - glm::mat4 refPose = GetAdditiveBonePose(bone, animation, 0.0); - glm::mat4 srcPose = GetAdditiveBonePose(bone, animation, time + 1.0/60.0); - glm::mat4 boneMatrix = srcPose * glm::inverse(refPose); - boneMatrices[bone->ID] = boneMatrix; + PoseData refPose = GetAdditiveBonePose(bone, animation, 0.0); + PoseData srcPose = GetAdditiveBonePose(bone, animation, time + 1.0/60.0); + + PoseData finalPose; + finalPose.Translation = srcPose.Translation - refPose.Translation; + finalPose.Orientation = srcPose.Orientation * glm::inverse(refPose.Orientation); + finalPose.Scale = srcPose.Scale - refPose.Scale; + + boneMatrices[bone->ID] = finalPose; } for (auto &child : bone->Children) { @@ -104,7 +110,7 @@ void Skeleton::AdditiveBoneTransforms(const Animation* animation, double time, s } } -glm::mat4 Skeleton::GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time) +Skeleton::PoseData Skeleton::GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time) { glm::vec3 position = glm::vec3(0); glm::quat rotation = glm::quat(); @@ -152,141 +158,32 @@ glm::mat4 Skeleton::GetAdditiveBonePose(const Bone* bone, const Animation* anima } } - return (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale));; + PoseData finalPose; + finalPose.Translation = position; + finalPose.Orientation = rotation; + finalPose.Scale = scale; + + return finalPose; } - -glm::mat4 Skeleton::GetBonePose(const Bone* bone, const Animation* animation, double time, bool noRootMotion) +std::map Skeleton::BlendPoses(const std::map& pose1, const std::map& pose2, double weight) { - glm::mat4 boneMatrix; + std::map finalPose; - if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { - std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); - - Animation::Keyframe currentFrame; - Animation::Keyframe nextFrame; - - if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone - for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame - if (time >= boneKeyFrames.at(index).Time) { - currentFrame = boneKeyFrames.at(index); - nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size()); - break; - } - } - - float progress; - - if (nextFrame.Index == 0) { - nextFrame = currentFrame; - progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); - } else { - progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); - - } - - - if (progress > 1.0f || progress < 0.0f) { - progress = glm::clamp(progress, 0.0f, 1.0f); - } - Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; - Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - - glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - glm::quat rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; - - // Flag for no root motion - if (bone == RootBone && noRootMotion) { - position.x = 0; - position.z = 0; - } - - boneMatrix = (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale)); - - } else { // 1 keyframes for the current bone - currentFrame = boneKeyFrames.at(0); - boneMatrix = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)); - } - } //else { // 0 keyframes for the current bone - - // } - - return boneMatrix; -} - -glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix) -{ - glm::mat4 boneMatrix; - - Animation::Keyframe currentFrame; - Animation::Keyframe nextFrame; - - if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) { - std::vector boneKeyFrames = animation->JointAnimations.at(bone->ID); - - if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone - for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame - if (time >= boneKeyFrames.at(index).Time) { - currentFrame = boneKeyFrames.at(index); - nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size()); - break; - } - } - - float progress; - - if (nextFrame.Index == 0) { - nextFrame = currentFrame; - progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time); - } else { - progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time); - } - - if (progress > 1.0f || progress < 0.0f) { - //LOG_INFO("Progress %f", progress); - progress = glm::clamp(progress, 0.0f, 1.0f); - } - Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties; - Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties; - - glm::vec3 positionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress; - glm::quat rotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress); - glm::vec3 scaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress; - - boneMatrix = (glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp)) * childMatrix; - - } else { // 1 keyframes for the current bone - currentFrame = boneKeyFrames.at(0); - boneMatrix = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)) * childMatrix; - - } - } else { // 0 keyframes for the current bone - if (bone->Parent) { - boneMatrix = bone->Parent->OffsetMatrix * glm::inverse(bone->OffsetMatrix) * childMatrix; - } else { - boneMatrix = glm::inverse(bone->OffsetMatrix) * childMatrix; - } - } - - if (bone->Parent) { - return GetBoneTransform(bone->Parent, animation, time, boneMatrix); - } else { - return boneMatrix; - } -} - -std::map Skeleton::BlendPoses(const std::map& pose1, const std::map& pose2, double weight) -{ - std::map finalPose; + float weight1 = (float)(1.0 - weight); + float weight2 = (float)(weight); for (auto& b : Bones) { int boneID = b.second->ID; - glm::mat4 blendedPose = glm::mat4(0); + PoseData blendedPose; + blendedPose.Translation = glm::vec3(0); + blendedPose.Orientation = glm::quat(); + blendedPose.Scale = glm::vec3(1); if(pose1.find(boneID) != pose1.end() && pose2.find(boneID) != pose2.end()) { - blendedPose += pose1.at(boneID) * (float)(1.0 - weight); - blendedPose += pose2.at(boneID) * (float)weight; + blendedPose.Translation = pose1.at(boneID).Translation * weight1 + pose2.at(boneID).Translation * weight2; + blendedPose.Orientation = glm::slerp(pose1.at(boneID).Orientation, pose2.at(boneID).Orientation, weight2); + blendedPose.Scale = pose1.at(boneID).Scale * weight1 + pose2.at(boneID).Scale * weight2; finalPose[boneID] = blendedPose; } else if(pose1.find(boneID) != pose1.end()) { finalPose[boneID] = pose1.at(boneID); @@ -298,9 +195,9 @@ std::map Skeleton::BlendPoses(const std::map& po return finalPose; } -std::map Skeleton::OverridePose(const std::map& overridePose, const std::map& targetPose) +std::map Skeleton::OverridePose(const std::map& overridePose, const std::map& targetPose) { - std::map finalPose; + std::map finalPose; for (auto& b : Bones) { int boneID = b.second->ID; @@ -313,18 +210,22 @@ std::map Skeleton::OverridePose(const std::map& return finalPose; } -std::map Skeleton::BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose) +std::map Skeleton::BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose) { - std::map finalPose; + std::map finalPose; for (auto& b : Bones) { int boneID = b.second->ID; - glm::mat4 blendedPose = glm::mat4(1); + PoseData blendedPose; + blendedPose.Translation = glm::vec3(0); + blendedPose.Orientation = glm::quat(); + blendedPose.Scale = glm::vec3(1); if (additivePose.find(boneID) != additivePose.end() && targetPose.find(boneID) != targetPose.end()) { - blendedPose = additivePose.at(boneID) * targetPose.at(boneID); + blendedPose.Translation = additivePose.at(boneID).Translation + targetPose.at(boneID).Translation; + blendedPose.Orientation = additivePose.at(boneID).Orientation * targetPose.at(boneID).Orientation; + blendedPose.Scale = additivePose.at(boneID).Scale + targetPose.at(boneID).Scale; finalPose[boneID] = blendedPose; - } else if (additivePose.find(boneID) != additivePose.end()) { finalPose[boneID] = additivePose.at(boneID); } else if (targetPose.find(boneID) != targetPose.end()) { @@ -335,9 +236,12 @@ std::map Skeleton::BlendPoseAdditive(const std::map& boneMatrices, std::vector& finalPose, std::map& boneTransforms) +void Skeleton::GetFinalPose(std::map& poseDatas, std::vector& finalPose, std::map& boneTransforms) { - AccumulateFinalPose(boneMatrices, boneTransforms, RootBone, glm::mat4(1)); + + std::map boneMatrices; + + AccumulateFinalPose(boneMatrices, poseDatas, boneTransforms, RootBone, glm::mat4(1)); for(auto& b : boneMatrices) { finalPose.push_back(b.second); @@ -345,12 +249,12 @@ void Skeleton::GetFinalPose(std::map& boneMatrices, std::vector< } -void Skeleton::AccumulateFinalPose(std::map& boneMatrices, std::map& boneTransforms, const Bone* bone, glm::mat4 parentMatrix) +void Skeleton::AccumulateFinalPose(std::map& boneMatrices, std::map& poseDatas, std::map& boneTransforms, const Bone* bone, glm::mat4 parentMatrix) { glm::mat4 boneMatrix; - if (boneMatrices.find(bone->ID) != boneMatrices.end()) { - boneMatrix = parentMatrix * boneMatrices.at(bone->ID); + if (poseDatas.find(bone->ID) != poseDatas.end()) { + boneMatrix = parentMatrix * (glm::translate(poseDatas.at(bone->ID).Translation) * glm::mat4(poseDatas.at(bone->ID).Orientation) * glm::scale(poseDatas.at(bone->ID).Scale)); boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix; } else { if (bone->Parent) { @@ -365,7 +269,7 @@ void Skeleton::AccumulateFinalPose(std::map& boneMatrices, std:: boneTransforms[bone->ID] = boneMatrix; for (auto &child : bone->Children) { - AccumulateFinalPose(boneMatrices, boneTransforms, child, boneMatrix); + AccumulateFinalPose(boneMatrices, poseDatas, boneTransforms, child, boneMatrix); } } From d8a0e69ff05b361974ba6db4ecc7e9ac4f0cecd5 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 2 Mar 2016 17:11:18 +0100 Subject: [PATCH 16/94] fixup! AutoAnimationBlend now working correctly for unique nodes, Commited debug code --- src/Engine/Rendering/BoneAttachmentSystem.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/Engine/Rendering/BoneAttachmentSystem.cpp b/src/Engine/Rendering/BoneAttachmentSystem.cpp index 191fb3bd..43dc8634 100644 --- a/src/Engine/Rendering/BoneAttachmentSystem.cpp +++ b/src/Engine/Rendering/BoneAttachmentSystem.cpp @@ -50,19 +50,6 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp glm::vec4 perspective; glm::decompose(boneTransform, scale, rotation, translation, skew, perspective); - float lowRange = 0.98f; - float highRange = 1.02f; - if(scale.x < lowRange || scale.y < lowRange || scale.z < lowRange || - scale.x > highRange || scale.y > highRange || scale.z > highRange) { - if (entity.HasComponent("Model")) { - (glm::vec4&)entity["Model"]["Color"] = glm::vec4(1, 0, 0, 1); - } - } else { - if (entity.HasComponent("Model")) { - (glm::vec4&)entity["Model"]["Color"] = glm::vec4(0, 1, 0, 1); - } - } - glm::vec3 angles = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation)); if ((bool)entity["BoneAttachment"]["InheritPosition"]) { From e9bbb5ed2a4adc2116764eaac835e98bee58803d Mon Sep 17 00:00:00 2001 From: viktorljung Date: Wed, 2 Mar 2016 17:42:55 +0100 Subject: [PATCH 17/94] Fixed BlendTree crash when animation nodes are null --- src/Engine/Rendering/BlendTree.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index cb7ffa69..8b044134 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -142,9 +142,13 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E } else if (node->Weight == 0.f) { node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity); }*/ + + if(node->Child[0] == nullptr && node->Child[1] == nullptr) { + return nullptr; + } else { + return node; + } - - return node; } else if (childEntity.HasComponent("BlendOverride")) { Node* node = new Node(); node->Entity = childEntity; @@ -153,7 +157,12 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E node->Type = NodeType::Override; node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Master"], childEntity); node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Slave"], childEntity); - return node; + + if (node->Child[0] == nullptr && node->Child[1] == nullptr) { + return nullptr; + } else { + return node; + } } else if (childEntity.HasComponent("BlendAdditive")) { Node* node = new Node(); node->Entity = childEntity; @@ -162,7 +171,12 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E node->Type = NodeType::Additive; node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Adder"], childEntity); node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Receiver"], childEntity); - return node; + + if(node->Child[0] == nullptr && node->Child[1] == nullptr) { + return nullptr; + } else { + return node; + } } @@ -252,7 +266,6 @@ void BlendTree::Blend(std::map& pose) if(currentNode->Pose.size() == 0) { if (currentNode->Child[0] != nullptr && currentNode->Child[1] != nullptr) { if (currentNode->Child[0]->Pose.size() != 0 && currentNode->Child[1]->Pose.size() != 0) { - switch (currentNode->Type) { case BlendTree::NodeType::Additive: currentNode->Pose = m_Skeleton->BlendPoseAdditive(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose); From 9c9d1eede614ef8e7d3c6d25ad00499297e2acd4 Mon Sep 17 00:00:00 2001 From: Tleety Date: Wed, 2 Mar 2016 22:34:03 +0100 Subject: [PATCH 18/94] Components for ScoreScreen Added --- resources/Schema/Components.xsd | 1 + resources/Schema/Components/ScoreScreen.xml | 3 +++ resources/Schema/Components/ScoreScreen.xsd | 10 ++++++++++ resources/Schema/Types/Entity.xsd | 1 + 4 files changed, 15 insertions(+) create mode 100644 resources/Schema/Components/ScoreScreen.xml create mode 100644 resources/Schema/Components/ScoreScreen.xsd diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index fccfd3d0..e559db09 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -57,4 +57,5 @@ + \ No newline at end of file diff --git a/resources/Schema/Components/ScoreScreen.xml b/resources/Schema/Components/ScoreScreen.xml new file mode 100644 index 00000000..646002c4 --- /dev/null +++ b/resources/Schema/Components/ScoreScreen.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/resources/Schema/Components/ScoreScreen.xsd b/resources/Schema/Components/ScoreScreen.xsd new file mode 100644 index 00000000..387140f2 --- /dev/null +++ b/resources/Schema/Components/ScoreScreen.xsd @@ -0,0 +1,10 @@ + + + + + + + The screen where player scores will be shown. + + + \ No newline at end of file diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index d543a7f4..1da5e628 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -60,6 +60,7 @@ + From b431a875f75c741b0ecd5576b1819a2331ae5a85 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Tue, 1 Mar 2016 13:26:50 +0100 Subject: [PATCH 19/94] New weapon behaviours --- .../Systems/Weapon/DefenderWeaponBehaviour.h | 12 +-- .../Systems/Weapon/SidearmWeaponBehaviour.h | 32 ++++++++ include/Game/Systems/Weapon/WeaponBehaviour.h | 74 ++++++++++++------- resources/Schema/Components.xsd | 1 + .../Schema/Components/DefenderWeapon.xsd | 12 +++ resources/Schema/Components/SidearmWeapon.xml | 14 ++++ resources/Schema/Components/SidearmWeapon.xsd | 48 ++++++++++++ resources/Schema/Entities/Player.xml | 8 +- resources/Schema/Types/Entity.xsd | 1 + src/Engine/Rendering/Renderer.cpp | 2 +- .../Weapon/DefenderWeaponBehaviour.cpp | 24 +++--- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 58 +++++++++++++++ 12 files changed, 232 insertions(+), 54 deletions(-) create mode 100644 include/Game/Systems/Weapon/SidearmWeaponBehaviour.h create mode 100644 resources/Schema/Components/SidearmWeapon.xml create mode 100644 resources/Schema/Components/SidearmWeapon.xsd create mode 100644 src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index 5ca13d3e..986d8586 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -15,10 +15,10 @@ public: } void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override; - void UpdateWeapon(WeaponInfo& wi, double dt) override; - void OnPrimaryFire(WeaponInfo& wi) override; - void OnCeasePrimaryFire(WeaponInfo& wi) override; - bool OnInputCommand(WeaponInfo& wi, const Events::InputCommand& e) override; + void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) override; + void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; + bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) override; private: std::random_device m_RandomDevice; @@ -29,8 +29,8 @@ private: bool OnSetCamera(const Events::SetCamera& e); // Weapon functions - void fireShell(WeaponInfo& wi); - void dealDamage(WeaponInfo& wi, glm::vec3 direction, double damage); + void fireShell(ComponentWrapper cWeapon, WeaponInfo& wi); + void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage); // Utility float traceRayDistance(glm::vec3 origin, glm::vec3 direction); diff --git a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h new file mode 100644 index 00000000..787c3c61 --- /dev/null +++ b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h @@ -0,0 +1,32 @@ +#include "WeaponBehaviour.h" +#include "Collision/Collision.h" +#include "Core/EPlayerDamage.h" + +class SidearmWeaponBehaviour : public WeaponBehaviour +{ +public: + SidearmWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree* collisionOctree) + : System(systemParams) + , WeaponBehaviour(systemParams, "SidearmWeapon", renderer, collisionOctree) + , m_RandomEngine(m_RandomDevice()) + { } + + void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override; + void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) override; + void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) override; + +private: + std::random_device m_RandomDevice; + std::mt19937 m_RandomEngine; + EntityWrapper m_CurrentCamera; + + // Weapon functions + void fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi); + //void dealDamage(WeaponInfo& wi, glm::vec3 direction, double damage); + + // Utility + bool canFire(ComponentWrapper cWeapon); + //float traceRayDistance(glm::vec3 origin, glm::vec3 direction); +}; \ No newline at end of file diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index f23269df..2ab53e0e 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -24,36 +24,35 @@ public: } virtual ~WeaponBehaviour() = default; - virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override { auto weapon = getActiveWeapon(entity); if (!weapon) { return; } else { - UpdateWeapon(*weapon, dt); + UpdateWeapon(cWeapon, *weapon, dt); } } protected: struct WeaponInfo { - std::string WeaponComponent; EntityWrapper Player; EntityWrapper WeaponEntity; EntityWrapper FirstPersonEntity; EntityWrapper ThirdPersonEntity; - ComponentWrapper GetComponent() { return WeaponEntity[WeaponComponent]; } }; IRenderer* m_Renderer; Octree* m_CollisionOctree; std::unordered_map m_ActiveWeapons; - virtual void UpdateWeapon(WeaponInfo& wi, double dt) { } - virtual void OnPrimaryFire(WeaponInfo& wi) { } - virtual void OnCeasePrimaryFire(WeaponInfo& wi) { } - virtual void OnReload(WeaponInfo& wi) { } - virtual bool OnInputCommand(WeaponInfo& wi, const Events::InputCommand& e) { return false; } + virtual void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { } + virtual void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { } + virtual void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { } + virtual void OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) { } + virtual void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) { } + virtual bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) { return false; } private: EventRelay m_EInputCommand; @@ -70,15 +69,19 @@ private: } // Make sure the player has this weapon - auto weapon = getWeaponComponent(player); - if (!weapon) { + auto cWeapon = getWeaponComponent(player); + if (!cWeapon) { return false; } // Weapon selection if (e.Command == "SelectWeapon") { - if (static_cast(e.Value) == static_cast((*weapon)["Slot"])) { - selectWeapon(player); + if (e.Value > 0) { + if (static_cast(e.Value) == static_cast((*cWeapon)["Slot"])) { + selectWeapon(player); + } else { + holsterWeapon(*cWeapon, player); + } } } @@ -91,18 +94,18 @@ private: // Fire if (e.Command == "PrimaryFire") { if (e.Value > 0) { - OnPrimaryFire(*activeWeapon); + OnPrimaryFire(*cWeapon, *activeWeapon); } else { - OnCeasePrimaryFire(*activeWeapon); + OnCeasePrimaryFire(*cWeapon, *activeWeapon); } } // Reload if (e.Command == "Reload" && e.Value != 0) { - OnReload(*activeWeapon); + OnReload(*cWeapon, *activeWeapon); } - return OnInputCommand(*activeWeapon, e); + return OnInputCommand(*cWeapon, *activeWeapon, e); } boost::optional getWeaponComponent(EntityWrapper player) @@ -131,6 +134,11 @@ private: void selectWeapon(EntityWrapper player) { + // Don't reselect weapon if it's already active + if (getActiveWeapon(player)) { + return; + } + // Find the weapon attachments matching the weapon type std::vector weaponAttachments = player.ChildrenWithComponent("WeaponAttachment"); EntityWrapper firstPersonAttachment; @@ -152,14 +160,6 @@ private: return; } - // Purge other weapon entities - for (auto& attachment : weaponAttachments) { - //if (attachment == firstPersonAttachment || attachment == thirdPersonAttachment) { - // continue; - //} - attachment.DeleteChildren(); - } - // Spawn the weapon(s) EntityWrapper firstPersonWeapon; EntityWrapper thirdPersonWeapon; @@ -170,12 +170,34 @@ private: thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment); } - m_ActiveWeapons[player].WeaponComponent = m_ComponentType; m_ActiveWeapons[player].Player = player; m_ActiveWeapons[player].WeaponEntity = player; m_ActiveWeapons[player].FirstPersonEntity = firstPersonWeapon; m_ActiveWeapons[player].ThirdPersonEntity = thirdPersonWeapon; } + + void holsterWeapon(ComponentWrapper cWeapon, EntityWrapper player) + { + auto activeWeapon = getActiveWeapon(player); + if (!activeWeapon) { + return; + } + WeaponInfo& wi = *activeWeapon; + + // Send holster event + OnHolster(cWeapon, wi); + + // Delete weapon entities + if (wi.FirstPersonEntity.Valid()) { + m_World->DeleteEntity(wi.FirstPersonEntity.ID); + } + if (wi.ThirdPersonEntity.Valid()) { + m_World->DeleteEntity(wi.ThirdPersonEntity.ID); + } + + // Make weapon inactive + m_ActiveWeapons.erase(player); + } }; #endif diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index 0c8886f3..711f4999 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -54,6 +54,7 @@ + diff --git a/resources/Schema/Components/DefenderWeapon.xsd b/resources/Schema/Components/DefenderWeapon.xsd index 3fe5a64a..0ec61964 100755 --- a/resources/Schema/Components/DefenderWeapon.xsd +++ b/resources/Schema/Components/DefenderWeapon.xsd @@ -4,6 +4,18 @@ + + + + + + + + + + + + diff --git a/resources/Schema/Components/SidearmWeapon.xml b/resources/Schema/Components/SidearmWeapon.xml new file mode 100644 index 00000000..b63706b6 --- /dev/null +++ b/resources/Schema/Components/SidearmWeapon.xml @@ -0,0 +1,14 @@ + + + 16 + 16 + 20 + 120 + 0.01 + 0.5 + + false + 0 + false + 0 + \ No newline at end of file diff --git a/resources/Schema/Components/SidearmWeapon.xsd b/resources/Schema/Components/SidearmWeapon.xsd new file mode 100644 index 00000000..844b449f --- /dev/null +++ b/resources/Schema/Components/SidearmWeapon.xsd @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + Ammo currently loaded into the magazine + + + Max number of rounds in a magazine + + + Damage dealt if all shotgun pellets hit + + + Rate of fire in rounds per minute + + + View punch in radians for each shell fired + + + Time it takes to load ONE SHELL into the weapon in seconds + + + + + + + + + + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 34692605..d157c99e 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -6,11 +6,6 @@ - - - - - 52.867678870419283 @@ -488,9 +483,10 @@ AssaultWeapon - Schema/Entities/AssaultWeaponView.xml + Schema/Entities/SidearmWeaponView.xml + SidearmWeapon diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index 57445a15..f9870a51 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -52,6 +52,7 @@ + diff --git a/src/Engine/Rendering/Renderer.cpp b/src/Engine/Rendering/Renderer.cpp index 3ce985b6..7e11f3b2 100644 --- a/src/Engine/Rendering/Renderer.cpp +++ b/src/Engine/Rendering/Renderer.cpp @@ -17,7 +17,7 @@ void Renderer::Initialize() m_TextPass->Initialize(); /* m_ScreenQuad = ResourceManager::Load("Models/Core/ScreenQuad.obj"); - m_UnitQuad = ResourceManager::Load("Models/Core/UnitQuad.obj"); + m_UnitQuad = ResourceManager::Load(sModels/Core/UnitQuad.obj"); m_UnitSphere = ResourceManager::Load("Models/Core/UnitSphere.obj");*/ m_ImGuiRenderPass = new ImGuiRenderPass(this, m_EventBroker); diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 028bd10c..0a179b4c 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -6,36 +6,32 @@ void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWr WeaponBehaviour::UpdateComponent(entity, cWeapon, dt); } -void DefenderWeaponBehaviour::UpdateWeapon(WeaponInfo& wi, double dt) +void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { - ComponentWrapper cWeapon = wi.GetComponent(); - bool isFiring = cWeapon["IsFiring"]; bool cooldownPassed = (double)cWeapon["TimeSinceLastFire"] >= (60.0 / (double)cWeapon["RPM"]); bool isNotShielding = wi.Player.ChildrenWithComponent("Shield").size() == 0; if (isFiring && cooldownPassed && isNotShielding) { - fireShell(wi); + fireShell(cWeapon, wi); } } -void DefenderWeaponBehaviour::OnPrimaryFire(WeaponInfo& wi) +void DefenderWeaponBehaviour::OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { - ComponentWrapper cWeapon = wi.GetComponent(); cWeapon["IsFiring"] = true; bool cooldownPassed = (double)cWeapon["TimeSinceLastFire"] >= (60.0 / (double)cWeapon["RPM"]); bool isNotShielding = wi.Player.ChildrenWithComponent("Shield").size() == 0; if (cooldownPassed && isNotShielding) { - fireShell(wi); + fireShell(cWeapon, wi); } } -void DefenderWeaponBehaviour::OnCeasePrimaryFire(WeaponInfo& wi) +void DefenderWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { - ComponentWrapper cWeapon = wi.GetComponent(); cWeapon["IsFiring"] = false; } -bool DefenderWeaponBehaviour::OnInputCommand(WeaponInfo& wi, const Events::InputCommand& e) +bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) { if (e.Command == "SpecialAbility" && IsServer) { EntityWrapper attachment = wi.Player.FirstChildByName("ShieldAttachment"); @@ -57,10 +53,8 @@ bool DefenderWeaponBehaviour::OnSetCamera(const Events::SetCamera& e) return true; } -void DefenderWeaponBehaviour::fireShell(WeaponInfo& wi) +void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi) { - ComponentWrapper cWeapon = wi.GetComponent(); - cWeapon["TimeSinceLastFire"] = 0.0; int numPellets = cWeapon["NumPellets"]; float spreadAngle = cWeapon["SpreadAngle"]; @@ -95,13 +89,13 @@ void DefenderWeaponBehaviour::fireShell(WeaponInfo& wi) orientation.x += angles.x; orientation.y += angles.y; glm::vec3 trajectory = direction * distance; - dealDamage(wi, direction, pelletDamage); + dealDamage(cWeapon, wi, direction, pelletDamage); } } } -void DefenderWeaponBehaviour::dealDamage(WeaponInfo& wi, glm::vec3 direction, double damage) +void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage) { // Only deal damage client side if (!IsClient) { diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp new file mode 100644 index 00000000..8c3906af --- /dev/null +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -0,0 +1,58 @@ +#include "Systems/Weapon/SidearmWeaponBehaviour.h" + +void SidearmWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) +{ + double& cooldown = cWeapon["FireCooldown"]; + if (cooldown > 0) { + cooldown -= dt; + if (cooldown < 0) { + cooldown = 0; + } + } + WeaponBehaviour::UpdateComponent(entity, cWeapon, dt); +} + +void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) +{ + if (canFire(cWeapon)) { + fireBullet(cWeapon, wi); + } +} + +void SidearmWeaponBehaviour::OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + cWeapon["TriggerHeld"] = true; + if (canFire(cWeapon)) { + fireBullet(cWeapon, wi); + } +} + +void SidearmWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + cWeapon["TriggerHeld"] = false; +} + +void SidearmWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + // Make sure the trigger is released if weapon is holstered while firing + cWeapon["TriggerHeld"] = false; + + // Cancel any reload + cWeapon["IsReloading"] = false; + cWeapon["ReloadTimer"] = 0.0; + + LOG_DEBUG("HOLSTER"); +} + +void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + +} + +bool SidearmWeaponBehaviour::canFire(ComponentWrapper cWeapon) +{ + bool triggerHeld = cWeapon["TriggerHeld"]; + double& cooldown = cWeapon["FireCooldown"]; + // TODO: Ammo checks + return triggerHeld && cooldown <= 0.0; +} \ No newline at end of file From 6f8023b285d260f68efd9ac615b702721e8ae0b4 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Tue, 1 Mar 2016 16:35:30 +0100 Subject: [PATCH 20/94] HACK: Added Activate button for spawners in editor. Right now it includes the event from Game, but SpawnerSystem should probably be moved to Engine. --- include/Engine/Editor/EditorGUI.h | 1 + src/Engine/Editor/EditorGUI.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/Engine/Editor/EditorGUI.h b/include/Engine/Editor/EditorGUI.h index 57574e66..807bfc8b 100644 --- a/include/Engine/Editor/EditorGUI.h +++ b/include/Engine/Editor/EditorGUI.h @@ -22,6 +22,7 @@ #include "../Core/ELockMouse.h" #include "../Core/EFileDropped.h" #include "../Rendering/Texture.h" +#include "Game/Events/ESpawnerSpawn.h" class EditorGUI { diff --git a/src/Engine/Editor/EditorGUI.cpp b/src/Engine/Editor/EditorGUI.cpp index 8ce15d0a..a1ceafd0 100644 --- a/src/Engine/Editor/EditorGUI.cpp +++ b/src/Engine/Editor/EditorGUI.cpp @@ -338,6 +338,15 @@ bool EditorGUI::drawComponentNode(EntityWrapper entity, const ComponentInfo& ci) } } + if (ci.Name == "Spawner") { + if (ImGui::Button("Activate")) { + Events::SpawnerSpawn e; + e.Spawner = entity; + e.Parent = entity; + m_EventBroker->Publish(e); + } + } + return true; } From afd0e69a8a9a0c2050429277b77ab85308731f21 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Tue, 1 Mar 2016 16:35:54 +0100 Subject: [PATCH 21/94] Updated Player.xml for multiple weapons --- .../Schema/Entities/DefenderWeaponView.xml | 8 ++--- resources/Schema/Entities/Player.xml | 30 ++++++++++++++----- .../Schema/Entities/SidearmWeaponView.xml | 27 +++++++++++++++++ .../Schema/Entities/SidearmWeaponWorld.xml | 27 +++++++++++++++++ src/Game/Game.cpp | 2 ++ 5 files changed, 81 insertions(+), 13 deletions(-) create mode 100644 resources/Schema/Entities/SidearmWeaponView.xml create mode 100644 resources/Schema/Entities/SidearmWeaponWorld.xml diff --git a/resources/Schema/Entities/DefenderWeaponView.xml b/resources/Schema/Entities/DefenderWeaponView.xml index f6b6e89d..b65194f9 100755 --- a/resources/Schema/Entities/DefenderWeaponView.xml +++ b/resources/Schema/Entities/DefenderWeaponView.xml @@ -1,16 +1,12 @@ - + - - R_Arm_Weapon_Joint - - Models/Weapons/Blue/DefenderGunBlue.mesh - + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index d157c99e..394f4622 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -11,6 +11,7 @@ 52.867678870419283 + @@ -453,7 +454,7 @@ Idle - 1.9408570429715581 + 0.022133545026491674 1 @@ -467,26 +468,38 @@ + + R_Arm_Weapon_Joint + DefenderWeapon Schema/Entities/DefenderWeaponView.xml - + + + + + + R_Arm_Weapon_Joint + AssaultWeapon + SidearmWeapon Schema/Entities/SidearmWeaponView.xml - - SidearmWeapon + + + + @@ -515,7 +528,7 @@ Idle - 1.5631122524686134 + 0.13373697879978863 1 @@ -550,14 +563,17 @@ + + R_Arm_Weapon_Joint + - AssaultWeapon + SidearmWeapon - Schema/Entities/AssaultWeaponWorld.xml + Schema/Entities/SidearmWeaponWorld.xml diff --git a/resources/Schema/Entities/SidearmWeaponView.xml b/resources/Schema/Entities/SidearmWeaponView.xml new file mode 100644 index 00000000..68d29676 --- /dev/null +++ b/resources/Schema/Entities/SidearmWeaponView.xml @@ -0,0 +1,27 @@ + + + + + + Models/Weapons/SecondaryWeapon.mesh + + + + + + + + + + + Schema/Entities/RayBlue.xml + + + + + + + + + + diff --git a/resources/Schema/Entities/SidearmWeaponWorld.xml b/resources/Schema/Entities/SidearmWeaponWorld.xml new file mode 100644 index 00000000..21cb26a7 --- /dev/null +++ b/resources/Schema/Entities/SidearmWeaponWorld.xml @@ -0,0 +1,27 @@ + + + + + + Models/Weapons/SecondaryWeapon.mesh + + + + + + + + + + + Schema/Entities/RayBlue.xml + + + + + + + + + + diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 21f5c901..7607efec 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -19,6 +19,7 @@ #include "Game/Systems/AmmoPickupSystem.h" #include "Game/Systems/DamageIndicatorSystem.h" #include "Game/Systems/Weapon/DefenderWeaponBehaviour.h" +#include "Game/Systems/Weapon/SidearmWeaponBehaviour.h" #include "Rendering/AnimationSystem.h" #include "Game/Systems/HealthHUDSystem.h" #include "Rendering/BoneAttachmentSystem.h" @@ -128,6 +129,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer, m_OctreeCollision); + m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer, m_OctreeCollision); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); From 050ce57e24a09aa8e87b4a40604d08d9b0f7e4f0 Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 00:32:07 +0100 Subject: [PATCH 22/94] Fixed AbilityUI for player and changed so the AbilityCooldown system wont need a child with text, instead just write if it has one. --- resources/Schema/Entities/Player.xml | 105 ++++++++++++------ src/Game/Systems/AbilityCooldownHUDSystem.cpp | 14 ++- 2 files changed, 79 insertions(+), 40 deletions(-) diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 34692605..c93989d8 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -12,6 +12,9 @@ + + 3 + 52.867678870419283 @@ -70,8 +73,8 @@ Textures/Weapons/Crosshair/SmallThickHoleDot.png - false + false @@ -94,42 +97,22 @@ - - - - 1 - - - - 100/100 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - 1 + Textures/HealthHUD3.png - - + @@ -146,8 +129,8 @@ Textures/Core/White.png - false + false @@ -164,8 +147,8 @@ Textures/Core/White.png - false + false @@ -182,8 +165,8 @@ Textures/Core/White.png - false + false @@ -195,8 +178,62 @@ + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + @@ -233,8 +270,8 @@ - + @@ -267,8 +304,8 @@ - + @@ -302,8 +339,8 @@ - + @@ -336,8 +373,8 @@ - + @@ -369,8 +406,8 @@ - + @@ -446,8 +483,8 @@ + - @@ -605,8 +642,8 @@ - + @@ -615,8 +652,8 @@ Textures/Icons/Arrow.png - false + false diff --git a/src/Game/Systems/AbilityCooldownHUDSystem.cpp b/src/Game/Systems/AbilityCooldownHUDSystem.cpp index 44180a62..7226019f 100644 --- a/src/Game/Systems/AbilityCooldownHUDSystem.cpp +++ b/src/Game/Systems/AbilityCooldownHUDSystem.cpp @@ -14,17 +14,19 @@ void AbilityCooldownHUDSystem::Update(double dt) if (!abilityEntity.Valid()) return; EntityWrapper cooldownTextEntity = entity.FirstChildByName("Cooldown"); + + double maxAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownMaxTimer"]; + double currentAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownTimer"]; + if(cooldownTextEntity.Valid()) { if(cooldownTextEntity.HasComponent("Text")) { - double maxAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownMaxTimer"]; - double currentAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownTimer"]; - currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0; std::string t = (std::string&)cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3); - if(entity.HasComponent("Fill")) { - entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD; //TODO: current time needs to be in the component. - } } } + if (entity.HasComponent("Fill")) { + currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0; + entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD; + } } } From d74ae4e4119aadc0525ed566e74252030c27cdfa Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 00:55:44 +0100 Subject: [PATCH 23/94] Some fixes to the Player and map, added skeleton system for the ScoreScreen --- include/Game/Systems/ScoreScreenSystem.h | 18 + .../{NewMap2version3NEW.xml => CP_Rocky.xml} | 1506 +++++++++-------- resources/Schema/Entities/Player.xml | 11 + src/Game/Systems/AbilityCooldownHUDSystem.cpp | 3 +- src/Game/Systems/ScoreScreenSystem.cpp | 6 + 5 files changed, 802 insertions(+), 742 deletions(-) create mode 100644 include/Game/Systems/ScoreScreenSystem.h rename resources/Schema/Entities/{NewMap2version3NEW.xml => CP_Rocky.xml} (97%) create mode 100644 src/Game/Systems/ScoreScreenSystem.cpp diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h new file mode 100644 index 00000000..691aa791 --- /dev/null +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -0,0 +1,18 @@ +#ifndef ScoreScreenSystem_h__ +#define ScoreScreenSystem_h__ + +#include "../../Engine/Core/System.h" +#include "../../Engine/GLM.h" + +class ScoreScreenSystem : public PureSystem +{ +public: + ScoreScreenSystem(SystemParams params) + : System(params) + , PureSystem("ScoreScreen") + { } + + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override; +}; + +#endif \ No newline at end of file diff --git a/resources/Schema/Entities/NewMap2version3NEW.xml b/resources/Schema/Entities/CP_Rocky.xml similarity index 97% rename from resources/Schema/Entities/NewMap2version3NEW.xml rename to resources/Schema/Entities/CP_Rocky.xml index 61e7b740..8617886f 100644 --- a/resources/Schema/Entities/NewMap2version3NEW.xml +++ b/resources/Schema/Entities/CP_Rocky.xml @@ -29,6 +29,18 @@ + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + @@ -70,18 +82,6 @@ - - - - - Models/Props/Walls/SciFiWallBig.mesh - - - - - - - @@ -114,6 +114,30 @@ + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + @@ -369,8 +393,8 @@ - + @@ -384,8 +408,8 @@ - + @@ -399,8 +423,8 @@ - + @@ -414,8 +438,8 @@ - + @@ -456,8 +480,8 @@ - + @@ -471,8 +495,8 @@ - + @@ -485,8 +509,8 @@ - + @@ -514,8 +538,8 @@ - + @@ -543,8 +567,8 @@ - + @@ -584,8 +608,8 @@ - + @@ -634,8 +658,8 @@ - + @@ -649,8 +673,8 @@ - + @@ -664,8 +688,8 @@ - + @@ -707,8 +731,8 @@ - + @@ -760,8 +784,8 @@ - + @@ -775,8 +799,8 @@ - + @@ -795,20 +819,20 @@ - + - - 2 + + - + @@ -825,8 +849,8 @@ + - @@ -842,20 +866,20 @@ - + - - 2 + + - + @@ -872,8 +896,8 @@ + - @@ -889,20 +913,20 @@ - + - - 2 + + - + @@ -919,8 +943,8 @@ + - @@ -936,20 +960,20 @@ - + - - 2 + + - + @@ -966,8 +990,8 @@ + - @@ -983,20 +1007,20 @@ - + - - 2 + + - + @@ -1013,8 +1037,8 @@ + - @@ -1030,20 +1054,20 @@ - + - - 2 + + - + @@ -1060,8 +1084,8 @@ + - @@ -1077,20 +1101,20 @@ - + - - 2 + + - + @@ -1107,8 +1131,8 @@ + - @@ -1170,8 +1194,8 @@ - + @@ -1317,8 +1341,8 @@ - + @@ -1396,8 +1420,8 @@ - + @@ -1424,8 +1448,8 @@ - + @@ -1489,8 +1513,8 @@ - + @@ -1554,8 +1578,8 @@ - + @@ -1722,8 +1746,8 @@ - + @@ -1736,8 +1760,8 @@ - + @@ -1836,8 +1860,8 @@ - + @@ -2020,8 +2044,8 @@ - + @@ -2104,8 +2128,8 @@ - + @@ -2128,8 +2152,8 @@ - + @@ -2142,8 +2166,8 @@ - + @@ -2156,8 +2180,8 @@ - + @@ -2346,20 +2370,20 @@ - + - - 2 + + - + @@ -2376,8 +2400,8 @@ + - @@ -2393,20 +2417,20 @@ - + - - 2 + + - + @@ -2423,8 +2447,8 @@ + - @@ -2474,8 +2498,8 @@ - + @@ -2536,8 +2560,8 @@ - + @@ -2551,8 +2575,8 @@ - + @@ -2598,8 +2622,8 @@ - + @@ -2612,8 +2636,8 @@ - + @@ -2626,8 +2650,8 @@ - + @@ -2640,8 +2664,8 @@ - + @@ -2670,6 +2694,328 @@ + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + @@ -2684,8 +3030,8 @@ - + @@ -2734,8 +3080,8 @@ - + @@ -2749,8 +3095,8 @@ - + @@ -2764,8 +3110,8 @@ - + @@ -2807,8 +3153,8 @@ - + @@ -2860,8 +3206,8 @@ - + @@ -2875,8 +3221,8 @@ - + @@ -2895,20 +3241,20 @@ - + - - 2 + + - + @@ -2925,8 +3271,8 @@ + - @@ -2942,20 +3288,20 @@ - + - - 2 + + - + @@ -2972,8 +3318,8 @@ + - @@ -2989,20 +3335,20 @@ - + - - 2 + + - + @@ -3019,8 +3365,8 @@ + - @@ -3036,20 +3382,20 @@ - + - - 2 + + - + @@ -3066,8 +3412,8 @@ + - @@ -3083,20 +3429,20 @@ - + - - 2 + + - + @@ -3113,8 +3459,8 @@ + - @@ -3130,20 +3476,20 @@ - + - - 2 + + - + @@ -3160,8 +3506,8 @@ + - @@ -3177,20 +3523,20 @@ - + - - 2 + + - + @@ -3207,8 +3553,8 @@ + - @@ -3224,6 +3570,180 @@ + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + @@ -3270,8 +3790,8 @@ - + @@ -3356,46 +3876,6 @@ - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -3409,20 +3889,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -3436,19 +3902,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3462,19 +3915,6 @@ - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - @@ -3488,48 +3928,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -3542,19 +3940,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -3568,19 +3953,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -3589,21 +3961,8 @@ - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - + @@ -3621,19 +3980,6 @@ - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - @@ -3654,8 +4000,8 @@ - + @@ -3669,6 +4015,20 @@ + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + @@ -3822,22 +4182,8 @@ - - - - - - - - - - Models/Props/Bridges/SciFiBridge1Blue.mesh - - - - - + @@ -3877,240 +4223,6 @@ - - - - - - - - - - Models/Props/Flora/SpecialRoot.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall1.mesh - - - - - - - - - - - - Models/Props/Walls/MediumWall1.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - @@ -4120,100 +4232,12 @@ - + - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - @@ -4228,22 +4252,8 @@ - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - + @@ -4256,8 +4266,22 @@ - + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + @@ -4299,10 +4323,10 @@ + -15 - -15 4 @@ -4435,10 +4459,10 @@ + 15 - 15 @@ -4462,6 +4486,76 @@ + + + + + Schema/Entities/Player.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + @@ -4482,7 +4576,7 @@ 10 - + @@ -4493,7 +4587,7 @@ 10 - + @@ -4616,76 +4710,6 @@ - - - - - Schema/Entities/Player.xml - - - - - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index c93989d8..b7699132 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -107,6 +107,7 @@ Textures/HealthHUD3.png + false @@ -249,6 +250,7 @@ Textures/Core/UnitHexagon.png + false @@ -267,6 +269,7 @@ Textures/Core/UnitHexagon_Rotated.png + false @@ -283,6 +286,7 @@ Textures/Core/UnitHexagon.png + false @@ -301,6 +305,7 @@ Textures/Core/UnitHexagon_Rotated.png + false @@ -317,6 +322,7 @@ Textures/Core/UnitHexagon.png + false @@ -336,6 +342,7 @@ Textures/Core/UnitHexagon_Rotated.png + false @@ -352,6 +359,7 @@ Textures/Core/UnitHexagon.png + false @@ -370,6 +378,7 @@ Textures/Core/UnitHexagon_Rotated.png + false @@ -386,6 +395,7 @@ Textures/Core/UnitHexagon.png + false @@ -403,6 +413,7 @@ Textures/Core/UnitHexagon_Rotated.png + false diff --git a/src/Game/Systems/AbilityCooldownHUDSystem.cpp b/src/Game/Systems/AbilityCooldownHUDSystem.cpp index 7226019f..ccb12a97 100644 --- a/src/Game/Systems/AbilityCooldownHUDSystem.cpp +++ b/src/Game/Systems/AbilityCooldownHUDSystem.cpp @@ -18,6 +18,8 @@ void AbilityCooldownHUDSystem::Update(double dt) double maxAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownMaxTimer"]; double currentAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownTimer"]; + currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0; + if(cooldownTextEntity.Valid()) { if(cooldownTextEntity.HasComponent("Text")) { @@ -25,7 +27,6 @@ void AbilityCooldownHUDSystem::Update(double dt) } } if (entity.HasComponent("Fill")) { - currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0; entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD; } } diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp new file mode 100644 index 00000000..8fa4dd73 --- /dev/null +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -0,0 +1,6 @@ +#include "Game/Systems/ScoreScreenSystem.h" + +void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) +{ + //Logic here +} From 047a119e3f33e219af196b9900379dd7dd7e4858 Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 01:04:24 +0100 Subject: [PATCH 24/94] ScoreScreenSystem things --- include/Game/Systems/ScoreScreenSystem.h | 16 ++++++++++------ src/Game/Systems/ScoreScreenSystem.cpp | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h index 691aa791..b65d9465 100644 --- a/include/Game/Systems/ScoreScreenSystem.h +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -1,18 +1,22 @@ #ifndef ScoreScreenSystem_h__ #define ScoreScreenSystem_h__ -#include "../../Engine/Core/System.h" -#include "../../Engine/GLM.h" +#include "Core/System.h" +#include "Core/EPlayerDeath.h" +#include "Core/EPlayerSpawned.h" +#include "GLM.h" class ScoreScreenSystem : public PureSystem { public: - ScoreScreenSystem(SystemParams params) - : System(params) - , PureSystem("ScoreScreen") - { } + ScoreScreenSystem(SystemParams params); virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override; + + EventRelay m_EPlayerDeath; + void OnPlayerDeath(const Events::PlayerDeath& e); + EventRelay m_EPlayerSpawned; + void OnPlayerSpawn(const Events::PlayerSpawned& e); }; #endif \ No newline at end of file diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 8fa4dd73..37dccb20 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -1,6 +1,25 @@ #include "Game/Systems/ScoreScreenSystem.h" + +ScoreScreenSystem::ScoreScreenSystem(SystemParams params) + : System(params) + , PureSystem("ScoreScreen") +{ + EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &ScoreScreenSystem::OnPlayerDeath); + EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &ScoreScreenSystem::OnPlayerSpawn); +} + void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) { //Logic here } + +void ScoreScreenSystem::OnPlayerDeath(const Events::PlayerDeath& e) +{ + //When player die, add it to his score, and when possible the player who killed him. +} + +void ScoreScreenSystem::OnPlayerSpawn(const Events::PlayerSpawned& e) +{ + //When a player spawn, add a new entry to the score screen. +} From 13546aa3fc3e24a0744f12e89aa1e2191f13a334 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Tue, 1 Mar 2016 22:37:19 +0100 Subject: [PATCH 25/94] DefenderWeapon and SidearmWeapon --- .../Systems/Weapon/DefenderWeaponBehaviour.h | 12 +-- .../Systems/Weapon/SidearmWeaponBehaviour.h | 3 +- include/Game/Systems/Weapon/WeaponBehaviour.h | 57 +++++++++-- .../Schema/Components/DefenderWeapon.xml | 6 +- .../Schema/Components/DefenderWeapon.xsd | 6 +- resources/Schema/Components/SidearmWeapon.xml | 4 +- resources/Schema/Components/SidearmWeapon.xsd | 6 +- resources/Schema/Entities/Player.xml | 14 +-- resources/Schema/Entities/Ray2Red | 18 ++++ resources/Schema/Entities/Ray2Red.xml | 43 ++++++++ .../Schema/Entities/SidearmWeaponView.xml | 63 +++++++++++- src/Engine/Editor/EditorGUI.cpp | 52 ++++++++-- .../Weapon/DefenderWeaponBehaviour.cpp | 98 ++++++++++++++----- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 23 ++++- 14 files changed, 340 insertions(+), 65 deletions(-) create mode 100644 resources/Schema/Entities/Ray2Red create mode 100644 resources/Schema/Entities/Ray2Red.xml diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index 986d8586..c1e132b1 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -1,7 +1,6 @@ #include "WeaponBehaviour.h" #include "Collision/Collision.h" #include "Core/EPlayerDamage.h" -#include "Rendering/ESetCamera.h" class DefenderWeaponBehaviour : public WeaponBehaviour { @@ -10,29 +9,24 @@ public: : System(systemParams) , WeaponBehaviour(systemParams, "DefenderWeapon", renderer, collisionOctree) , m_RandomEngine(m_RandomDevice()) - { - EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &DefenderWeaponBehaviour::OnSetCamera); - } + { } void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override; void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) override; void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) override; bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) override; private: std::random_device m_RandomDevice; std::mt19937 m_RandomEngine; - EntityWrapper m_CurrentCamera; - - EventRelay m_ESetCamera; - bool OnSetCamera(const Events::SetCamera& e); // Weapon functions void fireShell(ComponentWrapper cWeapon, WeaponInfo& wi); void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage); + bool canFire(ComponentWrapper cWeapon, WeaponInfo& wi); // Utility - float traceRayDistance(glm::vec3 origin, glm::vec3 direction); Camera cameraFromEntity(EntityWrapper camera); }; \ No newline at end of file diff --git a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h index 787c3c61..d221b8bb 100644 --- a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h @@ -15,12 +15,12 @@ public: void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) override; void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) override; private: std::random_device m_RandomDevice; std::mt19937 m_RandomEngine; - EntityWrapper m_CurrentCamera; // Weapon functions void fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi); @@ -28,5 +28,6 @@ private: // Utility bool canFire(ComponentWrapper cWeapon); + bool playerInFirstPerson(EntityWrapper player); //float traceRayDistance(glm::vec3 origin, glm::vec3 direction); }; \ No newline at end of file diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index 2ab53e0e..e0783bd2 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -7,6 +7,7 @@ #include "Collision/EntityAABB.h" #include "Input/EInputCommand.h" #include "Systems/SpawnerSystem.h" +#include "Rendering/ESetCamera.h" template class WeaponBehaviour : public PureSystem @@ -21,6 +22,7 @@ public: , m_CollisionOctree(collisionOctree) { EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &WeaponBehaviour::_OnInputCommand) + EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &WeaponBehaviour::_OnSetCamera) } virtual ~WeaponBehaviour() = default; @@ -44,6 +46,7 @@ protected: }; IRenderer* m_Renderer; + EntityWrapper m_CurrentCamera; Octree* m_CollisionOctree; std::unordered_map m_ActiveWeapons; @@ -51,10 +54,49 @@ protected: virtual void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { } virtual void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { } virtual void OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) { } + virtual void OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) { } virtual void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) { } virtual bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) { return false; } + bool isPlayerInFirstPerson(EntityWrapper player) + { + if (!m_CurrentCamera.Valid()) { + return false; + } else { + return m_CurrentCamera == player || m_CurrentCamera.IsChildOf(player); + } + } + + // Returns wi.FirstPersonEntity or wi.ThirdPersonEntity depending on + // if the player is in first person mode or not. + EntityWrapper getRelevantWeaponModelEntity(WeaponInfo& wi) + { + if (isPlayerInFirstPerson(wi.Player)) { + return wi.FirstPersonEntity; + } else { + return wi.ThirdPersonEntity; + } + } + + float traceRayDistance(glm::vec3 origin, glm::vec3 direction) + { + float distance; + glm::vec3 pos; + auto entity = Collision::EntityFirstHitByRay(Ray(origin, direction), m_CollisionOctree, distance, pos); + if (entity) { + return distance; + } else { + return 100.f; + } + } + private: + EventRelay m_ESetCamera; + bool _OnSetCamera(const Events::SetCamera& e) + { + m_CurrentCamera = e.CameraEntity; + return true; + } EventRelay m_EInputCommand; bool _OnInputCommand(const Events::InputCommand& e) { @@ -78,7 +120,7 @@ private: if (e.Command == "SelectWeapon") { if (e.Value > 0) { if (static_cast(e.Value) == static_cast((*cWeapon)["Slot"])) { - selectWeapon(player); + selectWeapon(*cWeapon, player); } else { holsterWeapon(*cWeapon, player); } @@ -132,7 +174,7 @@ private: return activeWeapon; } - void selectWeapon(EntityWrapper player) + void selectWeapon(ComponentWrapper cWeapon, EntityWrapper player) { // Don't reselect weapon if it's already active if (getActiveWeapon(player)) { @@ -170,10 +212,13 @@ private: thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment); } - m_ActiveWeapons[player].Player = player; - m_ActiveWeapons[player].WeaponEntity = player; - m_ActiveWeapons[player].FirstPersonEntity = firstPersonWeapon; - m_ActiveWeapons[player].ThirdPersonEntity = thirdPersonWeapon; + WeaponInfo& wi = m_ActiveWeapons[player]; + wi.Player = player; + wi.WeaponEntity = player; + wi.FirstPersonEntity = firstPersonWeapon; + wi.ThirdPersonEntity = thirdPersonWeapon; + + OnEquip(cWeapon, wi); } void holsterWeapon(ComponentWrapper cWeapon, EntityWrapper player) diff --git a/resources/Schema/Components/DefenderWeapon.xml b/resources/Schema/Components/DefenderWeapon.xml index 998f3bde..1b336fc4 100755 --- a/resources/Schema/Components/DefenderWeapon.xml +++ b/resources/Schema/Components/DefenderWeapon.xml @@ -11,6 +11,8 @@ 0.01 0.5 - false - 0 + false + 0 + false + 0 \ No newline at end of file diff --git a/resources/Schema/Components/DefenderWeapon.xsd b/resources/Schema/Components/DefenderWeapon.xsd index 0ec61964..c1b98e2f 100755 --- a/resources/Schema/Components/DefenderWeapon.xsd +++ b/resources/Schema/Components/DefenderWeapon.xsd @@ -48,8 +48,10 @@ Time it takes to load ONE SHELL into the weapon in seconds - - + + + + diff --git a/resources/Schema/Components/SidearmWeapon.xml b/resources/Schema/Components/SidearmWeapon.xml index b63706b6..1d503ecc 100644 --- a/resources/Schema/Components/SidearmWeapon.xml +++ b/resources/Schema/Components/SidearmWeapon.xml @@ -3,9 +3,11 @@ 16 16 20 - 120 + 500 + false 0.01 0.5 + 0.5 false 0 diff --git a/resources/Schema/Components/SidearmWeapon.xsd b/resources/Schema/Components/SidearmWeapon.xsd index 844b449f..bafb9de2 100644 --- a/resources/Schema/Components/SidearmWeapon.xsd +++ b/resources/Schema/Components/SidearmWeapon.xsd @@ -23,7 +23,7 @@ Ammo currently loaded into the magazine - Max number of rounds in a magazine + Max number of rounds in a magazine Damage dealt if all shotgun pellets hit @@ -31,12 +31,16 @@ Rate of fire in rounds per minute + View punch in radians for each shell fired Time it takes to load ONE SHELL into the weapon in seconds + + Time it takes from selecting the weapon until it's ready to fire + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 394f4622..5c5efc07 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -8,7 +8,7 @@ - 52.867678870419283 + 102.85760837900634 @@ -454,7 +454,7 @@ Idle - 0.022133545026491674 + 1.8348644854054612 1 @@ -478,8 +478,8 @@ Schema/Entities/DefenderWeaponView.xml - - + + @@ -497,8 +497,8 @@ Schema/Entities/SidearmWeaponView.xml - - + + @@ -528,7 +528,7 @@ Idle - 0.13373697879978863 + 0.013134522267137072 1 diff --git a/resources/Schema/Entities/Ray2Red b/resources/Schema/Entities/Ray2Red new file mode 100644 index 00000000..813443b2 --- /dev/null +++ b/resources/Schema/Entities/Ray2Red @@ -0,0 +1,18 @@ + + + + + + Textures/Effects/Ray.png + + + + + + + + + + + + diff --git a/resources/Schema/Entities/Ray2Red.xml b/resources/Schema/Entities/Ray2Red.xml new file mode 100644 index 00000000..6c7c3248 --- /dev/null +++ b/resources/Schema/Entities/Ray2Red.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + Textures/Effects/Ray.png + + + + + + + + + + + + + + + Textures/Effects/Ray.png + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/SidearmWeaponView.xml b/resources/Schema/Entities/SidearmWeaponView.xml index 68d29676..f01ffdf7 100644 --- a/resources/Schema/Entities/SidearmWeaponView.xml +++ b/resources/Schema/Entities/SidearmWeaponView.xml @@ -14,7 +14,7 @@ - Schema/Entities/RayBlue.xml + Schema/Entities/Ray2Red.xml @@ -22,6 +22,67 @@ + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + 16 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + 8 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + diff --git a/src/Engine/Editor/EditorGUI.cpp b/src/Engine/Editor/EditorGUI.cpp index a1ceafd0..4e7c8ab6 100644 --- a/src/Engine/Editor/EditorGUI.cpp +++ b/src/Engine/Editor/EditorGUI.cpp @@ -390,14 +390,52 @@ bool EditorGUI::drawComponentField_Vector(ComponentWrapper &c, const ComponentIn // Limit scale values to a minimum of 0 return ImGui::DragFloat3("", glm::value_ptr(val), 0.1f, 0.f, std::numeric_limits::max()); } else if (field.Name == "Orientation") { - // Make orentations have a period of 2*Pi - glm::vec3 tempVal = glm::fmod(val, glm::vec3(glm::two_pi())); - if (ImGui::SliderFloat3("", glm::value_ptr(tempVal), 0.f, glm::two_pi())) { - val = tempVal; - return true; - } else { - return false; + //glm::vec3 tempVal = val; + glm::vec3 originalVal = val; + + ImVec2 cursorPos = ImGui::GetCursorScreenPos(); + glm::tvec3 isSnapping(false, false, false); + bool changed = ImGui::DragFloat3("", glm::value_ptr(val), 0.066666f); + if (changed) { + // Make orentations have a period of 2*Pi + val = glm::fmod(val, glm::vec3(glm::two_pi())); + for (int i = 0; i < 3; i++) { + if (val[i] < 0) { + val[i] += glm::two_pi(); + } + } } + + // Snap to angle + //float snapRange = glm::pi() / 15.f; + //float snapAngle = glm::quarter_pi(); + //glm::vec3 snap = glm::fmod(val, glm::vec3(snapAngle)); + //for (int i = 0; i < 3; i++) { + // isSnapping[i] = glm::abs(snap[i] - (snapRange / 2.f)) < snapRange; + //} + //if (changed && ImGui::IsMouseDown(0)) { + // glm::vec3 change = val - originalVal; + // for (int i = 0; i < 3; i++) { + // if (isSnapping[i] && glm::abs(change[i]) < snapRange) { + // val[i] -= snap[i] - snapRange; + // } + // } + //} + + // Draw snapping outline + float width = ImGui::CalcItemWidth() / 3.f;; + float spacing = GImGui->Style.ItemInnerSpacing.x; + for (int i = 0; i < 3; i++) { + if (isSnapping[i]) { + ImVec2 pos = cursorPos + ImVec2(i * (width + spacing), 0.f); + ImRect bb(pos - ImVec2(1, 1), pos + ImVec2(width, 17)); + auto window = ImGui::GetCurrentWindow(); + const ImU32 col = window->Color(ImGuiCol_HeaderActive); + window->DrawList->AddRect(bb.Min, bb.Max, col, 3.f); + } + } + + return changed; } else { return ImGui::DragFloat3("", glm::value_ptr(val), 0.1f, std::numeric_limits::lowest(), std::numeric_limits::max()); } diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 0a179b4c..4c0f9673 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -2,33 +2,73 @@ void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) { - (double&)cWeapon["TimeSinceLastFire"] += dt; + double& fireCooldown = cWeapon["FireCooldown"]; + fireCooldown = glm::max(0.0, fireCooldown - dt); + WeaponBehaviour::UpdateComponent(entity, cWeapon, dt); } void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { - bool isFiring = cWeapon["IsFiring"]; - bool cooldownPassed = (double)cWeapon["TimeSinceLastFire"] >= (60.0 / (double)cWeapon["RPM"]); - bool isNotShielding = wi.Player.ChildrenWithComponent("Shield").size() == 0; - if (isFiring && cooldownPassed && isNotShielding) { + double& reloadTimer = cWeapon["ReloadTimer"]; + reloadTimer = glm::max(0.0, reloadTimer - dt); + + double reloadTime = cWeapon["ReloadTime"]; + bool& isReloading = cWeapon["IsReloading"]; + if (isReloading && reloadTimer <= 0.0) { + int& magAmmo = cWeapon["MagazineAmmo"]; + int& magSize = cWeapon["MagazineSize"]; + int& ammo = cWeapon["Ammo"]; + if (magAmmo < magSize && ammo > 0) { + ammo -= 1; + magAmmo += 1; + reloadTimer = reloadTime; + } else { + isReloading = false; + } + } + + if (canFire(cWeapon, wi)) { fireShell(cWeapon, wi); } } void DefenderWeaponBehaviour::OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { - cWeapon["IsFiring"] = true; - bool cooldownPassed = (double)cWeapon["TimeSinceLastFire"] >= (60.0 / (double)cWeapon["RPM"]); - bool isNotShielding = wi.Player.ChildrenWithComponent("Shield").size() == 0; - if (cooldownPassed && isNotShielding) { + cWeapon["TriggerHeld"] = true; + if (canFire(cWeapon, wi)) { fireShell(cWeapon, wi); } } void DefenderWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { - cWeapon["IsFiring"] = false; + cWeapon["TriggerHeld"] = false; +} + +void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + bool& isReloading = cWeapon["IsReloading"]; + if (isReloading) { + return; + } + + int& magAmmo = cWeapon["MagazineAmmo"]; + int& magSize = cWeapon["MagazineSize"]; + if (magAmmo >= magSize) { + return; + } + int& ammo = cWeapon["Ammo"]; + if (ammo <= 0) { + return; + } + + double reloadTime = cWeapon["ReloadTime"]; + double& reloadTimer = cWeapon["ReloadTimer"]; + + // Start reload + isReloading = true; + reloadTimer = reloadTime; } bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) @@ -47,15 +87,23 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf return false; } -bool DefenderWeaponBehaviour::OnSetCamera(const Events::SetCamera& e) -{ - m_CurrentCamera = e.CameraEntity; - return true; -} - void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi) { - cWeapon["TimeSinceLastFire"] = 0.0; + cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"]; + + // Stop reloading + bool& isReloading = cWeapon["IsReloading"]; + isReloading = false; + + // Ammo + int& magAmmo = cWeapon["MagazineAmmo"]; + if (magAmmo <= 0) { + OnReload(cWeapon, wi); + return; + } else { + magAmmo -= 1; + } + int numPellets = cWeapon["NumPellets"]; float spreadAngle = cWeapon["SpreadAngle"]; std::uniform_real_distribution randomSpreadAngle(-spreadAngle, spreadAngle); @@ -92,7 +140,6 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi dealDamage(cWeapon, wi, direction, pelletDamage); } } - } void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage) @@ -154,16 +201,13 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w LOG_DEBUG("Damage: %f", damage); } -float DefenderWeaponBehaviour::traceRayDistance(glm::vec3 origin, glm::vec3 direction) +bool DefenderWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi) { - float distance; - glm::vec3 pos; - auto entity = Collision::EntityFirstHitByRay(Ray(origin, direction), m_CollisionOctree, distance, pos); - if (entity) { - return distance; - } else { - return 100.f; - } + bool triggerHeld = cWeapon["TriggerHeld"]; + bool cooldownPassed = (double)cWeapon["FireCooldown"] <= 0.0; + bool isNotShielding = wi.Player.ChildrenWithComponent("Shield").size() == 0; + // TODO: Ammo checks + return triggerHeld && cooldownPassed && isNotShielding; } Camera DefenderWeaponBehaviour::cameraFromEntity(EntityWrapper camera) diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index 8c3906af..9a3ed6ab 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -14,7 +14,7 @@ void SidearmWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWra void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { - if (canFire(cWeapon)) { + if ((bool)cWeapon["Automatic"] && canFire(cWeapon)) { fireBullet(cWeapon, wi); } } @@ -32,6 +32,11 @@ void SidearmWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapon cWeapon["TriggerHeld"] = false; } +void SidearmWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + cWeapon["FireCooldown"] = (double)cWeapon["EquipTime"]; +} + void SidearmWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) { // Make sure the trigger is released if weapon is holstered while firing @@ -46,7 +51,23 @@ void SidearmWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi) { + cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"]; + // Get weapon model based on current person + EntityWrapper weaponModelEntity = getRelevantWeaponModelEntity(wi); + if (!weaponModelEntity.Valid()) { + return; + } + + // Tracer + EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzle"); + if (tracerSpawner.Valid()) { + glm::vec3 origin = Transform::AbsolutePosition(tracerSpawner); + glm::vec3 direction = Transform::AbsoluteOrientation(tracerSpawner) * glm::vec3(0, 0, -1); + float distance = traceRayDistance(origin, direction); + EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner); + ((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f); + } } bool SidearmWeaponBehaviour::canFire(ComponentWrapper cWeapon) From 40c66f76ae6e69d843a63c39d90ca6aa23b2a31f Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 01:28:43 +0100 Subject: [PATCH 26/94] A component for tracking score for players. --- resources/Schema/Components.xsd | 1 + resources/Schema/Components/ScoreIdentity.xml | 3 +++ resources/Schema/Components/ScoreIdentity.xsd | 20 +++++++++++++++++++ resources/Schema/Types/Entity.xsd | 1 + 4 files changed, 25 insertions(+) create mode 100644 resources/Schema/Components/ScoreIdentity.xml create mode 100644 resources/Schema/Components/ScoreIdentity.xsd diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index d1572252..48f3ca04 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -60,4 +60,5 @@ + \ No newline at end of file diff --git a/resources/Schema/Components/ScoreIdentity.xml b/resources/Schema/Components/ScoreIdentity.xml new file mode 100644 index 00000000..95478277 --- /dev/null +++ b/resources/Schema/Components/ScoreIdentity.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/resources/Schema/Components/ScoreIdentity.xsd b/resources/Schema/Components/ScoreIdentity.xsd new file mode 100644 index 00000000..9ed69918 --- /dev/null +++ b/resources/Schema/Components/ScoreIdentity.xsd @@ -0,0 +1,20 @@ + + + + + A component tracking data for the score of a player. + + + The Kills per death score. + + + The amount of kills. + + + The amount of deaths. + + + Ping of a player. + + + \ No newline at end of file diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index 126276f6..9f364e11 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -63,6 +63,7 @@ + From 0e8b97dbbade6bb39c6f2b8af6c1cfc43ce67cde Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 01:35:32 +0100 Subject: [PATCH 27/94] Made AmmunitionHUD into TextFieldReader which reads any component field on a parent and updates a Text component with the value! --- include/Engine/Core/EntityWrapper.h | 1 + include/Game/Systems/AmmunitionHUDSystem.h | 17 ---- include/Game/Systems/TextFieldReader.h | 19 +++++ resources/Schema/Components.xsd | 2 +- resources/Schema/Components/AmmunitionHUD.xml | 3 - resources/Schema/Components/AmmunitionHUD.xsd | 10 --- .../Schema/Components/TextFieldReader.xml | 6 ++ .../Schema/Components/TextFieldReader.xsd | 21 +++++ .../Schema/Entities/DefenderWeaponView.xml | 15 +++- resources/Schema/Entities/Player.xml | 82 +++++++++---------- .../Schema/Entities/SidearmWeaponView.xml | 13 ++- resources/Schema/Types/Entity.xsd | 2 +- src/Engine/Core/EntityWrapper.cpp | 12 +++ src/Game/Game.cpp | 6 +- src/Game/Systems/AmmunitionHUDSystem.cpp | 36 -------- src/Game/Systems/TextFieldReader.cpp | 46 +++++++++++ 16 files changed, 174 insertions(+), 117 deletions(-) delete mode 100644 include/Game/Systems/AmmunitionHUDSystem.h create mode 100644 include/Game/Systems/TextFieldReader.h delete mode 100644 resources/Schema/Components/AmmunitionHUD.xml delete mode 100644 resources/Schema/Components/AmmunitionHUD.xsd create mode 100644 resources/Schema/Components/TextFieldReader.xml create mode 100644 resources/Schema/Components/TextFieldReader.xsd delete mode 100644 src/Game/Systems/AmmunitionHUDSystem.cpp create mode 100644 src/Game/Systems/TextFieldReader.cpp diff --git a/include/Engine/Core/EntityWrapper.h b/include/Engine/Core/EntityWrapper.h index 8ece8e59..12029720 100644 --- a/include/Engine/Core/EntityWrapper.h +++ b/include/Engine/Core/EntityWrapper.h @@ -27,6 +27,7 @@ struct EntityWrapper bool HasComponent(const std::string& componentType); void AttachComponent(const char* componentName); EntityWrapper Parent(); + EntityWrapper FirstParentByName(const std::string& parentEntityName); EntityWrapper FirstChildByName(const std::string& name); EntityWrapper FirstParentWithComponent(const std::string& componentType); EntityWrapper Clone(EntityWrapper parent = EntityWrapper::Invalid); diff --git a/include/Game/Systems/AmmunitionHUDSystem.h b/include/Game/Systems/AmmunitionHUDSystem.h deleted file mode 100644 index b22a85b5..00000000 --- a/include/Game/Systems/AmmunitionHUDSystem.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef AmmunitionHUDSystem_h__ -#define AmmunitionHUDSystem_h__ - -#include "../../Engine/Core/System.h" -#include "../../Engine/GLM.h" - -class AmmunitionHUDSystem : public ImpureSystem -{ -public: - AmmunitionHUDSystem(SystemParams params) - : System(params) - { } - - virtual void Update(double dt) override; -}; - -#endif \ No newline at end of file diff --git a/include/Game/Systems/TextFieldReader.h b/include/Game/Systems/TextFieldReader.h new file mode 100644 index 00000000..1ea8e966 --- /dev/null +++ b/include/Game/Systems/TextFieldReader.h @@ -0,0 +1,19 @@ +#ifndef AmmunitionHUDSystem_h__ +#define AmmunitionHUDSystem_h__ + +#include +#include "../../Engine/Core/System.h" +#include "../../Engine/GLM.h" + +class TextFieldReader : public PureSystem +{ +public: + TextFieldReader(SystemParams params) + : System(params) + , PureSystem("TextFieldReader") + { } + + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cTextFieldReader, double dt) override; +}; + +#endif \ No newline at end of file diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index 711f4999..ee8bc31d 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -45,7 +45,7 @@ - + diff --git a/resources/Schema/Components/AmmunitionHUD.xml b/resources/Schema/Components/AmmunitionHUD.xml deleted file mode 100644 index 63b86150..00000000 --- a/resources/Schema/Components/AmmunitionHUD.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/resources/Schema/Components/AmmunitionHUD.xsd b/resources/Schema/Components/AmmunitionHUD.xsd deleted file mode 100644 index 1a48d8d1..00000000 --- a/resources/Schema/Components/AmmunitionHUD.xsd +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - Hud element for tracking ammunition from parent with AssaultWeapon component. Child with the name "MagazineAmmo" tracks clip ammunition. Child with the name "Ammo" tracks ammo. - - - \ No newline at end of file diff --git a/resources/Schema/Components/TextFieldReader.xml b/resources/Schema/Components/TextFieldReader.xml new file mode 100644 index 00000000..52430804 --- /dev/null +++ b/resources/Schema/Components/TextFieldReader.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/resources/Schema/Components/TextFieldReader.xsd b/resources/Schema/Components/TextFieldReader.xsd new file mode 100644 index 00000000..7c77890d --- /dev/null +++ b/resources/Schema/Components/TextFieldReader.xsd @@ -0,0 +1,21 @@ + + + + + + Reads a value from a specific field of a compoent of parent entity and writes it to the Text component on this entity. + + + + The name of the parent entity to read the component field from. Leave empty to read from this entity. + + + The component type to read the field value from. + + + The field name to read the value from. + + + + + \ No newline at end of file diff --git a/resources/Schema/Entities/DefenderWeaponView.xml b/resources/Schema/Entities/DefenderWeaponView.xml index b65194f9..0886ac67 100755 --- a/resources/Schema/Entities/DefenderWeaponView.xml +++ b/resources/Schema/Entities/DefenderWeaponView.xml @@ -33,7 +33,6 @@ - @@ -61,8 +60,13 @@ + + Player + DefenderWeapon + MagazineAmmo + - 32 + 0 Fonts/DroidSans.ttf,64 @@ -74,8 +78,13 @@ + + Player + DefenderWeapon + Ammo + - 360 + 0 Fonts/DroidSans.ttf,64 diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 5c5efc07..e0230582 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -7,9 +7,7 @@ - - 102.85760837900634 - + @@ -26,7 +24,7 @@ - + @@ -66,8 +64,8 @@ Textures/Weapons/Crosshair/SmallThickHoleDot.png - false + false @@ -90,42 +88,22 @@ - - - - 1 - - - - 100/100 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - 1 + Textures/HealthHUD3.png - - + @@ -142,8 +120,8 @@ Textures/Core/White.png - false + false @@ -160,8 +138,8 @@ Textures/Core/White.png - false + false @@ -178,8 +156,8 @@ Textures/Core/White.png - false + false @@ -193,6 +171,26 @@ + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + @@ -229,8 +227,8 @@ - + @@ -263,8 +261,8 @@ - + @@ -298,8 +296,8 @@ - + @@ -332,8 +330,8 @@ - + @@ -365,8 +363,8 @@ - + @@ -442,8 +440,8 @@ - + @@ -490,9 +488,8 @@ R_Arm_Weapon_Joint - AssaultWeapon - SidearmWeapon + Schema/Entities/SidearmWeaponView.xml @@ -575,7 +572,10 @@ Schema/Entities/SidearmWeaponWorld.xml - + + + + @@ -617,8 +617,8 @@ - + @@ -627,8 +627,8 @@ Textures/Icons/Arrow.png - false + false diff --git a/resources/Schema/Entities/SidearmWeaponView.xml b/resources/Schema/Entities/SidearmWeaponView.xml index f01ffdf7..d3dcda66 100644 --- a/resources/Schema/Entities/SidearmWeaponView.xml +++ b/resources/Schema/Entities/SidearmWeaponView.xml @@ -24,7 +24,11 @@ - + + + + + @@ -52,6 +56,11 @@ + + Player + SidearmWeapon + MagazineAmmo + 16 Fonts/DroidSans.ttf,64 @@ -73,8 +82,8 @@ - + diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index f9870a51..b4ceb6d2 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -43,7 +43,7 @@ - + diff --git a/src/Engine/Core/EntityWrapper.cpp b/src/Engine/Core/EntityWrapper.cpp index b3bef55a..3c217353 100644 --- a/src/Engine/Core/EntityWrapper.cpp +++ b/src/Engine/Core/EntityWrapper.cpp @@ -34,6 +34,18 @@ EntityWrapper EntityWrapper::Parent() } } +EntityWrapper EntityWrapper::FirstParentByName(const std::string& parentEntityName) +{ + EntityWrapper entity = *this; + while (entity.Parent().Valid()) { + entity = entity.Parent(); + if (entity.Name() == parentEntityName) { + return entity; + } + } + return EntityWrapper::Invalid; +} + EntityWrapper EntityWrapper::FirstChildByName(const std::string& name) { return firstChildByNameRecursive(name, this->ID); diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 7607efec..10107ab1 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -27,7 +27,7 @@ #include "../Engine/Core/UniformScaleSystem.h" #include "Rendering/AnimationSystem.h" #include "Network/MultiplayerSnapshotFilter.h" -#include "Game/Systems/AmmunitionHUDSystem.h" +#include "Game/Systems/TextFieldReader.h" #include "Game/Systems/CapturePointArrowHUDSystem.h" #include "Game/Systems/KillFeedSystem.h" #include "Game/Systems/BoostSystem.h" @@ -136,7 +136,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); + m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); @@ -145,7 +145,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); + m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); diff --git a/src/Game/Systems/AmmunitionHUDSystem.cpp b/src/Game/Systems/AmmunitionHUDSystem.cpp deleted file mode 100644 index c9d87072..00000000 --- a/src/Game/Systems/AmmunitionHUDSystem.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "Game/Systems/AmmunitionHUDSystem.h" - -void AmmunitionHUDSystem::Update(double dt) -{ - //Hud element for tracking ammunition from parent with AssaultWeapon component.Child with the name "MagazineAmmo" tracks clip ammunition.Child with the name "Ammo" tracks ammo. - - auto ammunitionHUDs = m_World->GetComponents("AmmunitionHUD"); - if (ammunitionHUDs == nullptr) { - return; - } - - for (auto& ammunitionHUDComponent : *ammunitionHUDs) { - EntityWrapper entity = EntityWrapper(m_World, ammunitionHUDComponent.EntityID); - - EntityWrapper playerEntity = entity.FirstParentWithComponent("AssaultWeapon"); - - if (!playerEntity.Valid()) { - return; - } - - - EntityWrapper magazineAmmo = entity.FirstChildByName("MagazineAmmo"); - if(magazineAmmo.Valid()) { - if(magazineAmmo.HasComponent("Text")) { - (std::string&)magazineAmmo["Text"]["Content"] = std::to_string((int)playerEntity["AssaultWeapon"]["MagazineAmmo"]); - } - } - - EntityWrapper ammo = entity.FirstChildByName("Ammo"); - if (ammo.Valid()) { - if (ammo.HasComponent("Text")) { - (std::string&)ammo["Text"]["Content"] = std::to_string((int)playerEntity["AssaultWeapon"]["Ammo"]); - } - } - } -} diff --git a/src/Game/Systems/TextFieldReader.cpp b/src/Game/Systems/TextFieldReader.cpp new file mode 100644 index 00000000..8712a61f --- /dev/null +++ b/src/Game/Systems/TextFieldReader.cpp @@ -0,0 +1,46 @@ +#include "Game/Systems/TextFieldReader.h" + +void TextFieldReader::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cAmmunitionHUD, double dt) +{ + if (!entity.HasComponent("Text")) { + return; + } + + // Find the entity to read from + const std::string& parentEntityName = cAmmunitionHUD["ParentEntityName"]; + EntityWrapper readEntity = entity; + if (!parentEntityName.empty()) { + readEntity = entity.FirstParentByName(parentEntityName); + if (!readEntity.Valid()) { + return; + } + } + + // Find the component to read from + const std::string& componentType = cAmmunitionHUD["ComponentType"]; + if (componentType.empty() || !readEntity.HasComponent(componentType)) { + return; + } + ComponentWrapper component = readEntity[componentType]; + + // Find the field to read from + const std::string& fieldName = cAmmunitionHUD["Field"]; + if (fieldName.empty() || component.Info.Fields.count(fieldName) == 0) { + return; + } + const ComponentInfo::Field_t& field = component.Info.Fields.at(fieldName); + + std::string& text = entity["Text"]["Content"]; + + if (field.Type == "int") { + text = boost::lexical_cast((const int&)component[fieldName]); + } else if (field.Type == "float") { + text = boost::lexical_cast((const float&)component[fieldName]); + } else if (field.Type == "double") { + text = boost::lexical_cast((const double&)component[fieldName]); + } else if (field.Type == "bool") { + text = boost::lexical_cast((const bool&)component[fieldName]); + } else if (field.Type == "string") { + text = (const std::string&)component[fieldName]; + } +} From 362378536e9438b5c311dfddf31e24b6ecca5dbc Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 3 Mar 2016 01:39:12 +0100 Subject: [PATCH 28/94] Switching rooms --- include/Engine/Rendering/AnimationSystem.h | 3 + include/Engine/Rendering/AutoBlendQueue.h | 27 + include/Engine/Rendering/BlendTree.h | 3 + .../Engine/Rendering/EAutoAnimationBlend.h | 7 +- resources/Schema/Entities/AnimationTests2.xml | 1040 ++++++----------- resources/Schema/Entities/BlendTreeTest.xml | 557 +++++++++ resources/Schema/Entities/ble | 145 +++ src/Engine/Rendering/AnimationSystem.cpp | 294 ++++- src/Engine/Rendering/AutoBlendQueue.cpp | 0 src/Engine/Rendering/BlendTree.cpp | 15 + 10 files changed, 1375 insertions(+), 716 deletions(-) create mode 100644 include/Engine/Rendering/AutoBlendQueue.h create mode 100644 resources/Schema/Entities/BlendTreeTest.xml create mode 100644 resources/Schema/Entities/ble create mode 100644 src/Engine/Rendering/AutoBlendQueue.cpp diff --git a/include/Engine/Rendering/AnimationSystem.h b/include/Engine/Rendering/AnimationSystem.h index 1ea076fd..fd53022f 100644 --- a/include/Engine/Rendering/AnimationSystem.h +++ b/include/Engine/Rendering/AnimationSystem.h @@ -57,10 +57,13 @@ private: EntityWrapper RootNode = EntityWrapper::Invalid; double Duration; double CurrentTime = 0.0; + double Delay = 0.0; BlendTree::AutoBlendInfo BlendInfo; }; + std::list m_AutoBlendJobs; + std::unordered_map m_QueuedAutoBlendJobs; std::list m_BlendJobs; std::list m_QueuedBlendJobs; diff --git a/include/Engine/Rendering/AutoBlendQueue.h b/include/Engine/Rendering/AutoBlendQueue.h new file mode 100644 index 00000000..12dd249e --- /dev/null +++ b/include/Engine/Rendering/AutoBlendQueue.h @@ -0,0 +1,27 @@ +#ifndef AutoBlendQueue_h__ +#define AutoBlendQueue_h__ + +#include "../Core/ResourceManager.h" +#include "Skeleton.h" +#include "Model.h" +#include "BlendTree.h" + +class AutoBlendQueue +{ +public: + struct AutoBlendJob + { + EntityWrapper RootNode = EntityWrapper::Invalid; + double Duration; + double CurrentTime = 0.0; + double Delay = 0.0; + BlendTree::AutoBlendInfo BlendInfo; + }; + +private: + std::map m_BlendQueue; + + +}; + +#endif diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index 29ad3ca9..5605707a 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -60,9 +60,12 @@ public: { std::string NodeName; double progress; + bool Restart; + double AnimationSpeed; std::unordered_map StartWeights; }; + BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton); ~BlendTree(); diff --git a/include/Engine/Rendering/EAutoAnimationBlend.h b/include/Engine/Rendering/EAutoAnimationBlend.h index b148664f..edd8e0bc 100644 --- a/include/Engine/Rendering/EAutoAnimationBlend.h +++ b/include/Engine/Rendering/EAutoAnimationBlend.h @@ -11,7 +11,12 @@ struct AutoAnimationBlend : Event { EntityWrapper RootNode = EntityWrapper::Invalid; std::string NodeName; - double Duration; + double Duration = 0.0; + double Delay = 0.0; + + + double AnimationSpeed = 1.0; + bool Restart = false; EntityWrapper AnimationEntity = EntityWrapper::Invalid; }; diff --git a/resources/Schema/Entities/AnimationTests2.xml b/resources/Schema/Entities/AnimationTests2.xml index aaa6de48..b5b46c85 100644 --- a/resources/Schema/Entities/AnimationTests2.xml +++ b/resources/Schema/Entities/AnimationTests2.xml @@ -3,7 +3,7 @@ - 0.40000000596046448 + 0.30000001192092896 3 @@ -21,7 +21,7 @@ - 0.80000001192092896 + 0 Models/Widgets/Lights/DirectionalLightWidget.mesh @@ -33,15 +33,15 @@ - + 8 - 0.20000000298023224 + 0.60000002384185791 - + @@ -49,12 +49,12 @@ - Aim + AimBlend FinalBlend 5 - Models/Characters/Defender/DefenderRed.mesh + Models/Characters/Assault/AssaultBlue.mesh @@ -66,110 +66,65 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - - + - + - + - - 3 - - - - - - - - - - - AimRifleA - - false - true - + + AimPrimary + AimSecondary + 0 + - + + + + + AimRifleA + + false + true + + + + + + + + + AimSecWepA + + false + true + + + + + + - WeaponBlend + ReloadSwitchBlend MovementBlend - - - - ShootBlend - Reload - 0 - - - - - - - - ShootFast - ShootSlow - 1 - - - - - - - - ShootFastRifleU - - 1 - - - - - - - - - ShootRifleU - - 1 - - - - - - - - - - - ReloadSwitchU - - 1 - - - - - - - StandCrouchBlend - Jump + JumpDashBlend 0 @@ -185,100 +140,156 @@ - + - Walk - StrafeBlend - 1 + MovementBlend + Idle + 0 - + + + + RunWalkBlend + StrafeLRBlend + 0 + + + + + + + + Walk + Run + 1 + + + + + + + + WalkF + + + + + + + + + RunF + + 1 + + + + + + + + + + + Left + Right + 0 + + + + + + + + StrafeLeftF + + + + + + + + + StrafeRightF + + + + + + + + + + - CrouchWalkF - + IdleF + 1 - - - - Left - Right - 1 - - - - - - - - CrouchStrafeLeftF - - 1 - - - - - - - - - CrouchStrafeRightF - - 1 - - - - - - - - + - RunWalkBlend - StrafeBlend - 1 + MovementBlend + Idle - + - Run - Walk + Walk + StrafeLRBlend 0 - + - - RunF - - 1 - + + Left + Right + 0 + - + + + + + CrouchStrafeLeftF + + + + + + + + + CrouchStrafeRightF + + + + + + - WalkF - - 1 + CrouchWalkF @@ -286,33 +297,110 @@ - + + + + CrouchF + + 1 + + + + + + + + + + + + + Jump + DashBlend + 1 + + + + + + + + JumpF + + + + + + + + + + DashFBBlend + DashLRBlend + 0 + + + + + - Left - Right + DashForward + DashBackward 1 - + - StrafeLeftF - - 1 + DashForwardF + false - + - StrafeRightF - - 1 + DashBackwardF + + false + + + + + + + + + + + DashLeft + DashRight + 0 + + + + + + + + DashLeftF + + false + + + + + + + + + DashRightF + false @@ -324,543 +412,106 @@ - + + + + + + ReloadSwitch + WeaponActionBlend + 1 + + + + + - JumpF - + ReloadSwitchU + 1 + + + + IdleBlend + ShootBlend + 1 + + + + + + + + IdlePrimary + IdleSecondary + + + + + + + + IdleAssaultRifleU + + + + + + + + + IdleSecWepU + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + - - - - - - - - - - - R_Arm_Weapon_Joint - - - - Models/Core/UnitCube.mesh - - true - - - - - - - - - - - - - R_Hand - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - R_Arm - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - R_Shoulder - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - Neck - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - Spine_3 - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - Spine_2 - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - Spine_1 - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - Hip - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Leg_Top - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Leg_Bottom - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Foot - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Toe - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Shoulder - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Arm - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Hand - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Shoulder_Armor_Joint - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - Chin - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - Head - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - Perietal - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - L_Elbow - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - R_Leg_Bottom - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - R_Elbow - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - R_Leg_Top - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - R_Foot - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - R_Toe - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - R_Shoulder_Armor_Joint - - true - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - @@ -874,6 +525,31 @@ + + + + + 8 + 0.60000002384185791 + + + + + + + + + + + 8 + 0.80000001192092896 + + + + + + + diff --git a/resources/Schema/Entities/BlendTreeTest.xml b/resources/Schema/Entities/BlendTreeTest.xml new file mode 100644 index 00000000..3457fc5e --- /dev/null +++ b/resources/Schema/Entities/BlendTreeTest.xml @@ -0,0 +1,557 @@ + + + + + + 0.30000001192092896 + 3 + + + + + + + + + + + + + + + + + 0 + + + Models/Widgets/Lights/DirectionalLightWidget.mesh + + + + + + + + + + + + + 8 + 0.60000002384185791 + + + + + + + + + + + AimBlend + FinalBlend + + + 5 + Models/Characters/Assault/AssaultBlue.mesh + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + + + + + + + + AimRifleA + + false + true + + + + + + + + + AimSecWepA + + false + true + + + + + + + + + + + ReloadSwitchBlend + MovementBlend + + + + + + + + StandCrouchBlend + JumpDashBlend + 0 + + + + + + + + StandMovement + CrouchMovement + 0 + + + + + + + + MovementBlend + Idle + 0 + + + + + + + + RunWalkBlend + StrafeLRBlend + 0 + + + + + + + + Walk + Run + 1 + + + + + + + + WalkF + + + + + + + + + RunF + + 1 + + + + + + + + + + + Left + Right + 0 + + + + + + + + StrafeLeftF + + + + + + + + + StrafeRightF + + + + + + + + + + + + + IdleF + + 1 + + + + + + + + + + + MovementBlend + Idle + + + + + + + + Walk + StrafeLRBlend + 0 + + + + + + + + Left + Right + 0 + + + + + + + + CrouchStrafeLeftF + + + + + + + + + CrouchStrafeRightF + + + + + + + + + + + CrouchWalkF + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + + + Jump + DashBlend + 1 + + + + + + + + JumpF + + + + + + + + + + DashFBBlend + DashLRBlend + 0 + + + + + + + + DashForward + DashBackward + 1 + + + + + + + + DashForwardF + false + + + + + + + + + DashBackwardF + + false + + + + + + + + + + + DashLeft + DashRight + 0 + + + + + + + + DashLeftF + + false + + + + + + + + + DashRightF + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 1 + + + + + + + + IdlePrimary + IdleSecondary + + + + + + + + IdleAssaultRifleU + + + + + + + + + IdleSecWepU + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + + + + + + + + + + + 8 + 0.60000002384185791 + + + + + + + + + + + 8 + 0.80000001192092896 + + + + + + + + + + + + diff --git a/resources/Schema/Entities/ble b/resources/Schema/Entities/ble new file mode 100644 index 00000000..6518ee5b --- /dev/null +++ b/resources/Schema/Entities/ble @@ -0,0 +1,145 @@ + + + + + + 0.30000001192092896 + 3 + + + + + + + + + + + + + + + + + 0 + + + Models/Widgets/Lights/DirectionalLightWidget.mesh + + + + + + + + + + + + + 8 + 0.60000002384185791 + + + + + + + + + + + + + + + 5 + Models/Characters/Defender/DefenderBlue.mesh + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + AimPrimary + AimSecondary + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + + + + + + + + + + + 8 + 0.60000002384185791 + + + + + + + + + + + 8 + 0.80000001192092896 + + + + + + + + + + + + diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 11a21881..4e7f15f6 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -92,9 +92,30 @@ void AnimationSystem::UpdateAnimations(double dt) double animationSpeed = (double)animationC["Speed"]; if (animationSpeed != 0.0) { + double nextTime = (double)animationC["Time"] + animationSpeed * dt; + //Pre animation end blend + if (m_QueuedAutoBlendJobs.find(entity) != m_QueuedAutoBlendJobs.end()) { + if (glm::sign(m_QueuedAutoBlendJobs.at(entity).Delay) < 0) { + if (!(bool)animationC["Loop"]) { + if (nextTime > animation->Duration + m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) > 0) { + AnimationComplete(entity); + } else if (nextTime < 0 - m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) < 0) { + AnimationComplete(entity); + } + } else { + if (nextTime > animation->Duration + m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) > 0) { + AnimationComplete(entity); + } else if (nextTime < 0 - m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) < 0) { + AnimationComplete(entity); + } + } + } + } + + if (!(bool)animationC["Loop"]) { if (nextTime > animation->Duration) { nextTime = animation->Duration; @@ -119,6 +140,7 @@ void AnimationSystem::UpdateAnimations(double dt) e.Entity = entity; e.Name = (std::string)animationC["AnimationName"]; m_EventBroker->Publish(e); + AnimationComplete(entity); while (nextTime > animation->Duration) { nextTime -= animation->Duration; @@ -128,13 +150,12 @@ void AnimationSystem::UpdateAnimations(double dt) e.Entity = entity; e.Name = (std::string)animationC["AnimationName"]; m_EventBroker->Publish(e); - + AnimationComplete(entity); while (nextTime < 0) { nextTime += animation->Duration; } } } - (double&)animationC["Time"] = nextTime; } } @@ -143,7 +164,7 @@ void AnimationSystem::UpdateAnimations(double dt) void AnimationSystem::UpdateWeights(double dt) { - /* for (auto it = m_BlendJobs.begin(); it != m_BlendJobs.end(); it++) { + for (auto it = m_BlendJobs.begin(); it != m_BlendJobs.end();) { if (!it->BlendEntity.Valid()) { it = m_BlendJobs.erase(it); continue; @@ -161,7 +182,9 @@ void AnimationSystem::UpdateWeights(double dt) it = m_BlendJobs.erase(it); } } - }*/ + + ++it; + } for (auto it = m_AutoBlendJobs.begin(); it != m_AutoBlendJobs.end();) { @@ -214,7 +237,7 @@ void AnimationSystem::UpdateWeights(double dt) void AnimationSystem::AnimationComplete(EntityWrapper animationEntity) { - for (auto it = m_QueuedBlendJobs.begin(); it != m_QueuedBlendJobs.end(); it++) { + for (auto it = m_QueuedBlendJobs.begin(); it != m_QueuedBlendJobs.end();) { if (!it->BlendEntity.Valid() || !it->AnimationEntity.Valid()) { it = m_QueuedBlendJobs.erase(it); continue; @@ -229,10 +252,28 @@ void AnimationSystem::AnimationComplete(EntityWrapper animationEntity) bj.CurrentTime = 0.0; m_BlendJobs.push_back(bj); it = m_QueuedBlendJobs.erase(it); + continue; } + ++it; } + + if (m_QueuedAutoBlendJobs.find(animationEntity) != m_QueuedAutoBlendJobs.end()) { + AutoBlendJob abj = m_QueuedAutoBlendJobs.at(animationEntity); + + if (!abj.RootNode.Valid() || !animationEntity.Valid()) { + m_QueuedAutoBlendJobs.erase(animationEntity); + } else { + m_AutoBlendJobs.push_back(abj); + m_QueuedAutoBlendJobs.erase(animationEntity); + } + + + + } + + } bool AnimationSystem::OnAnimationBlend(Events::AnimationBlend& e) @@ -256,17 +297,16 @@ bool AnimationSystem::OnAnimationBlend(Events::AnimationBlend& e) m_QueuedBlendJobs.push_back(qbj); return true; } + } else { + BlendJob bj; + bj.BlendEntity = e.BlendEntity; + bj.StartWeight = (double)e.BlendEntity["Blend"]["Weight"]; + bj.GoalWeight = e.GoalWeight; + bj.Duration = e.Duration; + bj.CurrentTime = 0.0; + m_BlendJobs.push_back(bj); + return true; } - - BlendJob bj; - bj.BlendEntity = e.BlendEntity; - bj.StartWeight = (double)e.BlendEntity["Blend"]["Weight"]; - bj.GoalWeight = e.GoalWeight; - bj.Duration = e.Duration; - bj.CurrentTime = 0.0; - m_BlendJobs.push_back(bj); - - return true; } @@ -280,18 +320,39 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) return false; } - AutoBlendJob abj; - abj.RootNode = e.RootNode; - abj.CurrentTime = 0.0; - abj.Duration = e.Duration; + if (e.AnimationEntity.Valid()) { + AutoBlendJob abj; + abj.RootNode = e.RootNode; + abj.CurrentTime = 0.0; + abj.Duration = e.Duration; + abj.Delay = e.Delay; - BlendTree::AutoBlendInfo abInfo; - abInfo.NodeName = e.NodeName; - abInfo.progress = 0.0; - - abj.BlendInfo = abInfo; + BlendTree::AutoBlendInfo abInfo; + abInfo.NodeName = e.NodeName; + abInfo.progress = 0.0; + abInfo.Restart = e.Restart; + abInfo.AnimationSpeed = e.AnimationSpeed; + abj.BlendInfo = abInfo; - m_AutoBlendJobs.push_back(abj); + m_QueuedAutoBlendJobs[e.AnimationEntity] = abj; + return true; + } else { + AutoBlendJob abj; + abj.RootNode = e.RootNode; + abj.CurrentTime = 0.0; + abj.Duration = e.Duration; + + BlendTree::AutoBlendInfo abInfo; + abInfo.NodeName = e.NodeName; + abInfo.progress = 0.0; + abInfo.Restart = e.Restart; + abInfo.AnimationSpeed = e.AnimationSpeed; + + abj.BlendInfo = abInfo; + + m_AutoBlendJobs.push_back(abj); + return true; + } } @@ -301,8 +362,6 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) if (e.Value == 1.f) { if (e.Command == "BlendTest0") { - - auto blendComponents = m_World->GetComponents("BlendAdditive"); if (blendComponents == nullptr) { @@ -314,11 +373,12 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); if (entity.Name() == "Assault") { - Events::AutoAnimationBlend aeb; aeb.Duration = m_BlendTime1; aeb.NodeName = m_AnimationName1; aeb.RootNode = entity; + aeb.Restart = true; + m_EventBroker->Publish(aeb); } @@ -338,15 +398,183 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) if (entity.Name() == "Assault") { - Events::AutoAnimationBlend aeb; - aeb.Duration = m_BlendTime2; - aeb.NodeName = m_AnimationName2; - aeb.RootNode = entity; - m_EventBroker->Publish(aeb); + { + Events::AutoAnimationBlend aeb; + aeb.Duration = m_BlendTime2; + aeb.NodeName = m_AnimationName2; + aeb.RootNode = entity; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + + { + Events::AutoAnimationBlend aeb; + aeb.Duration = m_BlendTime2; + aeb.NodeName = "Run"; + aeb.RootNode = entity; + aeb.Restart = true; + aeb.AnimationEntity = entity.FirstChildByName("DashLeft"); + m_EventBroker->Publish(aeb); + } } } } + + + if(e.Command == "DashForward") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "DashForward"; + aeb.RootNode = entity; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "Run"; + aeb.RootNode = entity; + aeb.Restart = true; + aeb.Delay = 0; + aeb.AnimationEntity = entity.FirstChildByName("DashForward"); + m_EventBroker->Publish(aeb); + } + } + } + + } else if (e.Command == "DashBackward") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "DashBackward"; + aeb.RootNode = entity; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "Run"; + aeb.RootNode = entity; + aeb.Restart = true; + aeb.Delay = -0.3; + aeb.AnimationEntity = entity.FirstChildByName("DashBackward"); + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Command == "DashLeft") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "DashLeft"; + aeb.RootNode = entity; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "Run"; + aeb.RootNode = entity; + aeb.Restart = true; + aeb.Delay = -0.3; + aeb.AnimationEntity = entity.FirstChildByName("DashLeft"); + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Command == "DashRight") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "DashRight"; + aeb.RootNode = entity; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "Run"; + aeb.RootNode = entity; + aeb.Restart = true; + aeb.AnimationEntity = entity.FirstChildByName("DashRight"); + aeb.Delay = -0.3; + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Command == "Jump") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.35; + aeb.NodeName = "Jump"; + aeb.RootNode = entity; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.35; + aeb.NodeName = "Run"; + aeb.RootNode = entity; + aeb.Restart = false; + aeb.AnimationEntity = entity.FirstChildByName("Jump"); + m_EventBroker->Publish(aeb); + } + } + } + } + + } } diff --git a/src/Engine/Rendering/AutoBlendQueue.cpp b/src/Engine/Rendering/AutoBlendQueue.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 8b044134..f7381d4d 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -207,6 +207,21 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) { std::vector goalNodes = FindNodesByName(blendInfo.NodeName); + if (blendInfo.Restart) { + for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) { + EntityWrapper entity = (*it)->Entity; + + if (entity.Valid()) { + if (entity.HasComponent("Animation")) { + (double&)entity["Animation"]["Time"] = 0.0; + (double&)entity["Animation"]["Speed"] = blendInfo.AnimationSpeed; + } + } + } + blendInfo.Restart = false; + } + + if(goalNodes.size() == 0) { return blendInfo; } else if(goalNodes.size() == 1) { From 9d4441852c5d27d727c17f761679d9ce08028e0f Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 03:39:00 +0100 Subject: [PATCH 29/94] DefenderWeapon view punch and crosshair travel with return --- assets | 2 +- .../Systems/Weapon/DefenderWeaponBehaviour.h | 2 + .../Schema/Components/DefenderWeapon.xml | 5 +- .../Schema/Components/DefenderWeapon.xsd | 7 +++ resources/Schema/Entities/MovementTest.xml | 12 ++-- resources/Schema/Entities/Player.xml | 13 ++-- .../Weapon/DefenderWeaponBehaviour.cpp | 59 ++++++++++++++++++- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 2 - 8 files changed, 83 insertions(+), 19 deletions(-) diff --git a/assets b/assets index 72530423..b8baf48e 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 72530423ad3744341f42cbfdcba18295a2cfac90 +Subproject commit b8baf48e5ee88ddb7d9bd818e31e3a52d96daec5 diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index c1e132b1..77d579f8 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -1,6 +1,7 @@ #include "WeaponBehaviour.h" #include "Collision/Collision.h" #include "Core/EPlayerDamage.h" +#include "Sound/EPlaySoundOnEntity.h" class DefenderWeaponBehaviour : public WeaponBehaviour { @@ -16,6 +17,7 @@ public: void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) override; bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) override; private: diff --git a/resources/Schema/Components/DefenderWeapon.xml b/resources/Schema/Components/DefenderWeapon.xml index 1b336fc4..68b87759 100755 --- a/resources/Schema/Components/DefenderWeapon.xml +++ b/resources/Schema/Components/DefenderWeapon.xml @@ -6,13 +6,16 @@ 64 90 0.174533 + 0.174533 10 120 - 0.01 + 0.03 + 0.2 0.5 false 0 false 0 + 0 \ No newline at end of file diff --git a/resources/Schema/Components/DefenderWeapon.xsd b/resources/Schema/Components/DefenderWeapon.xsd index c1b98e2f..d2b503f8 100755 --- a/resources/Schema/Components/DefenderWeapon.xsd +++ b/resources/Schema/Components/DefenderWeapon.xsd @@ -37,6 +37,9 @@ Spread angle in radians + + Maximum vertical aim travel angle in radians + Rate of fire in rounds per minute @@ -44,6 +47,9 @@ View punch in radians for each shell fired + + The speed in radians per second the view returns to its original position after being punched + Time it takes to load ONE SHELL into the weapon in seconds @@ -52,6 +58,7 @@ + diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 41474568..3429194a 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -26,7 +26,7 @@ - Models/Characters/Assault/AssaultTPose.mesh + Models/Characters/Assault/AssaultRed.mesh @@ -39,7 +39,7 @@ - Models/Characters/Assault/AssaultTPose.mesh + Models/Characters/Assault/AssaultRed.mesh @@ -94,11 +94,11 @@ - Models/Characters/Assault/AssaultTPose.mesh + Models/Characters/Assault/AssaultBlue.mesh - + @@ -107,11 +107,11 @@ - Models/Characters/Assault/AssaultTPose.mesh + Models/Characters/Assault/AssaultBlue.mesh - + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index e0230582..1ee9d5d3 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -458,7 +458,7 @@ - Models/Characters/Assault/FirstPerson.mesh + Models/Characters/Assault/Test/FirstPerson.mesh @@ -524,8 +524,7 @@ - Idle - 0.013134522267137072 + IdleF 1 @@ -537,8 +536,8 @@ - Models/Characters/Assault/AssaultAnimations.mesh - + Models/Characters/Assault/AssaultBlue.mesh + @@ -573,8 +572,8 @@ Schema/Entities/SidearmWeaponWorld.xml - - + + diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 4c0f9673..50d5889d 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -10,9 +10,11 @@ void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWr void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { + // Decrement reload timer double& reloadTimer = cWeapon["ReloadTimer"]; reloadTimer = glm::max(0.0, reloadTimer - dt); + // Handle reloading double reloadTime = cWeapon["ReloadTime"]; bool& isReloading = cWeapon["IsReloading"]; if (isReloading && reloadTimer <= 0.0) { @@ -23,11 +25,31 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& ammo -= 1; magAmmo += 1; reloadTimer = reloadTime; + Events::PlaySoundOnEntity e; + e.EmitterID = wi.Player.ID; + e.FilePath = "Audio/weapon/Zoom.wav"; + m_EventBroker->Publish(e); } else { isReloading = false; } } + // Restore view angle + if (IsClient) { + float& currentTravel = cWeapon["CurrentTravel"]; + float& returnSpeed = cWeapon["ViewReturnSpeed"]; + if (currentTravel > 0) { + float change = returnSpeed * dt; + currentTravel = glm::max(0.f, currentTravel - change); + EntityWrapper camera = wi.Player.FirstChildByName("Camera"); + if (camera.Valid()) { + glm::vec3& cameraOrientation = camera["Transform"]["Orientation"]; + cameraOrientation.x -= change; + } + } + } + + // Fire if we're able to fire if (canFire(cWeapon, wi)) { fireShell(cWeapon, wi); } @@ -71,6 +93,16 @@ void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) reloadTimer = reloadTime; } +void DefenderWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + // Make sure the trigger is released if weapon is holstered while firing + cWeapon["TriggerHeld"] = false; + + // Cancel any reload + cWeapon["IsReloading"] = false; + cWeapon["ReloadTimer"] = 0.0; +} + bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) { if (e.Command == "SpecialAbility" && IsServer) { @@ -114,11 +146,29 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi std::vector pelletAngles; for (int i = 0; i < numPellets; i++) { pelletAngles.push_back(glm::vec2(randomSpreadAngle(m_RandomEngine), randomSpreadAngle(m_RandomEngine))); - LOG_DEBUG("%f %f", pelletAngles[i].x, pelletAngles[i].y); } double pelletDamage = (double)cWeapon["BaseDamage"] / numPellets; + // View punch + if (IsClient) { + EntityWrapper camera = wi.Player.FirstChildByName("Camera"); + if (camera.Valid()) { + glm::vec3& cameraOrientation = camera["Transform"]["Orientation"]; + float viewPunch = cWeapon["ViewPunch"]; + float maxTravelAngle = cWeapon["MaxTravelAngle"]; + float& currentTravel = cWeapon["CurrentTravel"]; + if (currentTravel < maxTravelAngle) { + float change = viewPunch; + if (currentTravel + change > maxTravelAngle) { + change = maxTravelAngle - currentTravel; + } + cameraOrientation.x += change; + currentTravel += change; + } + } + } + // Tracers EntityWrapper weaponModelEntity; if (wi.Player == LocalPlayer) { @@ -140,6 +190,12 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi dealDamage(cWeapon, wi, direction, pelletDamage); } } + + // Sound + Events::PlaySoundOnEntity e; + e.EmitterID = wi.Player.ID; + e.FilePath = "Audio/weapon/Blast.wav"; + m_EventBroker->Publish(e); } void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage) @@ -206,7 +262,6 @@ bool DefenderWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi) bool triggerHeld = cWeapon["TriggerHeld"]; bool cooldownPassed = (double)cWeapon["FireCooldown"] <= 0.0; bool isNotShielding = wi.Player.ChildrenWithComponent("Shield").size() == 0; - // TODO: Ammo checks return triggerHeld && cooldownPassed && isNotShielding; } diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index 9a3ed6ab..d32b7d7e 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -45,8 +45,6 @@ void SidearmWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) // Cancel any reload cWeapon["IsReloading"] = false; cWeapon["ReloadTimer"] = 0.0; - - LOG_DEBUG("HOLSTER"); } void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi) From 27d3ec4118e3d8508ba46633e49ee96ec2b37947 Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 09:49:20 +0100 Subject: [PATCH 30/94] Added some fields in score components to track more data. Added some logic to the ScoreSystem class --- include/Game/Systems/ScoreScreenSystem.h | 15 +++++- resources/Schema/Components/ScoreIdentity.xml | 7 +++ resources/Schema/Components/ScoreIdentity.xsd | 6 +++ resources/Schema/Components/ScoreScreen.xml | 2 + resources/Schema/Components/ScoreScreen.xsd | 11 +++-- src/Game/Systems/ScoreScreenSystem.cpp | 47 ++++++++++++++++++- 6 files changed, 81 insertions(+), 7 deletions(-) diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h index b65d9465..ec95d6a2 100644 --- a/include/Game/Systems/ScoreScreenSystem.h +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -14,9 +14,20 @@ public: virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override; EventRelay m_EPlayerDeath; - void OnPlayerDeath(const Events::PlayerDeath& e); + bool OnPlayerDeath(const Events::PlayerDeath& e); EventRelay m_EPlayerSpawned; - void OnPlayerSpawn(const Events::PlayerSpawned& e); + bool OnPlayerSpawn(const Events::PlayerSpawned& e); + +private: + struct PlayerData { + int ID = -1; + std::string Name = ""; + int Team = -1; + EntityWrapper Player = EntityWrapper::Invalid; + }; + + int m_PlayerCounter = 0; + std::unordered_map m_PlayerIdentities; }; #endif \ No newline at end of file diff --git a/resources/Schema/Components/ScoreIdentity.xml b/resources/Schema/Components/ScoreIdentity.xml index 95478277..a4aa0639 100644 --- a/resources/Schema/Components/ScoreIdentity.xml +++ b/resources/Schema/Components/ScoreIdentity.xml @@ -1,3 +1,10 @@ + + -1 + 0.0 + 0 + 0 + 0 + true \ No newline at end of file diff --git a/resources/Schema/Components/ScoreIdentity.xsd b/resources/Schema/Components/ScoreIdentity.xsd index 9ed69918..5ab80c22 100644 --- a/resources/Schema/Components/ScoreIdentity.xsd +++ b/resources/Schema/Components/ScoreIdentity.xsd @@ -4,6 +4,9 @@ A component tracking data for the score of a player. + + A unique id for tracking identities + The Kills per death score. @@ -16,5 +19,8 @@ Ping of a player. + + If the player is currently connected or not + \ No newline at end of file diff --git a/resources/Schema/Components/ScoreScreen.xml b/resources/Schema/Components/ScoreScreen.xml index 646002c4..65d84aa6 100644 --- a/resources/Schema/Components/ScoreScreen.xml +++ b/resources/Schema/Components/ScoreScreen.xml @@ -1,3 +1,5 @@ + 0 + 0 \ No newline at end of file diff --git a/resources/Schema/Components/ScoreScreen.xsd b/resources/Schema/Components/ScoreScreen.xsd index 387140f2..d07b4a19 100644 --- a/resources/Schema/Components/ScoreScreen.xsd +++ b/resources/Schema/Components/ScoreScreen.xsd @@ -1,10 +1,13 @@ - - - The screen where player scores will be shown. - + The screen where player scores will be shown. + + The amount of score identities this scoreboard hold + + + Where the next scoreIdentity should be placed. + \ No newline at end of file diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 37dccb20..c66bdb2d 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -11,7 +11,30 @@ ScoreScreenSystem::ScoreScreenSystem(SystemParams params) void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) { - //Logic here + if(!entity.Valid() || !entity.HasComponent("ScoreScreen")){ + return; + } + + auto children = entity.ChildrenWithComponent("ScoreIdentity"); + + for (auto it = m_PlayerIdentities.begin(); it != m_PlayerIdentities.end(); ++it) { + bool found = false; + for (auto child : children) { + std::string name = (std::string)child["ScoreIdentity"]["Name"]; + if (it->first == name) { + found = true; + break; + } + } + if(found == false) { + //There is no entry for this player, create one. + + } + } + //For each scoreboard, go through children and see if they have all of the ones needed. + //Also need to take into account the order so they dont flicker. + //If they do not have all children we need to add them. + //Just add a new component to the scorescreen entity, the "ScoreIdentity" component. } void ScoreScreenSystem::OnPlayerDeath(const Events::PlayerDeath& e) @@ -22,4 +45,26 @@ void ScoreScreenSystem::OnPlayerDeath(const Events::PlayerDeath& e) void ScoreScreenSystem::OnPlayerSpawn(const Events::PlayerSpawned& e) { //When a player spawn, add a new entry to the score screen. + if(!e.Player.Valid()) { + return; + } + EntityWrapper entity = e.Player; + + std::unordered_map::const_iterator got; + got = m_PlayerIdentities.find(e.PlayerName); + if (got == m_PlayerIdentities.end()) { + PlayerData data; + data.ID = m_PlayerCounter; + data.Name = e.PlayerName; + data.Player = e.Player; + if(!entity.HasComponent("Team")) { + return; + } + data.Team = (int)entity["Team"]["Team"]; + + std::pair list (data.Name, data); + m_PlayerIdentities.insert(list); + m_PlayerCounter++; + } + } From ff6e2167d4d4a81b21443f1439dd8907bd915421 Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 11:25:06 +0100 Subject: [PATCH 31/94] Some new events and changes to ScoreSystem --- include/Engine/Network/EPlayerConnected.h | 17 + include/Engine/Network/Server.h | 1 + include/Game/Systems/ScoreScreenSystem.h | 8 + resources/Schema/Components/ScoreIdentity.xsd | 44 +- resources/Schema/Components/ScoreScreen.xsd | 16 +- resources/Schema/Entities/CP_Rocky.xml | 2105 ++++++++--------- resources/Schema/Entities/ScoreIdentity.xml | 98 + src/Engine/Network/Server.cpp | 5 + src/Game/Game.cpp | 2 + src/Game/Systems/ScoreScreenSystem.cpp | 39 +- 10 files changed, 1251 insertions(+), 1084 deletions(-) create mode 100644 include/Engine/Network/EPlayerConnected.h create mode 100644 resources/Schema/Entities/ScoreIdentity.xml diff --git a/include/Engine/Network/EPlayerConnected.h b/include/Engine/Network/EPlayerConnected.h new file mode 100644 index 00000000..8c12dd3d --- /dev/null +++ b/include/Engine/Network/EPlayerConnected.h @@ -0,0 +1,17 @@ +#ifndef Events_PlayerConnected +#define Events_PlayerConnected + +#include "Core/EventBroker.h" + +namespace Events +{ + +struct PlayerConnected : public Event +{ + std::string PlayerName = ""; + int PlayerID = -1; +}; + +} +#endif // !Events_PlayerConnected + diff --git a/include/Engine/Network/Server.h b/include/Engine/Network/Server.h index 7bcefc65..6ccbb4bd 100644 --- a/include/Engine/Network/Server.h +++ b/include/Engine/Network/Server.h @@ -21,6 +21,7 @@ #include "Core/EEntityDeleted.h" #include "Core/EComponentDeleted.h" #include "Core/EAmmoPickup.h" +#include "Network/EPlayerConnected.h" class Server : public Network { diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h index ec95d6a2..7f7c4064 100644 --- a/include/Game/Systems/ScoreScreenSystem.h +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -2,8 +2,12 @@ #define ScoreScreenSystem_h__ #include "Core/System.h" +#include "Core/ResourceManager.h" +#include "Core/EntityFile.h" #include "Core/EPlayerDeath.h" #include "Core/EPlayerSpawned.h" +#include "Network/EPlayerConnected.h" +#include "Network/EPlayerDisconnected.h" #include "GLM.h" class ScoreScreenSystem : public PureSystem @@ -17,6 +21,10 @@ public: bool OnPlayerDeath(const Events::PlayerDeath& e); EventRelay m_EPlayerSpawned; bool OnPlayerSpawn(const Events::PlayerSpawned& e); + EventRelay m_EPlayerConnected; + bool OnPlayerConnected(const Events::PlayerConnected& e); + EventRelay m_EPlayerDisconnected; + bool OnPlayerDisconnected(const Events::PlayerDisconnected& e); private: struct PlayerData { diff --git a/resources/Schema/Components/ScoreIdentity.xsd b/resources/Schema/Components/ScoreIdentity.xsd index 5ab80c22..d1a85bee 100644 --- a/resources/Schema/Components/ScoreIdentity.xsd +++ b/resources/Schema/Components/ScoreIdentity.xsd @@ -3,24 +3,30 @@ A component tracking data for the score of a player. - - - A unique id for tracking identities - - - The Kills per death score. - - - The amount of kills. - - - The amount of deaths. - - - Ping of a player. - - - If the player is currently connected or not - + + + + A name for tracking score identities, this should be unique. + + + An id for tracking identities + + + The Kills per death score. + + + The amount of kills. + + + The amount of deaths. + + + Ping of a player. + + + If the player is currently connected or not + + + \ No newline at end of file diff --git a/resources/Schema/Components/ScoreScreen.xsd b/resources/Schema/Components/ScoreScreen.xsd index d07b4a19..c8d3fa59 100644 --- a/resources/Schema/Components/ScoreScreen.xsd +++ b/resources/Schema/Components/ScoreScreen.xsd @@ -3,11 +3,15 @@ The screen where player scores will be shown. - - The amount of score identities this scoreboard hold - - - Where the next scoreIdentity should be placed. - + + + + The amount of score identities this scoreboard hold + + + Where the next scoreIdentity should be placed. + + + \ No newline at end of file diff --git a/resources/Schema/Entities/CP_Rocky.xml b/resources/Schema/Entities/CP_Rocky.xml index 8617886f..0adcbe6e 100644 --- a/resources/Schema/Entities/CP_Rocky.xml +++ b/resources/Schema/Entities/CP_Rocky.xml @@ -29,6 +29,26 @@ + + + + + Models/Props/Walls/SciFiWallSmall1.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall2.mesh + + + + + @@ -62,26 +82,6 @@ - - - - - Models/Props/Walls/SciFiWallSmall1.mesh - - - - - - - - - - Models/Props/Walls/SciFiWallSmall2.mesh - - - - - @@ -116,7 +116,6 @@ - Models/Core/UnitCube.mesh @@ -132,8 +131,8 @@ - - + + @@ -599,6 +598,36 @@ + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + @@ -775,36 +804,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - @@ -828,11 +827,11 @@ 2 - + - + @@ -849,7 +848,7 @@ - + @@ -875,11 +874,11 @@ 2 - + - + @@ -896,7 +895,7 @@ - + @@ -922,11 +921,11 @@ 2 - + - + @@ -943,7 +942,7 @@ - + @@ -969,11 +968,11 @@ 2 - + - + @@ -990,7 +989,7 @@ - + @@ -1016,11 +1015,11 @@ 2 - + - + @@ -1037,7 +1036,7 @@ - + @@ -1063,11 +1062,11 @@ 2 - + - + @@ -1084,7 +1083,7 @@ - + @@ -1110,11 +1109,11 @@ 2 - + - + @@ -1131,7 +1130,7 @@ - + @@ -2379,11 +2378,11 @@ 2 - + - + @@ -2400,7 +2399,7 @@ - + @@ -2426,11 +2425,11 @@ 2 - + - + @@ -2447,7 +2446,7 @@ - + @@ -2694,6 +2693,679 @@ + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + @@ -3234,147 +3906,6 @@ - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - @@ -3391,11 +3922,11 @@ 2 - + - + @@ -3412,7 +3943,7 @@ - + @@ -3428,55 +3959,8 @@ Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - + + @@ -3485,11 +3969,11 @@ 2 - + - + @@ -3506,7 +3990,7 @@ - + @@ -3532,11 +4016,11 @@ 2 - + - + @@ -3553,7 +4037,195 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + @@ -3565,679 +4237,6 @@ - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridge1Blue.mesh - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridge1Blue.mesh - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridge1Blue.mesh - - - - - - - - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - - - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - - Models/Core/UnitPlane.mesh - - true - - - - - - - - - @@ -4486,6 +4485,76 @@ + + + + + Schema/Entities/PlayerRed.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + @@ -4510,7 +4579,7 @@ false - + @@ -4523,7 +4592,7 @@ false - + @@ -4561,37 +4630,6 @@ - - - - 1 - - - - - - - - - 10 - - - - - - - - - - - 10 - - - - - - - @@ -4603,14 +4641,34 @@ + + + + 1 + + + + + - + 10 - + + + + + + + + + 10 + + + @@ -4629,81 +4687,22 @@ - 10 - + - - - - - - - Schema/Entities/PlayerRed.xml - - - - - - - - - - - - + - - - Models/Characters/Assault/AssaultTPose.mesh - false - + + + 10 + - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - + diff --git a/resources/Schema/Entities/ScoreIdentity.xml b/resources/Schema/Entities/ScoreIdentity.xml new file mode 100644 index 00000000..7d1e2437 --- /dev/null +++ b/resources/Schema/Entities/ScoreIdentity.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + Simon needs to push shit shit so i can write text from Component + Fonts/DroidSans.ttf,64 + + + + + + + + + + + ID + Fonts/DroidSans.ttf,64 + + + + + + + + + + + DickButt + Fonts/DroidSans.ttf,64 + + + + + + + + + + + 5 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + 12 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + 0.42 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + 84 + Fonts/DroidSans.ttf,64 + + + + + + + + + + diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index 68c00fbe..71889379 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -363,6 +363,11 @@ void Server::parseTCPConnect(Packet & packet) m_ConnectedPlayers.at(playerID).TCPAddress = m_Address; m_ConnectedPlayers.at(playerID).TCPPort = m_Port; + Events::PlayerConnected e; + e.PlayerID = playerID; + e.PlayerName = m_ConnectedPlayers.at(playerID).Name; + m_EventBroker->Publish(e); + LOG_INFO("parseTCPConnect: Spectator \"%s\" connected on IP: %s", m_ConnectedPlayers.at(playerID).Name.c_str(), m_ConnectedPlayers.at(playerID).TCPAddress.to_string().c_str()); diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index ab4b9652..e2055574 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -32,6 +32,7 @@ #include "Game/Systems/KillFeedSystem.h" #include "Game/Systems/BoostSystem.h" #include "Game/Systems/BoostIconsHUDSystem.h" +#include "Game/Systems/ScoreScreenSystem.h" #include "GUI/ButtonSystem.h" #include "GUI/MainMenuSystem.h" @@ -151,6 +152,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); m_SystemPipeline->AddSystem(updateOrderLevel); + m_SystemPipeline->AddSystem(updateOrderLevel); // Populate Octree with collidables ++updateOrderLevel; m_SystemPipeline->AddSystem(updateOrderLevel, m_OctreeCollision, "Collidable"); diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index c66bdb2d..01a03b52 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -7,11 +7,14 @@ ScoreScreenSystem::ScoreScreenSystem(SystemParams params) { EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &ScoreScreenSystem::OnPlayerDeath); EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &ScoreScreenSystem::OnPlayerSpawn); + EVENT_SUBSCRIBE_MEMBER(m_EPlayerConnected, &ScoreScreenSystem::OnPlayerConnected); + EVENT_SUBSCRIBE_MEMBER(m_EPlayerDisconnected, &ScoreScreenSystem::OnPlayerDisconnected); } void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) { - if(!entity.Valid() || !entity.HasComponent("ScoreScreen")){ + //TODO: Check team al + if(!entity.HasComponent("ScoreScreen")){ return; } @@ -28,7 +31,20 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& } if(found == false) { //There is no entry for this player, create one. + auto entityFile = ResourceManager::Load("Schema/Entities/ScoreIdentity.xml"); + EntityWrapper scoreIdentity = entityFile->MergeInto(m_World); + auto cScoreIdentity = scoreIdentity["ScoreIdentity"]; + auto data = it->second; + std::printf("\n\n"); + std::printf(data.Name.c_str()); + std::printf("\n\n"); + (std::string&)cScoreIdentity["Name"] = data.Name; + (int&)cScoreIdentity["ID"] = data.ID; + (int&)cScoreIdentity["Ping"] = 1337; + + m_World->SetName(scoreIdentity.ID, data.Name); + m_World->SetParent(scoreIdentity.ID, entity.ID); } } //For each scoreboard, go through children and see if they have all of the ones needed. @@ -37,16 +53,17 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& //Just add a new component to the scorescreen entity, the "ScoreIdentity" component. } -void ScoreScreenSystem::OnPlayerDeath(const Events::PlayerDeath& e) +bool ScoreScreenSystem::OnPlayerDeath(const Events::PlayerDeath& e) { //When player die, add it to his score, and when possible the player who killed him. + return 0; } -void ScoreScreenSystem::OnPlayerSpawn(const Events::PlayerSpawned& e) +bool ScoreScreenSystem::OnPlayerSpawn(const Events::PlayerSpawned& e) { //When a player spawn, add a new entry to the score screen. if(!e.Player.Valid()) { - return; + return 0; } EntityWrapper entity = e.Player; @@ -58,7 +75,7 @@ void ScoreScreenSystem::OnPlayerSpawn(const Events::PlayerSpawned& e) data.Name = e.PlayerName; data.Player = e.Player; if(!entity.HasComponent("Team")) { - return; + return 0; } data.Team = (int)entity["Team"]["Team"]; @@ -66,5 +83,15 @@ void ScoreScreenSystem::OnPlayerSpawn(const Events::PlayerSpawned& e) m_PlayerIdentities.insert(list); m_PlayerCounter++; } - + return 0; +} + +bool ScoreScreenSystem::OnPlayerConnected(const Events::PlayerConnected& e) +{ + return 0; +} + +bool ScoreScreenSystem::OnPlayerDisconnected(const Events::PlayerDisconnected& e) +{ + return 0; } From c8aeae2c9640290a8bcba80784945025406f785d Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 12:58:35 +0100 Subject: [PATCH 32/94] WIP --- include/Game/Systems/ScoreScreenSystem.h | 4 +- resources/Schema/Entities/CP_Rocky.xml | 1141 ++++++++++---------- src/Game/Systems/CapturePointHUDSystem.cpp | 6 +- src/Game/Systems/ScoreScreenSystem.cpp | 70 +- 4 files changed, 636 insertions(+), 585 deletions(-) diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h index 7f7c4064..a33d4684 100644 --- a/include/Game/Systems/ScoreScreenSystem.h +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -30,12 +30,12 @@ private: struct PlayerData { int ID = -1; std::string Name = ""; - int Team = -1; + int Team = 1; EntityWrapper Player = EntityWrapper::Invalid; }; int m_PlayerCounter = 0; - std::unordered_map m_PlayerIdentities; + std::unordered_map m_PlayerIdentities; }; #endif \ No newline at end of file diff --git a/resources/Schema/Entities/CP_Rocky.xml b/resources/Schema/Entities/CP_Rocky.xml index 0adcbe6e..a6f6302d 100644 --- a/resources/Schema/Entities/CP_Rocky.xml +++ b/resources/Schema/Entities/CP_Rocky.xml @@ -29,6 +29,16 @@ + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + @@ -72,16 +82,6 @@ - - - - - Models/Props/Walls/SciFiWallMedium.mesh - - - - - @@ -127,11 +127,42 @@ - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -765,6 +796,19 @@ + + + + + 2 + 1 + + + + + + + @@ -789,19 +833,6 @@ - - - - - 2 - 1 - - - - - - - @@ -827,11 +858,11 @@ 2 - + - + @@ -848,7 +879,7 @@ - + @@ -874,11 +905,11 @@ 2 - + - + @@ -895,7 +926,7 @@ - + @@ -921,11 +952,11 @@ 2 - + - + @@ -942,7 +973,7 @@ - + @@ -968,11 +999,11 @@ 2 - + - + @@ -989,7 +1020,7 @@ - + @@ -1015,11 +1046,11 @@ 2 - + - + @@ -1036,7 +1067,7 @@ - + @@ -1062,11 +1093,11 @@ 2 - + - + @@ -1083,7 +1114,7 @@ - + @@ -1109,11 +1140,11 @@ 2 - + - + @@ -1130,7 +1161,7 @@ - + @@ -2378,11 +2409,11 @@ 2 - + - + @@ -2399,7 +2430,7 @@ - + @@ -2425,11 +2456,11 @@ 2 - + - + @@ -2446,7 +2477,7 @@ - + @@ -2693,6 +2724,41 @@ + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + @@ -3138,6 +3204,94 @@ + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + @@ -3351,26 +3505,24 @@ - - - - Models/Core/UnitPlane.mesh - - true - - - - - - - - - + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + @@ -3384,45 +3536,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - @@ -3440,36 +3553,11 @@ - Models/Props/Walls/MediumWall1.mesh + Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - + + @@ -3500,6 +3588,45 @@ + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + @@ -3518,11 +3645,23 @@ - Models/Props/Walls/MediumWall2.mesh + Models/Props/Walls/SmallWall3.mesh - - + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + @@ -3534,8 +3673,21 @@ Models/Props/Walls/MediumWall2.mesh - - + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + @@ -3552,19 +3704,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - @@ -3580,169 +3719,11 @@ - - - - - - - - - - Models/Props/Flora/SpecialRoot.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - @@ -3758,21 +3739,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -3801,6 +3767,71 @@ + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -3815,6 +3846,21 @@ + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -3830,6 +3876,19 @@ + + + + + 2 + 1 + + + + + + + @@ -3854,19 +3913,6 @@ - - - - - 2 - 1 - - - - - - - @@ -3884,21 +3930,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -3912,9 +3943,9 @@ Models/Props/PickUps/PickUpHolder.mesh - - - + + + @@ -3922,58 +3953,11 @@ 2 - + - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - + @@ -3989,8 +3973,8 @@ Models/Props/PickUps/HealthPickUp.mesh - - + + @@ -4016,11 +4000,11 @@ 2 - + - + @@ -4037,7 +4021,7 @@ - + @@ -4053,8 +4037,8 @@ Models/Props/PickUps/PickUpHolder.mesh - - + + @@ -4063,11 +4047,11 @@ 2 - + - + @@ -4082,103 +4066,9 @@ Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - + @@ -4204,11 +4094,11 @@ 2 - + - + @@ -4225,7 +4115,148 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + @@ -4264,9 +4295,9 @@ Models/Props/Pillars/StonePillar.mesh - - - + + + @@ -4278,9 +4309,9 @@ Models/Props/Pillars/StonePillar.mesh - - - + + + @@ -4579,7 +4610,7 @@ false - + @@ -4592,7 +4623,7 @@ false - + @@ -4630,6 +4661,41 @@ + + + + 0.40000000596046448 + + + + + + + + + + + + 10 + + + + + + + + + + + + 10 + + + + + + + @@ -4650,18 +4716,6 @@ - - - - - 10 - - - - - - - @@ -4673,17 +4727,6 @@ - - - - 0.40000000596046448 - - - - - - - @@ -4695,18 +4738,6 @@ - - - - - 10 - - - - - - - diff --git a/src/Game/Systems/CapturePointHUDSystem.cpp b/src/Game/Systems/CapturePointHUDSystem.cpp index 6f1392e0..b7376249 100644 --- a/src/Game/Systems/CapturePointHUDSystem.cpp +++ b/src/Game/Systems/CapturePointHUDSystem.cpp @@ -9,7 +9,7 @@ CapturePointHUDSystem::CapturePointHUDSystem(SystemParams params) void CapturePointHUDSystem::Update(double dt) { - bool LoadCheck = true; + bool loadCheck = true; int redTeam; int blueTeam; int spectatorTeam; @@ -35,11 +35,11 @@ void CapturePointHUDSystem::Update(double dt) //Check if the HUD corresponds to the Capture Point Number if (HUD_ID == (int)entityCP["CapturePoint"]["CapturePointNumber"]) { ComponentWrapper& teamComponent = entityCP["Team"]; - if (LoadCheck) { + if (loadCheck) { redTeam = (int)teamComponent["Team"].Enum("Red"); blueTeam = (int)teamComponent["Team"].Enum("Blue"); spectatorTeam = (int)teamComponent["Team"].Enum("Spectator"); - LoadCheck = false; + loadCheck = false; } //Color hud with team color auto capturePointTeam = (int)teamComponent["Team"]; diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 01a03b52..361d9f1f 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -18,32 +18,53 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& return; } + int redTeamEnum; + int blueTeamEnum; + int spectatorTeamEnum; + int currentTeam = 0; + + if(entity.HasComponent("Team")) { + auto cTeam = entity["Team"]; + redTeamEnum = (int)cTeam["Team"].Enum("Red"); + blueTeamEnum = (int)cTeam["Team"].Enum("Blue"); + spectatorTeamEnum = (int)cTeam["Team"].Enum("Spectator"); + currentTeam = (int)cTeam["Team"]; + } + auto children = entity.ChildrenWithComponent("ScoreIdentity"); for (auto it = m_PlayerIdentities.begin(); it != m_PlayerIdentities.end(); ++it) { + bool found = false; for (auto child : children) { - std::string name = (std::string)child["ScoreIdentity"]["Name"]; - if (it->first == name) { + int ID = (int)child["ScoreIdentity"]["ID"]; + if (it->first == ID) { + if (it->second.Team != currentTeam) { + m_World->DeleteEntity(child.ID); + break; + } found = true; break; } } if(found == false) { + if(it->second.Team != currentTeam) { + //This player is not the same team as this scoreboard should show. + break; + } //There is no entry for this player, create one. auto entityFile = ResourceManager::Load("Schema/Entities/ScoreIdentity.xml"); EntityWrapper scoreIdentity = entityFile->MergeInto(m_World); auto cScoreIdentity = scoreIdentity["ScoreIdentity"]; auto data = it->second; - std::printf("\n\n"); - std::printf(data.Name.c_str()); - std::printf("\n\n"); (std::string&)cScoreIdentity["Name"] = data.Name; (int&)cScoreIdentity["ID"] = data.ID; (int&)cScoreIdentity["Ping"] = 1337; - m_World->SetName(scoreIdentity.ID, data.Name); + std::string IdentityName = "#" + std::to_string(data.ID) + ": " + data.Name; + + m_World->SetName(scoreIdentity.ID, IdentityName); m_World->SetParent(scoreIdentity.ID, entity.ID); } } @@ -61,37 +82,36 @@ bool ScoreScreenSystem::OnPlayerDeath(const Events::PlayerDeath& e) bool ScoreScreenSystem::OnPlayerSpawn(const Events::PlayerSpawned& e) { - //When a player spawn, add a new entry to the score screen. - if(!e.Player.Valid()) { + //When a player spawn, add data to the list entry with the same ID. + + std::unordered_map::iterator got; + + got = m_PlayerIdentities.find(e.PlayerID); + if(got == m_PlayerIdentities.end()) { + LOG_ERROR("Player spawned without having an entry on score screen"); return 0; } - EntityWrapper entity = e.Player; + auto& data = got->second; + data.Player = e.Player; + data.Team = (int)data.Player["Team"]["Team"]; - std::unordered_map::const_iterator got; - got = m_PlayerIdentities.find(e.PlayerName); - if (got == m_PlayerIdentities.end()) { - PlayerData data; - data.ID = m_PlayerCounter; - data.Name = e.PlayerName; - data.Player = e.Player; - if(!entity.HasComponent("Team")) { - return 0; - } - data.Team = (int)entity["Team"]["Team"]; - - std::pair list (data.Name, data); - m_PlayerIdentities.insert(list); - m_PlayerCounter++; - } return 0; } bool ScoreScreenSystem::OnPlayerConnected(const Events::PlayerConnected& e) { + //player has connected, add his data to the list of ScoreIdentities + PlayerData data; + data.ID = e.PlayerID; + data.Name = e.PlayerName; + m_PlayerIdentities.insert( {data.ID, data} ); + return 0; } bool ScoreScreenSystem::OnPlayerDisconnected(const Events::PlayerDisconnected& e) { + //player has disconnected, remove him from list of ScoreIdentities + m_PlayerIdentities.erase(e.PlayerID); return 0; } From 1210c915351def2445ab8e9749e578261658d518 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 13:51:47 +0100 Subject: [PATCH 33/94] Added Gameplay.AutoReload bool to config --- include/Game/Systems/Weapon/WeaponBehaviour.h | 8 ++++++-- resources/DefaultConfig.ini | 3 +++ src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp | 10 +++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index e0783bd2..d4520c9f 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -8,6 +8,7 @@ #include "Input/EInputCommand.h" #include "Systems/SpawnerSystem.h" #include "Rendering/ESetCamera.h" +#include "Core/ConfigFile.h" template class WeaponBehaviour : public PureSystem @@ -21,8 +22,10 @@ public: , m_Renderer(renderer) , m_CollisionOctree(collisionOctree) { - EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &WeaponBehaviour::_OnInputCommand) - EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &WeaponBehaviour::_OnSetCamera) + EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &WeaponBehaviour::_OnInputCommand); + EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &WeaponBehaviour::_OnSetCamera); + auto config = ResourceManager::Load("Config.ini"); + m_ConfigAutoReload = config->Get("Gameplay.AutoReload", true); } virtual ~WeaponBehaviour() = default; @@ -49,6 +52,7 @@ protected: EntityWrapper m_CurrentCamera; Octree* m_CollisionOctree; std::unordered_map m_ActiveWeapons; + bool m_ConfigAutoReload; virtual void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { } virtual void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) { } diff --git a/resources/DefaultConfig.ini b/resources/DefaultConfig.ini index 8917e3e1..fd468fd6 100644 --- a/resources/DefaultConfig.ini +++ b/resources/DefaultConfig.ini @@ -1,3 +1,6 @@ +[Gameplay] +AutoReload=true + [Debug] LogLevel=1 LoadMap= diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 50d5889d..3a4ed3a4 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -14,11 +14,16 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& double& reloadTimer = cWeapon["ReloadTimer"]; reloadTimer = glm::max(0.0, reloadTimer - dt); + // Start reloading automatically if at 0 mag ammo + int& magAmmo = cWeapon["MagazineAmmo"]; + if (m_ConfigAutoReload && magAmmo <= 0) { + OnReload(cWeapon, wi); + } + // Handle reloading - double reloadTime = cWeapon["ReloadTime"]; bool& isReloading = cWeapon["IsReloading"]; if (isReloading && reloadTimer <= 0.0) { - int& magAmmo = cWeapon["MagazineAmmo"]; + double reloadTime = cWeapon["ReloadTime"]; int& magSize = cWeapon["MagazineSize"]; int& ammo = cWeapon["Ammo"]; if (magAmmo < magSize && ammo > 0) { @@ -130,7 +135,6 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi // Ammo int& magAmmo = cWeapon["MagazineAmmo"]; if (magAmmo <= 0) { - OnReload(cWeapon, wi); return; } else { magAmmo -= 1; From f4983cf9610d6a2562cee64d29b86598e950cf22 Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 13:53:40 +0100 Subject: [PATCH 34/94] WIP --- resources/Schema/Entities/ScoreIdentity.xml | 104 ++++++++++++-------- src/Game/Systems/ScoreScreenSystem.cpp | 7 +- 2 files changed, 65 insertions(+), 46 deletions(-) diff --git a/resources/Schema/Entities/ScoreIdentity.xml b/resources/Schema/Entities/ScoreIdentity.xml index 7d1e2437..daf9d4eb 100644 --- a/resources/Schema/Entities/ScoreIdentity.xml +++ b/resources/Schema/Entities/ScoreIdentity.xml @@ -9,24 +9,17 @@ - - - - Simon needs to push shit shit so i can write text from Component - Fonts/DroidSans.ttf,64 - - - - - - - - ID + -1 Fonts/DroidSans.ttf,64 + + ScoreIdentity + ScoreIdentity + ID + @@ -36,35 +29,16 @@ - DickButt + Fonts/DroidSans.ttf,64 + + ScoreIdentity + ScoreIdentity + Name + - - - - - - - - - 5 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - 12 - Fonts/DroidSans.ttf,64 - - - + @@ -72,11 +46,50 @@ - 0.42 + 0 Fonts/DroidSans.ttf,64 + + ScoreIdentity + ScoreIdentity + KD + - + + + + + + + + + 0 + Fonts/DroidSans.ttf,64 + + + ScoreIdentity + ScoreIdentity + Kills + + + + + + + + + + + 0 + Fonts/DroidSans.ttf,64 + + + ScoreIdentity + ScoreIdentity + Deaths + + + @@ -84,11 +97,16 @@ - 84 + 0 Fonts/DroidSans.ttf,64 + + ScoreIdentity + ScoreIdentity + Ping + - + diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 361d9f1f..0713e13b 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -14,6 +14,10 @@ ScoreScreenSystem::ScoreScreenSystem(SystemParams params) void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) { //TODO: Check team al + if (!IsServer) { + return; + } + if(!entity.HasComponent("ScoreScreen")){ return; } @@ -62,9 +66,6 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& (int&)cScoreIdentity["ID"] = data.ID; (int&)cScoreIdentity["Ping"] = 1337; - std::string IdentityName = "#" + std::to_string(data.ID) + ": " + data.Name; - - m_World->SetName(scoreIdentity.ID, IdentityName); m_World->SetParent(scoreIdentity.ID, entity.ID); } } From a3494b92c8cbf386bbd07ee9052ab1cde8b9ab07 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 3 Mar 2016 17:48:25 +0100 Subject: [PATCH 35/94] Blending queues now working --- include/Engine/Rendering/AnimationSystem.h | 41 +- include/Engine/Rendering/AutoBlendQueue.h | 21 +- include/Engine/Rendering/BlendTree.h | 8 +- include/Engine/Rendering/EAnimationBlend.h | 21 - .../Engine/Rendering/EAutoAnimationBlend.h | 6 +- resources/Schema/Components/Animation.xml | 2 + resources/Schema/Components/Animation.xsd | 2 + resources/Schema/Entities/BlendTreeTest.xml | 37 +- src/Engine/Rendering/AnimationSystem.cpp | 504 ++++++++---------- src/Engine/Rendering/AutoBlendQueue.cpp | 195 +++++++ src/Engine/Rendering/BlendTree.cpp | 95 +++- 11 files changed, 554 insertions(+), 378 deletions(-) delete mode 100644 include/Engine/Rendering/EAnimationBlend.h diff --git a/include/Engine/Rendering/AnimationSystem.h b/include/Engine/Rendering/AnimationSystem.h index fd53022f..4f18b4a4 100644 --- a/include/Engine/Rendering/AnimationSystem.h +++ b/include/Engine/Rendering/AnimationSystem.h @@ -7,13 +7,12 @@ #include "../Core/System.h" #include "../Core/ResourceManager.h" #include "Rendering/Model.h" -#include "Rendering/EAnimationComplete.h" #include "Rendering/Skeleton.h" #include "Rendering/BlendTree.h" -#include "Rendering/EAnimationBlend.h" #include "Rendering/EAutoAnimationBlend.h" #include "../Input/EInputCommand.h" #include "../Core/EntityWrapper.h" +#include "Rendering/AutoBlendQueue.h" #include "imgui/imgui.h" @@ -27,10 +26,7 @@ private: void CreateBlendTrees(); void UpdateAnimations(double dt); void UpdateWeights(double dt); - void AnimationComplete(EntityWrapper animationEntity); - EventRelay m_EAnimationBlend; - bool OnAnimationBlend(Events::AnimationBlend& e); EventRelay m_EAutoAnimationBlend; bool OnAutoAnimationBlend(Events::AutoAnimationBlend& e); @@ -38,40 +34,7 @@ private: EventRelay m_EInputCommand; bool OnInputCommand(const Events::InputCommand& e); - struct BlendJob - { - EntityWrapper BlendEntity = EntityWrapper::Invalid; - double StartWeight; - double GoalWeight; - double Duration; - double CurrentTime = 0.0; - }; - - struct QueuedBlendJob : BlendJob - { - EntityWrapper AnimationEntity = EntityWrapper::Invalid; - }; - - struct AutoBlendJob - { - EntityWrapper RootNode = EntityWrapper::Invalid; - double Duration; - double CurrentTime = 0.0; - double Delay = 0.0; - BlendTree::AutoBlendInfo BlendInfo; - }; - - - std::list m_AutoBlendJobs; - std::unordered_map m_QueuedAutoBlendJobs; - std::list m_BlendJobs; - std::list m_QueuedBlendJobs; - - char m_AnimationName1[20] = "Run"; - float m_BlendTime1 = 0.5f; - - char m_AnimationName2[20] = "Jump"; - float m_BlendTime2 = 0.5f; + std::unordered_map m_AutoBlendQueues; }; #endif \ No newline at end of file diff --git a/include/Engine/Rendering/AutoBlendQueue.h b/include/Engine/Rendering/AutoBlendQueue.h index 12dd249e..3c808408 100644 --- a/include/Engine/Rendering/AutoBlendQueue.h +++ b/include/Engine/Rendering/AutoBlendQueue.h @@ -5,6 +5,7 @@ #include "Skeleton.h" #include "Model.h" #include "BlendTree.h" +#include "../Core/EntityWrapper.h" class AutoBlendQueue { @@ -15,11 +16,29 @@ public: double Duration; double CurrentTime = 0.0; double Delay = 0.0; + EntityWrapper AnimationEntity = EntityWrapper::Invalid; BlendTree::AutoBlendInfo BlendInfo; }; + struct AutoblendNode + { + AutoBlendJob BlendJob; + double StartTime; + double EndTime; + }; + + AutoBlendQueue() { }; + + void Insert(AutoBlendJob autoBlendJob); + void UpdateTime(double dt); + + void PrintQueue(); + bool HasActiveBlendJob(); + std::shared_ptr GetBlendTree(); + + AutoBlendQueue::AutoBlendJob& GetActiveBlendJob(); private: - std::map m_BlendQueue; + std::list m_BlendQueue; }; diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index 5605707a..2c5f1aa8 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -60,8 +60,7 @@ public: { std::string NodeName; double progress; - bool Restart; - double AnimationSpeed; + bool Start; std::unordered_map StartWeights; }; @@ -78,6 +77,11 @@ public: void PrintTree(); BlendTree::AutoBlendInfo AutoBlendStep(AutoBlendInfo blendInfo); + BlendTree::Node* GetCommonParent(std::string NodeName1, std::string NodeName2); + BlendTree::Node* FirstCommonParent(Node* node1, Node* node2); + + EntityWrapper GetSubTreeRoot(std::string nodeName); + private: Skeleton* m_Skeleton = nullptr; Node* m_Root = nullptr; diff --git a/include/Engine/Rendering/EAnimationBlend.h b/include/Engine/Rendering/EAnimationBlend.h deleted file mode 100644 index 880a2fd0..00000000 --- a/include/Engine/Rendering/EAnimationBlend.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef Events_AnimationBlend_h__ -#define Events_AnimationBlend_h__ - -#include "../Core/EventBroker.h" -#include "../Core/EntityWrapper.h" - -namespace Events -{ - -struct AnimationBlend : Event -{ - EntityWrapper BlendEntity = EntityWrapper::Invalid; - double GoalWeight; - double Duration; - - EntityWrapper AnimationEntity = EntityWrapper::Invalid; -}; - -} - -#endif diff --git a/include/Engine/Rendering/EAutoAnimationBlend.h b/include/Engine/Rendering/EAutoAnimationBlend.h index edd8e0bc..08c49191 100644 --- a/include/Engine/Rendering/EAutoAnimationBlend.h +++ b/include/Engine/Rendering/EAutoAnimationBlend.h @@ -13,9 +13,9 @@ struct AutoAnimationBlend : Event std::string NodeName; double Duration = 0.0; double Delay = 0.0; - - - double AnimationSpeed = 1.0; + + bool Start = false; + bool Reverse = false; bool Restart = false; EntityWrapper AnimationEntity = EntityWrapper::Invalid; diff --git a/resources/Schema/Components/Animation.xml b/resources/Schema/Components/Animation.xml index 45ee8428..05de9f9f 100644 --- a/resources/Schema/Components/Animation.xml +++ b/resources/Schema/Components/Animation.xml @@ -2,6 +2,8 @@ + false + false 0 true false diff --git a/resources/Schema/Components/Animation.xsd b/resources/Schema/Components/Animation.xsd index 5e82c333..1090c4c7 100644 --- a/resources/Schema/Components/Animation.xsd +++ b/resources/Schema/Components/Animation.xsd @@ -8,6 +8,8 @@ + + diff --git a/resources/Schema/Entities/BlendTreeTest.xml b/resources/Schema/Entities/BlendTreeTest.xml index 3457fc5e..69590ceb 100644 --- a/resources/Schema/Entities/BlendTreeTest.xml +++ b/resources/Schema/Entities/BlendTreeTest.xml @@ -68,9 +68,9 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - + + - @@ -85,11 +85,11 @@ - + - AimRifleA - + AimSecWepA + false true @@ -97,11 +97,11 @@ - + - AimSecWepA - + AimRifleA + false true @@ -125,7 +125,7 @@ StandCrouchBlend JumpDashBlend - 0 + 0.00067602147306955462 @@ -183,8 +183,9 @@ RunF - + 1 + true @@ -317,7 +318,7 @@ Jump DashBlend - 1 + 0.01016461050458084 @@ -327,6 +328,8 @@ JumpF + 1 + false @@ -337,7 +340,7 @@ DashFBBlend DashLRBlend - 0 + 0.99999999999984523 @@ -347,7 +350,7 @@ DashForward DashBackward - 1 + 0.98238059685988577 @@ -356,6 +359,8 @@ DashForwardF + + 1 false @@ -367,6 +372,7 @@ DashBackwardF + 1 false @@ -380,7 +386,7 @@ DashLeft DashRight - 0 + 0.96547196574235861 @@ -390,6 +396,7 @@ DashLeftF + 1 false @@ -400,6 +407,8 @@ DashRightF + + 1 false diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 4e7f15f6..166ecb47 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -3,21 +3,21 @@ AnimationSystem::AnimationSystem(SystemParams params) : System(params) { - EVENT_SUBSCRIBE_MEMBER(m_EAnimationBlend, &AnimationSystem::OnAnimationBlend); EVENT_SUBSCRIBE_MEMBER(m_EAutoAnimationBlend, &AnimationSystem::OnAutoAnimationBlend); EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &AnimationSystem::OnInputCommand); } void AnimationSystem::Update(double dt) { - ImGui::InputText("AnimationName1", &m_AnimationName1[0], sizeof(m_AnimationName1)); - ImGui::SliderFloat("Blendtime1", &m_BlendTime1, 0.f, 10.f); - ImGui::InputText("AnimationName2", &m_AnimationName2[0], sizeof(m_AnimationName2)); - ImGui::SliderFloat("Blendtime2", &m_BlendTime2, 0.f, 10.f); - UpdateAnimations(dt); CreateBlendTrees(); UpdateWeights(dt); + + + for(auto& autoBlendQueue : m_AutoBlendQueues) { + autoBlendQueue.second.UpdateTime(dt); + // autoBlendQueue.second.PrintQueue(); + } } void AnimationSystem::CreateBlendTrees() @@ -91,66 +91,29 @@ void AnimationSystem::UpdateAnimations(double dt) double animationSpeed = (double)animationC["Speed"]; - if (animationSpeed != 0.0) { + if((bool)animationC["Reverse"]) { + animationSpeed *= -1; + } + + + if ((bool)animationC["Play"]) { double nextTime = (double)animationC["Time"] + animationSpeed * dt; - - - //Pre animation end blend - if (m_QueuedAutoBlendJobs.find(entity) != m_QueuedAutoBlendJobs.end()) { - if (glm::sign(m_QueuedAutoBlendJobs.at(entity).Delay) < 0) { - if (!(bool)animationC["Loop"]) { - if (nextTime > animation->Duration + m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) > 0) { - AnimationComplete(entity); - } else if (nextTime < 0 - m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) < 0) { - AnimationComplete(entity); - } - } else { - if (nextTime > animation->Duration + m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) > 0) { - AnimationComplete(entity); - } else if (nextTime < 0 - m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) < 0) { - AnimationComplete(entity); - } - } - } - } - - if (!(bool)animationC["Loop"]) { if (nextTime > animation->Duration) { nextTime = animation->Duration; - Events::AnimationComplete e; - e.Entity = entity; - e.Name = (std::string)animationC["AnimationName"]; - m_EventBroker->Publish(e); - AnimationComplete(entity); - (double&)animationC["Speed"] = 0.0; + (bool&)animationC["Play"] = false; } else if (nextTime < 0) { - Events::AnimationComplete e; - e.Entity = entity; - e.Name = (std::string)animationC["AnimationName"]; - m_EventBroker->Publish(e); - AnimationComplete(entity); nextTime = 0; - (double&)animationC["Speed"] = 0.0; + (bool&)animationC["Play"] = false; } } else { if (nextTime > animation->Duration) { - Events::AnimationComplete e; - e.Entity = entity; - e.Name = (std::string)animationC["AnimationName"]; - m_EventBroker->Publish(e); - AnimationComplete(entity); while (nextTime > animation->Duration) { nextTime -= animation->Duration; } } else if (nextTime < 0) { - Events::AnimationComplete e; - e.Entity = entity; - e.Name = (std::string)animationC["AnimationName"]; - m_EventBroker->Publish(e); - AnimationComplete(entity); while (nextTime < 0) { nextTime += animation->Duration; } @@ -164,154 +127,27 @@ void AnimationSystem::UpdateAnimations(double dt) void AnimationSystem::UpdateWeights(double dt) { - for (auto it = m_BlendJobs.begin(); it != m_BlendJobs.end();) { - if (!it->BlendEntity.Valid()) { - it = m_BlendJobs.erase(it); - continue; - } + for (auto& autoBlendQueue : m_AutoBlendQueues) { - if (it->BlendEntity.HasComponent("Blend")) { - it->CurrentTime += dt; - double progress = it->CurrentTime / it->Duration; - progress = glm::clamp(progress, 0.0, 1.0); + if(autoBlendQueue.second.HasActiveBlendJob()) { + AutoBlendQueue::AutoBlendJob& blendJob = autoBlendQueue.second.GetActiveBlendJob(); - double weight = ((it->GoalWeight - it->StartWeight) * progress) + it->StartWeight; - (double&)it->BlendEntity["Blend"]["Weight"] = weight; + std::shared_ptr blendTree = autoBlendQueue.second.GetBlendTree(); - if(weight == it->GoalWeight) { - it = m_BlendJobs.erase(it); + if (blendTree != nullptr) { + blendJob.BlendInfo.progress = glm::clamp(blendJob.CurrentTime / blendJob.Duration, 0.0, 1.0); + LOG_INFO("Progress: %f, %s", blendJob.BlendInfo.progress, blendJob.BlendInfo.NodeName.c_str()); + blendJob.BlendInfo = blendTree->AutoBlendStep(blendJob.BlendInfo); } + } - ++it; - } - - - for (auto it = m_AutoBlendJobs.begin(); it != m_AutoBlendJobs.end();) { - it->CurrentTime += dt; - - if (!it->RootNode.Valid()) { - it = m_AutoBlendJobs.erase(it); - continue; - } - - if (!it->RootNode.HasComponent("Model")) { - it = m_AutoBlendJobs.erase(it); - continue; - } - - Model* model; - try { - model = ResourceManager::Load<::Model, true>(it->RootNode["Model"]["Resource"]); - } catch (const std::exception&) { - continue; - } - - Skeleton* skeleton = model->m_RawModel->m_Skeleton; - if (skeleton == nullptr) { - continue; - } - - std::shared_ptr blendTree; - if(skeleton->BlendTrees.find(it->RootNode) != skeleton->BlendTrees.end()) { - blendTree = skeleton->BlendTrees.at(it->RootNode); - } else { - it = m_AutoBlendJobs.erase(it); - continue; - } - - - it->BlendInfo.progress = glm::clamp(it->CurrentTime / it->Duration, 0.0, 1.0); - it->BlendInfo = blendTree->AutoBlendStep(it->BlendInfo); - - - if (it->CurrentTime >= it->Duration) { - it = m_AutoBlendJobs.erase(it); - continue; - } - - ++it; } } - -void AnimationSystem::AnimationComplete(EntityWrapper animationEntity) -{ - for (auto it = m_QueuedBlendJobs.begin(); it != m_QueuedBlendJobs.end();) { - if (!it->BlendEntity.Valid() || !it->AnimationEntity.Valid()) { - it = m_QueuedBlendJobs.erase(it); - continue; - } - - if(animationEntity == it->AnimationEntity) { - BlendJob bj; - bj.BlendEntity = it->BlendEntity; - bj.StartWeight = it->StartWeight; - bj.GoalWeight = it->GoalWeight; - bj.Duration = it->Duration; - bj.CurrentTime = 0.0; - m_BlendJobs.push_back(bj); - it = m_QueuedBlendJobs.erase(it); - continue; - } - - ++it; - } - - - if (m_QueuedAutoBlendJobs.find(animationEntity) != m_QueuedAutoBlendJobs.end()) { - AutoBlendJob abj = m_QueuedAutoBlendJobs.at(animationEntity); - - if (!abj.RootNode.Valid() || !animationEntity.Valid()) { - m_QueuedAutoBlendJobs.erase(animationEntity); - } else { - m_AutoBlendJobs.push_back(abj); - m_QueuedAutoBlendJobs.erase(animationEntity); - } - - - - } - - -} - -bool AnimationSystem::OnAnimationBlend(Events::AnimationBlend& e) -{ - if(!e.BlendEntity.Valid()) { - return false; - } - if(!e.BlendEntity.HasComponent("Blend")){ - return false; - } - - if (e.AnimationEntity.Valid()) { - if (e.AnimationEntity.HasComponent("Animation")) { - QueuedBlendJob qbj; - qbj.BlendEntity = e.BlendEntity; - qbj.StartWeight = (double)e.BlendEntity["Blend"]["Weight"]; - qbj.GoalWeight = e.GoalWeight; - qbj.Duration = e.Duration; - qbj.CurrentTime = 0.0; - qbj.AnimationEntity = e.AnimationEntity; - m_QueuedBlendJobs.push_back(qbj); - return true; - } - } else { - BlendJob bj; - bj.BlendEntity = e.BlendEntity; - bj.StartWeight = (double)e.BlendEntity["Blend"]["Weight"]; - bj.GoalWeight = e.GoalWeight; - bj.Duration = e.Duration; - bj.CurrentTime = 0.0; - m_BlendJobs.push_back(bj); - return true; - } -} - - bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) { + if(!e.RootNode.Valid()) { return false; } @@ -320,108 +156,80 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) return false; } - if (e.AnimationEntity.Valid()) { - AutoBlendJob abj; - abj.RootNode = e.RootNode; - abj.CurrentTime = 0.0; - abj.Duration = e.Duration; - abj.Delay = e.Delay; + Model* model; + try { + model = ResourceManager::Load<::Model, true>((std::string)e.RootNode["Model"]["Resource"]); + } catch (const std::exception&) { + return false; + } - BlendTree::AutoBlendInfo abInfo; - abInfo.NodeName = e.NodeName; - abInfo.progress = 0.0; - abInfo.Restart = e.Restart; - abInfo.AnimationSpeed = e.AnimationSpeed; - abj.BlendInfo = abInfo; + Skeleton* skeleton = model->m_RawModel->m_Skeleton; + if (skeleton == nullptr) { + return false; + } - m_QueuedAutoBlendJobs[e.AnimationEntity] = abj; - return true; + std::shared_ptr blendTree; + if (skeleton->BlendTrees.find(e.RootNode) != skeleton->BlendTrees.end()) { + blendTree = skeleton->BlendTrees.at(e.RootNode); } else { - AutoBlendJob abj; - abj.RootNode = e.RootNode; - abj.CurrentTime = 0.0; - abj.Duration = e.Duration; - - BlendTree::AutoBlendInfo abInfo; - abInfo.NodeName = e.NodeName; - abInfo.progress = 0.0; - abInfo.Restart = e.Restart; - abInfo.AnimationSpeed = e.AnimationSpeed; - - abj.BlendInfo = abInfo; - - m_AutoBlendJobs.push_back(abj); - return true; + return false; } + + EntityWrapper subTreeRoot = blendTree->GetSubTreeRoot(e.NodeName); + + if(!subTreeRoot.Valid()) { + return false; + } + + AutoBlendQueue::AutoBlendJob abj; + abj.AnimationEntity = e.AnimationEntity; + abj.CurrentTime = 0.0; + abj.Delay = e.Delay; + abj.Duration = e.Duration; + abj.RootNode = e.RootNode; + + abj.BlendInfo.NodeName = e.NodeName; + abj.BlendInfo.progress = 0.0; + abj.BlendInfo.Start = e.Start; + + if (e.Restart) { + EntityWrapper nodeEntity = subTreeRoot.FirstChildByName(e.NodeName); + if (nodeEntity.Valid()) { + if (nodeEntity.HasComponent("Animation")) { + const Skeleton::Animation* animation = skeleton->GetAnimation(nodeEntity["Animation"]["AnimationName"]); + + if (animation != nullptr) { + if (e.Restart) { + (bool&)nodeEntity["Animation"]["Reverse"] = e.Reverse; + if (e.Reverse) { + (double&)nodeEntity["Animation"]["Time"] = animation->Duration; + } else { + (double&)nodeEntity["Animation"]["Time"] = 0.0; + } + } + } + } + } + } + + + LOG_INFO("Inserting %s blendJob into %s subtree", e.NodeName.c_str(), subTreeRoot.Name().c_str()); + m_AutoBlendQueues[subTreeRoot].Insert(abj); + + LOG_INFO("\n"); + m_AutoBlendQueues.at(subTreeRoot).PrintQueue(); + LOG_INFO("\n"); + + + return true; } bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) { if (e.Value == 1.f) { - if (e.Command == "BlendTest0") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - - - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - Events::AutoAnimationBlend aeb; - aeb.Duration = m_BlendTime1; - aeb.NodeName = m_AnimationName1; - aeb.RootNode = entity; - aeb.Restart = true; - - m_EventBroker->Publish(aeb); - - } - } - - } else if (e.Command == "BlendTest1") { - - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - - - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - - { - Events::AutoAnimationBlend aeb; - aeb.Duration = m_BlendTime2; - aeb.NodeName = m_AnimationName2; - aeb.RootNode = entity; - aeb.Restart = true; - m_EventBroker->Publish(aeb); - } - - { - Events::AutoAnimationBlend aeb; - aeb.Duration = m_BlendTime2; - aeb.NodeName = "Run"; - aeb.RootNode = entity; - aeb.Restart = true; - aeb.AnimationEntity = entity.FirstChildByName("DashLeft"); - m_EventBroker->Publish(aeb); - } - - } - } - } - - if(e.Command == "DashForward") { auto blendComponents = m_World->GetComponents("BlendAdditive"); @@ -434,19 +242,21 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) if (entity.Name() == "Assault") { { Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; + aeb.Duration = 0.2; aeb.NodeName = "DashForward"; aeb.RootNode = entity; aeb.Restart = true; + aeb.Start = true; m_EventBroker->Publish(aeb); } { Events::AutoAnimationBlend aeb; aeb.Duration = 0.3; - aeb.NodeName = "Run"; + aeb.NodeName = "StandCrouchBlend"; aeb.RootNode = entity; - aeb.Restart = true; - aeb.Delay = 0; + aeb.Delay = -0.3; + aeb.Start = true; + aeb.Restart = false; aeb.AnimationEntity = entity.FirstChildByName("DashForward"); m_EventBroker->Publish(aeb); } @@ -469,14 +279,16 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) aeb.NodeName = "DashBackward"; aeb.RootNode = entity; aeb.Restart = true; + aeb.Start = true; m_EventBroker->Publish(aeb); } { Events::AutoAnimationBlend aeb; aeb.Duration = 0.3; - aeb.NodeName = "Run"; + aeb.NodeName = "StandCrouchBlend"; aeb.RootNode = entity; - aeb.Restart = true; + aeb.Start = true; + aeb.Restart = false; aeb.Delay = -0.3; aeb.AnimationEntity = entity.FirstChildByName("DashBackward"); m_EventBroker->Publish(aeb); @@ -499,15 +311,17 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) aeb.NodeName = "DashLeft"; aeb.RootNode = entity; aeb.Restart = true; + aeb.Start = true; m_EventBroker->Publish(aeb); } { Events::AutoAnimationBlend aeb; aeb.Duration = 0.3; - aeb.NodeName = "Run"; + aeb.NodeName = "StandCrouchBlend"; aeb.RootNode = entity; - aeb.Restart = true; aeb.Delay = -0.3; + aeb.Start = true; + aeb.Restart = false; aeb.AnimationEntity = entity.FirstChildByName("DashLeft"); m_EventBroker->Publish(aeb); } @@ -529,14 +343,16 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) aeb.NodeName = "DashRight"; aeb.RootNode = entity; aeb.Restart = true; + aeb.Start = true; m_EventBroker->Publish(aeb); } { Events::AutoAnimationBlend aeb; aeb.Duration = 0.3; - aeb.NodeName = "Run"; + aeb.NodeName = "StandCrouchBlend"; aeb.RootNode = entity; - aeb.Restart = true; + aeb.Start = true; + aeb.Restart = false; aeb.AnimationEntity = entity.FirstChildByName("DashRight"); aeb.Delay = -0.3; m_EventBroker->Publish(aeb); @@ -558,20 +374,128 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) aeb.Duration = 0.35; aeb.NodeName = "Jump"; aeb.RootNode = entity; + aeb.Start = true; aeb.Restart = true; m_EventBroker->Publish(aeb); } { Events::AutoAnimationBlend aeb; - aeb.Duration = 0.35; - aeb.NodeName = "Run"; + aeb.Duration = 0.6; + aeb.NodeName = "StandCrouchBlend"; aeb.RootNode = entity; + aeb.Start = true; aeb.Restart = false; aeb.AnimationEntity = entity.FirstChildByName("Jump"); m_EventBroker->Publish(aeb); } } } + } else if (e.Command == "Reload") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.2; + aeb.NodeName = "ReloadSwitch"; + aeb.RootNode = entity; + aeb.Start = true; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.2; + aeb.NodeName = "IdlePrimary"; + aeb.RootNode = entity; + aeb.Delay = -0.1; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = entity.FirstChildByName("ReloadSwitch"); + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Command == "Crouch") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "CrouchMovement"; + aeb.RootNode = entity; + aeb.Start = true; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Command == "Stand") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "StandMovement"; + aeb.RootNode = entity; + aeb.Start = true; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Command == "Shoot") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "ShootPrimary"; + aeb.RootNode = entity; + aeb.Start = true; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "IdlePrimary"; + aeb.RootNode = entity; + aeb.Delay = 0.0; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = entity.FirstChildByName("ShootPrimary"); + m_EventBroker->Publish(aeb); + } + } + } } diff --git a/src/Engine/Rendering/AutoBlendQueue.cpp b/src/Engine/Rendering/AutoBlendQueue.cpp index e69de29b..9f0a7366 100644 --- a/src/Engine/Rendering/AutoBlendQueue.cpp +++ b/src/Engine/Rendering/AutoBlendQueue.cpp @@ -0,0 +1,195 @@ +#include "Rendering/AutoBlendQueue.h" + +void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob) +{ + if(!autoBlendJob.RootNode.HasComponent("Model")) { + return; + } + + AutoblendNode blendNode; + blendNode.BlendJob = autoBlendJob; + blendNode.StartTime = autoBlendJob.Delay; + blendNode.EndTime = autoBlendJob.Delay + autoBlendJob.Duration; + + + + if (autoBlendJob.AnimationEntity.Valid()) { + if (autoBlendJob.AnimationEntity.HasComponent("Animation")) { + Model* model; + try { + model = ResourceManager::Load<::Model, true>((std::string)autoBlendJob.RootNode["Model"]["Resource"]); + } catch (const std::exception&) { + return; + } + + Skeleton* skeleton = model->m_RawModel->m_Skeleton; + if (skeleton == nullptr) { + return; + } + + const Skeleton::Animation* animation = skeleton->GetAnimation((std::string)autoBlendJob.AnimationEntity["Animation"]["AnimationName"]); + + if (animation == nullptr) { + return; + } + + double AnimationDuration = 0.0; + + double animationSpeed = (double)autoBlendJob.AnimationEntity["Animation"]["Speed"]; + double animationTime = (double)autoBlendJob.AnimationEntity["Animation"]["Time"]; + + + if ((bool)autoBlendJob.AnimationEntity["Animation"]["Reverse"]) { + AnimationDuration = (animation->Duration * animationSpeed) - (animation->Duration - animationTime); + } else { + AnimationDuration = (animation->Duration * animationSpeed) - animationTime; + } + + LOG_INFO("Animation Duration %f", AnimationDuration); + blendNode.StartTime += AnimationDuration; + blendNode.EndTime += AnimationDuration; + if (m_BlendQueue.size() == 0) { + m_BlendQueue.push_back(blendNode); + } else { + for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end(); it++) { + auto next = std::next(it, 1); + + if (next != m_BlendQueue.end()) { + if (it->StartTime >= blendNode.StartTime && next->StartTime <= blendNode.StartTime) { + LOG_INFO("Inserted %s between %s and %s", blendNode.BlendJob.BlendInfo.NodeName.c_str(), it->BlendJob.BlendInfo.NodeName.c_str(), next->BlendJob.BlendInfo.NodeName.c_str()); + m_BlendQueue.insert(next, blendNode); + return; + } + } else if(it->StartTime > blendNode.StartTime){ + LOG_INFO("Inserted %s after %s", blendNode.BlendJob.BlendInfo.NodeName.c_str(), it->BlendJob.BlendInfo.NodeName.c_str()); + m_BlendQueue.push_front(blendNode); + return; + } else if (it->StartTime <= blendNode.StartTime) { + LOG_INFO("Inserted %s after %s", blendNode.BlendJob.BlendInfo.NodeName.c_str(), it->BlendJob.BlendInfo.NodeName.c_str()); + m_BlendQueue.push_back(blendNode); + return; + } + } + } + } + } + + + LOG_INFO("Cleared BlendQueue and inserted %s", blendNode.BlendJob.BlendInfo.NodeName.c_str()); + m_BlendQueue.clear(); + m_BlendQueue.push_back(blendNode); +} + +void AutoBlendQueue::UpdateTime(double dt) +{ + for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end();) { + it->EndTime -= dt; + it->StartTime -= dt; + if (it->EndTime < 0) { + it = m_BlendQueue.erase(it); + } else { + it++; + } + } +} + +void AutoBlendQueue::PrintQueue() +{ + for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end(); it++) { + LOG_INFO("Start: %f End: %f \t %s", it->StartTime, it->EndTime, it->BlendJob.BlendInfo.NodeName.c_str()); + } +} + + +bool AutoBlendQueue::HasActiveBlendJob() +{ + if(m_BlendQueue.empty()) { + return false; + } else { + AutoblendNode blendNode = m_BlendQueue.front(); + if (blendNode.StartTime <= 0) { + AutoBlendJob blendJob = blendNode.BlendJob; + + if (!blendJob.RootNode.Valid()) { + m_BlendQueue.pop_front(); + return false; + } + + if (!blendJob.RootNode.HasComponent("Model")) { + m_BlendQueue.pop_front(); + return HasActiveBlendJob(); + } + + Model* model; + try { + model = ResourceManager::Load<::Model, true>(blendJob.RootNode["Model"]["Resource"]); + } catch (const std::exception&) { + m_BlendQueue.pop_front(); + return HasActiveBlendJob(); + } + + Skeleton* skeleton = model->m_RawModel->m_Skeleton; + if (skeleton == nullptr) { + m_BlendQueue.pop_front(); + return HasActiveBlendJob(); + } + + + if (skeleton->BlendTrees.find(blendJob.RootNode) != skeleton->BlendTrees.end()) { + return true; + } else { + m_BlendQueue.pop_front(); + return HasActiveBlendJob(); + } + + + } else { + return false; + } + } +} + + +std::shared_ptr AutoBlendQueue::GetBlendTree() +{ + AutoblendNode blendNode = m_BlendQueue.front(); + AutoBlendJob blendJob = blendNode.BlendJob; + + if (!blendJob.RootNode.Valid()) { + m_BlendQueue.pop_front(); + return false; + } + + if (!blendJob.RootNode.HasComponent("Model")) { + return nullptr; + } + + Model* model; + try { + model = ResourceManager::Load<::Model, true>(blendJob.RootNode["Model"]["Resource"]); + } catch (const std::exception&) { + return nullptr; + } + + Skeleton* skeleton = model->m_RawModel->m_Skeleton; + if (skeleton == nullptr) { + return nullptr; + } + + + if (skeleton->BlendTrees.find(blendJob.RootNode) != skeleton->BlendTrees.end()) { + return skeleton->BlendTrees.at(blendJob.RootNode); + } else { + return nullptr; + } + + + +} + +AutoBlendQueue::AutoBlendJob& AutoBlendQueue::GetActiveBlendJob() +{ + AutoblendNode& blendNode = m_BlendQueue.front(); + blendNode.BlendJob.CurrentTime = -blendNode.StartTime; + return blendNode.BlendJob; +} diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index f7381d4d..036c3f49 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -51,8 +51,6 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) } m_FinalPose = AccumulateFinalPose(); - - // PrintTree(); } @@ -207,18 +205,16 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) { std::vector goalNodes = FindNodesByName(blendInfo.NodeName); - if (blendInfo.Restart) { + if (blendInfo.Start) { for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) { EntityWrapper entity = (*it)->Entity; if (entity.Valid()) { if (entity.HasComponent("Animation")) { - (double&)entity["Animation"]["Time"] = 0.0; - (double&)entity["Animation"]["Speed"] = blendInfo.AnimationSpeed; + (bool&)entity["Animation"]["Play"] = true; } } } - blendInfo.Restart = false; } @@ -230,8 +226,6 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) while (currentNode != nullptr) { - - if(!currentNode->Entity.HasComponent("Blend")) { return blendInfo; } @@ -267,6 +261,91 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) return blendInfo; } + +BlendTree::Node* BlendTree::GetCommonParent(std::string NodeName1, std::string NodeName2) +{ + std::vector nodes1 = FindNodesByName(NodeName1); + std::vector nodes2 = FindNodesByName(NodeName2); + + for (auto it = nodes1.begin(); it != nodes1.end(); it++) { + auto next = std::next(it, 1); + + if(next != nodes1.end()) { + Node* commonParent = FirstCommonParent((*it), (*next)); + (*next) = commonParent; + nodes1.erase(it); + it = nodes1.begin(); + } + } + + for (auto it = nodes2.begin(); it != nodes2.end(); it++) { + auto next = std::next(it, 1); + + if (next != nodes2.end()) { + Node* commonParent = FirstCommonParent((*it), (*next)); + (*next) = commonParent; + nodes2.erase(it); + it = nodes2.begin(); + } + } + + return FirstCommonParent(nodes1.front(), nodes2.front());; +} + + +BlendTree::Node* BlendTree::FirstCommonParent(Node* node1, Node* node2) +{ + std::list node1Parents; + + Node* currentNode = node1; + while (currentNode != nullptr) { + node1Parents.push_back(currentNode); + currentNode = currentNode->Parent; + } + + currentNode = node2; + while (currentNode != nullptr) { + for (auto it = node1Parents.begin(); it != node1Parents.end(); it++) { + if (currentNode == (*it)) { + return currentNode; + } + } + currentNode = currentNode->Parent; + } + + return nullptr; +} + + +EntityWrapper BlendTree::GetSubTreeRoot(std::string nodeName) +{ + std::vector nodes = FindNodesByName(nodeName); + + std::vector subTreeRoots; + + for (auto it = nodes.begin(); it != nodes.end(); it++) { + Node* currentNode = (*it); + while (currentNode->Parent->Type == NodeType::Blend) { + currentNode = currentNode->Parent; + } + subTreeRoots.push_back(currentNode); + } + + + for (auto it = subTreeRoots.begin(); it != subTreeRoots.end(); it++) { + auto next = std::next(it, 1); + + if (next != subTreeRoots.end()) { + Node* commonParent = FirstCommonParent((*it), (*next)); + (*next) = commonParent; + subTreeRoots.erase(it); + it = subTreeRoots.begin(); + } + } + + return subTreeRoots.front()->Entity; +} + void BlendTree::Blend(std::map& pose) { Node* currentNode; From b2371f4a43a92991a79266805472be145dd295b8 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 20:00:42 +0100 Subject: [PATCH 36/94] Working AssaultWeapon --- .../Systems/Weapon/AssaultWeaponBehaviour.h | 51 +- .../Systems/Weapon/DefenderWeaponBehaviour.h | 7 +- .../Systems/Weapon/SidearmWeaponBehaviour.h | 7 +- resources/Schema/Components/AssaultWeapon.xml | 21 +- resources/Schema/Components/AssaultWeapon.xsd | 23 +- .../Schema/Components/DefenderWeapon.xml | 2 +- .../Schema/Components/DefenderWeapon.xsd | 2 +- resources/Schema/Components/SidearmWeapon.xml | 2 +- resources/Schema/Components/SidearmWeapon.xsd | 2 +- .../Schema/Entities/AssaultWeaponView.xml | 28 +- .../Schema/Entities/AssaultWeaponWorld.xml | 10 +- resources/Schema/Entities/Player.xml | 16 +- .../Entities/PlayerAssaultFallbackBlue.xml | 695 ++++++++++++++++++ resources/Schema/Entities/Ray2Red | 18 - resources/Schema/Entities/Ray2Red.xml | 43 -- resources/Schema/Entities/RayBlue | 17 - resources/Schema/Entities/RayBlue.xml | 44 +- resources/Schema/Entities/RayRed | 17 - resources/Schema/Entities/RayRed.xml | 20 - src/Game/Game.cpp | 2 + .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 228 ++++++ 21 files changed, 1061 insertions(+), 194 deletions(-) create mode 100644 resources/Schema/Entities/PlayerAssaultFallbackBlue.xml delete mode 100644 resources/Schema/Entities/Ray2Red delete mode 100644 resources/Schema/Entities/Ray2Red.xml delete mode 100644 resources/Schema/Entities/RayBlue delete mode 100644 resources/Schema/Entities/RayRed delete mode 100644 resources/Schema/Entities/RayRed.xml create mode 100644 src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp diff --git a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h index 993dd060..7244d443 100644 --- a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h @@ -1,47 +1,40 @@ #ifndef AssaultWeaponBehaviour_h__ #define AssaultWeaponBehaviour_h__ -#include "Sound/EPlaySoundOnEntity.h" -#include "Collision/Collision.h" -#include "Core/ConfigFile.h" #include "WeaponBehaviour.h" -#include "../SpawnerSystem.h" +#include "Collision/Collision.h" #include "Core/EPlayerDamage.h" -#include "Core/EShoot.h" +#include "Sound/EPlaySoundOnEntity.h" class AssaultWeaponBehaviour : public WeaponBehaviour { public: AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree* collisionOctree) - : WeaponBehaviour(systemParams, "AssaultWeapon", renderer, collisionOctree) + : System(systemParams) + , WeaponBehaviour(systemParams, "AssaultWeapon", renderer, collisionOctree) + , m_RandomEngine(m_RandomDevice()) { } -protected: - virtual void OnPrimaryFire(WeaponInfo& wi) override; - virtual void OnCeasePrimaryFire(WeaponInfo& wi) override; - virtual void OnReload(WeaponInfo& wi) override; + void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override; + void UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) override; + void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) override; + //bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) override; private: - // State - bool m_Firing = false; - bool m_Reloading = false; - double m_ReloadTimer = 0.0; - double m_TimeSinceLastFire = 0.0; - EntityWrapper m_FirstPersonReloadImpostor; + std::random_device m_RandomDevice; + std::mt19937 m_RandomEngine; - bool hasAmmo(); - void fireRound(); - void spawnTracer(); - float traceRayDistance(glm::vec3 origin, glm::vec3 direction); - void playFireSound(); - void playEmptySound(); - void viewPunch(); - void finishReload(); - void playShootAnimation(); - void playIdleAnimation(); - void playReloadAnimation(); - bool shoot(double damage); - void showHitMarker(); + // Weapon functions + void fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi); + //void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage); + bool canFire(ComponentWrapper cWeapon, WeaponInfo& wi); + bool dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi); + + // Utility + //Camera cameraFromEntity(EntityWrapper camera); }; #endif \ No newline at end of file diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index 77d579f8..9e7d4991 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -1,3 +1,6 @@ +#ifndef DefenderWeaponBehaviour_h__ +#define DefenderWeaponBehaviour_h__ + #include "WeaponBehaviour.h" #include "Collision/Collision.h" #include "Core/EPlayerDamage.h" @@ -31,4 +34,6 @@ private: // Utility Camera cameraFromEntity(EntityWrapper camera); -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h index d221b8bb..10e6105a 100644 --- a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h @@ -1,3 +1,6 @@ +#ifndef SidearmWeaponBehaviour_h__ +#define SidearmWeaponBehaviour_h__ + #include "WeaponBehaviour.h" #include "Collision/Collision.h" #include "Core/EPlayerDamage.h" @@ -30,4 +33,6 @@ private: bool canFire(ComponentWrapper cWeapon); bool playerInFirstPerson(EntityWrapper player); //float traceRayDistance(glm::vec3 origin, glm::vec3 direction); -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/resources/Schema/Components/AssaultWeapon.xml b/resources/Schema/Components/AssaultWeapon.xml index c835217b..ba74fbb7 100755 --- a/resources/Schema/Components/AssaultWeapon.xml +++ b/resources/Schema/Components/AssaultWeapon.xml @@ -1,12 +1,21 @@ + 32 32 - 360 - 360 - 5 - 120 - 0.01 + 320 + 320 + 15 + 0.174533 + 0.10 + 420 + 0.03 + 0.18 2 - + 0.5 + false + 0 + false + 0 + 0 \ No newline at end of file diff --git a/resources/Schema/Components/AssaultWeapon.xsd b/resources/Schema/Components/AssaultWeapon.xsd index 7e9854a2..a1e745de 100755 --- a/resources/Schema/Components/AssaultWeapon.xsd +++ b/resources/Schema/Components/AssaultWeapon.xsd @@ -7,6 +7,7 @@ + Ammo currently loaded into the magazine @@ -20,16 +21,32 @@ Maximum ammo able to be carried + + Spread angle in radians + + + Maximum vertical aim travel angle in radians + Rate of fire in rounds per minute - View punch in radians for each bullet fired + View punch in radians for each shell fired + + + The speed in radians per second the view returns to its original position after being punched - Time it takes to reload the weapon in seconds + Time it takes to load ONE SHELL into the weapon in seconds - + + Time it takes from selecting the weapon until it's ready to fire + + + + + + diff --git a/resources/Schema/Components/DefenderWeapon.xml b/resources/Schema/Components/DefenderWeapon.xml index 68b87759..b01955bc 100755 --- a/resources/Schema/Components/DefenderWeapon.xml +++ b/resources/Schema/Components/DefenderWeapon.xml @@ -1,5 +1,6 @@ + 8 8 64 @@ -12,7 +13,6 @@ 0.03 0.2 0.5 - false 0 false diff --git a/resources/Schema/Components/DefenderWeapon.xsd b/resources/Schema/Components/DefenderWeapon.xsd index d2b503f8..53200952 100755 --- a/resources/Schema/Components/DefenderWeapon.xsd +++ b/resources/Schema/Components/DefenderWeapon.xsd @@ -19,6 +19,7 @@ + Ammo currently loaded into the magazine @@ -53,7 +54,6 @@ Time it takes to load ONE SHELL into the weapon in seconds - diff --git a/resources/Schema/Components/SidearmWeapon.xml b/resources/Schema/Components/SidearmWeapon.xml index 1d503ecc..bc90c067 100644 --- a/resources/Schema/Components/SidearmWeapon.xml +++ b/resources/Schema/Components/SidearmWeapon.xml @@ -1,5 +1,6 @@ + 16 16 20 @@ -8,7 +9,6 @@ 0.01 0.5 0.5 - false 0 false diff --git a/resources/Schema/Components/SidearmWeapon.xsd b/resources/Schema/Components/SidearmWeapon.xsd index bafb9de2..514bf354 100644 --- a/resources/Schema/Components/SidearmWeapon.xsd +++ b/resources/Schema/Components/SidearmWeapon.xsd @@ -19,6 +19,7 @@ + Ammo currently loaded into the magazine @@ -41,7 +42,6 @@ Time it takes from selecting the weapon until it's ready to fire - diff --git a/resources/Schema/Entities/AssaultWeaponView.xml b/resources/Schema/Entities/AssaultWeaponView.xml index 4b985fbb..b5c87674 100755 --- a/resources/Schema/Entities/AssaultWeaponView.xml +++ b/resources/Schema/Entities/AssaultWeaponView.xml @@ -1,17 +1,11 @@ - + - - R_Arm_Weapon_Joint - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - + @@ -21,7 +15,8 @@ Schema/Entities/RayBlue.xml - + + @@ -37,9 +32,8 @@ - - + @@ -70,6 +64,11 @@ Fonts/DroidSans.ttf,64 + + Player + AssaultWeapon + MagazineAmmo + @@ -79,10 +78,15 @@ - 360 + 320 Fonts/DroidSans.ttf,64 + + Player + AssaultWeapon + Ammo + diff --git a/resources/Schema/Entities/AssaultWeaponWorld.xml b/resources/Schema/Entities/AssaultWeaponWorld.xml index 6fcb97b3..9f33c8f2 100755 --- a/resources/Schema/Entities/AssaultWeaponWorld.xml +++ b/resources/Schema/Entities/AssaultWeaponWorld.xml @@ -1,17 +1,11 @@ - + - - R_Arm_Weapon_Joint - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 1ee9d5d3..affe9f79 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -6,10 +6,14 @@ + + + + + - + - @@ -470,10 +474,10 @@ R_Arm_Weapon_Joint - DefenderWeapon + AssaultWeapon - Schema/Entities/DefenderWeaponView.xml + Schema/Entities/AssaultWeaponView.xml @@ -545,13 +549,13 @@ - DefenderWeapon + AssaultWeapon - Schema/Entities/DefenderWeaponWorld.xml + Schema/Entities/AssaultWeaponWorld.xml diff --git a/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml b/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml new file mode 100644 index 00000000..bb6367f8 --- /dev/null +++ b/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml @@ -0,0 +1,695 @@ + + + + + + + + + + + + + + + + + + 5 + + + + + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + + + + + + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + + + + + + + + Textures/Weapons/Crosshair/SmallThickHoleDot.png + + false + + + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + + + + + 1 + + + + + Textures/HealthHUD3.png + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 2 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 3 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 4 + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/Arrow5.mesh + + + + + + + + + + + + + + + + + + + + Idle + 1.8348644854054612 + 1 + + + + + Models/Characters/Assault/Test/FirstPerson.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + Schema/Entities/AssaultWeaponView.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + Schema/Entities/SidearmWeaponView.xml + + + + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + IdleF + 1 + + + + + AimRifle + + + + + + Models/Characters/Assault/AssaultBlue.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/AssaultWeaponWorld.xml + + + + + + + + + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + Schema/Entities/RayBlue.xml + + + + + + + + + + + Schema/Entities/ReloadEffectWorld.xml + + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + Insert name here + Fonts/DroidSans.ttf,100 + + + + + + + + + + + + + + Textures/Icons/Arrow.png + + false + + + + + 50 + true + + + + + + + + + + + + Schema/Entities/DefenderShield.xml + + + + + + + + + + diff --git a/resources/Schema/Entities/Ray2Red b/resources/Schema/Entities/Ray2Red deleted file mode 100644 index 813443b2..00000000 --- a/resources/Schema/Entities/Ray2Red +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - Textures/Effects/Ray.png - - - - - - - - - - - - diff --git a/resources/Schema/Entities/Ray2Red.xml b/resources/Schema/Entities/Ray2Red.xml deleted file mode 100644 index 6c7c3248..00000000 --- a/resources/Schema/Entities/Ray2Red.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - Textures/Effects/Ray.png - - - - - - - - - - - - - - - Textures/Effects/Ray.png - - - - - - - - - - - - - - diff --git a/resources/Schema/Entities/RayBlue b/resources/Schema/Entities/RayBlue deleted file mode 100644 index d34e185e..00000000 --- a/resources/Schema/Entities/RayBlue +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Models/Core/UnitCylinder.mesh - - - - - - - - - - - diff --git a/resources/Schema/Entities/RayBlue.xml b/resources/Schema/Entities/RayBlue.xml index 022d7769..0ad0ddf0 100644 --- a/resources/Schema/Entities/RayBlue.xml +++ b/resources/Schema/Entities/RayBlue.xml @@ -1,20 +1,46 @@ - + - 0.25 + 0.10000000149011612 - - Models/Effects/CylinderShot.mesh - - true - - + - + + + + + Textures/Effects/Ray.png + + + + + + + + + + + + + + + Textures/Effects/Ray.png + + + + + + + + + + + + diff --git a/resources/Schema/Entities/RayRed b/resources/Schema/Entities/RayRed deleted file mode 100644 index d34e185e..00000000 --- a/resources/Schema/Entities/RayRed +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Models/Core/UnitCylinder.mesh - - - - - - - - - - - diff --git a/resources/Schema/Entities/RayRed.xml b/resources/Schema/Entities/RayRed.xml deleted file mode 100644 index 0a20f148..00000000 --- a/resources/Schema/Entities/RayRed.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - 0.25 - - - Models/Effects/CylinderShot.mesh - - true - - - - - - - - - diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 10107ab1..9ebb28eb 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -18,6 +18,7 @@ #include "Game/Systems/PickupSpawnSystem.h" #include "Game/Systems/AmmoPickupSystem.h" #include "Game/Systems/DamageIndicatorSystem.h" +#include "Game/Systems/Weapon/AssaultWeaponBehaviour.h" #include "Game/Systems/Weapon/DefenderWeaponBehaviour.h" #include "Game/Systems/Weapon/SidearmWeaponBehaviour.h" #include "Rendering/AnimationSystem.h" @@ -128,6 +129,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); + m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer, m_OctreeCollision); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer, m_OctreeCollision); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer, m_OctreeCollision); m_SystemPipeline->AddSystem(updateOrderLevel); diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp new file mode 100644 index 00000000..c982637b --- /dev/null +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -0,0 +1,228 @@ +#include "Systems/Weapon/AssaultWeaponBehaviour.h" + +void AssaultWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) +{ + double& fireCooldown = cWeapon["FireCooldown"]; + fireCooldown = glm::max(0.0, fireCooldown - dt); + + WeaponBehaviour::UpdateComponent(entity, cWeapon, dt); +} + +void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) +{ + // Decrement reload timer + double& reloadTimer = cWeapon["ReloadTimer"]; + reloadTimer = glm::max(0.0, reloadTimer - dt); + + // Start reloading automatically if at 0 mag ammo + int& magAmmo = cWeapon["MagazineAmmo"]; + if (m_ConfigAutoReload && magAmmo <= 0) { + OnReload(cWeapon, wi); + } + + // Handle reloading + bool& isReloading = cWeapon["IsReloading"]; + if (isReloading && reloadTimer <= 0.0) { + int& magSize = cWeapon["MagazineSize"]; + int& ammo = cWeapon["Ammo"]; + + ammo = glm::max(0, ammo - (magSize - magAmmo)); + magAmmo = glm::min(magSize, ammo); + isReloading = false; + } + + // Restore view angle + if (IsClient) { + float& currentTravel = cWeapon["CurrentTravel"]; + float& returnSpeed = cWeapon["ViewReturnSpeed"]; + if (currentTravel > 0) { + float change = returnSpeed * dt; + currentTravel = glm::max(0.f, currentTravel - change); + EntityWrapper camera = wi.Player.FirstChildByName("Camera"); + if (camera.Valid()) { + glm::vec3& cameraOrientation = camera["Transform"]["Orientation"]; + cameraOrientation.x -= change; + } + } + } + + // Fire if we're able to fire + if (canFire(cWeapon, wi)) { + fireBullet(cWeapon, wi); + } +} + +void AssaultWeaponBehaviour::OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + cWeapon["TriggerHeld"] = true; + if (canFire(cWeapon, wi)) { + fireBullet(cWeapon, wi); + } +} + +void AssaultWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + cWeapon["TriggerHeld"] = false; +} + +void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + bool& isReloading = cWeapon["IsReloading"]; + if (isReloading) { + return; + } + + int& magAmmo = cWeapon["MagazineAmmo"]; + int& magSize = cWeapon["MagazineSize"]; + if (magAmmo >= magSize) { + return; + } + int& ammo = cWeapon["Ammo"]; + if (ammo <= 0) { + return; + } + + double reloadTime = cWeapon["ReloadTime"]; + double& reloadTimer = cWeapon["ReloadTimer"]; + + // Start reload + isReloading = true; + reloadTimer = reloadTime; +} + +void AssaultWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + // Make sure the trigger is released if weapon is holstered while firing + cWeapon["TriggerHeld"] = false; + + // Cancel any reload + cWeapon["IsReloading"] = false; + cWeapon["ReloadTimer"] = 0.0; +} + +void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"]; + + // Ammo + int& magAmmo = cWeapon["MagazineAmmo"]; + if (magAmmo <= 0) { + return; + } else { + magAmmo -= 1; + } + + // View punch + if (IsClient) { + EntityWrapper camera = wi.Player.FirstChildByName("Camera"); + if (camera.Valid()) { + glm::vec3& cameraOrientation = camera["Transform"]["Orientation"]; + float viewPunch = cWeapon["ViewPunch"]; + float maxTravelAngle = cWeapon["MaxTravelAngle"]; + float& currentTravel = cWeapon["CurrentTravel"]; + if (currentTravel < maxTravelAngle) { + float change = viewPunch; + if (currentTravel + change > maxTravelAngle) { + change = maxTravelAngle - currentTravel; + } + cameraOrientation.x += change; + currentTravel += change; + } + } + } + + // Get weapon model based on current person + EntityWrapper weaponModelEntity = getRelevantWeaponModelEntity(wi); + if (!weaponModelEntity.Valid()) { + return; + } + + // Tracer + EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzle"); + if (tracerSpawner.Valid()) { + glm::vec3 origin = Transform::AbsolutePosition(tracerSpawner); + glm::vec3 direction = glm::quat(Transform::AbsoluteOrientationEuler(tracerSpawner)) * glm::vec3(0, 0, -1); + float distance = traceRayDistance(origin, direction); + EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner); + if (ray.Valid()) { + ((glm::vec3&)ray["Transform"]["Scale"]).z = distance; + } + } + + // Deal damage + if (dealDamage(cWeapon, wi)) { + // Show hit marker + EntityWrapper hitMarkerSpawner = wi.Player.FirstChildByName("HitMarkerSpawner"); + if (hitMarkerSpawner.Valid()) { + SpawnerSystem::Spawn(hitMarkerSpawner, hitMarkerSpawner); + Events::PlaySoundOnEntity e; + e.EmitterID = wi.Player.ID; + e.FilePath = "Audio/weapon/hitclick.wav"; + m_EventBroker->Publish(e); + } + } +} + +bool AssaultWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + bool triggerHeld = cWeapon["TriggerHeld"]; + bool cooldownPassed = (double)cWeapon["FireCooldown"] <= 0.0; + bool isReloading = cWeapon["IsReloading"]; + return triggerHeld && cooldownPassed; +} + +bool AssaultWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + // Only deal damage client side + if (!IsClient) { + return false; + } + + // Only handle damage for the local player + if (wi.Player != LocalPlayer) { + return false; + } + + // Make sure the player isn't shooting from the grave + if (!wi.Player.Valid()) { + return false; + } + + // 3D-pick middle of screen + Rectangle viewport = m_Renderer->GetViewportSize(); + glm::vec2 centerScreen(viewport.Width / 2, viewport.Height / 2); + // TODO: Some horizontal spread + PickData pickData = m_Renderer->Pick(centerScreen); + EntityWrapper victim(m_World, pickData.Entity); + if (!victim.Valid()) { + return false; + } + + // Don't let us somehow shoot ourselves in the foot + if (victim == LocalPlayer) { + return false; + } + + // Only care about players being hit + if (!victim.HasComponent("Player")) { + victim = victim.FirstParentWithComponent("Player"); + } + if (!victim.Valid()) { + return false; + } + + double damage = cWeapon["BaseDamage"]; + // If friendly fire, reduce damage to 0 (needed to make Boosts, Ammosharing work) + if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) { + damage = 0; + } + + // Deal damage! + Events::PlayerDamage ePlayerDamage; + ePlayerDamage.Inflictor = wi.Player; + ePlayerDamage.Victim = victim; + ePlayerDamage.Damage = damage; + m_EventBroker->Publish(ePlayerDamage); + + return damage > 0; +} From cbb2ec2fd66efbd394f153faa6e95503c24daa57 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Tue, 2 Feb 2016 20:50:46 +0100 Subject: [PATCH 37/94] Unique ids for entity nodes in the editor to prevent weird behaviour when multiple entities have the same name --- src/Engine/Editor/EditorGUI.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Engine/Editor/EditorGUI.cpp b/src/Engine/Editor/EditorGUI.cpp index 4e7c8ab6..7435bca8 100644 --- a/src/Engine/Editor/EditorGUI.cpp +++ b/src/Engine/Editor/EditorGUI.cpp @@ -157,7 +157,7 @@ void EditorGUI::drawEntitiesRecursive(World* world, EntityID parent) auto entityChildren = world->GetEntityChildren(); auto range = entityChildren.equal_range(parent); for (auto it = range.first; it != range.second; it++) { - if (EditorGUI::drawEntityNode(EntityWrapper(world, it->second))) { + if (drawEntityNode(EntityWrapper(world, it->second))) { drawEntitiesRecursive(world, it->second); ImGui::TreePop(); } @@ -217,6 +217,7 @@ bool EditorGUI::drawEntityNode(EntityWrapper entity) ImGui::EndPopup(); } + ImGui::PushID(("EntityNode" + std::to_string(entity.ID)).c_str()); ImGui::SetNextTreeNodeOpened(true, ImGuiSetCond_Once); if (ImGui::TreeNode(formatEntityName(entity).c_str())) { // Handle drop events for reparenting @@ -224,8 +225,10 @@ bool EditorGUI::drawEntityNode(EntityWrapper entity) entityChangeParent(m_CurrentlyDragging, entity); m_CurrentlyDragging = EntityWrapper::Invalid; } + ImGui::PopID(); return true; } else { + ImGui::PopID(); return false; } } From c0e160833c03a4cbb4d0aa0d73524ecdab4fe2ae Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 20:39:21 +0100 Subject: [PATCH 38/94] Playtest 2 Fallback Map --- .../Entities/Maps/Playtest2-Fallback.xml | 8813 +++++++++++++++++ 1 file changed, 8813 insertions(+) create mode 100644 resources/Schema/Entities/Maps/Playtest2-Fallback.xml diff --git a/resources/Schema/Entities/Maps/Playtest2-Fallback.xml b/resources/Schema/Entities/Maps/Playtest2-Fallback.xml new file mode 100644 index 00000000..8217ab45 --- /dev/null +++ b/resources/Schema/Entities/Maps/Playtest2-Fallback.xml @@ -0,0 +1,8813 @@ + + + + + + + + + + + + + + + + + + 2 + Models/Props/GroundTest.mesh + + + + + + + + + Models/Props/Walls/SciFiWallTop.mesh + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + true + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall1.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall2.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallSmall3.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall4.mesh + + + + + + + + + + + + Models/Props/Highground1.mesh + + + + + + + + + + Models/Props/Highground2.mesh + + + + + + + + + + + Models/Props/Highground3.mesh + + + + + + + + + + + Models/Highgrounds/Highground24.mesh + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg25.mesh + + + + + + + + + + + + Models/Highgrounds/Hg26.mesh + + + + + + + + + + + + Models/Highgrounds/Hg9.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg4.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Highground12.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg16.mesh + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + Models/Highgrounds/Hg14.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + Models/Highgrounds/Hg11.mesh + + + + + + + + + + + + Models/Highgrounds/Hg20.mesh + + + + + + + + + + + + Models/Highgrounds/Hg18.mesh + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg7.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + + + Models/Props/Highground1.mesh + + + + + + + + + + + + Models/Props/Highground2.mesh + + + + + + + + + + + + + Models/Props/Highground3.mesh + + + + + + + + + + + + + Models/Highgrounds/Highground1.mesh + + + + + + + + + + + Models/Highgrounds/Highground2.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg1.mesh + + + + + + + + + + + Models/Highgrounds/Hg2.mesh + + + + + + + + + + + + + + Models/Highgrounds/Highground5.mesh + + + + + + + + + + + + Models/Highgrounds/Hg7.mesh + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + Models/Highgrounds/Hg18.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg20.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg6.mesh + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + Models/Highgrounds/Hg4.mesh + + + + + + + + + + + + Models/Highgrounds/Hg16.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg9.mesh + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + + + Models/Highgrounds/Highground22.mesh + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg21.mesh + + + + + + + + + + + + Models/Highgrounds/Hg11.mesh + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + + + Models/Highgrounds/Hg28.mesh + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + Models/Highgrounds/Hg23.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg23.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg28.mesh + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 2 + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/smallWall3.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + + + + 10 + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 3 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 15 + 1 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointBlue.mesh + + + + + + + + + + -15 + + + + 4 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 15 + 2 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointRed.mesh + + + + + + + + + + 15 + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/PlayerAssaultFallbackBlue.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + + + Schema/Entities/PlayerAssaultFallbackBlue.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + + + From 00c585de3cb762aa1e8e92ed26e555631feb226b Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 20:45:16 +0100 Subject: [PATCH 39/94] Score should now track to all clients --- include/Game/Systems/ScoreScreenSystem.h | 1 + resources/Schema/Components/ScoreScreen.xml | 1 + resources/Schema/Components/ScoreScreen.xsd | 3 + resources/Schema/Entities/CP_Rocky.xml | 2278 ++++++++++--------- resources/Schema/Entities/ScoreBoard.xml | 107 + src/Engine/Network/Server.cpp | 10 +- src/Game/Systems/ScoreScreenSystem.cpp | 32 +- 7 files changed, 1309 insertions(+), 1123 deletions(-) create mode 100644 resources/Schema/Entities/ScoreBoard.xml diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h index a33d4684..7a1d0cae 100644 --- a/include/Game/Systems/ScoreScreenSystem.h +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -34,6 +34,7 @@ private: EntityWrapper Player = EntityWrapper::Invalid; }; + std::vector m_DisconnectedIdentities; int m_PlayerCounter = 0; std::unordered_map m_PlayerIdentities; }; diff --git a/resources/Schema/Components/ScoreScreen.xml b/resources/Schema/Components/ScoreScreen.xml index 65d84aa6..d3571d07 100644 --- a/resources/Schema/Components/ScoreScreen.xml +++ b/resources/Schema/Components/ScoreScreen.xml @@ -2,4 +2,5 @@ 0 0 + \ No newline at end of file diff --git a/resources/Schema/Components/ScoreScreen.xsd b/resources/Schema/Components/ScoreScreen.xsd index c8d3fa59..fb285813 100644 --- a/resources/Schema/Components/ScoreScreen.xsd +++ b/resources/Schema/Components/ScoreScreen.xsd @@ -11,6 +11,9 @@ Where the next scoreIdentity should be placed. + + How much offset should be applied per position + diff --git a/resources/Schema/Entities/CP_Rocky.xml b/resources/Schema/Entities/CP_Rocky.xml index a6f6302d..a0ae548f 100644 --- a/resources/Schema/Entities/CP_Rocky.xml +++ b/resources/Schema/Entities/CP_Rocky.xml @@ -112,61 +112,111 @@ - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -629,6 +679,49 @@ + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 2 + + + + + + + + + @@ -673,17 +766,6 @@ - - - - - - - - - - - @@ -707,23 +789,19 @@ + + + + + + + + + + + - - - - - 5 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - @@ -739,34 +817,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - 2 - - - - - - - - - @@ -858,11 +908,11 @@ 2 - + - + @@ -879,7 +929,7 @@ - + @@ -905,11 +955,11 @@ 2 - + - + @@ -926,7 +976,7 @@ - + @@ -952,11 +1002,11 @@ 2 - + - + @@ -973,7 +1023,7 @@ - + @@ -999,11 +1049,11 @@ 2 - + - + @@ -1020,7 +1070,7 @@ - + @@ -1046,11 +1096,11 @@ 2 - + - + @@ -1067,7 +1117,7 @@ - + @@ -1093,11 +1143,11 @@ 2 - + - + @@ -1114,7 +1164,7 @@ - + @@ -1140,11 +1190,11 @@ 2 - + - + @@ -1161,7 +1211,7 @@ - + @@ -2409,11 +2459,11 @@ 2 - + - + @@ -2430,7 +2480,7 @@ - + @@ -2456,11 +2506,11 @@ 2 - + - + @@ -2477,7 +2527,7 @@ - + @@ -2739,559 +2789,6 @@ - - - - - - - - - - Models/Props/Flora/SpecialRoot.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - @@ -3311,47 +2808,6 @@ - - - - - Models/Props/Bridges/SciFiBridge1Blue.mesh - - - - - - - - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridge1Blue.mesh - - - - - - - - - @@ -3470,6 +2926,135 @@ + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + @@ -3484,8 +3069,8 @@ Models/Props/SciFiHolder1.mesh - - + + @@ -3497,8 +3082,8 @@ Models/Props/SciFiHolder1.mesh - - + + @@ -3514,11 +3099,23 @@ - Models/Props/Walls/BigWallRed.mesh + Models/Props/Walls/MediumWall1.mesh - - + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + @@ -3540,11 +3137,10 @@ - Models/Props/Walls/MediumWall2.mesh + Models/Props/Walls/MediumWall1.mesh - - + @@ -3556,12 +3152,65 @@ Models/Props/Walls/SmallWall3.mesh - + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + @@ -3627,20 +3276,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -3654,18 +3289,6 @@ - - - - - Models/Props/Walls/MediumWall1.mesh - - - - - - - @@ -3679,15 +3302,70 @@ + + + + + + + - Models/Props/Walls/MediumWall2.mesh + Models/Props/Flora/SpecialRoot.mesh - - + + + + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + @@ -3696,10 +3374,11 @@ - Models/Props/Walls/MediumWall1.mesh + Models/Props/Stones/MediumStone2.mesh - + + @@ -3708,11 +3387,382 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Stones/SmallStone2.mesh - - + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + @@ -3724,6 +3774,21 @@ + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -3739,6 +3804,85 @@ + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -3771,13 +3915,14 @@ - 6 + 4 Models/Props/Stones/ShinyStoneCrystalBlue.mesh + - - - + + + @@ -3785,20 +3930,10 @@ + 3 - - - - - - - - - - - - + @@ -3810,7 +3945,20 @@ 2 - + + + + + + + + + + 2 + 1 + + + @@ -3832,104 +3980,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 4 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 2 - 1 - - - - - - - - - - - - 2 - - - - - - - - - - - - 3 - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -3943,9 +3993,9 @@ Models/Props/PickUps/PickUpHolder.mesh - - - + + + @@ -3953,11 +4003,11 @@ 2 - + - + @@ -3972,56 +4022,9 @@ Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - + @@ -4047,11 +4050,11 @@ 2 - + - + @@ -4068,7 +4071,7 @@ - + @@ -4084,9 +4087,9 @@ Models/Props/PickUps/PickUpHolder.mesh - - - + + + @@ -4094,11 +4097,11 @@ 2 - + - + @@ -4114,55 +4117,8 @@ Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - + + @@ -4188,11 +4144,11 @@ 2 - + - + @@ -4209,7 +4165,54 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + @@ -4235,11 +4238,11 @@ 2 - + - + @@ -4256,7 +4259,54 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + @@ -4273,6 +4323,20 @@ + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + @@ -4302,20 +4366,6 @@ - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - @@ -4516,76 +4566,6 @@ - - - - - Schema/Entities/PlayerRed.xml - - - - - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - @@ -4610,7 +4590,7 @@ false - + @@ -4623,7 +4603,7 @@ false - + @@ -4656,18 +4636,97 @@ + + + + + Schema/Entities/PlayerRed.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + - + - - 0.40000000596046448 - + + 1 + + + + + + + + + 10 + - + @@ -4675,11 +4734,10 @@ - 10 - + @@ -4707,22 +4765,13 @@ - + - - 1 - - - - - - - - - 10 - + + 0.40000000596046448 + - + @@ -4730,10 +4779,11 @@ + 10 - + diff --git a/resources/Schema/Entities/ScoreBoard.xml b/resources/Schema/Entities/ScoreBoard.xml new file mode 100644 index 00000000..ce612800 --- /dev/null +++ b/resources/Schema/Entities/ScoreBoard.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index 71889379..6d6c4f92 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -635,9 +635,13 @@ bool Server::shouldSendToClient(EntityWrapper childEntity) return true; } } - return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid() - || childEntity.HasComponent("CapturePoint") || childEntity.HasComponent("HealthPickup") - || childEntity.HasComponent("AmmoPickup"); + return childEntity.HasComponent("Player") + || childEntity.FirstParentWithComponent("Player").Valid() + || childEntity.HasComponent("CapturePoint") + || childEntity.HasComponent("HealthPickup") + || childEntity.HasComponent("AmmoPickup") + || childEntity.HasComponent("ScoreScreen") + || childEntity.FirstParentWithComponent("ScoreScreen").Valid(); } PlayerID Server::GetPlayerIDFromEndpoint() diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 0713e13b..e23fba1d 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -13,7 +13,6 @@ ScoreScreenSystem::ScoreScreenSystem(SystemParams params) void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) { - //TODO: Check team al if (!IsServer) { return; } @@ -37,6 +36,8 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& auto children = entity.ChildrenWithComponent("ScoreIdentity"); + float position = 0.f; + for (auto it = m_PlayerIdentities.begin(); it != m_PlayerIdentities.end(); ++it) { bool found = false; @@ -45,20 +46,38 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& if (it->first == ID) { if (it->second.Team != currentTeam) { m_World->DeleteEntity(child.ID); + (int&)entity["ScoreScreen"]["TotalIdentities"] -= 1; break; } + for (auto it = m_DisconnectedIdentities.begin(); it != m_DisconnectedIdentities.end(); ++it) { + if (ID = *it) { + + m_World->DeleteEntity(child.ID); + (int&)entity["ScoreScreen"]["TotalIdentities"] -= 1; + it = m_DisconnectedIdentities.erase(it); + break; + } + } found = true; + //Update position for childs + glm::vec3 offset = (glm::vec3)entity["ScoreScreen"]["Offset"]; + (glm::vec3&) child["Transform"]["Position"] = offset * position; + position += 1.f; + break; } } if(found == false) { if(it->second.Team != currentTeam) { //This player is not the same team as this scoreboard should show. - break; + continue; } //There is no entry for this player, create one. auto entityFile = ResourceManager::Load("Schema/Entities/ScoreIdentity.xml"); EntityWrapper scoreIdentity = entityFile->MergeInto(m_World); + glm::vec3 offset = (glm::vec3)entity["ScoreScreen"]["Offset"]; + int newPosition = (int)entity["ScoreScreen"]["TotalIdentities"]; + (glm::vec3&) scoreIdentity["Transform"]["Position"] = offset * (float)newPosition; auto cScoreIdentity = scoreIdentity["ScoreIdentity"]; auto data = it->second; @@ -67,12 +86,12 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& (int&)cScoreIdentity["Ping"] = 1337; m_World->SetParent(scoreIdentity.ID, entity.ID); + + (int&)entity["ScoreScreen"]["TotalIdentities"] += 1; + } } - //For each scoreboard, go through children and see if they have all of the ones needed. - //Also need to take into account the order so they dont flicker. - //If they do not have all children we need to add them. - //Just add a new component to the scorescreen entity, the "ScoreIdentity" component. + //Local player should have an icon, compare with LocalPlayer somthing } bool ScoreScreenSystem::OnPlayerDeath(const Events::PlayerDeath& e) @@ -113,6 +132,7 @@ bool ScoreScreenSystem::OnPlayerConnected(const Events::PlayerConnected& e) bool ScoreScreenSystem::OnPlayerDisconnected(const Events::PlayerDisconnected& e) { //player has disconnected, remove him from list of ScoreIdentities + m_DisconnectedIdentities.push_back(e.PlayerID); m_PlayerIdentities.erase(e.PlayerID); return 0; } From e24a0b127b9c7be5b871fd56a5df265272c1338d Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 20:59:30 +0100 Subject: [PATCH 40/94] Added Ability cooldown UI and missing texture --- assets | 2 +- .../Entities/PlayerAssaultFallbackBlue.xml | 68 ++++++++++--------- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/assets b/assets index 7a6d7078..c82b5716 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 7a6d70787b036d8ae8763b69ae6ad098bf221c22 +Subproject commit c82b5716d98a0c9fb3914367e9b08cc2e7dbca43 diff --git a/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml b/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml index bb6367f8..d5d7579c 100644 --- a/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml @@ -169,6 +169,40 @@ + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + @@ -538,6 +572,7 @@ Models/Characters/Assault/AssaultBlue.mesh + false @@ -561,38 +596,7 @@ - - - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - Schema/Entities/RayBlue.xml - - - - - - - - - - - Schema/Entities/ReloadEffectWorld.xml - - - - - - - - + From 6532e9896eda73327421de694ed9127e70769fb2 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 21:05:21 +0100 Subject: [PATCH 41/94] fixup! Playtest 2 Fallback Map --- resources/Schema/Entities/Maps/Playtest2-Fallback.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/Schema/Entities/Maps/Playtest2-Fallback.xml b/resources/Schema/Entities/Maps/Playtest2-Fallback.xml index 8217ab45..113abe6e 100644 --- a/resources/Schema/Entities/Maps/Playtest2-Fallback.xml +++ b/resources/Schema/Entities/Maps/Playtest2-Fallback.xml @@ -1,5 +1,5 @@ - + From 68332102ead701a3c07eddb7921cc3313853b989 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 3 Mar 2016 21:20:55 +0100 Subject: [PATCH 42/94] Can now blend non unique nodes --- resources/Schema/Entities/BlendTreeTest.xml | 47 +++++++++---- src/Engine/Rendering/AnimationSystem.cpp | 77 ++++++++++++++++++++- src/Engine/Rendering/AutoBlendQueue.cpp | 2 +- src/Engine/Rendering/BlendTree.cpp | 62 ++++++++++++++++- 4 files changed, 168 insertions(+), 20 deletions(-) diff --git a/resources/Schema/Entities/BlendTreeTest.xml b/resources/Schema/Entities/BlendTreeTest.xml index 69590ceb..d2c7ead9 100644 --- a/resources/Schema/Entities/BlendTreeTest.xml +++ b/resources/Schema/Entities/BlendTreeTest.xml @@ -68,8 +68,8 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - - + + @@ -125,7 +125,7 @@ StandCrouchBlend JumpDashBlend - 0.00067602147306955462 + 1.055110346338068e-57 @@ -135,7 +135,7 @@ StandMovement CrouchMovement - 0 + 0.0069837930620454403 @@ -155,7 +155,7 @@ RunWalkBlend StrafeLRBlend - 0 + 2.4565650245976452e-16 @@ -165,7 +165,7 @@ Walk Run - 1 + 1.2938206818383024e-24 @@ -174,6 +174,9 @@ WalkF + + 1 + true @@ -183,7 +186,7 @@ RunF - + 1 true @@ -198,7 +201,7 @@ Left Right - 0 + 0.033793529385008014 @@ -207,6 +210,9 @@ StrafeLeftF + + 1 + true @@ -216,6 +222,9 @@ StrafeRightF + + 1 + true @@ -243,6 +252,7 @@ MovementBlend Idle + 0 @@ -252,7 +262,7 @@ Walk StrafeLRBlend - 0 + 2.4565650245976452e-16 @@ -262,7 +272,7 @@ Left Right - 0 + 0.033793529385008014 @@ -271,6 +281,9 @@ CrouchStrafeLeftF + + 1 + true @@ -280,6 +293,9 @@ CrouchStrafeRightF + + 1 + true @@ -291,6 +307,9 @@ CrouchWalkF + + 1 + true @@ -318,7 +337,7 @@ Jump DashBlend - 0.01016461050458084 + 1 @@ -340,7 +359,7 @@ DashFBBlend DashLRBlend - 0.99999999999984523 + 0.014621149736541383 @@ -350,7 +369,7 @@ DashForward DashBackward - 0.98238059685988577 + 0.014363533804961248 @@ -386,7 +405,7 @@ DashLeft DashRight - 0.96547196574235861 + 4.3244885367500671e-16 diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 166ecb47..4434e80b 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -371,7 +371,7 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) if (entity.Name() == "Assault") { { Events::AutoAnimationBlend aeb; - aeb.Duration = 0.35; + aeb.Duration = 0.25; aeb.NodeName = "Jump"; aeb.RootNode = entity; aeb.Start = true; @@ -380,7 +380,7 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) } { Events::AutoAnimationBlend aeb; - aeb.Duration = 0.6; + aeb.Duration = 0.3; aeb.NodeName = "StandCrouchBlend"; aeb.RootNode = entity; aeb.Start = true; @@ -496,6 +496,79 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) } } } + } else if (e.Command == "LeftTest") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Left"; + aeb.RootNode = entity; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Command == "RightTest") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + /* { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Right"; + aeb.RootNode = entity; + aeb.Start = true; + m_EventBroker->Publish(aeb); + }*/ + + + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "Right"; + aeb.RootNode = entity; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = entity.FirstChildByName("DashRight"); + aeb.Delay = -0.3; + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Command == "ForwardTest") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Walk"; + aeb.RootNode = entity; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + } + } } diff --git a/src/Engine/Rendering/AutoBlendQueue.cpp b/src/Engine/Rendering/AutoBlendQueue.cpp index 9f0a7366..e75e33b5 100644 --- a/src/Engine/Rendering/AutoBlendQueue.cpp +++ b/src/Engine/Rendering/AutoBlendQueue.cpp @@ -85,7 +85,7 @@ void AutoBlendQueue::UpdateTime(double dt) for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end();) { it->EndTime -= dt; it->StartTime -= dt; - if (it->EndTime < 0) { + if (it->EndTime <= 0) { it = m_BlendQueue.erase(it); } else { it++; diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 036c3f49..2f74b45e 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -252,16 +252,72 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) lastNode = currentNode; currentNode = currentNode->Parent; } - - } else if(goalNodes.size() >= 2) { + std::vector sharedParents; + std::vector nodes = goalNodes; + + for (auto it = nodes.begin(); it != nodes.end(); it++) { + auto next = std::next(it, 1); + if (next != nodes.end()) { + Node* commonParent = FirstCommonParent((*it), (*next)); + sharedParents.push_back(commonParent); + (*next) = commonParent; + nodes.erase(it); + it = nodes.begin(); + } + } + + + for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) { + + Node* currentNode = (*it)->Parent; + Node* lastNode = (*it); + + while (currentNode != nullptr) { + if (!currentNode->Entity.HasComponent("Blend")) { + return blendInfo; + } + + bool ShouldBreak = false; + for (auto it = sharedParents.begin(); it != sharedParents.end(); it++) { + if(currentNode == (*it)) { + ShouldBreak = true; + } + } + + if(ShouldBreak) { + break; + } + + double startWeight; + if (blendInfo.StartWeights.find(currentNode->Entity) != blendInfo.StartWeights.end()) { + startWeight = blendInfo.StartWeights.at(currentNode->Entity); + } else { + startWeight = currentNode->Weight; + blendInfo.StartWeights[currentNode->Entity] = startWeight; + } + + double goalWeight; + if (currentNode->Child[0] == lastNode) { + goalWeight = 0.0; + } else if (currentNode->Child[1] == lastNode) { + goalWeight = 1.0; + } + + double weight = ((goalWeight - startWeight) * blendInfo.progress) + startWeight; + (double&)currentNode->Entity["Blend"]["Weight"] = weight; + currentNode->Weight = weight; + + lastNode = currentNode; + currentNode = currentNode->Parent; + } + } } return blendInfo; } - BlendTree::Node* BlendTree::GetCommonParent(std::string NodeName1, std::string NodeName2) { std::vector nodes1 = FindNodesByName(NodeName1); From b1148c0c6cc8f00272459c6c00ee5281345e48f6 Mon Sep 17 00:00:00 2001 From: Jocke Date: Thu, 3 Mar 2016 21:24:31 +0100 Subject: [PATCH 43/94] Added a afterimage SprintEffect for the Sniper. --- include/Game/Systems/PlayerMovementSystem.h | 2 + resources/Schema/Components/SprintAbility.xml | 1 + resources/Schema/Components/SprintAbility.xsd | 3 ++ resources/Schema/Entities/SprintEffect.xml | 25 ++++++++++++ src/Game/Systems/PlayerMovementSystem.cpp | 40 ++++++++++++++++++- 5 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 resources/Schema/Entities/SprintEffect.xml diff --git a/include/Game/Systems/PlayerMovementSystem.h b/include/Game/Systems/PlayerMovementSystem.h index bf7b4718..981fc13a 100644 --- a/include/Game/Systems/PlayerMovementSystem.h +++ b/include/Game/Systems/PlayerMovementSystem.h @@ -30,6 +30,8 @@ private: bool m_LeftFoot = false; // To get a difference when calculating the walking state. glm::vec3 m_LastPosition = glm::vec3(); + // Used to track afterimages for sprint effect. + float m_SprintEffectTimer; // The logic for making the sound play when player is moving void playerStep(double dt); // Spawn a hexagon at origin of an Entity diff --git a/resources/Schema/Components/SprintAbility.xml b/resources/Schema/Components/SprintAbility.xml index 5cc59a3a..578c0017 100644 --- a/resources/Schema/Components/SprintAbility.xml +++ b/resources/Schema/Components/SprintAbility.xml @@ -1,4 +1,5 @@ 2.0 + false \ No newline at end of file diff --git a/resources/Schema/Components/SprintAbility.xsd b/resources/Schema/Components/SprintAbility.xsd index 9eabb450..7fe0d65a 100644 --- a/resources/Schema/Components/SprintAbility.xsd +++ b/resources/Schema/Components/SprintAbility.xsd @@ -12,6 +12,9 @@ This is the strength of the sprint effect + + True if currently sprinting. + diff --git a/resources/Schema/Entities/SprintEffect.xml b/resources/Schema/Entities/SprintEffect.xml new file mode 100644 index 00000000..ab897cf5 --- /dev/null +++ b/resources/Schema/Entities/SprintEffect.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + 0.1 + + + + 0.1 + + + + + + + + + + diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index b116bcd9..8d0ff990 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -2,6 +2,7 @@ PlayerMovementSystem::PlayerMovementSystem(SystemParams params) : System(params) + , m_SprintEffectTimer(0.f) { EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &PlayerMovementSystem::OnPlayerSpawned); EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &PlayerMovementSystem::OnDoubleJump); @@ -19,8 +20,42 @@ void PlayerMovementSystem::Update(double dt) { updateMovementControllers(dt); // Only do physics calculations on client and only for themselves. - if (IsClient && LocalPlayer.Valid()) { - updateVelocity(LocalPlayer, dt); + if (IsClient) { + if (LocalPlayer.Valid()){ + updateVelocity(LocalPlayer, dt); + } + m_SprintEffectTimer += dt; + if (m_SprintEffectTimer < 0.016f) { + return; + } + m_SprintEffectTimer = 0.f; + const ComponentPool* pool = m_World->GetComponents("SprintAbility"); + if (pool == nullptr) { + return; + } + for (auto cSprint : *pool) { + if (/*cSprint.EntityID != LocalPlayer.ID && */(bool)cSprint["Active"]) { + // Spawn one afterimage for each player that sprints. + EntityWrapper player(m_World, cSprint.EntityID); + auto entityFile = ResourceManager::Load("Schema/Entities/SprintEffect.xml"); + EntityWrapper dashEffect = entityFile->MergeInto(m_World); + auto playerModel = player.FirstChildByName("PlayerModel"); + if (!playerModel.Valid()) { + continue; + } + auto playerEntityModel = playerModel["Model"]; + auto playerEntityAnimation = playerModel["Animation"]; + playerEntityModel.Copy(dashEffect["Model"]); + playerEntityAnimation.Copy(dashEffect["Animation"]); + dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"]; + ((glm::vec4&)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f; + dashEffect["Animation"]["Speed1"] = 0.0; + dashEffect["Animation"]["Speed2"] = 0.0; + dashEffect["Animation"]["Speed3"] = 0.0; + dashEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"]; + dashEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"]; + } + } } } @@ -64,6 +99,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt) } bool sniperSprinting = false; if (player.HasComponent("SprintAbility")) { + (bool)player["SprintAbility"]["Active"] = controller->SpecialAbilityKeyDown(); if (controller->SpecialAbilityKeyDown()) { playerMovementSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"]; playerCrouchSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"]; From f5ea4e06c7b2b552e505a1c2f4c6c2e33b449058 Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 21:37:18 +0100 Subject: [PATCH 44/94] Map --- ...Playtest2-Fallback.xml => CP_RockHard.xml} | 4643 +++++++++-------- 1 file changed, 2322 insertions(+), 2321 deletions(-) rename resources/Schema/Entities/Maps/{Playtest2-Fallback.xml => CP_RockHard.xml} (99%) diff --git a/resources/Schema/Entities/Maps/Playtest2-Fallback.xml b/resources/Schema/Entities/Maps/CP_RockHard.xml similarity index 99% rename from resources/Schema/Entities/Maps/Playtest2-Fallback.xml rename to resources/Schema/Entities/Maps/CP_RockHard.xml index 113abe6e..4f104155 100644 --- a/resources/Schema/Entities/Maps/Playtest2-Fallback.xml +++ b/resources/Schema/Entities/Maps/CP_RockHard.xml @@ -1,5 +1,5 @@ - + @@ -30,6 +30,16 @@ + + + + + Models/Props/Walls/SciFiWallSmall2.mesh + + + + + @@ -73,16 +83,6 @@ - - - - - Models/Props/Walls/SciFiWallSmall2.mesh - - - - - @@ -704,6 +704,18 @@ + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + @@ -779,18 +791,6 @@ - - - - - Models/Highgrounds/Hg8.mesh - - - - - - - @@ -2528,6 +2528,169 @@ + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + @@ -2565,7 +2728,7 @@ - + @@ -2607,7 +2770,7 @@ - + @@ -2649,7 +2812,7 @@ - + @@ -2691,7 +2854,7 @@ - + @@ -2733,7 +2896,7 @@ - + @@ -2775,7 +2938,7 @@ - + @@ -2817,7 +2980,7 @@ - + @@ -2859,7 +3022,7 @@ - + @@ -2901,7 +3064,7 @@ - + @@ -2975,6 +3138,52 @@ + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + @@ -3052,6 +3261,357 @@ + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + @@ -3331,19 +3891,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -3358,19 +3905,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -3384,19 +3918,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - @@ -3439,19 +3960,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3465,19 +3973,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3492,19 +3987,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -3518,20 +4000,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -3546,20 +4014,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -3574,20 +4028,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -3601,19 +4041,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -3627,19 +4054,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3653,19 +4067,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3679,19 +4080,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3705,19 +4093,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3731,20 +4106,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -3759,20 +4120,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -3787,20 +4134,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -3815,20 +4148,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -3843,20 +4162,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -3871,20 +4176,6 @@ - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - @@ -3899,19 +4190,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -3925,20 +4203,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -3953,20 +4217,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -3981,20 +4231,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -4009,20 +4245,6 @@ - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - @@ -4037,19 +4259,6 @@ - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - @@ -4065,7 +4274,7 @@ - + @@ -4074,38 +4283,12 @@ - Models/Props/Stones/AssaultHolder.mesh + Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - + + + @@ -4114,11 +4297,12 @@ - Models/Props/Stones/AssaultHolder.mesh + Models/Props/Walls/SpecialWall1.mesh - - + + + @@ -4127,19 +4311,33 @@ - Models/Props/Stones/AssaultHolder.mesh + Models/Props/Walls/SpecialWall1.mesh - - - + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + - + @@ -4151,77 +4349,7 @@ Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar1Red.mesh - - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - + @@ -4251,11 +4379,11 @@ - Models/Props/Walls/MediumWall3.mesh + Models/Props/Walls/SmallWall3.mesh - - + + @@ -4273,6 +4401,19 @@ + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + @@ -4280,8 +4421,21 @@ Models/Props/Walls/SmallWall3.mesh - - + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + @@ -4313,46 +4467,6 @@ - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - @@ -4360,8 +4474,21 @@ Models/Props/Walls/MediumWall3.mesh - - + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + @@ -4373,21 +4500,8 @@ Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - + + @@ -4413,7 +4527,20 @@ Models/Props/Walls/SmallWall3.mesh - + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + @@ -4427,8 +4554,77 @@ Models/Props/Walls/MediumWall3.mesh - - + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + @@ -4446,20 +4642,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -4473,20 +4655,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -4555,19 +4723,6 @@ - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - @@ -4608,20 +4763,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -4636,19 +4777,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - @@ -4666,134 +4794,6 @@ - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - @@ -4801,7 +4801,7 @@ - + @@ -4810,65 +4810,11 @@ - Models/Props/Walls/BigWallRed.mesh + Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - + + @@ -4878,12 +4824,11 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Stones/AssaultHolder.mesh - - - + + @@ -4892,12 +4837,11 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Stones/AssaultHolder.mesh - - - + + @@ -4906,11 +4850,11 @@ - Models/Props/Walls/MediumWall3.mesh + Models/Props/Stones/AssaultHolder.mesh - - + + @@ -4919,11 +4863,11 @@ - Models/Props/Walls/BigWallRed.mesh + Models/Props/Stones/AssaultHolder.mesh - - + + @@ -4932,11 +4876,146 @@ - Models/Props/Walls/BigWallBlue.mesh + Models/Props/Stones/AssaultHolder.mesh - + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + @@ -4945,12 +5024,62 @@ - Models/Props/Walls/smallWall3.mesh + Models/Props/Stones/AssaultHolder.mesh - - - + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + @@ -4994,7 +5123,7 @@ - + @@ -5036,7 +5165,7 @@ - + @@ -5048,7 +5177,7 @@ - + @@ -5057,171 +5186,105 @@ - Models/Props/Stones/AssaultHolder.mesh + Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + @@ -5231,11 +5294,12 @@ - Models/Props/Stones/AssaultHolder.mesh + Models/Props/Walls/SmallWall3.mesh - - + + + @@ -5244,11 +5308,11 @@ - Models/Props/Stones/AssaultHolder.mesh + Models/Props/Walls/BigWallRed.mesh - - + + @@ -5257,39 +5321,12 @@ - Models/Props/Stones/AssaultHolder.mesh + Models/Props/Walls/smallWall3.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - + + + @@ -5318,11 +5355,12 @@ - Models/Props/Pillars/StonePillar.mesh + Models/Props/Stones/SmallStone2.mesh - - + + + @@ -5344,11 +5382,11 @@ - Models/Props/Stones/SmallStone1.mesh + Models/Props/Stones/MediumStone2.mesh - - + + @@ -5366,6 +5404,85 @@ + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + @@ -5380,19 +5497,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - @@ -5406,20 +5510,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -5461,19 +5551,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -5543,19 +5620,6 @@ - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - @@ -5570,20 +5634,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -5597,19 +5647,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -5625,43 +5662,6 @@ - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - @@ -5676,21 +5676,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -5710,10 +5695,10 @@ - 3 + 2 - + @@ -5722,10 +5707,10 @@ - 2 + 3 - + @@ -5761,21 +5746,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -5799,61 +5769,11 @@ Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - + + - - - - - - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - @@ -5892,13 +5812,108 @@ Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -5914,21 +5929,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -5951,6 +5951,33 @@ + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + @@ -5958,9 +5985,21 @@ Models/Props/Stones/MediumStone2.mesh - - - + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + @@ -5978,46 +6017,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6039,36 +6038,9 @@ Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - + + + @@ -6090,11 +6062,52 @@ - Models/Props/Stones/MediumStone2.mesh + Models/Props/Stones/BigStone.mesh - - + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + @@ -6120,8 +6133,89 @@ Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + @@ -6133,8 +6227,210 @@ Models/Props/Stones/BigStone.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + @@ -6152,20 +6448,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -6180,20 +6462,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6207,20 +6475,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -6235,19 +6489,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6261,19 +6502,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6287,19 +6515,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - @@ -6341,19 +6556,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -6366,19 +6568,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -6392,20 +6581,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -6420,19 +6595,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -6446,19 +6608,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6472,19 +6621,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6498,20 +6634,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6526,20 +6648,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -6553,19 +6661,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6579,19 +6674,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6605,19 +6687,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6631,19 +6700,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6658,20 +6714,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -6686,20 +6728,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6714,20 +6742,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6769,20 +6783,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6813,11 +6813,116 @@ + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + @@ -6850,7 +6955,7 @@ - + @@ -6892,7 +6997,7 @@ - + @@ -6934,7 +7039,7 @@ - + @@ -6976,49 +7081,7 @@ - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - + @@ -7060,7 +7123,7 @@ - + @@ -7102,7 +7165,7 @@ - + @@ -7119,6 +7182,20 @@ + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + @@ -7147,20 +7224,6 @@ - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - @@ -7203,74 +7266,79 @@ - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + @@ -7403,74 +7471,6 @@ - - - - - Models/Props/Bridges/SciFiBridge1Blue.mesh - - - - - - - - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridge1Blue.mesh - - - - - - - - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - - - - - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - @@ -7478,6 +7478,19 @@ + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + @@ -7504,19 +7517,6 @@ - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - @@ -7544,9 +7544,8 @@ Models/Props/Flora/SpecialRoot.mesh - - - + + @@ -7558,8 +7557,9 @@ Models/Props/Flora/SpecialRoot.mesh - - + + + @@ -7599,6 +7599,126 @@ + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -7613,6 +7733,34 @@ + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + @@ -7652,20 +7800,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -7706,20 +7840,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -7746,33 +7866,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - @@ -7801,33 +7894,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - @@ -7855,32 +7921,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - @@ -7907,32 +7947,6 @@ - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - @@ -7974,20 +7988,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -8010,19 +8010,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - @@ -8050,6 +8037,19 @@ + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + @@ -8142,6 +8142,48 @@ + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + @@ -8171,20 +8213,6 @@ - - - - - 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - @@ -8228,20 +8256,6 @@ - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - @@ -8286,20 +8300,6 @@ - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - @@ -8349,6 +8349,189 @@ + + + + + + + + + + Schema/Entities/PlayerAssaultFallbackBlue.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + + + Schema/Entities/PlayerAssaultFallbackBlue.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + @@ -8360,17 +8543,20 @@ 10 - + - - 1 - - + + + 10 + + + + @@ -8380,11 +8566,21 @@ 10 - + + + + + 0.69999998807907104 + 1.6000000238418579 + + + + + @@ -8411,7 +8607,7 @@ - 1 + 0.40000000596046448 @@ -8419,18 +8615,6 @@ - - - - - 10 - - - - - - - @@ -8438,38 +8622,6 @@ - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 3 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - @@ -8507,6 +8659,75 @@ + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 15 + 2 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 3 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + @@ -8547,43 +8768,6 @@ - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 15 - 2 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - @@ -8625,189 +8809,6 @@ - - - - - - - - - - Schema/Entities/PlayerAssaultFallbackBlue.xml - - - - - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - - - Schema/Entities/PlayerAssaultFallbackBlue.xml - - - - - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - From 984b8ad3e9a8b588bdecb5e46bb918c19b0113c6 Mon Sep 17 00:00:00 2001 From: Jocke Date: Thu, 3 Mar 2016 21:57:27 +0100 Subject: [PATCH 45/94] SprintEffect defaults to 30% extra speed. --- resources/Schema/Components/SprintAbility.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/Schema/Components/SprintAbility.xml b/resources/Schema/Components/SprintAbility.xml index 578c0017..d9727ed9 100644 --- a/resources/Schema/Components/SprintAbility.xml +++ b/resources/Schema/Components/SprintAbility.xml @@ -1,5 +1,5 @@ - 2.0 + 1.3 false \ No newline at end of file From ae13a2db6b8df273d1490f1ecf9bf6215b28a6c5 Mon Sep 17 00:00:00 2001 From: Jocke Date: Thu, 3 Mar 2016 22:09:51 +0100 Subject: [PATCH 46/94] Player cannot see their own sprint effect. --- src/Game/Systems/PlayerMovementSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index 8d0ff990..ab4ac6a1 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -34,7 +34,7 @@ void PlayerMovementSystem::Update(double dt) return; } for (auto cSprint : *pool) { - if (/*cSprint.EntityID != LocalPlayer.ID && */(bool)cSprint["Active"]) { + if (cSprint.EntityID != LocalPlayer.ID && (bool)cSprint["Active"]) { // Spawn one afterimage for each player that sprints. EntityWrapper player(m_World, cSprint.EntityID); auto entityFile = ResourceManager::Load("Schema/Entities/SprintEffect.xml"); From c84d7ebb8fd118dcc4edc73a3e60b79ed83d4294 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 22:25:07 +0100 Subject: [PATCH 47/94] PlayerAssaultFallbackBlue and PlayerAssaultFallbackRed --- resources/Schema/Entities/MovementTest.xml | 8 +- .../Entities/PlayerAssaultFallbackBlue.xml | 144 ++- .../Entities/PlayerAssaultFallbackRed.xml | 829 ++++++++++++++++++ resources/Schema/Entities/RayBlue.xml | 2 +- resources/Schema/Entities/RayRed.xml | 46 + ...aponView.xml => WeaponAssaultBlueView.xml} | 0 ...onWorld.xml => WeaponAssaultBlueWorld.xml} | 0 .../Schema/Entities/WeaponAssaultRedView.xml | 103 +++ .../Schema/Entities/WeaponAssaultRedWorld.xml | 34 + 9 files changed, 1154 insertions(+), 12 deletions(-) create mode 100644 resources/Schema/Entities/PlayerAssaultFallbackRed.xml create mode 100644 resources/Schema/Entities/RayRed.xml rename resources/Schema/Entities/{AssaultWeaponView.xml => WeaponAssaultBlueView.xml} (100%) mode change 100755 => 100644 rename resources/Schema/Entities/{AssaultWeaponWorld.xml => WeaponAssaultBlueWorld.xml} (100%) mode change 100755 => 100644 create mode 100644 resources/Schema/Entities/WeaponAssaultRedView.xml create mode 100644 resources/Schema/Entities/WeaponAssaultRedWorld.xml diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 3429194a..7bbaf21d 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -10,7 +10,7 @@ - Schema/Entities/PlayerRed.xml + Schema/Entities/PlayerAssaultFallbackRed.xml @@ -78,7 +78,7 @@ - Schema/Entities/Player.xml + Schema/Entities/PlayerAssaultFallbackBlue.xml @@ -98,7 +98,7 @@ - + @@ -111,7 +111,7 @@ - + diff --git a/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml b/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml index d5d7579c..94177cee 100644 --- a/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml @@ -169,7 +169,7 @@ - + @@ -493,7 +493,7 @@ Models/Characters/Assault/Test/FirstPerson.mesh - + @@ -507,14 +507,114 @@ AssaultWeapon - Schema/Entities/AssaultWeaponView.xml + Schema/Entities/WeaponAssaultBlueView.xml - + + + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + Schema/Entities/Weapons/RayBlue.xml + + + + + + + + + + + + Schema/Entities/ReloadEffectView.xml + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + 32 + Fonts/DroidSans.ttf,64 + + + + Player + AssaultWeapon + MagazineAmmo + + + + + + + + + + + 320 + Fonts/DroidSans.ttf,64 + + + + Player + AssaultWeapon + Ammo + + + + + + + + + + + + + + + @@ -572,7 +672,6 @@ Models/Characters/Assault/AssaultBlue.mesh - false @@ -589,14 +688,45 @@ - Schema/Entities/AssaultWeaponWorld.xml + Schema/Entities/WeaponAssaultBlueWorld.xml - + + + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + Schema/Entities/Weapons/RayBlue.xml + + + + + + + + + + + Schema/Entities/ReloadEffectWorld.xml + + + + + + + + diff --git a/resources/Schema/Entities/PlayerAssaultFallbackRed.xml b/resources/Schema/Entities/PlayerAssaultFallbackRed.xml new file mode 100644 index 00000000..c16cb556 --- /dev/null +++ b/resources/Schema/Entities/PlayerAssaultFallbackRed.xml @@ -0,0 +1,829 @@ + + + + + + + + + + + + + + + + + + 5 + + + + + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + + + + + + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + + + + + + + + Textures/Weapons/Crosshair/SmallThickHoleDot.png + + false + + + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + + + + + 1 + + + + + Textures/HealthHUD3.png + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 2 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 3 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 4 + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/Arrow5.mesh + + + + + + + + + + + + + + + + + + + + Idle + 1.8348644854054612 + 1 + + + + + Models/Characters/Assault/Test/FirstPerson.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + Schema/Entities/WeaponAssaultRedView.xml + + + + + + + + + + + Models/Weapons/Red/AssaultWeaponRed.mesh + + + + + + + + Schema/Entities/Weapons/RayRed.xml + + + + + + + + + + + + Schema/Entities/ReloadEffectView.xml + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + 32 + Fonts/DroidSans.ttf,64 + + + + Player + AssaultWeapon + MagazineAmmo + + + + + + + + + + + 320 + Fonts/DroidSans.ttf,64 + + + + Player + AssaultWeapon + Ammo + + + + + + + + + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + Schema/Entities/SidearmWeaponView.xml + + + + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + IdleF + 1 + + + + + AimRifle + + + + + + Models/Characters/Assault/AssaultRed.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultRedWorld.xml + + + + + + + + + + + Models/Weapons/Red/AssaultWeaponRed.mesh + + + + + + + + Schema/Entities/Weapons/RayRed.xml + + + + + + + + + + + Schema/Entities/ReloadEffectWorld.xml + + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + Insert name here + Fonts/DroidSans.ttf,100 + + + + + + + + + + + + + + Textures/Icons/Arrow.png + + false + + + + + 50 + true + + + + + + + + + + + + Schema/Entities/DefenderShield.xml + + + + + + + + + + diff --git a/resources/Schema/Entities/RayBlue.xml b/resources/Schema/Entities/RayBlue.xml index 0ad0ddf0..83adbe51 100644 --- a/resources/Schema/Entities/RayBlue.xml +++ b/resources/Schema/Entities/RayBlue.xml @@ -1,5 +1,5 @@ - + diff --git a/resources/Schema/Entities/RayRed.xml b/resources/Schema/Entities/RayRed.xml new file mode 100644 index 00000000..70ab685e --- /dev/null +++ b/resources/Schema/Entities/RayRed.xml @@ -0,0 +1,46 @@ + + + + + + 0.10000000149011612 + + + + + + + + + + + Textures/Effects/Ray.png + + + + + + + + + + + + + + + Textures/Effects/Ray.png + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/AssaultWeaponView.xml b/resources/Schema/Entities/WeaponAssaultBlueView.xml old mode 100755 new mode 100644 similarity index 100% rename from resources/Schema/Entities/AssaultWeaponView.xml rename to resources/Schema/Entities/WeaponAssaultBlueView.xml diff --git a/resources/Schema/Entities/AssaultWeaponWorld.xml b/resources/Schema/Entities/WeaponAssaultBlueWorld.xml old mode 100755 new mode 100644 similarity index 100% rename from resources/Schema/Entities/AssaultWeaponWorld.xml rename to resources/Schema/Entities/WeaponAssaultBlueWorld.xml diff --git a/resources/Schema/Entities/WeaponAssaultRedView.xml b/resources/Schema/Entities/WeaponAssaultRedView.xml new file mode 100644 index 00000000..322b1439 --- /dev/null +++ b/resources/Schema/Entities/WeaponAssaultRedView.xml @@ -0,0 +1,103 @@ + + + + + + Models/Weapons/Red/AssaultWeaponRed.mesh + + + + + + + + + Schema/Entities/RayRed.xml + + + + + + + + + + + + Schema/Entities/ReloadEffectView.xml + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + 32 + Fonts/DroidSans.ttf,64 + + + + Player + AssaultWeapon + MagazineAmmo + + + + + + + + + + + 320 + Fonts/DroidSans.ttf,64 + + + + Player + AssaultWeapon + Ammo + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponAssaultRedWorld.xml b/resources/Schema/Entities/WeaponAssaultRedWorld.xml new file mode 100644 index 00000000..68d78d03 --- /dev/null +++ b/resources/Schema/Entities/WeaponAssaultRedWorld.xml @@ -0,0 +1,34 @@ + + + + + + Models/Weapons/Red/AssaultWeaponRed.mesh + + + + + + + + + Schema/Entities/RayRed.xml + + + + + + + + + + + Schema/Entities/ReloadEffectWorld.xml + + + + + + + + From 8466a282b791fd34f54d6960ac55ec7f50ebfd7e Mon Sep 17 00:00:00 2001 From: stiffly Date: Thu, 3 Mar 2016 22:48:42 +0100 Subject: [PATCH 48/94] The server will now parse a death event and pass it forward with a KillDeath event to the score system. --- include/Engine/Core/EPlayerDeath.h | 5 +++-- include/Engine/Network/EKillDeath.h | 19 +++++++++++++++++ include/Engine/Network/Server.h | 7 ++++++- src/Engine/Network/Server.cpp | 32 +++++++++++++++++++++++------ src/Game/Systems/HealthSystem.cpp | 21 ++++++++++--------- 5 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 include/Engine/Network/EKillDeath.h diff --git a/include/Engine/Core/EPlayerDeath.h b/include/Engine/Core/EPlayerDeath.h index 363745a6..dca47205 100644 --- a/include/Engine/Core/EPlayerDeath.h +++ b/include/Engine/Core/EPlayerDeath.h @@ -10,8 +10,9 @@ namespace Events struct PlayerDeath : Event { //KilledBy,KilledByWhat is optional for now. It might be used later in the playerlog-system - EntityWrapper Player; - std::string KilledByWhat; + EntityWrapper Player = EntityWrapper::Invalid; + EntityWrapper Killer = EntityWrapper::Invalid; + std::string KilledByWhat = ""; }; } diff --git a/include/Engine/Network/EKillDeath.h b/include/Engine/Network/EKillDeath.h new file mode 100644 index 00000000..e53f3b8c --- /dev/null +++ b/include/Engine/Network/EKillDeath.h @@ -0,0 +1,19 @@ +#ifndef Events_KillDeath_h__ +#define Events_KillDeath_h__ + +#include "Core/EventBroker.h" + +typedef unsigned int PlayerID; + +namespace Events +{ + +struct KillDeath : public Event +{ + PlayerID Casualty = -1; + PlayerID Killer = -1; +}; + +} + +#endif \ No newline at end of file diff --git a/include/Engine/Network/Server.h b/include/Engine/Network/Server.h index 7bcefc65..6796aaf2 100644 --- a/include/Engine/Network/Server.h +++ b/include/Engine/Network/Server.h @@ -21,6 +21,8 @@ #include "Core/EEntityDeleted.h" #include "Core/EComponentDeleted.h" #include "Core/EAmmoPickup.h" +#include "Core/EPlayerDeath.h" +#include "Network/EKillDeath.h" class Server : public Network { @@ -77,7 +79,8 @@ private: void parseOnPlayerDamage(Packet& packet); void identifyPacketLoss(); void kick(PlayerID player); - PlayerID GetPlayerIDFromEndpoint(); + PlayerID getPlayerIDFromEndpoint(); + PlayerID getPlayerIDFromEntityID(); void parsePlayerTransform(Packet& packet); void parseOnInputCommand(Packet& packet); void parseClientPing(); @@ -103,6 +106,8 @@ private: bool OnPlayerDamage(const Events::PlayerDamage& e); EventRelay m_EAmmoPickup; bool OnAmmoPickup(const Events::AmmoPickup& e); + EventRelay m_EPlayerDeath; + bool OnPlayerDeath(const Events::PlayerDeath& e); }; #endif diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index 68c00fbe..ebb95109 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -14,6 +14,7 @@ Server::Server(World* world, EventBroker* eventBroker, int port) EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted); EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage); EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &Server::OnAmmoPickup); + EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &Server::OnPlayerDeath); // BindWW if (port == 0) { port = config->Get("Networking.Port", 27666); @@ -351,7 +352,7 @@ void Server::parseTCPConnect(Packet & packet) LOG_INFO("Parsing connections"); // Check if player is already connected // Ska vara till lagd i TCPServer receive - PlayerID playerID = GetPlayerIDFromEndpoint(); + PlayerID playerID = getPlayerIDFromEndpoint(); if (playerID == -1) { return; } @@ -526,10 +527,19 @@ bool Server::OnAmmoPickup(const Events::AmmoPickup & e) return true; } + +bool Server::OnPlayerDeath(const Events::PlayerDeath& e) +{ + Events::KillDeath eKD; + eKD.Casualty = getPlayerIDFromEntityID(e.Player.ID); + eKD.Killer = getPlayerIDFromEntityID(e.Killer.ID); + m_EventBroker->Publish(eKD); +} + void Server::parseClientPing() { LOG_INFO("%i: Parsing ping", m_PacketID); - PlayerID player = GetPlayerIDFromEndpoint(); + PlayerID player = getPlayerIDFromEndpoint(); if (player == -1) { return; } @@ -567,7 +577,7 @@ void Server::parseOnInputCommand(Packet& packet) { PlayerID player = -1; // Check which player it was who sent the message - player = GetPlayerIDFromEndpoint(); + player = getPlayerIDFromEndpoint(); if (player != -1) { while (packet.DataReadSize() < packet.Size()) { Events::InputCommand e; @@ -586,7 +596,7 @@ void Server::parseOnInputCommand(Packet& packet) void Server::parsePlayerTransform(Packet& packet) { - PlayerID playerID = GetPlayerIDFromEndpoint(); + PlayerID playerID = getPlayerIDFromEndpoint(); if (playerID == -1) { return; } @@ -635,7 +645,7 @@ bool Server::shouldSendToClient(EntityWrapper childEntity) || childEntity.HasComponent("AmmoPickup"); } -PlayerID Server::GetPlayerIDFromEndpoint() +PlayerID Server::getPlayerIDFromEndpoint() { // check both tcp and udp connection for (auto& kv : m_ConnectedPlayers) { @@ -647,4 +657,14 @@ PlayerID Server::GetPlayerIDFromEndpoint() } } return -1; -} \ No newline at end of file +} + +PlayerID Server::getPlayerIDFromEntityID(EntityID entityID) +{ + for (int i = 0; i < m_ConnectedPlayers.size(); ++i) { + if (entityID == m_ConnectedPlayers[i].EntityID) { + return i; + } + } + return -1; +} diff --git a/src/Game/Systems/HealthSystem.cpp b/src/Game/Systems/HealthSystem.cpp index b4ace6b9..9fa570c2 100644 --- a/src/Game/Systems/HealthSystem.cpp +++ b/src/Game/Systems/HealthSystem.cpp @@ -12,15 +12,7 @@ HealthSystem::HealthSystem(SystemParams params) } void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cHealth, double dt) -{ - double& health = cHealth["Health"]; - if (health <= 0.0) { - Events::PlayerDeath ePlayerDeath; - ePlayerDeath.Player = entity; - m_EventBroker->Publish(ePlayerDeath); - //Note: we will delete the entity in PlayerDeathSystem - } -} +{ } bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e) { @@ -35,7 +27,16 @@ bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e) if (playerBoostDefenderEntity.Valid()) { e.Damage -= (double)playerBoostDefenderEntity["BoostDefender"]["StrengthOfEffect"]; } - health -= e.Damage; + if (health > 0) { + health -= e.Damage; + if (health <= 0.0) { + Events::PlayerDeath ePlayerDeath; + ePlayerDeath.Player = e.Victim; + ePlayerDeath.Killer = e.Inflictor; + m_EventBroker->Publish(ePlayerDeath); + //Note: we will delete the entity in PlayerDeathSystem + } + } return true; } From 714665f0a303cdbf7d1f864a4b763f8a3e896700 Mon Sep 17 00:00:00 2001 From: stiffly Date: Thu, 3 Mar 2016 22:55:12 +0100 Subject: [PATCH 49/94] Updated the PlayerID getter in Server.cpp. --- src/Engine/Network/Server.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index ebb95109..207b10f7 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -661,9 +661,9 @@ PlayerID Server::getPlayerIDFromEndpoint() PlayerID Server::getPlayerIDFromEntityID(EntityID entityID) { - for (int i = 0; i < m_ConnectedPlayers.size(); ++i) { - if (entityID == m_ConnectedPlayers[i].EntityID) { - return i; + for(auto& kv : m_ConnectedPlayers) { + if (entityID == kv.second.EntityID) { + return kv.first; } } return -1; From 011aa53bc0879e5c080cedc9f341443f22dc9003 Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 22:55:18 +0100 Subject: [PATCH 50/94] ScoreScreen things --- resources/Schema/Entities/CP_Rocky.xml | 2870 ++++++++++------- resources/Schema/Entities/ScoreBoard_Blue.xml | 121 + resources/Schema/Entities/ScoreBoard_Main.xml | 68 + resources/Schema/Entities/ScoreBoard_Red.xml | 121 + resources/Schema/Entities/ScoreIdentity.xml | 47 +- 5 files changed, 2031 insertions(+), 1196 deletions(-) create mode 100644 resources/Schema/Entities/ScoreBoard_Blue.xml create mode 100644 resources/Schema/Entities/ScoreBoard_Main.xml create mode 100644 resources/Schema/Entities/ScoreBoard_Red.xml diff --git a/resources/Schema/Entities/CP_Rocky.xml b/resources/Schema/Entities/CP_Rocky.xml index a0ae548f..a9c4aaac 100644 --- a/resources/Schema/Entities/CP_Rocky.xml +++ b/resources/Schema/Entities/CP_Rocky.xml @@ -21,6 +21,19 @@ + + + + + Models/Props/Highground7.mesh + + + + + + + + @@ -29,6 +42,29 @@ + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + true + + + + + @@ -59,29 +95,6 @@ - - - - - Models/Props/Walls/SciFiWallBig.mesh - - - - - - - - - - - - Models/Props/Walls/SciFiWallBig.mesh - true - - - - - @@ -112,96 +125,36 @@ + + + + + + Schema/Entities/ScoreBoard_Main.xml + + + + + + - + - - - - + - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - Models/Core/UnitCube.mesh - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -209,11 +162,593 @@ - + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + Schema/Entities/ScoreBoard_Blue.xml + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Name + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + KD + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Kills + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Deaths + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + Schema/Entities/ScoreBoard_Red.xml + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Name + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + KD + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Kills + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Deaths + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/ScoreBoard_Main.xml + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + Schema/Entities/ScoreBoard_Blue.xml + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Name + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + KD + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Kills + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Deaths + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + Schema/Entities/ScoreBoard_Red.xml + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Name + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + KD + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Kills + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Deaths + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + @@ -284,19 +819,6 @@ - - - - - Models/Props/Highground7.mesh - - - - - - - - @@ -766,6 +1288,17 @@ + + + + + + + + + + + @@ -789,17 +1322,6 @@ - - - - - - - - - - - @@ -908,11 +1430,11 @@ 2 - + - + @@ -929,7 +1451,7 @@ - + @@ -955,11 +1477,11 @@ 2 - + - + @@ -976,7 +1498,7 @@ - + @@ -1002,11 +1524,11 @@ 2 - + - + @@ -1023,7 +1545,7 @@ - + @@ -1049,11 +1571,11 @@ 2 - + - + @@ -1070,7 +1592,7 @@ - + @@ -1096,11 +1618,11 @@ 2 - + - + @@ -1117,7 +1639,7 @@ - + @@ -1143,11 +1665,11 @@ 2 - + - + @@ -1164,7 +1686,7 @@ - + @@ -1190,11 +1712,11 @@ 2 - + - + @@ -1211,7 +1733,7 @@ - + @@ -2459,11 +2981,11 @@ 2 - + - + @@ -2480,7 +3002,7 @@ - + @@ -2506,11 +3028,11 @@ 2 - + - + @@ -2527,7 +3049,7 @@ - + @@ -2774,6 +3296,308 @@ + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + @@ -2794,20 +3618,6 @@ - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - @@ -2926,6 +3736,20 @@ + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + @@ -2969,94 +3793,6 @@ - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - @@ -3090,220 +3826,6 @@ - - - - - - - - - - Models/Props/Walls/MediumWall1.mesh - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall1.mesh - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - @@ -3333,65 +3855,12 @@ - Models/Props/Stones/MediumStone1.mesh + Models/Props/Stones/BigStone.mesh - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - + + + @@ -3403,34 +3872,7 @@ Models/Props/Stones/BigStone.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - + @@ -3448,165 +3890,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -3614,20 +3897,8 @@ Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - + + @@ -3635,12 +3906,11 @@ - Models/Props/Stones/SmallStone2.mesh + Models/Props/Stones/SmallStone1.mesh - - - + + @@ -3678,11 +3948,92 @@ - Models/Props/Stones/MediumStone1.mesh + Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + @@ -3694,8 +4045,114 @@ Models/Props/Stones/BigStone.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + @@ -3730,12 +4187,39 @@ - Models/Props/Stones/BigStone.mesh + Models/Props/Stones/SmallStone1.mesh - - - + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + @@ -3747,9 +4231,8 @@ Models/Props/Stones/MediumStone2.mesh - - - + + @@ -3758,11 +4241,50 @@ - Models/Props/Stones/SmallStone2.mesh + Models/Props/Stones/MediumStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + @@ -3789,100 +4311,6 @@ - - - - - 5 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -3911,6 +4339,85 @@ + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -3930,10 +4437,11 @@ - 3 + 2 + 1 - + @@ -3954,17 +4462,31 @@ - 2 - 1 + 3 - + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -3973,9 +4495,9 @@ Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - + + + @@ -3987,100 +4509,6 @@ - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - @@ -4097,11 +4525,11 @@ 2 - + - + @@ -4118,54 +4546,7 @@ - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - + @@ -4191,11 +4572,11 @@ 2 - + - + @@ -4212,7 +4593,7 @@ - + @@ -4238,11 +4619,11 @@ 2 - + - + @@ -4259,7 +4640,101 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + @@ -4285,11 +4760,11 @@ 2 - + - + @@ -4306,7 +4781,54 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + @@ -4327,12 +4849,13 @@ - Models/Props/Pillars/StonePillar.mesh + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh - - - + + + @@ -4341,13 +4864,12 @@ - 6 - Models/Props/Pillars/SciFiPillar1Blue.mesh + Models/Props/Pillars/StonePillar.mesh - - - + + + @@ -4384,6 +4906,160 @@ + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + + 10 + + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + 0.40000000596046448 + + + + + + + + + + + + + + Schema/Entities/PlayerRed.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + @@ -4582,6 +5258,19 @@ + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + @@ -4608,19 +5297,6 @@ - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - @@ -4636,160 +5312,6 @@ - - - - - Schema/Entities/PlayerRed.xml - - - - - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - 10 - - - - - - - - - - - 10 - - - - - - - - - - - - 10 - - - - - - - - - - - 10 - - - - - - - - - - - 0.40000000596046448 - - - - - - - - - - - - 10 - - - - - - - - - diff --git a/resources/Schema/Entities/ScoreBoard_Blue.xml b/resources/Schema/Entities/ScoreBoard_Blue.xml new file mode 100644 index 00000000..6b1a7bdd --- /dev/null +++ b/resources/Schema/Entities/ScoreBoard_Blue.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Name + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + KD + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Kills + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Deaths + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/ScoreBoard_Main.xml b/resources/Schema/Entities/ScoreBoard_Main.xml new file mode 100644 index 00000000..565fb57b --- /dev/null +++ b/resources/Schema/Entities/ScoreBoard_Main.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/ScoreBoard_Red.xml b/resources/Schema/Entities/ScoreBoard_Red.xml new file mode 100644 index 00000000..7c69656b --- /dev/null +++ b/resources/Schema/Entities/ScoreBoard_Red.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Name + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + KD + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Kills + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Deaths + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/ScoreIdentity.xml b/resources/Schema/Entities/ScoreIdentity.xml index daf9d4eb..b2df3821 100644 --- a/resources/Schema/Entities/ScoreIdentity.xml +++ b/resources/Schema/Entities/ScoreIdentity.xml @@ -14,6 +14,9 @@ -1 Fonts/DroidSans.ttf,64 + + + ScoreIdentity @@ -21,7 +24,8 @@ ID - + + @@ -31,6 +35,9 @@ Fonts/DroidSans.ttf,64 + + + ScoreIdentity @@ -38,7 +45,8 @@ Name - + + @@ -48,6 +56,9 @@ 0 Fonts/DroidSans.ttf,64 + + + ScoreIdentity @@ -55,7 +66,8 @@ KD - + + @@ -65,6 +77,9 @@ 0 Fonts/DroidSans.ttf,64 + + + ScoreIdentity @@ -72,7 +87,8 @@ Kills - + + @@ -82,6 +98,9 @@ 0 Fonts/DroidSans.ttf,64 + + + ScoreIdentity @@ -89,24 +108,8 @@ Deaths - - - - - - - - - 0 - Fonts/DroidSans.ttf,64 - - - ScoreIdentity - ScoreIdentity - Ping - - - + + From 217c3fe55cf8088c978a5ce16844b3f881656e3f Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 22:58:45 +0100 Subject: [PATCH 51/94] Fixes --- resources/DefaultConfig.ini | 2 +- .../Entities/{Maps => }/CP_RockHard.xml | 6748 +++++++++-------- .../Entities/PlayerAssaultFallbackBlue.xml | 135 +- .../Entities/PlayerAssaultFallbackRed.xml | 135 +- src/Game/Game.cpp | 2 +- 5 files changed, 3536 insertions(+), 3486 deletions(-) rename resources/Schema/Entities/{Maps => }/CP_RockHard.xml (95%) diff --git a/resources/DefaultConfig.ini b/resources/DefaultConfig.ini index fd468fd6..92e7bad3 100644 --- a/resources/DefaultConfig.ini +++ b/resources/DefaultConfig.ini @@ -75,7 +75,7 @@ NumIterations=9 TextureQuality=0 [GLOW] -Quality=3; +Quality=3 [GLOW1] NumIterations=5 diff --git a/resources/Schema/Entities/Maps/CP_RockHard.xml b/resources/Schema/Entities/CP_RockHard.xml similarity index 95% rename from resources/Schema/Entities/Maps/CP_RockHard.xml rename to resources/Schema/Entities/CP_RockHard.xml index 4f104155..2231df59 100644 --- a/resources/Schema/Entities/Maps/CP_RockHard.xml +++ b/resources/Schema/Entities/CP_RockHard.xml @@ -2,6 +2,10 @@ + + 1.2059834585982117 + 4 + @@ -30,28 +34,6 @@ - - - - - Models/Props/Walls/SciFiWallSmall2.mesh - - - - - - - - - - Models/Props/Walls/SciFiWallBig.mesh - - - - - - - @@ -83,6 +65,28 @@ + + + + + Models/Props/Walls/SciFiWallSmall2.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + @@ -704,6 +708,44 @@ + + + + + Models/Highgrounds/Hg18.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg20.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg6.mesh + + + + + + + @@ -753,44 +795,6 @@ - - - - - Models/Highgrounds/Hg18.mesh - - - - - - - - - - - - - Models/Highgrounds/Hg20.mesh - - - - - - - - - - - - - Models/Highgrounds/Hg6.mesh - - - - - - - @@ -1926,6 +1930,68 @@ + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + @@ -2691,6 +2757,25 @@ + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + @@ -2728,7 +2813,7 @@ - + @@ -2770,7 +2855,7 @@ - + @@ -2812,7 +2897,7 @@ - + @@ -2854,7 +2939,7 @@ - + @@ -2896,7 +2981,7 @@ - + @@ -2938,7 +3023,7 @@ - + @@ -2980,7 +3065,7 @@ - + @@ -3022,7 +3107,7 @@ - + @@ -3064,7 +3149,7 @@ - + @@ -3076,73 +3161,24 @@ - - - - - - - - - - Models/Props/Flora/SpecialRoot.mesh - - - - - - - - - - - - - - Models/Props/Flora/SpecialRoot.mesh - - - - - - - - - - - - - - Models/Props/Flora/SpecialRoot.mesh - - - - - - - - - - - - - Models/Props/Flora/SpecialRoot.mesh - - - - - - - - - - - + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + @@ -3169,91 +3205,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - @@ -3261,32 +3212,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -3294,8 +3219,8 @@ Models/Props/Stones/SmallStone1.mesh - - + + @@ -3317,11 +3242,12 @@ - Models/Props/Stones/SmallStone2.mesh + Models/Props/Stones/mediumStone2.mesh - - + + + @@ -3333,48 +3259,8 @@ Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - + + @@ -3387,21 +3273,8 @@ Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - + + @@ -3420,102 +3293,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - @@ -3534,84 +3311,16 @@ - Models/Props/Stones/mediumStone2.mesh + Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - + + - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3619,7 +3328,9 @@ Models/Props/Stones/BigStone.mesh - + + + @@ -3628,11 +3339,11 @@ - Models/Props/Stones/MediumStone2.mesh + Models/Props/Stones/SmallStone2.mesh - - + + @@ -3658,8 +3369,265 @@ Models/Props/Stones/MediumStone2.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + @@ -3677,6 +3645,219 @@ + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + @@ -3704,220 +3885,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - @@ -3946,33 +3913,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -3980,128 +3920,7 @@ Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - + @@ -4120,48 +3939,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -4176,47 +3953,6 @@ - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -4231,6 +3967,20 @@ + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + @@ -4238,9 +3988,8 @@ Models/Props/Stones/SmallStone2.mesh - - - + + @@ -4252,8 +4001,129 @@ Models/Props/Stones/mediumStone2.mesh - - + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + @@ -4263,18 +4133,114 @@ - Models/Props/Stones/mediumStone2.mesh + Models/Props/Stones/MediumStone2.mesh - - + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + - + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + @@ -4283,26 +4249,11 @@ - Models/Props/Walls/SpecialWall1.mesh + Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - + - @@ -4311,12 +4262,11 @@ - Models/Props/Walls/SpecialWall1.mesh + Models/Props/SciFiHolder1.mesh - - - + + @@ -4325,31 +4275,37 @@ - Models/Props/Walls/SpecialWall1.mesh + Models/Props/SciFiHolder1.mesh - - - + + - - - - - - - - Models/Props/Pillars/StonePillar.mesh + Models/Props/SciFiHolder1.mesh - + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + @@ -4368,21 +4324,7 @@ Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - + @@ -4395,8 +4337,35 @@ Models/Props/Walls/MediumWall3.mesh - - + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + @@ -4414,6 +4383,19 @@ + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -4421,13 +4403,121 @@ Models/Props/Walls/SmallWall3.mesh - + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + @@ -4441,6 +4531,115 @@ + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + @@ -4480,19 +4679,6 @@ - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - @@ -4507,19 +4693,6 @@ - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - @@ -4533,74 +4706,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - @@ -4615,101 +4720,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -4723,15 +4733,23 @@ + + + + + + + - Models/Props/Walls/MediumWall3.mesh + Models/Props/Walls/SpecialWall1.mesh - - + + + @@ -4740,11 +4758,12 @@ - Models/Props/Walls/MediumWall3.mesh + Models/Props/Walls/SpecialWall1.mesh - - + + + @@ -4753,12 +4772,12 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Walls/SpecialWall1.mesh - - - + + + @@ -4767,33 +4786,18 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Walls/SpecialWall1.mesh - - - + + + - - - - Models/Core/UnitPlane.mesh - - true - - - - - - - - - @@ -4813,61 +4817,8 @@ Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - + + @@ -4893,22 +4844,8 @@ Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - + + @@ -4933,8 +4870,9 @@ Models/Props/Stones/AssaultHolder.mesh - - + + + @@ -4946,9 +4884,8 @@ Models/Props/Stones/AssaultHolder.mesh - - - + + @@ -4974,8 +4911,8 @@ Models/Props/Stones/AssaultHolder.mesh - - + + @@ -4987,21 +4924,8 @@ Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - + + @@ -5027,8 +4951,8 @@ Models/Props/Stones/AssaultHolder.mesh - - + + @@ -5040,31 +4964,8 @@ Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - + + @@ -5073,107 +4974,82 @@ - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh + Models/Props/Stones/AssaultHolder.mesh - - + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + - - - - - - - + - Models/Props/PickUps/PickUpHolder.mesh + Models/Props/Stones/AssaultHolder.mesh - - - + + - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - + + - Models/Props/PickUps/PickUpHolder.mesh + Models/Props/Stones/AssaultHolder.mesh - - - + + + - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + @@ -5208,88 +5084,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -5331,6 +5125,216 @@ + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + @@ -5338,6 +5342,34 @@ + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + @@ -5355,25 +5387,11 @@ - Models/Props/Stones/SmallStone2.mesh + Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - + + @@ -5398,8 +5416,8 @@ Models/Props/Stones/SmallStone1.mesh - - + + @@ -5408,11 +5426,11 @@ - Models/Props/Stones/mediumStone2.mesh + Models/Props/Stones/BigStone.mesh - - + + @@ -5434,11 +5452,11 @@ - Models/Props/Stones/SmallStone1.mesh + Models/Props/Stones/mediumStone2.mesh - - + + @@ -5450,35 +5468,8 @@ Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - + + @@ -5501,11 +5492,11 @@ - Models/Props/Stones/MediumStone2.mesh + Models/Props/Stones/SmallStone1.mesh - - + + @@ -5517,105 +5508,8 @@ Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - + + @@ -5638,11 +5532,25 @@ - Models/Props/Stones/SmallStone1.mesh + Models/Props/Stones/MediumStone2.mesh - - + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + @@ -5660,6 +5568,102 @@ + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + @@ -5676,6 +5680,189 @@ + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -5746,189 +5933,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - - - - - - - - - - - - - - - - 5 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -5958,9 +5962,8 @@ Models/Props/Stones/SmallStone1.mesh - - - + + @@ -5982,11 +5985,12 @@ - Models/Props/Stones/MediumStone2.mesh + Models/Props/Stones/SmallStone1.mesh - - + + + @@ -5995,11 +5999,11 @@ - Models/Props/Stones/BigStone.mesh + Models/Props/Stones/MediumStone2.mesh - - + + @@ -6031,195 +6035,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6253,8 +6068,62 @@ Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + @@ -6267,8 +6136,344 @@ Models/Props/Stones/SmallStone2.mesh - - + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + @@ -6287,101 +6492,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6403,8 +6513,8 @@ Models/Props/Stones/SmallStone2.mesh - - + + @@ -6413,11 +6523,11 @@ - Models/Props/Stones/MediumStone2.mesh + Models/Props/Stones/BigStone.mesh - - + + @@ -6429,8 +6539,9 @@ Models/Props/Stones/SmallStone1.mesh - - + + + @@ -6442,8 +6553,49 @@ Models/Props/Stones/SmallStone2.mesh - - + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + @@ -6462,33 +6614,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6496,8 +6621,21 @@ Models/Props/Stones/SmallStone2.mesh - - + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + @@ -6509,8 +6647,60 @@ Models/Props/Stones/MediumStone2.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + @@ -6556,98 +6746,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6661,45 +6759,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6714,20 +6773,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -6742,47 +6787,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6813,158 +6817,11 @@ - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - @@ -6997,7 +6854,7 @@ - + @@ -7039,7 +6896,7 @@ - + @@ -7055,8 +6912,8 @@ Models/Props/PickUps/PickUpHolder.mesh - - + + @@ -7064,24 +6921,24 @@ - + - + 8 - Models/Props/PickUps/HealthPickUp.mesh + Models/Props/PickUps/AmmoPickUp.mesh - + @@ -7123,7 +6980,91 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + @@ -7165,7 +7106,7 @@ - + @@ -7177,6 +7118,69 @@ + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + @@ -7189,37 +7193,7 @@ Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar1Blue.mesh - - - - - + @@ -7242,10 +7216,12 @@ - Models/Props/Pillars/StonePillar.mesh + Models/Props/Pillars/SciFiPillar2Blue.mesh - + + + @@ -7257,9 +7233,37 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - - + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + @@ -7283,19 +7287,6 @@ - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - @@ -7323,6 +7314,19 @@ + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + @@ -7544,8 +7548,9 @@ Models/Props/Flora/SpecialRoot.mesh - - + + + @@ -7557,9 +7562,8 @@ Models/Props/Flora/SpecialRoot.mesh - - - + + @@ -7606,13 +7610,187 @@ Models/Props/Walls/SmallWall3.mesh - - + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + @@ -7626,6 +7804,128 @@ + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + @@ -7652,181 +7952,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - @@ -7840,60 +7965,6 @@ - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -7908,32 +7979,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - @@ -7947,47 +7992,6 @@ - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -8150,8 +8154,9 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - + + + @@ -8170,92 +8175,6 @@ - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - - 4 - Models/Props/Pillars/SciFiPillar3Blue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar1Blue.mesh - - - - - - - - - - - - - 4 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - @@ -8279,9 +8198,8 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - - + + @@ -8294,8 +8212,94 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + @@ -8349,189 +8353,6 @@ - - - - - - - - - - Schema/Entities/PlayerAssaultFallbackBlue.xml - - - - - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - - - Schema/Entities/PlayerAssaultFallbackBlue.xml - - - - - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - - - - - @@ -8560,13 +8381,13 @@ - + - - 10 - + + 0.40000000596046448 + - + @@ -8581,6 +8402,17 @@ + + + + 10 + + + + + + + @@ -8604,17 +8436,6 @@ - - - - 0.40000000596046448 - - - - - - - @@ -8622,43 +8443,6 @@ - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 15 - 1 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - @@ -8696,38 +8480,6 @@ - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 3 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - @@ -8768,6 +8520,75 @@ + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 15 + 1 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 3 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + @@ -8809,6 +8630,497 @@ + + + + + + + + + + Schema/Entities/PlayerAssaultFallbackBlue.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + + + Schema/Entities/PlayerAssaultFallbackRed.xml + + + + + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + + + + + + + + + 0.049999997019767761 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 2 + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 3 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 4 + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + 3 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + PickClass + 2 + + + + + + + + + + + + + Textures/Core/UnitRaptor.png + + + + PickClass + 1 + + + + + + + + + + + + + Textures/Test/aM4ME4GR.png + + + + PickClass + 3 + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml b/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml index 94177cee..9650cfe8 100644 --- a/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultFallbackBlue.xml @@ -514,107 +514,7 @@ - - - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - Schema/Entities/Weapons/RayBlue.xml - - - - - - - - - - - - Schema/Entities/ReloadEffectView.xml - - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - - - - - - 32 - Fonts/DroidSans.ttf,64 - - - - Player - AssaultWeapon - MagazineAmmo - - - - - - - - - - - 320 - Fonts/DroidSans.ttf,64 - - - - Player - AssaultWeapon - Ammo - - - - - - - - - - - - - - - + @@ -695,38 +595,7 @@ - - - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - Schema/Entities/Weapons/RayBlue.xml - - - - - - - - - - - Schema/Entities/ReloadEffectWorld.xml - - - - - - - - + diff --git a/resources/Schema/Entities/PlayerAssaultFallbackRed.xml b/resources/Schema/Entities/PlayerAssaultFallbackRed.xml index c16cb556..a32988c7 100644 --- a/resources/Schema/Entities/PlayerAssaultFallbackRed.xml +++ b/resources/Schema/Entities/PlayerAssaultFallbackRed.xml @@ -514,107 +514,7 @@ - - - - - Models/Weapons/Red/AssaultWeaponRed.mesh - - - - - - - - Schema/Entities/Weapons/RayRed.xml - - - - - - - - - - - - Schema/Entities/ReloadEffectView.xml - - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - - - - - - 32 - Fonts/DroidSans.ttf,64 - - - - Player - AssaultWeapon - MagazineAmmo - - - - - - - - - - - 320 - Fonts/DroidSans.ttf,64 - - - - Player - AssaultWeapon - Ammo - - - - - - - - - - - - - - - + @@ -695,38 +595,7 @@ - - - - - Models/Weapons/Red/AssaultWeaponRed.mesh - - - - - - - - Schema/Entities/Weapons/RayRed.xml - - - - - - - - - - - Schema/Entities/ReloadEffectWorld.xml - - - - - - - - + diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 0629fbd5..18e6fd5c 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -111,7 +111,7 @@ Game::Game(int argc, char* argv[]) // Create Octrees // TODO: Perhaps the world bounds should be set in some non-arbitrary way instead of this. - AABB boxContainingTheWorld(glm::vec3(-300), glm::vec3(300)); + AABB boxContainingTheWorld = AABB::FromOriginSize(glm::vec3(0.f, 10.7f, 0.f), glm::vec3(140.f, 31.f, 190.f)); m_OctreeCollision = new Octree(boxContainingTheWorld, 4); m_OctreeTrigger = new Octree(boxContainingTheWorld, 4); m_OctreeFrustrumCulling = new Octree(boxContainingTheWorld, 4); From e3fbd2082c18f6e761b9f7c1d211d4e0924312da Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 3 Mar 2016 23:20:13 +0100 Subject: [PATCH 52/94] BlendQueues fully working --- include/Engine/Rendering/BlendTree.h | 3 +- .../Engine/Rendering/EAutoAnimationBlend.h | 1 + resources/Schema/Components/Blend.xml | 1 + resources/Schema/Components/Blend.xsd | 1 + resources/Schema/Entities/BlendTreeTest.xml | 39 ++++--- src/Engine/Rendering/AnimationSystem.cpp | 101 ++++++++++-------- src/Engine/Rendering/AutoBlendQueue.cpp | 9 +- src/Engine/Rendering/BlendTree.cpp | 10 +- 8 files changed, 99 insertions(+), 66 deletions(-) diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index 2c5f1aa8..aa06f1e6 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -29,7 +29,7 @@ public: Node* Child[2] = { nullptr, nullptr }; NodeType Type; std::map Pose; - //std::vector Pose; + bool SubTreeRoot = false; double Weight = 0.0; Node* Next() { @@ -61,6 +61,7 @@ public: std::string NodeName; double progress; bool Start; + bool SingleBlend; std::unordered_map StartWeights; }; diff --git a/include/Engine/Rendering/EAutoAnimationBlend.h b/include/Engine/Rendering/EAutoAnimationBlend.h index 08c49191..ebd29848 100644 --- a/include/Engine/Rendering/EAutoAnimationBlend.h +++ b/include/Engine/Rendering/EAutoAnimationBlend.h @@ -17,6 +17,7 @@ struct AutoAnimationBlend : Event bool Start = false; bool Reverse = false; bool Restart = false; + bool SingleLevelBlend = false; EntityWrapper AnimationEntity = EntityWrapper::Invalid; }; diff --git a/resources/Schema/Components/Blend.xml b/resources/Schema/Components/Blend.xml index f949a102..a4a328ca 100644 --- a/resources/Schema/Components/Blend.xml +++ b/resources/Schema/Components/Blend.xml @@ -3,4 +3,5 @@ 0.5 + false \ No newline at end of file diff --git a/resources/Schema/Components/Blend.xsd b/resources/Schema/Components/Blend.xsd index 95fc8f49..34d32385 100644 --- a/resources/Schema/Components/Blend.xsd +++ b/resources/Schema/Components/Blend.xsd @@ -8,6 +8,7 @@ + diff --git a/resources/Schema/Entities/BlendTreeTest.xml b/resources/Schema/Entities/BlendTreeTest.xml index d2c7ead9..a3188348 100644 --- a/resources/Schema/Entities/BlendTreeTest.xml +++ b/resources/Schema/Entities/BlendTreeTest.xml @@ -68,8 +68,8 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - - + + @@ -81,15 +81,16 @@ AimPrimary AimSecondary 0 + true - + - AimSecWepA - + AimRifleA + false true @@ -97,11 +98,11 @@ - + - AimRifleA - + AimSecWepA + false true @@ -125,7 +126,8 @@ StandCrouchBlend JumpDashBlend - 1.055110346338068e-57 + 2.5146881298480398e-63 + true @@ -135,7 +137,8 @@ StandMovement CrouchMovement - 0.0069837930620454403 + 0.012867419418159054 + true @@ -174,7 +177,7 @@ WalkF - + 1 true @@ -186,7 +189,7 @@ RunF - + 1 true @@ -210,7 +213,7 @@ StrafeLeftF - + 1 true @@ -222,7 +225,7 @@ StrafeRightF - + 1 true @@ -281,7 +284,7 @@ CrouchStrafeLeftF - + 1 true @@ -293,7 +296,7 @@ CrouchStrafeRightF - + 1 true @@ -307,7 +310,7 @@ CrouchWalkF - + 1 true @@ -338,6 +341,7 @@ Jump DashBlend 1 + true @@ -448,6 +452,7 @@ ReloadSwitch WeaponActionBlend 1 + true diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 4434e80b..5c048fed 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -148,11 +148,11 @@ void AnimationSystem::UpdateWeights(double dt) bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) { - if(!e.RootNode.Valid()) { + if (!e.RootNode.Valid()) { return false; } - if(!e.RootNode.HasComponent("Model")) { + if (!e.RootNode.HasComponent("Model")) { return false; } @@ -179,7 +179,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) EntityWrapper subTreeRoot = blendTree->GetSubTreeRoot(e.NodeName); - if(!subTreeRoot.Valid()) { + if (!subTreeRoot.Valid()) { return false; } @@ -193,16 +193,18 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) abj.BlendInfo.NodeName = e.NodeName; abj.BlendInfo.progress = 0.0; abj.BlendInfo.Start = e.Start; + abj.BlendInfo.SingleBlend = e.SingleLevelBlend; - if (e.Restart) { - EntityWrapper nodeEntity = subTreeRoot.FirstChildByName(e.NodeName); - if (nodeEntity.Valid()) { - if (nodeEntity.HasComponent("Animation")) { - const Skeleton::Animation* animation = skeleton->GetAnimation(nodeEntity["Animation"]["AnimationName"]); + EntityWrapper nodeEntity = subTreeRoot.FirstChildByName(e.NodeName); // more than one + if (nodeEntity.Valid()) { + if (nodeEntity.HasComponent("Animation")) { + const Skeleton::Animation* animation = skeleton->GetAnimation(nodeEntity["Animation"]["AnimationName"]); + (bool&)nodeEntity["Animation"]["Reverse"] = e.Reverse; + + if (e.Restart) { if (animation != nullptr) { if (e.Restart) { - (bool&)nodeEntity["Animation"]["Reverse"] = e.Reverse; if (e.Reverse) { (double&)nodeEntity["Animation"]["Time"] = animation->Duration; } else { @@ -439,27 +441,7 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) aeb.RootNode = entity; aeb.Start = true; aeb.Restart = true; - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "Stand") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "StandMovement"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = true; + aeb.SingleLevelBlend = true; m_EventBroker->Publish(aeb); } } @@ -526,27 +508,15 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); if (entity.Name() == "Assault") { - /* { + { Events::AutoAnimationBlend aeb; aeb.Duration = 0.1; aeb.NodeName = "Right"; aeb.RootNode = entity; aeb.Start = true; m_EventBroker->Publish(aeb); - }*/ - - - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "Right"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = entity.FirstChildByName("DashRight"); - aeb.Delay = -0.3; - m_EventBroker->Publish(aeb); } + } } } else if (e.Command == "ForwardTest") { @@ -570,8 +540,51 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) } } } + } else if (e.Command == "BackwardTest") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Walk"; + aeb.RootNode = entity; + aeb.Start = true; + aeb.Reverse = true; + m_EventBroker->Publish(aeb); + } + } + } + } else if (e.Value == 0.f) { + if (e.Command == "Crouch") { + auto blendComponents = m_World->GetComponents("BlendAdditive"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Assault") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "StandMovement"; + aeb.RootNode = entity; + aeb.Start = true; + aeb.Restart = true; + aeb.SingleLevelBlend = true; + m_EventBroker->Publish(aeb); + } + } + } + } } } diff --git a/src/Engine/Rendering/AutoBlendQueue.cpp b/src/Engine/Rendering/AutoBlendQueue.cpp index e75e33b5..7ea79383 100644 --- a/src/Engine/Rendering/AutoBlendQueue.cpp +++ b/src/Engine/Rendering/AutoBlendQueue.cpp @@ -54,6 +54,11 @@ void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob) for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end(); it++) { auto next = std::next(it, 1); + + if (it->BlendJob.BlendInfo.NodeName == autoBlendJob.BlendInfo.NodeName) { + (*it) = blendNode; + } + if (next != m_BlendQueue.end()) { if (it->StartTime >= blendNode.StartTime && next->StartTime <= blendNode.StartTime) { LOG_INFO("Inserted %s between %s and %s", blendNode.BlendJob.BlendInfo.NodeName.c_str(), it->BlendJob.BlendInfo.NodeName.c_str(), next->BlendJob.BlendInfo.NodeName.c_str()); @@ -83,11 +88,11 @@ void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob) void AutoBlendQueue::UpdateTime(double dt) { for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end();) { - it->EndTime -= dt; - it->StartTime -= dt; if (it->EndTime <= 0) { it = m_BlendQueue.erase(it); } else { + it->EndTime -= dt; + it->StartTime -= dt; it++; } } diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 2f74b45e..60858f2a 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -27,6 +27,7 @@ BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton) m_Root->Parent = nullptr; m_Root->Type = NodeType::Blend; m_Root->Weight = (double)ModelEntity["Blend"]["Weight"]; + m_Root->SubTreeRoot = (bool)ModelEntity["Blend"]["SubTreeRoot"]; (double&)ModelEntity["Blend"]["Weight"] = glm::clamp((double)ModelEntity["Blend"]["Weight"], 0.0, 1.0); m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose1"], ModelEntity); m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose2"], ModelEntity); @@ -132,6 +133,7 @@ BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, E node->Type = NodeType::Blend; (double&)childEntity["Blend"]["Weight"] = glm::clamp((double)childEntity["Blend"]["Weight"], 0.0, 1.0); node->Weight = (double)childEntity["Blend"]["Weight"]; + node->SubTreeRoot = (bool)childEntity["Blend"]["SubTreeRoot"]; //if (node->Weight < 1.f && node->Weight > 0.f) { node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity); node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity); @@ -251,6 +253,10 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) lastNode = currentNode; currentNode = currentNode->Parent; + + if (blendInfo.SingleBlend) { + break; + } } } else if(goalNodes.size() >= 2) { std::vector sharedParents; @@ -380,8 +386,8 @@ EntityWrapper BlendTree::GetSubTreeRoot(std::string nodeName) std::vector subTreeRoots; for (auto it = nodes.begin(); it != nodes.end(); it++) { - Node* currentNode = (*it); - while (currentNode->Parent->Type == NodeType::Blend) { + Node* currentNode = (*it)->Parent; + while (!currentNode->SubTreeRoot) { currentNode = currentNode->Parent; } subTreeRoots.push_back(currentNode); From bebdacabb4ee15da79b33ac3ea7c57f256c49751 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 3 Mar 2016 23:41:08 +0100 Subject: [PATCH 53/94] Clean up --- include/Engine/Rendering/AnimationSystem.h | 5 - .../Schema/Entities/AssaultBlendTree.xml | 513 ++++++++++++++++++ resources/Schema/Entities/BlendTreeTest.xml | 42 +- src/Engine/Rendering/AnimationSystem.cpp | 373 ------------- src/Engine/Rendering/AutoBlendQueue.cpp | 5 - 5 files changed, 538 insertions(+), 400 deletions(-) create mode 100644 resources/Schema/Entities/AssaultBlendTree.xml diff --git a/include/Engine/Rendering/AnimationSystem.h b/include/Engine/Rendering/AnimationSystem.h index 4f18b4a4..a04aa3c5 100644 --- a/include/Engine/Rendering/AnimationSystem.h +++ b/include/Engine/Rendering/AnimationSystem.h @@ -10,7 +10,6 @@ #include "Rendering/Skeleton.h" #include "Rendering/BlendTree.h" #include "Rendering/EAutoAnimationBlend.h" -#include "../Input/EInputCommand.h" #include "../Core/EntityWrapper.h" #include "Rendering/AutoBlendQueue.h" @@ -30,10 +29,6 @@ private: EventRelay m_EAutoAnimationBlend; bool OnAutoAnimationBlend(Events::AutoAnimationBlend& e); - - EventRelay m_EInputCommand; - bool OnInputCommand(const Events::InputCommand& e); - std::unordered_map m_AutoBlendQueues; }; diff --git a/resources/Schema/Entities/AssaultBlendTree.xml b/resources/Schema/Entities/AssaultBlendTree.xml new file mode 100644 index 00000000..e8dcff8a --- /dev/null +++ b/resources/Schema/Entities/AssaultBlendTree.xml @@ -0,0 +1,513 @@ + + + + + + AimBlend + FinalBlend + + + 5 + Models/Characters/Assault/AssaultBlue.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + true + + + + + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + MovementBlend + + + + + + + + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 + true + + + + + + + + StandMovement + CrouchMovement + 0.012867419418159054 + true + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + MovementBlend + Idle + 0 + + + + + + + + Walk + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + + + + + + CrouchWalkF + + 1 + true + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + + + Jump + DashBlend + 1 + true + + + + + + + + JumpF + + 1 + false + + + + + + + + + DashFBBlend + DashLRBlend + 0.014621149736541383 + + + + + + + + DashForward + DashBackward + 0.014363533804961248 + + + + + + + + DashForwardF + + 1 + false + + + + + + + + + DashBackwardF + + 1 + false + + + + + + + + + + + DashLeft + DashRight + 4.3244885367500671e-16 + + + + + + + + DashLeftF + + 1 + false + + + + + + + + + DashRightF + + 1 + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/BlendTreeTest.xml b/resources/Schema/Entities/BlendTreeTest.xml index a3188348..79e2e223 100644 --- a/resources/Schema/Entities/BlendTreeTest.xml +++ b/resources/Schema/Entities/BlendTreeTest.xml @@ -68,8 +68,8 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - - + + @@ -86,11 +86,11 @@ - + - AimRifleA - + AimSecWepA + false true @@ -98,10 +98,10 @@ - + - AimSecWepA + AimRifleA false true @@ -148,7 +148,7 @@ MovementBlend Idle - 0 + 1 @@ -177,7 +177,7 @@ WalkF - + 1 true @@ -189,7 +189,7 @@ RunF - + 1 true @@ -213,7 +213,7 @@ StrafeLeftF - + 1 true @@ -225,7 +225,7 @@ StrafeRightF - + 1 true @@ -241,8 +241,9 @@ IdleF - + 1 + true @@ -284,7 +285,7 @@ CrouchStrafeLeftF - + 1 true @@ -296,7 +297,7 @@ CrouchStrafeRightF - + 1 true @@ -310,7 +311,7 @@ CrouchWalkF - + 1 true @@ -473,7 +474,7 @@ IdleBlend ShootBlend - 1 + 0 @@ -483,6 +484,7 @@ IdlePrimary IdleSecondary + 0 @@ -491,6 +493,9 @@ IdleAssaultRifleU + + 1 + true @@ -500,6 +505,9 @@ IdleSecWepU + + 1 + true diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 5c048fed..99643997 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -4,7 +4,6 @@ AnimationSystem::AnimationSystem(SystemParams params) : System(params) { EVENT_SUBSCRIBE_MEMBER(m_EAutoAnimationBlend, &AnimationSystem::OnAutoAnimationBlend); - EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &AnimationSystem::OnInputCommand); } void AnimationSystem::Update(double dt) @@ -16,7 +15,6 @@ void AnimationSystem::Update(double dt) for(auto& autoBlendQueue : m_AutoBlendQueues) { autoBlendQueue.second.UpdateTime(dt); - // autoBlendQueue.second.PrintQueue(); } } @@ -136,7 +134,6 @@ void AnimationSystem::UpdateWeights(double dt) if (blendTree != nullptr) { blendJob.BlendInfo.progress = glm::clamp(blendJob.CurrentTime / blendJob.Duration, 0.0, 1.0); - LOG_INFO("Progress: %f, %s", blendJob.BlendInfo.progress, blendJob.BlendInfo.NodeName.c_str()); blendJob.BlendInfo = blendTree->AutoBlendStep(blendJob.BlendInfo); } @@ -215,376 +212,6 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) } } } - - - LOG_INFO("Inserting %s blendJob into %s subtree", e.NodeName.c_str(), subTreeRoot.Name().c_str()); m_AutoBlendQueues[subTreeRoot].Insert(abj); - - LOG_INFO("\n"); - m_AutoBlendQueues.at(subTreeRoot).PrintQueue(); - LOG_INFO("\n"); - - return true; } - -bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) -{ - - if (e.Value == 1.f) { - if(e.Command == "DashForward") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.2; - aeb.NodeName = "DashForward"; - aeb.RootNode = entity; - aeb.Restart = true; - aeb.Start = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "StandCrouchBlend"; - aeb.RootNode = entity; - aeb.Delay = -0.3; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = entity.FirstChildByName("DashForward"); - m_EventBroker->Publish(aeb); - } - } - } - - } else if (e.Command == "DashBackward") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "DashBackward"; - aeb.RootNode = entity; - aeb.Restart = true; - aeb.Start = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "StandCrouchBlend"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = false; - aeb.Delay = -0.3; - aeb.AnimationEntity = entity.FirstChildByName("DashBackward"); - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "DashLeft") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "DashLeft"; - aeb.RootNode = entity; - aeb.Restart = true; - aeb.Start = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "StandCrouchBlend"; - aeb.RootNode = entity; - aeb.Delay = -0.3; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = entity.FirstChildByName("DashLeft"); - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "DashRight") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "DashRight"; - aeb.RootNode = entity; - aeb.Restart = true; - aeb.Start = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "StandCrouchBlend"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = entity.FirstChildByName("DashRight"); - aeb.Delay = -0.3; - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "Jump") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.25; - aeb.NodeName = "Jump"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "StandCrouchBlend"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = entity.FirstChildByName("Jump"); - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "Reload") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.2; - aeb.NodeName = "ReloadSwitch"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.2; - aeb.NodeName = "IdlePrimary"; - aeb.RootNode = entity; - aeb.Delay = -0.1; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = entity.FirstChildByName("ReloadSwitch"); - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "Crouch") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "CrouchMovement"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = true; - aeb.SingleLevelBlend = true; - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "Shoot") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "ShootPrimary"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "IdlePrimary"; - aeb.RootNode = entity; - aeb.Delay = 0.0; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = entity.FirstChildByName("ShootPrimary"); - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "LeftTest") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "Left"; - aeb.RootNode = entity; - aeb.Start = true; - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Command == "RightTest") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "Right"; - aeb.RootNode = entity; - aeb.Start = true; - m_EventBroker->Publish(aeb); - } - - } - } - } else if (e.Command == "ForwardTest") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "Walk"; - aeb.RootNode = entity; - aeb.Start = true; - m_EventBroker->Publish(aeb); - } - } - } - } - } else if (e.Command == "BackwardTest") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "Walk"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Reverse = true; - m_EventBroker->Publish(aeb); - } - } - } - } else if (e.Value == 0.f) { - if (e.Command == "Crouch") { - auto blendComponents = m_World->GetComponents("BlendAdditive"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Assault") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "StandMovement"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = true; - aeb.SingleLevelBlend = true; - m_EventBroker->Publish(aeb); - } - } - } - } - } -} - diff --git a/src/Engine/Rendering/AutoBlendQueue.cpp b/src/Engine/Rendering/AutoBlendQueue.cpp index 7ea79383..cafb7ee5 100644 --- a/src/Engine/Rendering/AutoBlendQueue.cpp +++ b/src/Engine/Rendering/AutoBlendQueue.cpp @@ -45,7 +45,6 @@ void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob) AnimationDuration = (animation->Duration * animationSpeed) - animationTime; } - LOG_INFO("Animation Duration %f", AnimationDuration); blendNode.StartTime += AnimationDuration; blendNode.EndTime += AnimationDuration; if (m_BlendQueue.size() == 0) { @@ -61,16 +60,13 @@ void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob) if (next != m_BlendQueue.end()) { if (it->StartTime >= blendNode.StartTime && next->StartTime <= blendNode.StartTime) { - LOG_INFO("Inserted %s between %s and %s", blendNode.BlendJob.BlendInfo.NodeName.c_str(), it->BlendJob.BlendInfo.NodeName.c_str(), next->BlendJob.BlendInfo.NodeName.c_str()); m_BlendQueue.insert(next, blendNode); return; } } else if(it->StartTime > blendNode.StartTime){ - LOG_INFO("Inserted %s after %s", blendNode.BlendJob.BlendInfo.NodeName.c_str(), it->BlendJob.BlendInfo.NodeName.c_str()); m_BlendQueue.push_front(blendNode); return; } else if (it->StartTime <= blendNode.StartTime) { - LOG_INFO("Inserted %s after %s", blendNode.BlendJob.BlendInfo.NodeName.c_str(), it->BlendJob.BlendInfo.NodeName.c_str()); m_BlendQueue.push_back(blendNode); return; } @@ -80,7 +76,6 @@ void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob) } - LOG_INFO("Cleared BlendQueue and inserted %s", blendNode.BlendJob.BlendInfo.NodeName.c_str()); m_BlendQueue.clear(); m_BlendQueue.push_back(blendNode); } From 2167b6f7b1562430a01ecf19f0459adfa2881a46 Mon Sep 17 00:00:00 2001 From: stiffly Date: Thu, 3 Mar 2016 23:43:50 +0100 Subject: [PATCH 54/94] Fix for previous commit.. --- include/Engine/Network/Server.h | 2 +- src/Engine/Network/Server.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/Engine/Network/Server.h b/include/Engine/Network/Server.h index 6796aaf2..d1fd2975 100644 --- a/include/Engine/Network/Server.h +++ b/include/Engine/Network/Server.h @@ -80,7 +80,7 @@ private: void identifyPacketLoss(); void kick(PlayerID player); PlayerID getPlayerIDFromEndpoint(); - PlayerID getPlayerIDFromEntityID(); + PlayerID getPlayerIDFromEntityID(EntityID entityID); void parsePlayerTransform(Packet& packet); void parseOnInputCommand(Packet& packet); void parseClientPing(); diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index 207b10f7..3f664f7e 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -534,6 +534,7 @@ bool Server::OnPlayerDeath(const Events::PlayerDeath& e) eKD.Casualty = getPlayerIDFromEntityID(e.Player.ID); eKD.Killer = getPlayerIDFromEntityID(e.Killer.ID); m_EventBroker->Publish(eKD); + return false; } void Server::parseClientPing() From 7e6d32aaecac3649d6ac5f4c4a38198189951f25 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 3 Mar 2016 23:28:16 +0100 Subject: [PATCH 55/94] Fixed AssaultWeapon reload logic --- .../Systems/Weapon/AssaultWeaponBehaviour.h | 1 + resources/Schema/Components/AssaultWeapon.xml | 1 + resources/Schema/Components/AssaultWeapon.xsd | 1 + .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 34 ++++++++++++++----- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h index 7244d443..69bd15e1 100644 --- a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h @@ -20,6 +20,7 @@ public: void OnPrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnCeasePrimaryFire(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) override; + void OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) override; //bool OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e) override; diff --git a/resources/Schema/Components/AssaultWeapon.xml b/resources/Schema/Components/AssaultWeapon.xml index ba74fbb7..263a840a 100755 --- a/resources/Schema/Components/AssaultWeapon.xml +++ b/resources/Schema/Components/AssaultWeapon.xml @@ -15,6 +15,7 @@ 0.5 false 0 + false false 0 0 diff --git a/resources/Schema/Components/AssaultWeapon.xsd b/resources/Schema/Components/AssaultWeapon.xsd index a1e745de..1faf14fa 100755 --- a/resources/Schema/Components/AssaultWeapon.xsd +++ b/resources/Schema/Components/AssaultWeapon.xsd @@ -44,6 +44,7 @@ + diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index c982637b..4d0f2258 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -10,18 +10,28 @@ void AssaultWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWra void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { - // Decrement reload timer - double& reloadTimer = cWeapon["ReloadTimer"]; - reloadTimer = glm::max(0.0, reloadTimer - dt); - // Start reloading automatically if at 0 mag ammo int& magAmmo = cWeapon["MagazineAmmo"]; if (m_ConfigAutoReload && magAmmo <= 0) { OnReload(cWeapon, wi); } - // Handle reloading + // Only start reloading once we're done firing + bool& reloadQueued = cWeapon["ReloadQueued"]; + double& fireCooldown = cWeapon["FireCooldown"]; bool& isReloading = cWeapon["IsReloading"]; + if (reloadQueued && fireCooldown <= 0) { + reloadQueued = fireCooldown; + isReloading = true; + } + + // Decrement reload timer + double& reloadTimer = cWeapon["ReloadTimer"]; + if (isReloading) { + reloadTimer = glm::max(0.0, reloadTimer - dt); + } + + // Handle reloading if (isReloading && reloadTimer <= 0.0) { int& magSize = cWeapon["MagazineSize"]; int& ammo = cWeapon["Ammo"]; @@ -67,8 +77,9 @@ void AssaultWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapon void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) { + bool& reloadQueued = cWeapon["ReloadQueued"]; bool& isReloading = cWeapon["IsReloading"]; - if (isReloading) { + if (reloadQueued || isReloading) { return; } @@ -86,10 +97,15 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) double& reloadTimer = cWeapon["ReloadTimer"]; // Start reload - isReloading = true; + reloadQueued = true; reloadTimer = reloadTime; } +void AssaultWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + cWeapon["FireCooldown"] = (double)cWeapon["EquipTime"]; +} + void AssaultWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) { // Make sure the trigger is released if weapon is holstered while firing @@ -167,8 +183,8 @@ bool AssaultWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi) { bool triggerHeld = cWeapon["TriggerHeld"]; bool cooldownPassed = (double)cWeapon["FireCooldown"] <= 0.0; - bool isReloading = cWeapon["IsReloading"]; - return triggerHeld && cooldownPassed; + bool isNotReloading = !(bool)cWeapon["IsReloading"]; + return triggerHeld && cooldownPassed && isNotReloading; } bool AssaultWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi) From 118d61c711ef63a8fd36df67ed9d0b57dbbe1ce3 Mon Sep 17 00:00:00 2001 From: Tleety Date: Thu, 3 Mar 2016 23:55:52 +0100 Subject: [PATCH 56/94] Should now remove players from scoreboard if they disconnect --- src/Game/Systems/ScoreScreenSystem.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index e23fba1d..d237456d 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -39,7 +39,6 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& float position = 0.f; for (auto it = m_PlayerIdentities.begin(); it != m_PlayerIdentities.end(); ++it) { - bool found = false; for (auto child : children) { int ID = (int)child["ScoreIdentity"]["ID"]; @@ -49,12 +48,14 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& (int&)entity["ScoreScreen"]["TotalIdentities"] -= 1; break; } - for (auto it = m_DisconnectedIdentities.begin(); it != m_DisconnectedIdentities.end(); ++it) { - if (ID = *it) { - + for (auto it2 = m_DisconnectedIdentities.begin(); it2 != m_DisconnectedIdentities.end(); ++it2) { + if (ID == *it2) { m_World->DeleteEntity(child.ID); (int&)entity["ScoreScreen"]["TotalIdentities"] -= 1; - it = m_DisconnectedIdentities.erase(it); + it2 = m_DisconnectedIdentities.erase(it2); + it = m_PlayerIdentities.erase(it); + + //Remove from m_playerIdentities break; } } @@ -67,6 +68,11 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& break; } } + + if (it == m_PlayerIdentities.end()) { + break; + } + if(found == false) { if(it->second.Team != currentTeam) { //This player is not the same team as this scoreboard should show. @@ -133,6 +139,5 @@ bool ScoreScreenSystem::OnPlayerDisconnected(const Events::PlayerDisconnected& e { //player has disconnected, remove him from list of ScoreIdentities m_DisconnectedIdentities.push_back(e.PlayerID); - m_PlayerIdentities.erase(e.PlayerID); return 0; } From 66374b7ff9924747251cc14a59ceeba6e52df9a7 Mon Sep 17 00:00:00 2001 From: Tleety Date: Fri, 4 Mar 2016 00:21:01 +0100 Subject: [PATCH 57/94] Should now track score correctly --- include/Game/Systems/ScoreScreenSystem.h | 8 +++++--- src/Game/Systems/ScoreScreenSystem.cpp | 23 ++++++++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h index 7a1d0cae..384f3c8d 100644 --- a/include/Game/Systems/ScoreScreenSystem.h +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -4,7 +4,7 @@ #include "Core/System.h" #include "Core/ResourceManager.h" #include "Core/EntityFile.h" -#include "Core/EPlayerDeath.h" +#include "Network/EKillDeath.h" #include "Core/EPlayerSpawned.h" #include "Network/EPlayerConnected.h" #include "Network/EPlayerDisconnected.h" @@ -17,8 +17,8 @@ public: virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override; - EventRelay m_EPlayerDeath; - bool OnPlayerDeath(const Events::PlayerDeath& e); + EventRelay m_EPlayerDeath; + bool OnPlayerDeath(const Events::KillDeath& e); EventRelay m_EPlayerSpawned; bool OnPlayerSpawn(const Events::PlayerSpawned& e); EventRelay m_EPlayerConnected; @@ -34,6 +34,8 @@ private: EntityWrapper Player = EntityWrapper::Invalid; }; + std::unordered_map m_DeathAmount; + std::unordered_map m_KillAmount; std::vector m_DisconnectedIdentities; int m_PlayerCounter = 0; std::unordered_map m_PlayerIdentities; diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index d237456d..5c7fe569 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -60,7 +60,23 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& } } found = true; - //Update position for childs + //Update Deaths for child + std::unordered_map::iterator gotDeaths = m_DeathAmount.find(ID); + if(gotDeaths != m_DeathAmount.end()) { + (int&)child["ScoreIdentity"]["Deaths"] += gotDeaths->second; + (double&)child["ScoreIdentity"]["KD"] = (double)((int)child["ScoreIdentity"]["Deaths"]/(int)child["ScoreIdentity"]["Deaths"]); + m_DeathAmount.erase(gotDeaths); + + } + //Update Kills for child + std::unordered_map::iterator gotKills = m_KillAmount.find(ID); + if (gotKills != m_KillAmount.end()) { + (int&)child["ScoreIdentity"]["Kills"] += gotKills->second; + (double&)child["ScoreIdentity"]["KD"] = (double)((int)child["ScoreIdentity"]["Deaths"]/(int)child["ScoreIdentity"]["Deaths"]); + m_KillAmount.erase(gotKills); + + } + //Update position for child glm::vec3 offset = (glm::vec3)entity["ScoreScreen"]["Offset"]; (glm::vec3&) child["Transform"]["Position"] = offset * position; position += 1.f; @@ -89,7 +105,6 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& (std::string&)cScoreIdentity["Name"] = data.Name; (int&)cScoreIdentity["ID"] = data.ID; - (int&)cScoreIdentity["Ping"] = 1337; m_World->SetParent(scoreIdentity.ID, entity.ID); @@ -100,9 +115,11 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& //Local player should have an icon, compare with LocalPlayer somthing } -bool ScoreScreenSystem::OnPlayerDeath(const Events::PlayerDeath& e) +bool ScoreScreenSystem::OnPlayerDeath(const Events::KillDeath& e) { //When player die, add it to his score, and when possible the player who killed him. + m_DeathAmount[e.Casualty]++; + m_KillAmount[e.Killer]++; return 0; } From 00b5a1771c3447ec12c645f3385b1187aee125e6 Mon Sep 17 00:00:00 2001 From: Tleety Date: Fri, 4 Mar 2016 01:34:29 +0100 Subject: [PATCH 58/94] Should now work fully, not KD tho --- include/Game/Systems/ScoreScreenSystem.h | 4 ++-- src/Game/Systems/BoostSystem.cpp | 10 ++++++-- src/Game/Systems/ScoreScreenSystem.cpp | 29 +++++++++++------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h index 384f3c8d..f2528a7f 100644 --- a/include/Game/Systems/ScoreScreenSystem.h +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -31,11 +31,11 @@ private: int ID = -1; std::string Name = ""; int Team = 1; + int Kills = 0; + int Deaths = 0; EntityWrapper Player = EntityWrapper::Invalid; }; - std::unordered_map m_DeathAmount; - std::unordered_map m_KillAmount; std::vector m_DisconnectedIdentities; int m_PlayerCounter = 0; std::unordered_map m_PlayerIdentities; diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index c79576e4..c3dc1f2b 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -11,10 +11,16 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) if (e.Victim.ID == e.Inflictor.ID) { return false; } - if (!e.Victim.Valid() && e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { + + if (!e.Victim.Valid() || !LocalPlayer.Valid()) { return false; } - if (!e.Inflictor.Valid() || !e.Victim.Valid()) { + + if (e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { + return false; + } + + if (!e.Inflictor.Valid()) { return false; } diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 5c7fe569..29749a9b 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -40,7 +40,7 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& for (auto it = m_PlayerIdentities.begin(); it != m_PlayerIdentities.end(); ++it) { bool found = false; - for (auto child : children) { + for (auto& child : children) { int ID = (int)child["ScoreIdentity"]["ID"]; if (it->first == ID) { if (it->second.Team != currentTeam) { @@ -61,21 +61,11 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& } found = true; //Update Deaths for child - std::unordered_map::iterator gotDeaths = m_DeathAmount.find(ID); - if(gotDeaths != m_DeathAmount.end()) { - (int&)child["ScoreIdentity"]["Deaths"] += gotDeaths->second; - (double&)child["ScoreIdentity"]["KD"] = (double)((int)child["ScoreIdentity"]["Deaths"]/(int)child["ScoreIdentity"]["Deaths"]); - m_DeathAmount.erase(gotDeaths); - - } + (int&)child["ScoreIdentity"]["Kills"] = it->second.Kills; //Update Kills for child - std::unordered_map::iterator gotKills = m_KillAmount.find(ID); - if (gotKills != m_KillAmount.end()) { - (int&)child["ScoreIdentity"]["Kills"] += gotKills->second; - (double&)child["ScoreIdentity"]["KD"] = (double)((int)child["ScoreIdentity"]["Deaths"]/(int)child["ScoreIdentity"]["Deaths"]); - m_KillAmount.erase(gotKills); + (int&)child["ScoreIdentity"]["Deaths"] = it->second.Deaths; + //KD is not updated at the moment. - } //Update position for child glm::vec3 offset = (glm::vec3)entity["ScoreScreen"]["Offset"]; (glm::vec3&) child["Transform"]["Position"] = offset * position; @@ -118,8 +108,15 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& bool ScoreScreenSystem::OnPlayerDeath(const Events::KillDeath& e) { //When player die, add it to his score, and when possible the player who killed him. - m_DeathAmount[e.Casualty]++; - m_KillAmount[e.Killer]++; + std::unordered_map::iterator got; + got = m_PlayerIdentities.find(e.Casualty); + if(got != m_PlayerIdentities.end()) { + got->second.Deaths++; + } + got = m_PlayerIdentities.find(e.Killer); + if (got != m_PlayerIdentities.end()) { + got->second.Kills++; + } return 0; } From 1616fb20d14904f04c39f09c7f9f1c59186e253f Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 4 Mar 2016 02:03:50 +0100 Subject: [PATCH 59/94] Skinned meshes now in T-Pose when not it's blendtree is null --- include/Engine/Rendering/Skeleton.h | 3 + src/Engine/Rendering/DrawFinalPass.cpp | 110 +++++++++++++++++-------- src/Engine/Rendering/PickingPass.cpp | 15 +++- src/Engine/Rendering/Skeleton.cpp | 12 +++ 4 files changed, 102 insertions(+), 38 deletions(-) diff --git a/include/Engine/Rendering/Skeleton.h b/include/Engine/Rendering/Skeleton.h index 08e348ab..3711c8b2 100644 --- a/include/Engine/Rendering/Skeleton.h +++ b/include/Engine/Rendering/Skeleton.h @@ -77,6 +77,9 @@ public: std::map BlendPoseAdditive(const std::map& additivePose, const std::map& targetPose); void GetFinalPose(std::map& boneMatrices, std::vector& finalPose, std::map& boneTransforms); + std::vector GetTPose(); + + std::map Animations; private: Skeleton::PoseData GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time); diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index 1b7f87ea..a610fab1 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -362,11 +362,15 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture); glUniform3fv(glGetUniformLocation(explosionSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position())); + std::vector frameBones; if (explosionEffectJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = explosionEffectJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + + } else { m_ExplosionEffectProgram->Bind(); @@ -391,11 +395,14 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& //bind textures BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob); GLERROR("asdasd"); + std::vector frameBones; if (explosionEffectJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = explosionEffectJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ExplosionEffectSplatMapProgram->Bind(); @@ -438,12 +445,14 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture); glUniform3fv(glGetUniformLocation(forwardSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position())); - if (modelJob->BlendTree != nullptr) { - std::vector frameBones; + std::vector frameBones; + if (modelJob->BlendTree != nullptr) { frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } - } + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ForwardPlusProgram->Bind(); GLERROR("Bind ForwardPlusProgram"); @@ -467,11 +476,14 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& //bind textures BindModelTextures(forwardSplatMapSkinnedHandle, modelJob); GLERROR("asdasd"); + std::vector frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ForwardPlusSplatMapProgram->Bind(); @@ -547,11 +559,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listm_CubeMapTexture); glUniform3fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position())); + std::vector frameBones; if (explosionEffectJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = explosionEffectJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ExplosionEffectShieldCheckProgram->Bind(); @@ -578,11 +593,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list frameBones; if (explosionEffectJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = explosionEffectJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ExplosionEffectSplatMapShieldCheckProgram->Bind(); @@ -614,12 +632,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listm_CubeMapTexture); glUniform3fv(glGetUniformLocation(explosionSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position())); + std::vector frameBones; if (explosionEffectJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = explosionEffectJob->Skeleton->GetTPose(); } - } + glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ExplosionEffectProgram->Bind(); GLERROR("Bind ExplosionEffect program"); @@ -643,12 +663,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list frameBones; if (explosionEffectJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = explosionEffectJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ExplosionEffectSplatMapProgram->Bind(); @@ -693,11 +715,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listm_CubeMapTexture); glUniform3fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position())); + std::vector frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ForwardPlusShieldCheckProgram->Bind(); @@ -723,11 +748,13 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { m_ForwardPlusSplatMapShieldCheckProgram->Bind(); @@ -757,11 +784,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::listm_CubeMapTexture); glUniform3fv(glGetUniformLocation(forwardSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position())); + std::vector frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_ForwardPlusProgram->Bind(); @@ -787,11 +817,13 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { m_ForwardPlusSplatMapProgram->Bind(); @@ -849,11 +881,14 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list frameBones; if (explosionEffectJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = explosionEffectJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = explosionEffectJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + if (GLERROR("Animation")) { continue; } @@ -885,12 +920,16 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + + //draw glBindVertexArray(modelJob->Model->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); @@ -918,11 +957,14 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::listProjectionMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); + std::vector frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_FillDepthStencilBufferProgram->Bind(); GLuint shaderHandle = m_FillDepthStencilBufferProgram->GetHandle(); diff --git a/src/Engine/Rendering/PickingPass.cpp b/src/Engine/Rendering/PickingPass.cpp index 096762d8..57e10aff 100644 --- a/src/Engine/Rendering/PickingPass.cpp +++ b/src/Engine/Rendering/PickingPass.cpp @@ -104,11 +104,15 @@ void PickingPass::Draw(RenderScene& scene) glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); + std::vector frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + + } else { m_PickingProgram->Bind(); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); @@ -210,12 +214,15 @@ void PickingPass::Draw(RenderScene& scene) glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1]))); + std::vector frameBones; if (modelJob->BlendTree != nullptr) { - std::vector frameBones; frameBones = modelJob->BlendTree->GetFinalPose(); - glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { + frameBones = modelJob->Skeleton->GetTPose(); } + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + } else { m_PickingProgram->Bind(); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); diff --git a/src/Engine/Rendering/Skeleton.cpp b/src/Engine/Rendering/Skeleton.cpp index c9ae2732..592279ed 100644 --- a/src/Engine/Rendering/Skeleton.cpp +++ b/src/Engine/Rendering/Skeleton.cpp @@ -249,6 +249,18 @@ void Skeleton::GetFinalPose(std::map& poseDatas, std::v } + +std::vector Skeleton::GetTPose() +{ + std::vector finalMatrices; + + for (auto b : Bones) { + finalMatrices.push_back(glm::mat4(1)); + } + + return finalMatrices; +} + void Skeleton::AccumulateFinalPose(std::map& boneMatrices, std::map& poseDatas, std::map& boneTransforms, const Bone* bone, glm::mat4 parentMatrix) { glm::mat4 boneMatrix; From 778bbd13ca32ce106714c96ec2289e529c955ebf Mon Sep 17 00:00:00 2001 From: Tleety Date: Fri, 4 Mar 2016 02:19:13 +0100 Subject: [PATCH 60/94] double's should now be displayed with only 1 decimal. --- include/Game/Systems/TextFieldReader.h | 2 ++ resources/Schema/Entities/ScoreIdentity.xml | 4 ++-- src/Game/Systems/TextFieldReader.cpp | 12 ++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/Game/Systems/TextFieldReader.h b/include/Game/Systems/TextFieldReader.h index 1ea8e966..290bedbc 100644 --- a/include/Game/Systems/TextFieldReader.h +++ b/include/Game/Systems/TextFieldReader.h @@ -2,6 +2,8 @@ #define AmmunitionHUDSystem_h__ #include +#include +#include #include "../../Engine/Core/System.h" #include "../../Engine/GLM.h" diff --git a/resources/Schema/Entities/ScoreIdentity.xml b/resources/Schema/Entities/ScoreIdentity.xml index b2df3821..2d1b471a 100644 --- a/resources/Schema/Entities/ScoreIdentity.xml +++ b/resources/Schema/Entities/ScoreIdentity.xml @@ -54,7 +54,7 @@ - 0 + 0.0 Fonts/DroidSans.ttf,64 @@ -66,7 +66,7 @@ KD - + diff --git a/src/Game/Systems/TextFieldReader.cpp b/src/Game/Systems/TextFieldReader.cpp index 8712a61f..c2e5c1e4 100644 --- a/src/Game/Systems/TextFieldReader.cpp +++ b/src/Game/Systems/TextFieldReader.cpp @@ -35,9 +35,17 @@ void TextFieldReader::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c if (field.Type == "int") { text = boost::lexical_cast((const int&)component[fieldName]); } else if (field.Type == "float") { - text = boost::lexical_cast((const float&)component[fieldName]); + std::ostringstream ss; + float f = (float)component[fieldName]; + ss << std::fixed << std::setprecision(2); + ss << f; + text = ss.str(); } else if (field.Type == "double") { - text = boost::lexical_cast((const double&)component[fieldName]); + std::ostringstream ss; + double d = (double)component[fieldName]; + ss << std::fixed << std::setprecision(1); + ss << d; + text = ss.str(); } else if (field.Type == "bool") { text = boost::lexical_cast((const bool&)component[fieldName]); } else if (field.Type == "string") { From 45991000ae312eee4f611a2a823e2b0dc46a6bd4 Mon Sep 17 00:00:00 2001 From: Tleety Date: Fri, 4 Mar 2016 02:20:42 +0100 Subject: [PATCH 61/94] Removed unused code --- src/Game/Systems/ScoreScreenSystem.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 29749a9b..338e7acc 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -27,11 +27,7 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& int currentTeam = 0; if(entity.HasComponent("Team")) { - auto cTeam = entity["Team"]; - redTeamEnum = (int)cTeam["Team"].Enum("Red"); - blueTeamEnum = (int)cTeam["Team"].Enum("Blue"); - spectatorTeamEnum = (int)cTeam["Team"].Enum("Spectator"); - currentTeam = (int)cTeam["Team"]; + currentTeam = (int)entity["Team"]["Team"]; } auto children = entity.ChildrenWithComponent("ScoreIdentity"); From 49802fed91ad6277bee9713b8c7ef6737376c127 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 4 Mar 2016 02:24:13 +0100 Subject: [PATCH 62/94] Blend duration can now be 0.0 --- include/Engine/Rendering/AnimationSystem.h | 5 ++- src/Engine/Rendering/AnimationSystem.cpp | 47 +++++++++++++++++++++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/include/Engine/Rendering/AnimationSystem.h b/include/Engine/Rendering/AnimationSystem.h index a04aa3c5..ec8db2dd 100644 --- a/include/Engine/Rendering/AnimationSystem.h +++ b/include/Engine/Rendering/AnimationSystem.h @@ -12,7 +12,7 @@ #include "Rendering/EAutoAnimationBlend.h" #include "../Core/EntityWrapper.h" #include "Rendering/AutoBlendQueue.h" - +#include "../Input/EInputCommand.h" #include "imgui/imgui.h" class AnimationSystem : public ImpureSystem @@ -28,7 +28,8 @@ private: EventRelay m_EAutoAnimationBlend; bool OnAutoAnimationBlend(Events::AutoAnimationBlend& e); - + EventRelay m_EInputCommand; + bool OnInputCommand(const Events::InputCommand& e); std::unordered_map m_AutoBlendQueues; }; diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 99643997..9d785a5c 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -4,6 +4,7 @@ AnimationSystem::AnimationSystem(SystemParams params) : System(params) { EVENT_SUBSCRIBE_MEMBER(m_EAutoAnimationBlend, &AnimationSystem::OnAutoAnimationBlend); + EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &AnimationSystem::OnInputCommand); } void AnimationSystem::Update(double dt) @@ -133,7 +134,12 @@ void AnimationSystem::UpdateWeights(double dt) std::shared_ptr blendTree = autoBlendQueue.second.GetBlendTree(); if (blendTree != nullptr) { - blendJob.BlendInfo.progress = glm::clamp(blendJob.CurrentTime / blendJob.Duration, 0.0, 1.0); + if (blendJob.Duration != 0.0) { + blendJob.BlendInfo.progress = glm::clamp(blendJob.CurrentTime / blendJob.Duration, 0.0, 1.0); + } else { + blendJob.BlendInfo.progress = 1.0; + } + blendJob.BlendInfo = blendTree->AutoBlendStep(blendJob.BlendInfo); } @@ -215,3 +221,42 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) m_AutoBlendQueues[subTreeRoot].Insert(abj); return true; } + +bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) +{ + if (e.Value == 1.0f) { + if (e.Command == "Shoot") { + auto blendComponents = m_World->GetComponents("Model"); + + if (blendComponents == nullptr) { + return false; + } + for (auto& bc : *blendComponents) { + EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); + + if (entity.Name() == "Hands") { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.0; + aeb.NodeName = "Fire"; + aeb.RootNode = entity; + aeb.Start = true; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Idle"; + aeb.RootNode = entity; + aeb.Delay = 0.0; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = entity.FirstChildByName("PrimaryBlendTree").FirstChildByName("Fire"); + m_EventBroker->Publish(aeb); + } + } + } + } + } +} From 1ff91a5c5d595342ec8bb7b992ea0dfdf4fdabb4 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 4 Mar 2016 02:30:05 +0100 Subject: [PATCH 63/94] fixup! Blend duration can now be 0.0 Commited input test stuff --- include/Engine/Rendering/AnimationSystem.h | 2 -- src/Engine/Rendering/AnimationSystem.cpp | 40 ---------------------- 2 files changed, 42 deletions(-) diff --git a/include/Engine/Rendering/AnimationSystem.h b/include/Engine/Rendering/AnimationSystem.h index ec8db2dd..30c6fce5 100644 --- a/include/Engine/Rendering/AnimationSystem.h +++ b/include/Engine/Rendering/AnimationSystem.h @@ -28,8 +28,6 @@ private: EventRelay m_EAutoAnimationBlend; bool OnAutoAnimationBlend(Events::AutoAnimationBlend& e); - EventRelay m_EInputCommand; - bool OnInputCommand(const Events::InputCommand& e); std::unordered_map m_AutoBlendQueues; }; diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 9d785a5c..5bac27f9 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -4,7 +4,6 @@ AnimationSystem::AnimationSystem(SystemParams params) : System(params) { EVENT_SUBSCRIBE_MEMBER(m_EAutoAnimationBlend, &AnimationSystem::OnAutoAnimationBlend); - EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &AnimationSystem::OnInputCommand); } void AnimationSystem::Update(double dt) @@ -221,42 +220,3 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) m_AutoBlendQueues[subTreeRoot].Insert(abj); return true; } - -bool AnimationSystem::OnInputCommand(const Events::InputCommand& e) -{ - if (e.Value == 1.0f) { - if (e.Command == "Shoot") { - auto blendComponents = m_World->GetComponents("Model"); - - if (blendComponents == nullptr) { - return false; - } - for (auto& bc : *blendComponents) { - EntityWrapper entity = EntityWrapper(m_World, bc.EntityID); - - if (entity.Name() == "Hands") { - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.0; - aeb.NodeName = "Fire"; - aeb.RootNode = entity; - aeb.Start = true; - aeb.Restart = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = "Idle"; - aeb.RootNode = entity; - aeb.Delay = 0.0; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = entity.FirstChildByName("PrimaryBlendTree").FirstChildByName("Fire"); - m_EventBroker->Publish(aeb); - } - } - } - } - } -} From 3a8f7c5d03225a73611ff60999e31c2a459c58ae Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 02:48:03 +0100 Subject: [PATCH 64/94] First attempt at AssaultWeapon animations! --- assets | 2 +- .../Systems/Weapon/AssaultWeaponBehaviour.h | 1 + .../Schema/Entities/AssaultBlendTree.xml | 513 ------------- resources/Schema/Entities/BlendTreeAim.xml | 41 ++ .../Schema/Entities/BlendTreeAssault.xml | 445 ++++++++++++ .../Entities/BlendTreeAssaultWeapon.xml | 65 ++ .../Entities/BlendTreeSidearmWeapon.xml | 10 + resources/Schema/Entities/MovementTest.xml | 20 +- resources/Schema/Entities/Player.xml | 684 ++++++++++++++++-- src/Game/Systems/PlayerMovementSystem.cpp | 89 +-- .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 46 ++ 11 files changed, 1253 insertions(+), 663 deletions(-) delete mode 100644 resources/Schema/Entities/AssaultBlendTree.xml create mode 100644 resources/Schema/Entities/BlendTreeAim.xml create mode 100644 resources/Schema/Entities/BlendTreeAssault.xml create mode 100644 resources/Schema/Entities/BlendTreeAssaultWeapon.xml create mode 100644 resources/Schema/Entities/BlendTreeSidearmWeapon.xml diff --git a/assets b/assets index c82b5716..4205e927 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit c82b5716d98a0c9fb3914367e9b08cc2e7dbca43 +Subproject commit 4205e92755aa67c90db6d272047cd92037ae9f11 diff --git a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h index 69bd15e1..d577e22f 100644 --- a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h @@ -5,6 +5,7 @@ #include "Collision/Collision.h" #include "Core/EPlayerDamage.h" #include "Sound/EPlaySoundOnEntity.h" +#include "Rendering/EAutoAnimationBlend.h" class AssaultWeaponBehaviour : public WeaponBehaviour { diff --git a/resources/Schema/Entities/AssaultBlendTree.xml b/resources/Schema/Entities/AssaultBlendTree.xml deleted file mode 100644 index e8dcff8a..00000000 --- a/resources/Schema/Entities/AssaultBlendTree.xml +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - AimBlend - FinalBlend - - - 5 - Models/Characters/Assault/AssaultBlue.mesh - - - - - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - - - - - - AimPrimary - AimSecondary - 0 - true - - - - - - - - AimSecWepA - - false - true - - - - - - - - - AimRifleA - - false - true - - - - - - - - - - - ReloadSwitchBlend - MovementBlend - - - - - - - - StandCrouchBlend - JumpDashBlend - 2.5146881298480398e-63 - true - - - - - - - - StandMovement - CrouchMovement - 0.012867419418159054 - true - - - - - - - - MovementBlend - Idle - 1 - - - - - - - - RunWalkBlend - StrafeLRBlend - 2.4565650245976452e-16 - - - - - - - - Walk - Run - 1.2938206818383024e-24 - - - - - - - - WalkF - - 1 - true - - - - - - - - - RunF - - 1 - true - - - - - - - - - - - Left - Right - 0.033793529385008014 - - - - - - - - StrafeLeftF - - 1 - true - - - - - - - - - StrafeRightF - - 1 - true - - - - - - - - - - - - - IdleF - - 1 - true - - - - - - - - - - - MovementBlend - Idle - 0 - - - - - - - - Walk - StrafeLRBlend - 2.4565650245976452e-16 - - - - - - - - Left - Right - 0.033793529385008014 - - - - - - - - CrouchStrafeLeftF - - 1 - true - - - - - - - - - CrouchStrafeRightF - - 1 - true - - - - - - - - - - - CrouchWalkF - - 1 - true - - - - - - - - - - - CrouchF - - 1 - - - - - - - - - - - - - Jump - DashBlend - 1 - true - - - - - - - - JumpF - - 1 - false - - - - - - - - - DashFBBlend - DashLRBlend - 0.014621149736541383 - - - - - - - - DashForward - DashBackward - 0.014363533804961248 - - - - - - - - DashForwardF - - 1 - false - - - - - - - - - DashBackwardF - - 1 - false - - - - - - - - - - - DashLeft - DashRight - 4.3244885367500671e-16 - - - - - - - - DashLeftF - - 1 - false - - - - - - - - - DashRightF - - 1 - false - - - - - - - - - - - - - - - - - ReloadSwitch - WeaponActionBlend - 1 - true - - - - - - - - ReloadSwitchU - - 1 - - - - - - - - - IdleBlend - ShootBlend - 0 - - - - - - - - IdlePrimary - IdleSecondary - 0 - - - - - - - - IdleAssaultRifleU - - 1 - true - - - - - - - - - IdleSecWepU - - 1 - true - - - - - - - - - - - ShootPrimary - ShootSecondary - 0 - - - - - - - - ShootFastRifleU - - 1 - - - - - - - - - ShootSecWepFastU - - - - - - - - - - - - - - - - diff --git a/resources/Schema/Entities/BlendTreeAim.xml b/resources/Schema/Entities/BlendTreeAim.xml new file mode 100644 index 00000000..a340c8d5 --- /dev/null +++ b/resources/Schema/Entities/BlendTreeAim.xml @@ -0,0 +1,41 @@ + + + + + + AimPrimary + AimSecondary + 0 + true + + + + + + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + diff --git a/resources/Schema/Entities/BlendTreeAssault.xml b/resources/Schema/Entities/BlendTreeAssault.xml new file mode 100644 index 00000000..1cd121eb --- /dev/null +++ b/resources/Schema/Entities/BlendTreeAssault.xml @@ -0,0 +1,445 @@ + + + + + + ReloadSwitchBlend + MovementBlend + + + + + + + + + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 + true + + + + + + + + StandMovement + CrouchMovement + 0 + true + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + Walk + StrafeLRBlend + 0 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + + + + + + CrouchWalkF + + 1 + true + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + Jump + DashBlend + 1 + true + + + + + + + + JumpF + + 1 + false + + + + + + + + + DashFBBlend + DashLRBlend + 0.014621149736541383 + + + + + + + + DashForward + DashBackward + 0.014363533804961248 + + + + + + + + DashForwardF + + 1 + false + + + + + + + + + DashBackwardF + + 1 + false + + + + + + + + + + + DashLeft + DashRight + 4.3244885367500671e-16 + + + + + + + + DashLeftF + + 1 + false + + + + + + + + + DashRightF + + 1 + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/BlendTreeAssaultWeapon.xml b/resources/Schema/Entities/BlendTreeAssaultWeapon.xml new file mode 100644 index 00000000..a68175a2 --- /dev/null +++ b/resources/Schema/Entities/BlendTreeAssaultWeapon.xml @@ -0,0 +1,65 @@ + + + + + + Idle + WeaponAction + 0 + true + + + + + + + + + Fire + Reload + 1 + + + + + + + + ShootShotgunF + 1 + true + false + + + + + + + + + ReloadSwitchF + + 1 + true + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + diff --git a/resources/Schema/Entities/BlendTreeSidearmWeapon.xml b/resources/Schema/Entities/BlendTreeSidearmWeapon.xml new file mode 100644 index 00000000..627829e5 --- /dev/null +++ b/resources/Schema/Entities/BlendTreeSidearmWeapon.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 7bbaf21d..90c943ef 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -8,15 +8,15 @@ - - - Schema/Entities/PlayerAssaultFallbackRed.xml - + + + Schema/Entities/PlayerAssaultFallbackRed.xml + @@ -76,15 +76,15 @@ - - - Schema/Entities/PlayerAssaultFallbackBlue.xml - + + + Schema/Entities/Player.xml + @@ -98,7 +98,7 @@ - + @@ -111,7 +111,7 @@ - + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index affe9f79..d34dba32 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -6,11 +6,12 @@ - - - - - + + + + + + @@ -22,11 +23,6 @@ 5 - - - - - @@ -173,6 +169,40 @@ + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + @@ -219,12 +249,12 @@ - - 2 - + + 2 + Textures/Core/UnitHexagon_Rotated.png @@ -253,12 +283,12 @@ - - 3 - + + 3 + Textures/Core/UnitHexagon_Rotated.png @@ -287,13 +317,13 @@ - - 4 - 1 + + 4 + Textures/Core/UnitHexagon_Rotated.png @@ -322,12 +352,12 @@ - - 1 - + + 1 + Textures/Core/UnitHexagon_Rotated.png @@ -356,11 +386,11 @@ - 1 + Textures/Core/UnitHexagon_Rotated.png @@ -433,15 +463,15 @@ - - - Models/Widgets/Arrows/Arrow5.mesh - + + + Models/Widgets/Arrows/Arrow5.mesh + @@ -454,16 +484,14 @@ - - Idle - 1.8348644854054612 - 1 - - - + + BlendTreeAssaultWeapon + BlendTreeSecondaryWeapon + 0 + true + - Models/Characters/Assault/Test/FirstPerson.mesh - + Models/Characters/Defender/FirstPersonDefenderBlue.mesh @@ -477,11 +505,11 @@ AssaultWeapon - Schema/Entities/AssaultWeaponView.xml + Schema/Entities/WeaponAssaultBlueView.xml - - + + @@ -498,12 +526,79 @@ Schema/Entities/SidearmWeaponView.xml - - + + + + + + Idle + WeaponAction + 0 + true + + + + + + + + Fire + Reload + 1 + + + + + + + + ShootShotgunF + 1 + true + false + + + + + + + + + ReloadSwitchF + + 1 + true + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + @@ -527,27 +622,25 @@ - - IdleF - 1 - - - - - AimRifle - - + + BlendTreeAim + BlendTreeAssault + Models/Characters/Assault/AssaultBlue.mesh + false + + R_Arm_Weapon_Joint + AssaultWeapon @@ -555,9 +648,12 @@ - Schema/Entities/AssaultWeaponWorld.xml + Schema/Entities/WeaponAssaultBlueWorld.xml - + + + + @@ -576,12 +672,490 @@ Schema/Entities/SidearmWeaponWorld.xml - - + + + + + + AimPrimary + AimSecondary + 0 + true + + + + + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + MovementBlend + + + + + + + + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 + true + + + + + + + + StandMovement + CrouchMovement + 0 + true + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + Walk + StrafeLRBlend + 0 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + + + + + + CrouchWalkF + + 1 + true + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + Jump + DashBlend + 1 + true + + + + + + + + JumpF + + 1 + false + + + + + + + + + DashFBBlend + DashLRBlend + 0.014621149736541383 + + + + + + + + DashForward + DashBackward + 0.014363533804961248 + + + + + + + + DashForwardF + + 1 + false + + + + + + + + + DashBackwardF + + 1 + false + + + + + + + + + + + DashLeft + DashRight + 4.3244885367500671e-16 + + + + + + + + DashLeftF + + 1 + false + + + + + + + + + DashRightF + + 1 + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index b116bcd9..d67e77bd 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -43,10 +43,10 @@ void PlayerMovementSystem::updateMovementControllers(double dt) // Set third person model aim pitch EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); if (playerModel.Valid()) { - ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"]; - float pitch = cameraOrientation.x + 0.2f; - double time = (pitch + glm::half_pi()) / glm::pi(); - cAnimationOffset["Time"] = time; + //ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"]; + //float pitch = cameraOrientation.x + 0.2f; + //double time = (pitch + glm::half_pi()) / glm::pi(); + //cAnimationOffset["Time"] = time; } } @@ -166,81 +166,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt) } } - // Animations - EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); - if (playerModel.Valid()) { - ComponentWrapper cAnimation = playerModel["Animation"]; - std::string& animationName1 = cAnimation["AnimationName1"]; - std::string& animationName2 = cAnimation["AnimationName2"]; - double& animationTime1 = cAnimation["Time1"]; - double& animationTime2 = cAnimation["Time2"]; - double& animationSpeed1 = cAnimation["Speed1"]; - double& animationSpeed2 = cAnimation["Speed2"]; - double& animationWeight1 = cAnimation["Weight1"]; - double& animationWeight2 = cAnimation["Weight2"]; - - float movementLength = glm::length(groundVelocity); - //TODO: add assault dash animation here - if (glm::length(controller->Movement()) > 0.f) { - double forwardMovement = controller->Movement().z; - double strafeMovement = controller->Movement().x; - - if (controller->Crouching() && animationName1 != "CrouchWalk") { - animationName1 = "CrouchWalk"; - animationSpeed1 = 1.0 * -glm::sign(controller->Movement().z); - } else { - if (glm::abs(forwardMovement) > 0) { - if (animationName1 != "Run") { - animationName1 = "Run"; - if (animationName2 == "StrafeLeft" || animationName2 == "StrafeRight") { - animationTime1 = animationTime2; - } else { - animationTime1 = 0.0; - } - } - animationSpeed1 = 2.f * -glm::sign(forwardMovement); - } - - if (glm::abs(strafeMovement) > 0) { - if (animationName2 != "StrafeLeft" && animationName2 != "StrafeRight") { - if (strafeMovement < 0) { - animationName2 = "StrafeLeft"; - } - if (strafeMovement > 0) { - animationName2 = "StrafeRight"; - } - if (animationName1 == "Run") { - animationTime2 = animationTime1; - } else { - animationTime2 = 0.0; - } - } - animationSpeed2 = 2.f * glm::abs(strafeMovement); - } - - double strafeWeight = glm::abs(strafeMovement) / (glm::abs(forwardMovement) + glm::abs(strafeMovement)); - animationWeight2 = strafeWeight; - animationWeight1 = 1.0 - strafeWeight; - } - } else { - if (controller->Crouching()) { - animationName1 = "Crouch"; - animationName2 = ""; - animationSpeed1 = 1.0; - animationSpeed2 = 0.0; - animationWeight1 = 1.0; - animationWeight2 = 0.0; - } else { - animationName1 = "Idle"; - animationName2 = ""; - animationSpeed1 = 1.f; - animationSpeed2 = 0.0; - animationWeight1 = 1.0; - animationWeight2 = 0.0; - //cAnimation["AnimationName2"] = "Idle"; - } - } - } + // TODO: Animations } controller->Reset(); @@ -354,10 +280,5 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e) playerEntityAnimation.Copy(dashEffect["Animation"]); dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"]; ((glm::vec4&)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f; - dashEffect["Animation"]["Speed1"] = 0.0; - dashEffect["Animation"]["Speed2"] = 0.0; - dashEffect["Animation"]["Speed3"] = 0.0; - dashEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"]; - dashEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"]; return true; } diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 4d0f2258..4f5b2b05 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -99,6 +99,29 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) // Start reload reloadQueued = true; reloadTimer = reloadTime; + + // Play animation + EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent(); + if (modelEntity.Valid()) { + EntityWrapper blendTree = modelEntity.FirstChildByName("PrimaryBlendTree"); + EntityWrapper reloadBlend = blendTree.FirstChildByName("Reload"); + + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = modelEntity; + eFireBlend.NodeName = "Reload"; + eFireBlend.Restart = true; + eFireBlend.Start = true; + eFireBlend.Duration = 0.0001; + m_EventBroker->Publish(eFireBlend); + + Events::AutoAnimationBlend eIdleBlend; + eIdleBlend.RootNode = modelEntity; + eIdleBlend.NodeName = "Idle"; + eIdleBlend.AnimationEntity = reloadBlend; + eIdleBlend.Delay = -0.2; + eIdleBlend.Duration = 0.2; + m_EventBroker->Publish(eIdleBlend); + } } void AssaultWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) @@ -177,6 +200,29 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi m_EventBroker->Publish(e); } } + + // Play animation + EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent(); + if (modelEntity.Valid()) { + EntityWrapper blendTree = modelEntity.FirstChildByName("PrimaryBlendTree"); + EntityWrapper fireBlend = blendTree.FirstChildByName("Fire"); + + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = modelEntity; + eFireBlend.NodeName = "Fire"; + eFireBlend.Restart = true; + eFireBlend.Start = true; + eFireBlend.Duration = 0.0001; + m_EventBroker->Publish(eFireBlend); + + Events::AutoAnimationBlend eIdleBlend; + eIdleBlend.RootNode = modelEntity; + eIdleBlend.NodeName = "Idle"; + eIdleBlend.AnimationEntity = fireBlend; + eIdleBlend.Delay = -0.2; + eIdleBlend.Duration = 0.2; + m_EventBroker->Publish(eIdleBlend); + } } bool AssaultWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi) From b7fa7f9119da4125b145b13d547398df38b5fc4b Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 02:50:03 +0100 Subject: [PATCH 65/94] Duration no longer needed --- src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 4f5b2b05..7d3b8615 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -111,7 +111,6 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) eFireBlend.NodeName = "Reload"; eFireBlend.Restart = true; eFireBlend.Start = true; - eFireBlend.Duration = 0.0001; m_EventBroker->Publish(eFireBlend); Events::AutoAnimationBlend eIdleBlend; From 0e95c5bb958a505f4971f997402fd5f81c785040 Mon Sep 17 00:00:00 2001 From: Tleety Date: Fri, 4 Mar 2016 02:52:04 +0100 Subject: [PATCH 66/94] Fixes --- include/Engine/Core/System.h | 2 +- include/Game/Systems/ScoreScreenSystem.h | 2 +- src/Game/Systems/ScoreScreenSystem.cpp | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/Engine/Core/System.h b/include/Engine/Core/System.h index 23d5f9a5..1ca1c824 100644 --- a/include/Engine/Core/System.h +++ b/include/Engine/Core/System.h @@ -68,7 +68,7 @@ protected: const std::string m_ComponentType; - virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) = 0; + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt) = 0; }; class ImpureSystem : public virtual System diff --git a/include/Game/Systems/ScoreScreenSystem.h b/include/Game/Systems/ScoreScreenSystem.h index f2528a7f..2559bfb3 100644 --- a/include/Game/Systems/ScoreScreenSystem.h +++ b/include/Game/Systems/ScoreScreenSystem.h @@ -15,7 +15,7 @@ class ScoreScreenSystem : public PureSystem public: ScoreScreenSystem(SystemParams params); - virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override; + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt) override; EventRelay m_EPlayerDeath; bool OnPlayerDeath(const Events::KillDeath& e); diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 338e7acc..2ad45f53 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -11,7 +11,7 @@ ScoreScreenSystem::ScoreScreenSystem(SystemParams params) EVENT_SUBSCRIBE_MEMBER(m_EPlayerDisconnected, &ScoreScreenSystem::OnPlayerDisconnected); } -void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) +void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt) { if (!IsServer) { return; @@ -28,6 +28,8 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& if(entity.HasComponent("Team")) { currentTeam = (int)entity["Team"]["Team"]; + } else { + return; } auto children = entity.ChildrenWithComponent("ScoreIdentity"); @@ -56,6 +58,9 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& } } found = true; + if(!child.Valid()) { + break; + } //Update Deaths for child (int&)child["ScoreIdentity"]["Kills"] = it->second.Kills; //Update Kills for child From 1bd71931b8452dd01f1768b38f44c9503e2028dc Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 4 Mar 2016 02:53:23 +0100 Subject: [PATCH 67/94] Fixed crash when trying to blend to a nonexistent node --- src/Engine/Rendering/BlendTree.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 60858f2a..9b6679ea 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -219,7 +219,6 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) } } - if(goalNodes.size() == 0) { return blendInfo; } else if(goalNodes.size() == 1) { @@ -383,6 +382,10 @@ EntityWrapper BlendTree::GetSubTreeRoot(std::string nodeName) { std::vector nodes = FindNodesByName(nodeName); + if (nodes.size() == 0) { + return EntityWrapper::Invalid; + } + std::vector subTreeRoots; for (auto it = nodes.begin(); it != nodes.end(); it++) { From d37b7c227725ed0ee724a224d22c66bc8e1c88fa Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 02:55:19 +0100 Subject: [PATCH 68/94] fixup! First attempt at AssaultWeapon animations! --- src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 7d3b8615..fa1b3ca2 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -203,7 +203,7 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi // Play animation EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent(); if (modelEntity.Valid()) { - EntityWrapper blendTree = modelEntity.FirstChildByName("PrimaryBlendTree"); + EntityWrapper blendTree = modelEntity.FirstChildByName("BlendTreeAssaultWeapon"); EntityWrapper fireBlend = blendTree.FirstChildByName("Fire"); Events::AutoAnimationBlend eFireBlend; From 03ea9bcf40607eff39b1dc781462cc730c572471 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 03:00:03 +0100 Subject: [PATCH 69/94] fixup! Duration no longer needed --- src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index fa1b3ca2..e181daf6 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -211,7 +211,6 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi eFireBlend.NodeName = "Fire"; eFireBlend.Restart = true; eFireBlend.Start = true; - eFireBlend.Duration = 0.0001; m_EventBroker->Publish(eFireBlend); Events::AutoAnimationBlend eIdleBlend; From 103fe98fe2b0add7d6679517b81fe688a3d96f63 Mon Sep 17 00:00:00 2001 From: Tleety Date: Fri, 4 Mar 2016 03:06:42 +0100 Subject: [PATCH 70/94] KD now updated --- src/Game/Systems/ScoreScreenSystem.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 2ad45f53..57b7a4da 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -66,6 +66,9 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& //Update Kills for child (int&)child["ScoreIdentity"]["Deaths"] = it->second.Deaths; //KD is not updated at the moment. + if (it->second.Deaths != 0) { + (double&)child["ScoreIdentity"]["KD"] = it->second.Kills/it->second.Deaths; + } //Update position for child glm::vec3 offset = (glm::vec3)entity["ScoreScreen"]["Offset"]; From dbafab2cef0fc7be4fca69dc3664b56b086f583a Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 03:07:36 +0100 Subject: [PATCH 71/94] fixup! First attempt at AssaultWeapon animations! --- src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index e181daf6..3918e9b8 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -103,7 +103,7 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) // Play animation EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent(); if (modelEntity.Valid()) { - EntityWrapper blendTree = modelEntity.FirstChildByName("PrimaryBlendTree"); + EntityWrapper blendTree = modelEntity.FirstChildByName("AssaultWeaponBlendTree"); EntityWrapper reloadBlend = blendTree.FirstChildByName("Reload"); Events::AutoAnimationBlend eFireBlend; From 0398006fdcb023af4162c2be60c92fde0aa08f0e Mon Sep 17 00:00:00 2001 From: Jocke Date: Fri, 4 Mar 2016 03:19:41 +0100 Subject: [PATCH 72/94] added safety ifs and renamed dasheffect to sprinteffect --- src/Game/Systems/PlayerMovementSystem.cpp | 26 ++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index ab4ac6a1..025a8b70 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -38,22 +38,28 @@ void PlayerMovementSystem::Update(double dt) // Spawn one afterimage for each player that sprints. EntityWrapper player(m_World, cSprint.EntityID); auto entityFile = ResourceManager::Load("Schema/Entities/SprintEffect.xml"); - EntityWrapper dashEffect = entityFile->MergeInto(m_World); + EntityWrapper sprintEffect = entityFile->MergeInto(m_World); auto playerModel = player.FirstChildByName("PlayerModel"); if (!playerModel.Valid()) { continue; } + if (!playerModel.HasComponent("Model")) { + continue; + } + if (!playerModel.HasComponent("Animation")) { + continue; + } auto playerEntityModel = playerModel["Model"]; auto playerEntityAnimation = playerModel["Animation"]; - playerEntityModel.Copy(dashEffect["Model"]); - playerEntityAnimation.Copy(dashEffect["Animation"]); - dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"]; - ((glm::vec4&)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f; - dashEffect["Animation"]["Speed1"] = 0.0; - dashEffect["Animation"]["Speed2"] = 0.0; - dashEffect["Animation"]["Speed3"] = 0.0; - dashEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"]; - dashEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"]; + playerEntityModel.Copy(sprintEffect["Model"]); + playerEntityAnimation.Copy(sprintEffect["Animation"]); + sprintEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"]; + ((glm::vec4&)sprintEffect["ExplosionEffect"]["EndColor"]).w = 0.f; + sprintEffect["Animation"]["Speed1"] = 0.0; + sprintEffect["Animation"]["Speed2"] = 0.0; + sprintEffect["Animation"]["Speed3"] = 0.0; + sprintEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"]; + sprintEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"]; } } } From 2507516a85c049925dea86e4239b1393934e9bd2 Mon Sep 17 00:00:00 2001 From: Jocke Date: Fri, 4 Mar 2016 03:28:58 +0100 Subject: [PATCH 73/94] Tweaked values for the effect to look better --- resources/Schema/Entities/SprintEffect.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/Schema/Entities/SprintEffect.xml b/resources/Schema/Entities/SprintEffect.xml index ab897cf5..6e892f8f 100644 --- a/resources/Schema/Entities/SprintEffect.xml +++ b/resources/Schema/Entities/SprintEffect.xml @@ -8,11 +8,11 @@ - 0.1 + 0.15 - 0.1 + 0.15 From 19ee66fc75ff6946622dd2735bd8e927773212ce Mon Sep 17 00:00:00 2001 From: Tleety Date: Fri, 4 Mar 2016 03:57:37 +0100 Subject: [PATCH 74/94] Fix --- resources/Schema/Entities/PlayerHUD.xml | 399 ++++++++++++++++++++++++ src/Game/Systems/ScoreScreenSystem.cpp | 3 - 2 files changed, 399 insertions(+), 3 deletions(-) create mode 100644 resources/Schema/Entities/PlayerHUD.xml diff --git a/resources/Schema/Entities/PlayerHUD.xml b/resources/Schema/Entities/PlayerHUD.xml new file mode 100644 index 00000000..e3e9165b --- /dev/null +++ b/resources/Schema/Entities/PlayerHUD.xml @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + Textures/Weapons/Crosshair/SmallThickHoleDot.png + + false + + + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 2 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 3 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 4 + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + 1 + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/Arrow5.mesh + + + + + + + + + + + + + + + + + diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 57b7a4da..6166e892 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -21,9 +21,6 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& return; } - int redTeamEnum; - int blueTeamEnum; - int spectatorTeamEnum; int currentTeam = 0; if(entity.HasComponent("Team")) { From 1f047ea30033d6e1dcc924645c4c7cab0d38b745 Mon Sep 17 00:00:00 2001 From: antc13 Date: Fri, 4 Mar 2016 04:22:04 +0100 Subject: [PATCH 75/94] Latest Map version (Hopefully) Now with textures. Made some very minor tweaks as well, by removing duplicated meshes. --- assets | 2 +- .../Schema/Entities/NewMap2version5NEW.xml | 8768 +++++++++++++++++ 2 files changed, 8769 insertions(+), 1 deletion(-) create mode 100644 resources/Schema/Entities/NewMap2version5NEW.xml diff --git a/assets b/assets index 7a6d7078..5d761454 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 7a6d70787b036d8ae8763b69ae6ad098bf221c22 +Subproject commit 5d7614549bfb6c497bfee12e2e295293a08e8e5e diff --git a/resources/Schema/Entities/NewMap2version5NEW.xml b/resources/Schema/Entities/NewMap2version5NEW.xml new file mode 100644 index 00000000..2925f516 --- /dev/null +++ b/resources/Schema/Entities/NewMap2version5NEW.xml @@ -0,0 +1,8768 @@ + + + + + + + + + + + + + + + + + + 2 + Models/Props/GroundTest.mesh + + + + + + + + Models/Props/Walls/SciFiWallTop.mesh + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + true + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall1.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall2.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallSmall3.mesh + + + + + + + + + + Models/Props/Walls/SciFiWallSmall4.mesh + + + + + + + + + + + + Models/Highgrounds/Highground1.mesh + + + + + + + + + + Models/Highgrounds/Highground2.mesh + + + + + + + + + + + Models/Highgrounds/Highground3.mesh + + + + + + + + + + + Models/Highgrounds/Highground24.mesh + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg25.mesh + + + + + + + + + + + + Models/Highgrounds/Hg26.mesh + + + + + + + + + + + + Models/Highgrounds/Hg9.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg4.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Highground12.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg16.mesh + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + Models/Highgrounds/Hg14.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + Models/Highgrounds/Hg11.mesh + + + + + + + + + + + + Models/Highgrounds/Hg20.mesh + + + + + + + + + + + + Models/Highgrounds/Hg18.mesh + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg7.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Highground3.mesh + + + + + + + + + + + + Models/Highgrounds/Highground1.mesh + + + + + + + + + + + Models/Highgrounds/Highground2.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg1.mesh + + + + + + + + + + + Models/Highgrounds/Hg2.mesh + + + + + + + + + + + + + + Models/Highgrounds/Highground5.mesh + + + + + + + + + + + + Models/Highgrounds/Hg7.mesh + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + Models/Highgrounds/Hg18.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg20.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg6.mesh + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + Models/Highgrounds/Hg4.mesh + + + + + + + + + + + + Models/Highgrounds/Hg16.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg9.mesh + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + + + Models/Highgrounds/Highground22.mesh + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg21.mesh + + + + + + + + + + + + Models/Highgrounds/Hg11.mesh + + + + + + + + + + + + Models/Highgrounds/Hg3.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + + + Models/Highgrounds/Hg28.mesh + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + Models/Highgrounds/Hg23.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg23.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg28.mesh + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg27.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg15.mesh + + + + + + + + + + + + + + Models/Highgrounds/Hg13.mesh + + + + + + + + + + + + + + + Models/Highgrounds/Hg1.mesh + + + + + + + + + + + + Models/Highgrounds/Hg2.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 2 + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/smallWall3.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Blue.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + + + + 10 + + + + + + + + + + + + + + + + + + + Schema/Entities/PlayerRed.xml + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 3 + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 15 + 1 + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointBlue.mesh + + + + + + + + + + -15 + + + + 4 + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 15 + 2 + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointRed.mesh + + + + + + + + + + 15 + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/Player.xml + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + From 177667eef5c310e6bc955e38cffc849bfa9b6ea8 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 05:02:25 +0100 Subject: [PATCH 76/94] The only working branch ever --- include/Game/Systems/Weapon/WeaponBehaviour.h | 33 + resources/Schema/Components/AssaultWeapon.xml | 2 +- .../Schema/Entities/DefenderWeaponViewRed.xml | 99 -- .../Entities/DefenderWeaponWorldRed.xml | 41 - resources/Schema/Entities/Player.xml | 129 +- .../Schema/Entities/PlayerDefenderBlue.xml | 1239 +++++++++++++++++ resources/Schema/Entities/Spawnpoint | 32 - resources/Schema/Entities/Testingu | 45 - .../Schema/Entities/WeaponAssaultBlueView.xml | 6 + .../Schema/Entities/WeaponAssaultRedView.xml | 103 -- .../Schema/Entities/WeaponAssaultRedWorld.xml | 34 - ...ponView.xml => WeaponDefenderBlueView.xml} | 20 +- ...nWorld.xml => WeaponDefenderBlueWorld.xml} | 0 resources/Schema/Entities/temp | 38 - resources/Schema/Entities/yeeee.xml | 122 -- src/Game/Game.cpp | 1 - .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 59 +- 17 files changed, 1385 insertions(+), 618 deletions(-) delete mode 100755 resources/Schema/Entities/DefenderWeaponViewRed.xml delete mode 100755 resources/Schema/Entities/DefenderWeaponWorldRed.xml create mode 100644 resources/Schema/Entities/PlayerDefenderBlue.xml delete mode 100644 resources/Schema/Entities/Spawnpoint delete mode 100644 resources/Schema/Entities/Testingu delete mode 100644 resources/Schema/Entities/WeaponAssaultRedView.xml delete mode 100644 resources/Schema/Entities/WeaponAssaultRedWorld.xml rename resources/Schema/Entities/{DefenderWeaponView.xml => WeaponDefenderBlueView.xml} (97%) mode change 100755 => 100644 rename resources/Schema/Entities/{DefenderWeaponWorld.xml => WeaponDefenderBlueWorld.xml} (100%) mode change 100755 => 100644 delete mode 100644 resources/Schema/Entities/temp delete mode 100644 resources/Schema/Entities/yeeee.xml diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index d4520c9f..3cda172e 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -94,6 +94,39 @@ protected: } } + void playAnimationAndReturn(EntityWrapper weaponModelEntity, const std::string& subTreeName, const std::string& animationNodeName) + { + EntityWrapper root = weaponModelEntity.FirstParentWithComponent("Model"); + if (!root.Valid()) { + return; + } + + EntityWrapper subTree = root.FirstChildByName(subTreeName); + if (!subTree.Valid()) { + return; + } + + EntityWrapper animationNode = subTree.FirstChildByName(animationNodeName); + if (!animationNode.Valid()) { + return; + } + + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = root; + eFireBlend.NodeName = animationNodeName; + eFireBlend.Restart = true; + eFireBlend.Start = true; + m_EventBroker->Publish(eFireBlend); + + Events::AutoAnimationBlend eIdleBlend; + eIdleBlend.RootNode = root; + eIdleBlend.NodeName = "Idle"; + eIdleBlend.AnimationEntity = animationNode; + eIdleBlend.Delay = -0.2; + eIdleBlend.Duration = 0.2; + m_EventBroker->Publish(eIdleBlend); + } + private: EventRelay m_ESetCamera; bool _OnSetCamera(const Events::SetCamera& e) diff --git a/resources/Schema/Components/AssaultWeapon.xml b/resources/Schema/Components/AssaultWeapon.xml index 263a840a..0cb381c2 100755 --- a/resources/Schema/Components/AssaultWeapon.xml +++ b/resources/Schema/Components/AssaultWeapon.xml @@ -11,7 +11,7 @@ 420 0.03 0.18 - 2 + 1.65 0.5 false 0 diff --git a/resources/Schema/Entities/DefenderWeaponViewRed.xml b/resources/Schema/Entities/DefenderWeaponViewRed.xml deleted file mode 100755 index b5b1c322..00000000 --- a/resources/Schema/Entities/DefenderWeaponViewRed.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - R_Arm_Weapon_Joint - - - - Models/Weapons/Red/DefenderGunRed.mesh - - - - - - - - - - - Schema/Entities/RayRed.xml - - - - - - - - - - - Schema/Entities/ReloadEffectView.xml - - - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - - - - - - 32 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - 360 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - diff --git a/resources/Schema/Entities/DefenderWeaponWorldRed.xml b/resources/Schema/Entities/DefenderWeaponWorldRed.xml deleted file mode 100755 index 7f697304..00000000 --- a/resources/Schema/Entities/DefenderWeaponWorldRed.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - R_Arm_Weapon_Joint - - - - Models/Weapons/Red/DefenderGunRed.mesh - - - - - - - - - - - - Schema/Entities/RayRed.xml - - - - - - - - - - - Schema/Entities/ReloadEffectWorld.xml - - - - - - - - diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index d34dba32..dfcf40a3 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -484,12 +484,10 @@ - - BlendTreeAssaultWeapon - BlendTreeSecondaryWeapon - 0 - true - + + Run + FinalBlend + Models/Characters/Defender/FirstPersonDefenderBlue.mesh @@ -508,8 +506,8 @@ Schema/Entities/WeaponAssaultBlueView.xml - - + + @@ -526,50 +524,73 @@ Schema/Entities/SidearmWeaponView.xml - - + + - + - Idle - WeaponAction + BlendTreeAssaultWeapon + BlendTreeSecondaryWeapon 0 true - + - Fire - Reload - 1 + Idle + WeaponAction + 0 + true - + - - ShootShotgunF - 1 - true - false - + + Fire + Reload + 0 + - + + + + + ShootShotgunF + 1 + false + + + + + + + + + ReloadSwitchF + 1 + false + + + + + + - + - ReloadSwitchF - + IdleF + 1 true @@ -579,22 +600,22 @@ - + - - IdleF - - 1 - true - - + + + RunF + + 1 + true + @@ -651,8 +672,8 @@ Schema/Entities/WeaponAssaultBlueWorld.xml - - + + @@ -672,8 +693,8 @@ Schema/Entities/SidearmWeaponWorld.xml - - + + @@ -780,7 +801,7 @@ CrouchStrafeLeftF - + 1 true @@ -792,7 +813,7 @@ CrouchStrafeRightF - + 1 true @@ -806,7 +827,7 @@ CrouchWalkF - + 1 true @@ -863,7 +884,7 @@ WalkF - + 1 true @@ -875,7 +896,7 @@ RunF - + 1 true @@ -895,11 +916,11 @@ - + - StrafeLeftF - + StrafeRightF + 1 true @@ -907,11 +928,11 @@ - + - StrafeRightF - + StrafeLeftF + 1 true @@ -927,7 +948,7 @@ IdleF - + 1 true @@ -1096,7 +1117,7 @@ IdleAssaultRifleU - + 1 true @@ -1108,7 +1129,7 @@ IdleSecWepU - + 1 true diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml new file mode 100644 index 00000000..aef660a3 --- /dev/null +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -0,0 +1,1239 @@ + + + + + + + + + + + + + + + + + + + + + + + + 5 + + + + + + + + + + + + 0.10000000149011612 + 300 + + + + + + + + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + + + + + + + + Textures/Weapons/Crosshair/SmallThickHoleDot.png + + false + + + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + + + + + 1 + + + + + Textures/HealthHUD3.png + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 2 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 3 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + 4 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 1 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/Arrow5.mesh + + + + + + + + + + + + + + + BlendTreeAssaultWeapon + BlendTreeSecondaryWeapon + 0 + true + + + Models/Characters/Defender/FirstPersonDefenderBlue.mesh + + + + + + + + R_Arm_Weapon_Joint + true + + + DefenderWeapon + + + Schema/Entities/WeaponDefenderBlueView.xml + + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + Schema/Entities/SidearmWeaponView.xml + + + + + + + + + + + + Idle + WeaponAction + 0 + true + + + + + + + + Fire + Reload + 1 + + + + + + + + ShootShotgunF + + 1 + false + + + + + + + + + ReloadSwitchF + + 1 + true + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultBlue.mesh + + false + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultBlueWorld.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + true + + + + + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + MovementBlend + + + + + + + + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 + true + + + + + + + + StandMovement + CrouchMovement + 0 + true + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + Walk + StrafeLRBlend + 0 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + + + + + + CrouchWalkF + + 1 + true + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + Jump + DashBlend + 1 + true + + + + + + + + JumpF + + 1 + false + + + + + + + + + DashFBBlend + DashLRBlend + 0.014621149736541383 + + + + + + + + DashForward + DashBackward + 0.014363533804961248 + + + + + + + + DashForwardF + + 1 + false + + + + + + + + + DashBackwardF + + 1 + false + + + + + + + + + + + DashLeft + DashRight + 4.3244885367500671e-16 + + + + + + + + DashLeftF + + 1 + false + + + + + + + + + DashRightF + + 1 + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + Insert name here + Fonts/DroidSans.ttf,100 + + + + + + + + + + + + + + Textures/Icons/Arrow.png + + false + + + + + 50 + true + + + + + + + + + + + + Schema/Entities/DefenderShield.xml + + + + + + + + + + diff --git a/resources/Schema/Entities/Spawnpoint b/resources/Schema/Entities/Spawnpoint deleted file mode 100644 index a53aaa08..00000000 --- a/resources/Schema/Entities/Spawnpoint +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - Models/Core/UnitCube.mesh - - - Schema/Entities/Player.xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Schema/Entities/Testingu b/resources/Schema/Entities/Testingu deleted file mode 100644 index 145550f4..00000000 --- a/resources/Schema/Entities/Testingu +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - Models/Core/UnitPlane.mesh - - - - - - - - - - - - Schema/Entities/Player.xml - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/Schema/Entities/WeaponAssaultBlueView.xml b/resources/Schema/Entities/WeaponAssaultBlueView.xml index b5c87674..9b10618b 100644 --- a/resources/Schema/Entities/WeaponAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponAssaultBlueView.xml @@ -98,6 +98,12 @@ + + + + + + diff --git a/resources/Schema/Entities/WeaponAssaultRedView.xml b/resources/Schema/Entities/WeaponAssaultRedView.xml deleted file mode 100644 index 322b1439..00000000 --- a/resources/Schema/Entities/WeaponAssaultRedView.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - Models/Weapons/Red/AssaultWeaponRed.mesh - - - - - - - - - Schema/Entities/RayRed.xml - - - - - - - - - - - - Schema/Entities/ReloadEffectView.xml - - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - - - - - - 32 - Fonts/DroidSans.ttf,64 - - - - Player - AssaultWeapon - MagazineAmmo - - - - - - - - - - - 320 - Fonts/DroidSans.ttf,64 - - - - Player - AssaultWeapon - Ammo - - - - - - - - - - - - - - - diff --git a/resources/Schema/Entities/WeaponAssaultRedWorld.xml b/resources/Schema/Entities/WeaponAssaultRedWorld.xml deleted file mode 100644 index 68d78d03..00000000 --- a/resources/Schema/Entities/WeaponAssaultRedWorld.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - Models/Weapons/Red/AssaultWeaponRed.mesh - - - - - - - - - Schema/Entities/RayRed.xml - - - - - - - - - - - Schema/Entities/ReloadEffectWorld.xml - - - - - - - - diff --git a/resources/Schema/Entities/DefenderWeaponView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml old mode 100755 new mode 100644 similarity index 97% rename from resources/Schema/Entities/DefenderWeaponView.xml rename to resources/Schema/Entities/WeaponDefenderBlueView.xml index 0886ac67..6ec4b452 --- a/resources/Schema/Entities/DefenderWeaponView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -60,16 +60,16 @@ + + 8 + Fonts/DroidSans.ttf,64 + + Player DefenderWeapon MagazineAmmo - - 0 - Fonts/DroidSans.ttf,64 - - @@ -78,16 +78,16 @@ + + 64 + Fonts/DroidSans.ttf,64 + + Player DefenderWeapon Ammo - - 0 - Fonts/DroidSans.ttf,64 - - diff --git a/resources/Schema/Entities/DefenderWeaponWorld.xml b/resources/Schema/Entities/WeaponDefenderBlueWorld.xml old mode 100755 new mode 100644 similarity index 100% rename from resources/Schema/Entities/DefenderWeaponWorld.xml rename to resources/Schema/Entities/WeaponDefenderBlueWorld.xml diff --git a/resources/Schema/Entities/temp b/resources/Schema/Entities/temp deleted file mode 100644 index baf4ce61..00000000 --- a/resources/Schema/Entities/temp +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - 0 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - 360 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - diff --git a/resources/Schema/Entities/yeeee.xml b/resources/Schema/Entities/yeeee.xml deleted file mode 100644 index d3853b8f..00000000 --- a/resources/Schema/Entities/yeeee.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - AimAdditive - BlendOverride - - - Models/Characters/Assault/AssaultAnimations.mesh - - - - - - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/AssaultWeaponBlue.mesh - - - - - - - - - - - AimRifleA - - true - - - - - - - - - ShootRifleAnimation - MovementBlend - - - - - - - - ShootFastRifleU - - 1 - - - - - - - - - BlendWalkRun - StrafeAnimation - 1 - - - - - - - - StrafeRightF - - 1 - - - - - - - - - RunAnimtaion - WalkAnimation - 0.43000054359436035 - - - - - - - - RunF - - 1 - - - - - - - - - WalkF - - 1 - - - - - - - - - - - - - - diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 18e6fd5c..d5622eec 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -143,7 +143,6 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 3918e9b8..cdb0a563 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -56,6 +56,21 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& } } + // Update first person run animation + /*ComponentWrapper cPlayer = wi.Player["Player"]; + ComponentWrapper cPhysics = wi.Player["Physics"]; + const float& movementSpeed = cPlayer["MovementSpeed"]; + float speed = glm::length((const glm::vec3&)cPhysics["Velocity"]); + float animationSpeed = glm::max(speed, movementSpeed) / movementSpeed; + EntityWrapper rootNode = wi.FirstPersonEntity.FirstParentWithComponent("Model"); + if (rootNode.Valid()) { + EntityWrapper animationNode = rootNode.FirstChildByName("Run"); + if (animationNode.Valid()) { + (bool&)animationNode["Animation"]["Play"] = animationSpeed > 0; + (double&)animationNode["Animation"]["Speed"] = animationSpeed; + } + }*/ + // Fire if we're able to fire if (canFire(cWeapon, wi)) { fireBullet(cWeapon, wi); @@ -101,25 +116,12 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) reloadTimer = reloadTime; // Play animation - EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent(); - if (modelEntity.Valid()) { - EntityWrapper blendTree = modelEntity.FirstChildByName("AssaultWeaponBlendTree"); - EntityWrapper reloadBlend = blendTree.FirstChildByName("Reload"); + playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Reload"); - Events::AutoAnimationBlend eFireBlend; - eFireBlend.RootNode = modelEntity; - eFireBlend.NodeName = "Reload"; - eFireBlend.Restart = true; - eFireBlend.Start = true; - m_EventBroker->Publish(eFireBlend); - - Events::AutoAnimationBlend eIdleBlend; - eIdleBlend.RootNode = modelEntity; - eIdleBlend.NodeName = "Idle"; - eIdleBlend.AnimationEntity = reloadBlend; - eIdleBlend.Delay = -0.2; - eIdleBlend.Duration = 0.2; - m_EventBroker->Publish(eIdleBlend); + // Spawn explosion effect + EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner"); + if (reloadEffectSpawner.Valid()) { + SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); } } @@ -201,26 +203,7 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi } // Play animation - EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent(); - if (modelEntity.Valid()) { - EntityWrapper blendTree = modelEntity.FirstChildByName("BlendTreeAssaultWeapon"); - EntityWrapper fireBlend = blendTree.FirstChildByName("Fire"); - - Events::AutoAnimationBlend eFireBlend; - eFireBlend.RootNode = modelEntity; - eFireBlend.NodeName = "Fire"; - eFireBlend.Restart = true; - eFireBlend.Start = true; - m_EventBroker->Publish(eFireBlend); - - Events::AutoAnimationBlend eIdleBlend; - eIdleBlend.RootNode = modelEntity; - eIdleBlend.NodeName = "Idle"; - eIdleBlend.AnimationEntity = fireBlend; - eIdleBlend.Delay = -0.2; - eIdleBlend.Duration = 0.2; - m_EventBroker->Publish(eIdleBlend); - } + playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Fire"); } bool AssaultWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi) From eec40b651986b60a65a4e68af832759f3c18f4af Mon Sep 17 00:00:00 2001 From: Jocke Date: Fri, 4 Mar 2016 05:10:18 +0100 Subject: [PATCH 77/94] We can now read larger packets than 65536 bytes in TCPClient::readBuffer() --- src/Engine/Network/TCPClient.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Engine/Network/TCPClient.cpp b/src/Engine/Network/TCPClient.cpp index 8bfa9ded..b3aa7d1b 100644 --- a/src/Engine/Network/TCPClient.cpp +++ b/src/Engine/Network/TCPClient.cpp @@ -76,7 +76,7 @@ size_t TCPClient::readBuffer() memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int)); if (sizeOfPacket > m_Socket->available()) { LOG_WARNING("TCPClient::readBuffer(): We haven't got the whole packet yet."); - return 0; + //return 0; } // if the buffer is to small increase the size of it // TODO if message is huge 1 time the buffer will not decrease. @@ -85,12 +85,15 @@ size_t TCPClient::readBuffer() m_ReadBuffer = new char[sizeOfPacket]; m_BufferSize = sizeOfPacket; } - // Read the rest of the message - size_t bytesReceived = m_Socket->read_some(boost - ::asio::buffer((void*)(m_ReadBuffer), sizeOfPacket), - error); - if (error) { - //LOG_ERROR("receive: %s", error.message().c_str()); + size_t bytesReceived = 0; + while (sizeOfPacket > bytesReceived) { + // Read the rest of the message + bytesReceived += m_Socket->read_some(boost + ::asio::buffer((void*)(m_ReadBuffer), sizeOfPacket - bytesReceived), + error); + if (error) { + //LOG_ERROR("receive: %s", error.message().c_str()); + } } if (sizeOfPacket > 1000000) LOG_WARNING("The packets received are bigger than 1MB"); From 5b80ba4398192a60f62a0270690c0e70c64193e5 Mon Sep 17 00:00:00 2001 From: Jocke Date: Fri, 4 Mar 2016 08:22:48 +0100 Subject: [PATCH 78/94] Made 3 new healthHUDs 1 for each class. --- assets | 2 +- .../Schema/Entities/HealthHUDAssault.xml | 156 ++++++++++++++++++ .../Schema/Entities/HealthHUDDefender.xml | 156 ++++++++++++++++++ resources/Schema/Entities/HealthHUDSniper.xml | 156 ++++++++++++++++++ 4 files changed, 469 insertions(+), 1 deletion(-) create mode 100644 resources/Schema/Entities/HealthHUDAssault.xml create mode 100644 resources/Schema/Entities/HealthHUDDefender.xml create mode 100644 resources/Schema/Entities/HealthHUDSniper.xml diff --git a/assets b/assets index 5d761454..d3be164b 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 5d7614549bfb6c497bfee12e2e295293a08e8e5e +Subproject commit d3be164b6929ed0f3847bf7b53c1247843a9eae6 diff --git a/resources/Schema/Entities/HealthHUDAssault.xml b/resources/Schema/Entities/HealthHUDAssault.xml new file mode 100644 index 00000000..efd91399 --- /dev/null +++ b/resources/Schema/Entities/HealthHUDAssault.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + false + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/HealthHUDDefender.xml b/resources/Schema/Entities/HealthHUDDefender.xml new file mode 100644 index 00000000..504fbd21 --- /dev/null +++ b/resources/Schema/Entities/HealthHUDDefender.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + 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/SheildDots-01.png + + false + + + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + false + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/HealthHUDSniper.xml b/resources/Schema/Entities/HealthHUDSniper.xml new file mode 100644 index 00000000..13b6dc4d --- /dev/null +++ b/resources/Schema/Entities/HealthHUDSniper.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + 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/Dash-01.png + + false + + + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + false + + + + + + + + + + + + + + From 7ba0e4ea9d8b2e5319feaad3a8a977cba92c3f90 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 4 Mar 2016 08:35:02 +0100 Subject: [PATCH 79/94] Run, Strafe and jump animations now playing --- .../Editor/EditorCameraInputController.h | 4 +- .../Engine/Input/FirstPersonInputController.h | 96 ++++++++++++- include/Engine/Rendering/BlendTree.h | 1 + .../Engine/Rendering/EAutoAnimationBlend.h | 2 + resources/Schema/Entities/Player.xml | 13 +- src/Engine/Editor/EditorSystem.cpp | 2 +- src/Engine/Rendering/AnimationSystem.cpp | 2 +- src/Engine/Rendering/BlendTree.cpp | 16 +++ src/Game/Systems/PlayerDeathSystem.cpp | 4 - src/Game/Systems/PlayerMovementSystem.cpp | 136 +++++++++++++++++- .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 2 +- 11 files changed, 253 insertions(+), 25 deletions(-) diff --git a/include/Engine/Editor/EditorCameraInputController.h b/include/Engine/Editor/EditorCameraInputController.h index 6cb31d99..257e3424 100644 --- a/include/Engine/Editor/EditorCameraInputController.h +++ b/include/Engine/Editor/EditorCameraInputController.h @@ -12,8 +12,8 @@ template class EditorCameraInputController : public FirstPersonInputController { public: - EditorCameraInputController(EventBroker* eventBroker, unsigned int playerID) - : FirstPersonInputController(eventBroker, playerID) + EditorCameraInputController(EventBroker* eventBroker, unsigned int playerID, EntityWrapper playerEntity) + : FirstPersonInputController(eventBroker, playerID, playerEntity) { EVENT_SUBSCRIBE_MEMBER(m_EMousePress, &EditorCameraInputController::OnMousePress); EVENT_SUBSCRIBE_MEMBER(m_EMouseRelease, &EditorCameraInputController::OnMouseRelease); diff --git a/include/Engine/Input/FirstPersonInputController.h b/include/Engine/Input/FirstPersonInputController.h index ed9469bd..2c7013e4 100644 --- a/include/Engine/Input/FirstPersonInputController.h +++ b/include/Engine/Input/FirstPersonInputController.h @@ -6,12 +6,13 @@ #include "../Core/ELockMouse.h" #include "../Game/Events/EDashAbility.h" #include "InputHandler.h" +#include "Rendering/EAutoAnimationBlend.h" template class FirstPersonInputController : public InputController { public: - FirstPersonInputController(EventBroker* eventBroker, int playerID); + FirstPersonInputController(EventBroker* eventBroker, int playerID, EntityWrapper playerEntity); virtual const glm::vec3 Movement() const { return m_Movement; } virtual const glm::vec3 Rotation() const { return m_Rotation; } @@ -34,6 +35,8 @@ public: protected: const int m_PlayerID; + EntityWrapper m_PlayerEntity; + bool m_MouseLocked = false; glm::vec3 m_Rotation; glm::vec3 m_Movement; @@ -65,9 +68,10 @@ protected: }; template -FirstPersonInputController::FirstPersonInputController(EventBroker* eventBroker, int playerID) +FirstPersonInputController::FirstPersonInputController(EventBroker* eventBroker, int playerID, EntityWrapper playerEntity) : InputController(eventBroker) , m_PlayerID(playerID) + , m_PlayerEntity(playerEntity) { EVENT_SUBSCRIBE_MEMBER(m_ELockMouse, &FirstPersonInputController::OnLockMouse); EVENT_SUBSCRIBE_MEMBER(m_EUnlockMouse, &FirstPersonInputController::OnUnlockMouse); @@ -118,13 +122,75 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm if (e.Command == "Forward") { float val = glm::clamp(e.Value, -1.f, 1.f); m_Movement.z = -val; + + if (m_PlayerEntity.Valid()) { + EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel"); + if (playerModel.Valid()) { + if (val > 0) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Run"; + aeb.RootNode = playerModel; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } else if (val < 0) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Run"; + aeb.RootNode = playerModel; + aeb.Start = true; + aeb.Reverse = true; + m_EventBroker->Publish(aeb); + } else { + + } + } + } } if (e.Command == "Right") { float val = glm::clamp(e.Value, -1.f, 1.f); m_Movement.x = val; + + if (m_PlayerEntity.Valid()) { + EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel"); + + if (playerModel.Valid()) { + if (val > 0) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Right"; + aeb.RootNode = playerModel; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } else if (val < 0) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Left"; + aeb.RootNode = playerModel; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } else { + + + } + } + } + } if (glm::length2(m_Movement) > 0) { m_Movement = glm::normalize(m_Movement); + } else { + if (m_PlayerEntity.Valid()) { + EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel"); + + if (playerModel.Valid()) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Idle"; + aeb.RootNode = playerModel; + m_EventBroker->Publish(aeb); + } + } } } @@ -159,6 +225,32 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm if (e.Command == "Crouch") { m_Crouching = e.Value > 0; + + if (m_PlayerEntity.Valid()) { + EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel"); + if (playerModel.Valid()) { + if (e.Value == 0.f) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "StandMovement"; + aeb.RootNode = playerModel; + aeb.Start = true; + aeb.Restart = true; + aeb.SingleLevelBlend = true; + m_EventBroker->Publish(aeb); + } else if(e.Value == 1.0f) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "CrouchMovement"; + aeb.RootNode = playerModel; + aeb.Start = true; + aeb.Restart = true; + aeb.SingleLevelBlend = true; + m_EventBroker->Publish(aeb); + } + } + } + } if (e.Command == "SpecialAbility") { diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index aa06f1e6..02f4a348 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -62,6 +62,7 @@ public: double progress; bool Start; bool SingleBlend; + double Weight; std::unordered_map StartWeights; }; diff --git a/include/Engine/Rendering/EAutoAnimationBlend.h b/include/Engine/Rendering/EAutoAnimationBlend.h index ebd29848..29d3d612 100644 --- a/include/Engine/Rendering/EAutoAnimationBlend.h +++ b/include/Engine/Rendering/EAutoAnimationBlend.h @@ -19,6 +19,8 @@ struct AutoAnimationBlend : Event bool Restart = false; bool SingleLevelBlend = false; + double Weight = -1.0; + EntityWrapper AnimationEntity = EntityWrapper::Invalid; }; diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index d34dba32..4ff512ac 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -631,7 +631,6 @@ Models/Characters/Assault/AssaultBlue.mesh - false @@ -719,12 +718,12 @@ ReloadSwitchBlend - MovementBlend + FinalMovementBlend - + StandCrouchBlend @@ -987,7 +986,7 @@ DashForwardF - 1 + 2 false @@ -999,7 +998,7 @@ DashBackwardF - 1 + 2 false @@ -1023,7 +1022,7 @@ DashLeftF - 1 + 3 false @@ -1035,7 +1034,7 @@ DashRightF - 1 + 3 false diff --git a/src/Engine/Editor/EditorSystem.cpp b/src/Engine/Editor/EditorSystem.cpp index 62ddba88..f9cdde0b 100644 --- a/src/Engine/Editor/EditorSystem.cpp +++ b/src/Engine/Editor/EditorSystem.cpp @@ -19,7 +19,7 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame m_ActualCamera = m_EditorCamera; m_EditorWorld->AttachComponent(m_EditorCamera.ID, "Transform"); m_EditorWorld->AttachComponent(m_EditorCamera.ID, "Camera"); - m_EditorCameraInputController = new EditorCameraInputController(m_EventBroker, -1); + m_EditorCameraInputController = new EditorCameraInputController(m_EventBroker, -1, EntityWrapper::Invalid); m_EditorGUI = new EditorGUI(m_World, m_EventBroker); m_EditorGUI->SetEntitySelectedCallback(std::bind(&EditorSystem::OnEntitySelected, this, std::placeholders::_1)); diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index 5bac27f9..005778e7 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -196,7 +196,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) abj.BlendInfo.progress = 0.0; abj.BlendInfo.Start = e.Start; abj.BlendInfo.SingleBlend = e.SingleLevelBlend; - + abj.BlendInfo.Weight = e.Weight; EntityWrapper nodeEntity = subTreeRoot.FirstChildByName(e.NodeName); // more than one if (nodeEntity.Valid()) { diff --git a/src/Engine/Rendering/BlendTree.cpp b/src/Engine/Rendering/BlendTree.cpp index 9b6679ea..29bbe7e6 100644 --- a/src/Engine/Rendering/BlendTree.cpp +++ b/src/Engine/Rendering/BlendTree.cpp @@ -207,6 +207,22 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo) { std::vector goalNodes = FindNodesByName(blendInfo.NodeName); + if(blendInfo.Weight >= 0 && blendInfo.Weight <= 1.0) { + for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) { + EntityWrapper entity = (*it)->Entity; + + if (entity.Valid()) { + if (entity.HasComponent("Blend")) { + (double&)entity["Blend"]["Weight"] = blendInfo.Weight; + } + } + } + + return blendInfo; + } + + + if (blendInfo.Start) { for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) { EntityWrapper entity = (*it)->Entity; diff --git a/src/Game/Systems/PlayerDeathSystem.cpp b/src/Game/Systems/PlayerDeathSystem.cpp index cbf0927f..b9a42ffc 100644 --- a/src/Game/Systems/PlayerDeathSystem.cpp +++ b/src/Game/Systems/PlayerDeathSystem.cpp @@ -45,10 +45,6 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player) //copy the data from player to explosioneffectmodel playerEntityModel.Copy(deathEffectEW["Model"]); playerEntityAnimation.Copy(deathEffectEW["Animation"]); - //freeze the animation - deathEffectEW["Animation"]["Speed1"] = 0.0; - deathEffectEW["Animation"]["Speed2"] = 0.0; - deathEffectEW["Animation"]["Speed3"] = 0.0; //copy the models position,orientation deathEffectEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"]; diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index d67e77bd..8fddbe96 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -42,11 +42,25 @@ void PlayerMovementSystem::updateMovementControllers(double dt) cameraOrientation.x = glm::clamp(cameraOrientation.x, -glm::half_pi(), glm::half_pi()); // Set third person model aim pitch EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); + + //Third-person aim if (playerModel.Valid()) { - //ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"]; - //float pitch = cameraOrientation.x + 0.2f; - //double time = (pitch + glm::half_pi()) / glm::pi(); - //cAnimationOffset["Time"] = time; + EntityWrapper aimPrimaryEntity = playerModel.FirstChildByName("AimPrimary"); + if(aimPrimaryEntity.Valid()){ + if(aimPrimaryEntity.HasComponent("Animation")) { + float pitch = cameraOrientation.x + 0.2f; + double time = (pitch + glm::half_pi()) / glm::pi(); + (double&)aimPrimaryEntity["Animation"]["Time"] = time; + } + } + EntityWrapper aimSecondaryEntity = playerModel.FirstChildByName("AimSecondary"); + if (aimSecondaryEntity.Valid()) { + if (aimSecondaryEntity.HasComponent("Animation")) { + float pitch = cameraOrientation.x + 0.2f; + double time = (pitch + glm::half_pi()) / glm::pi(); + (double&)aimSecondaryEntity["Animation"]["Time"] = time; + } + } } } @@ -140,10 +154,64 @@ void PlayerMovementSystem::updateMovementControllers(double dt) if (isOnGround) { (bool)cPhysics["IsOnGround"] = false; velocity.y = player["Player"]["JumpSpeed"]; + + + if (player.Valid()) { + EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); + if (playerModel.Valid()) { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.15; + aeb.NodeName = "Jump"; + aeb.RootNode = playerModel; + aeb.Start = true; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.25; + aeb.NodeName = "StandCrouchBlend"; + aeb.RootNode = playerModel; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = playerModel.FirstChildByName("Jump"); + m_EventBroker->Publish(aeb); + } + } + } + + } else if (player.HasComponent("DoubleJump") && !controller->DoubleJumping()) { //Enter here if player can double jump and is doing so. (bool)cPhysics["IsOnGround"] = false; velocity.y = player["DoubleJump"]["DoubleJumpSpeed"]; + + if (player.Valid()) { + EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); + if (playerModel.Valid()) { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.15; + aeb.NodeName = "Jump"; + aeb.RootNode = playerModel; + aeb.Start = true; + aeb.Restart = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.25; + aeb.NodeName = "StandCrouchBlend"; + aeb.RootNode = playerModel; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = playerModel.FirstChildByName("Jump"); + m_EventBroker->Publish(aeb); + } + } + } + // If IsServer and network is off this will not work if (IsClient) { //put a hexagon at the players feet @@ -234,7 +302,7 @@ void PlayerMovementSystem::playerStep(double dt) bool PlayerMovementSystem::OnPlayerSpawned(Events::PlayerSpawned& e) { // When a player spawns, create an input controller for them - m_PlayerInputControllers[e.Player] = new FirstPersonInputController(m_EventBroker, e.PlayerID); + m_PlayerInputControllers[e.Player] = new FirstPersonInputController(m_EventBroker, e.PlayerID, e.Player); if (e.PlayerID == -1) { // Keep track of the local player m_LocalPlayer = e.Player; @@ -267,18 +335,72 @@ void PlayerMovementSystem::spawnHexagon(EntityWrapper target) bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e) { EntityWrapper player(m_World, e.Player); - if (!player.Valid() || !IsClient || player.ID == LocalPlayer.ID) { + if (!player.Valid() || !IsClient){// || player.ID == LocalPlayer.ID) { return false; } auto entityFile = ResourceManager::Load("Schema/Entities/DashEffect.xml"); EntityWrapper dashEffect = entityFile->MergeInto(m_World); - auto playerModel = player.FirstChildByName("PlayerModel"); + EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); + +/* auto playerEntityModel = playerModel["Model"]; + + + if (player.HasComponent("Physics")) { + glm::vec3 velocity = (glm::vec3)player["Physics"]["Velocity"]; + + glm::vec2 direction = glm::vec2(velocity.x, velocity.z); + + std::string DashName = ""; + if (glm::abs(direction.x) > glm::abs(direction.y)) { + if(glm::sign(direction.x) > 0) { + DashName = "DashRight"; + } else { + DashName = "DashLeft"; + } + } else { + if (glm::sign(direction.y) > 0) { + DashName = "DashForward"; + } else { + DashName = "DashBackward"; + } + } + + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = DashName; + aeb.RootNode = playerModel; + aeb.Restart = true; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "StandCrouchBlend"; + aeb.RootNode = playerModel; + aeb.Delay = 0.3; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = playerModel.FirstChildByName(DashName); + m_EventBroker->Publish(aeb); + } + } + */ + +/* auto playerEntityAnimation = playerModel["Animation"]; + playerEntityModel.Copy(dashEffect["Model"]); playerEntityAnimation.Copy(dashEffect["Animation"]); dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"]; ((glm::vec4&)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f; +*/ + + + + return true; } diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 3918e9b8..55f6bb56 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -103,7 +103,7 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) // Play animation EntityWrapper modelEntity = wi.FirstPersonEntity.Parent().Parent(); if (modelEntity.Valid()) { - EntityWrapper blendTree = modelEntity.FirstChildByName("AssaultWeaponBlendTree"); + EntityWrapper blendTree = modelEntity.FirstChildByName("BlendTreeAssaultWeapon"); EntityWrapper reloadBlend = blendTree.FirstChildByName("Reload"); Events::AutoAnimationBlend eFireBlend; From 2b55450c183e222cac3293e159ba6cc0f1a3541b Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 08:54:59 +0100 Subject: [PATCH 80/94] Cray cray weapons --- assets | 2 +- include/Game/Systems/Weapon/WeaponBehaviour.h | 26 + resources/Schema/Entities/DefenderShield.xml | 42 +- resources/Schema/Entities/MovementTest.xml | 6 +- resources/Schema/Entities/Player.xml | 205 +-- .../Schema/Entities/PlayerAssaultBlue.xml | 1258 +++++++++++++++++ .../Schema/Entities/PlayerDefenderBlue.xml | 334 +++-- .../Entities/WeaponDefenderBlueView.xml | 8 +- .../Entities/WeaponDefenderBlueWorld.xml | 11 +- .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 17 +- .../Weapon/DefenderWeaponBehaviour.cpp | 39 + 11 files changed, 1694 insertions(+), 254 deletions(-) create mode 100644 resources/Schema/Entities/PlayerAssaultBlue.xml diff --git a/assets b/assets index 4205e927..819f9d1c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 4205e92755aa67c90db6d272047cd92037ae9f11 +Subproject commit 819f9d1c8f62e8ebb07dafbb39f6dff1fd4d5a05 diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index 3cda172e..b00dd2e0 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -9,6 +9,7 @@ #include "Systems/SpawnerSystem.h" #include "Rendering/ESetCamera.h" #include "Core/ConfigFile.h" +#include "Rendering/EAutoAnimationBlend.h" template class WeaponBehaviour : public PureSystem @@ -94,6 +95,31 @@ protected: } } + void playAnimation(EntityWrapper weaponModelEntity, const std::string& subTreeName, const std::string& animationNodeName) + { + EntityWrapper root = weaponModelEntity.FirstParentWithComponent("Model"); + if (!root.Valid()) { + return; + } + + EntityWrapper subTree = root.FirstChildByName(subTreeName); + if (!subTree.Valid()) { + return; + } + + EntityWrapper animationNode = subTree.FirstChildByName(animationNodeName); + if (!animationNode.Valid()) { + return; + } + + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = root; + eFireBlend.NodeName = animationNodeName; + eFireBlend.Restart = true; + eFireBlend.Start = true; + m_EventBroker->Publish(eFireBlend); + } + void playAnimationAndReturn(EntityWrapper weaponModelEntity, const std::string& subTreeName, const std::string& animationNodeName) { EntityWrapper root = weaponModelEntity.FirstParentWithComponent("Model"); diff --git a/resources/Schema/Entities/DefenderShield.xml b/resources/Schema/Entities/DefenderShield.xml index da760e72..5cb72116 100755 --- a/resources/Schema/Entities/DefenderShield.xml +++ b/resources/Schema/Entities/DefenderShield.xml @@ -2,36 +2,36 @@ + + Deploy + Idle + 0 + + + Models/Characters/Defender/DefenderShield.mesh + - + - - Models/Core/UnitPlane.mesh - - - - - - + + ActivateDeactiveShieldF + + 1 + + - + - - - Models/Core/UnitHexagon.mesh - - true - - - - - - + + ShieldFrontF + 1 + + diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 90c943ef..8202bff3 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -15,7 +15,7 @@ - Schema/Entities/PlayerAssaultFallbackRed.xml + Schema/Entities/PlayerDefenderBlue.xml @@ -98,7 +98,7 @@ - + @@ -111,7 +111,7 @@ - + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index dfcf40a3..70b387bb 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -485,11 +485,11 @@ - Run + MovementBlend FinalBlend - Models/Characters/Defender/FirstPersonDefenderBlue.mesh + Models/Characters/Assault/FirstPersonAssaultBlue.mesh @@ -506,8 +506,8 @@ Schema/Entities/WeaponAssaultBlueView.xml - - + + @@ -524,8 +524,8 @@ Schema/Entities/SidearmWeaponView.xml - - + + @@ -544,55 +544,31 @@ - Idle - WeaponAction + Fire + Reload 0 true - - - - Fire - Reload - 0 - - - - - - - - ShootShotgunF - 1 - false - - - - - - - - - ReloadSwitchF - 1 - false - - - - - - - - + - IdleF - + ShootRifleF 1 - true + false + + + + + + + + + ReloadSwitchF + 1 + false @@ -608,17 +584,42 @@ - + - - RunF - - 1 - true - + + Idle + Run + 0 + true + - + + + + + RunF + 1 + true + true + + + + + + + + + IdleF + 1 + true + true + + + + + + @@ -672,8 +673,8 @@ Schema/Entities/WeaponAssaultBlueWorld.xml - - + + @@ -693,8 +694,8 @@ Schema/Entities/SidearmWeaponWorld.xml - - + + @@ -801,7 +802,7 @@ CrouchStrafeLeftF - + 1 true @@ -813,7 +814,7 @@ CrouchStrafeRightF - + 1 true @@ -827,7 +828,7 @@ CrouchWalkF - + 1 true @@ -870,42 +871,6 @@ - - - - Walk - Run - 1.2938206818383024e-24 - - - - - - - - WalkF - - 1 - true - - - - - - - - - RunF - - 1 - true - - - - - - - @@ -920,7 +885,7 @@ StrafeRightF - + 1 true @@ -932,7 +897,43 @@ StrafeLeftF - + + 1 + true + + + + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + 1 true @@ -948,7 +949,7 @@ IdleF - + 1 true @@ -1117,7 +1118,7 @@ IdleAssaultRifleU - + 1 true @@ -1129,7 +1130,7 @@ IdleSecWepU - + 1 true diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml new file mode 100644 index 00000000..bcf4b5e5 --- /dev/null +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -0,0 +1,1258 @@ + + + + + + + + + + + + + + + + + + + + + + + 5 + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + + + + + + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + + + + + + + + Textures/Weapons/Crosshair/SmallThickHoleDot.png + + false + + + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + + + + + 1 + + + + + Textures/HealthHUD3.png + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 2 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 3 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + 4 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 1 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/Arrow5.mesh + + + + + + + + + + + + + + + MovementBlend + FinalBlend + + + Models/Characters/Assault/FirstPersonAssaultBlue.mesh + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + Schema/Entities/WeaponAssaultBlueView.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + Schema/Entities/SidearmWeaponView.xml + + + + + + + + + + + + BlendTreeAssaultWeapon + BlendTreeSecondaryWeapon + 0 + true + + + + + + + + Fire + Reload + 0 + true + + + + + + + + ShootRifleF + 1 + false + + + + + + + + + ReloadSwitchF + 1 + false + + + + + + + + + + + + + + + + + + + Idle + Run + 0 + true + + + + + + + + RunF + 1 + true + true + + + + + + + + + IdleF + 1 + true + true + + + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultBlue.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultBlueWorld.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + true + + + + + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + MovementBlend + + + + + + + + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 + true + + + + + + + + StandMovement + CrouchMovement + 0 + true + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + Walk + StrafeLRBlend + 0 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + + + + + + CrouchWalkF + + 1 + true + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + Jump + DashBlend + 1 + true + + + + + + + + JumpF + + 1 + false + + + + + + + + + DashFBBlend + DashLRBlend + 0.014621149736541383 + + + + + + + + DashForward + DashBackward + 0.014363533804961248 + + + + + + + + DashForwardF + + 1 + false + + + + + + + + + DashBackwardF + + 1 + false + + + + + + + + + + + DashLeft + DashRight + 4.3244885367500671e-16 + + + + + + + + DashLeftF + + 1 + false + + + + + + + + + DashRightF + + 1 + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + Insert name here + Fonts/DroidSans.ttf,100 + + + + + + + + + + + + + + Textures/Icons/Arrow.png + + false + + + + + 50 + true + + + + + + + + + + + + Schema/Entities/DefenderShield.xml + + + + + + + + + + diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index aef660a3..c3bfc074 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -1,31 +1,38 @@ - + - - + - - - - + + 4 + 52 + + + + 150 + 150 + + - + + true 5 - + + @@ -38,6 +45,7 @@ + @@ -213,7 +221,7 @@ - 100/100 + 150/150 Fonts/DroidSans.ttf,64 @@ -422,6 +430,7 @@ Fonts/DroidSans.ttf,64 + @@ -485,12 +494,10 @@ - - BlendTreeAssaultWeapon - BlendTreeSecondaryWeapon - 0 - true - + + MovementBlend + FinalBlend + Models/Characters/Defender/FirstPersonDefenderBlue.mesh @@ -501,7 +508,6 @@ R_Arm_Weapon_Joint - true DefenderWeapon @@ -510,9 +516,8 @@ Schema/Entities/WeaponDefenderBlueView.xml - - - + + @@ -529,38 +534,39 @@ Schema/Entities/SidearmWeaponView.xml - - + + - + - Idle - WeaponAction + BlendTreeDefenderWeapon + BlendTreeSecondaryWeapon 0 true - + - Fire - Reload - 1 + ActionBlend + Shield + 0 + true - + - ShootShotgunF - + ActivateDeactiveShieldF + 1 false @@ -568,39 +574,112 @@ - + - - ReloadSwitchF - - 1 - true - + + Idle + ActionBlend2 + 0 + true + - + + + + + IdleF + + + + + + + + + Fire + Reload + 0 + + + + + + + + ShootShotgunF + + 1 + false + + + + + + + + + ShotgunReloadTwoF + + 1 + false + + + + + + + + - + - - IdleF - - 1 - true - - + + + Idle + Run + 0 + true + - + + + + + RunF + + 1 + true + true + + + + + + + + + IdleF + + 1 + true + true + + + + + + @@ -632,9 +711,8 @@ - Models/Characters/Assault/AssaultBlue.mesh - - false + Models/Characters/Defender/DefenderBlue.mesh + @@ -651,11 +729,11 @@ - Schema/Entities/WeaponAssaultBlueWorld.xml + Schema/Entities/WeaponDefenderBlueWorld.xml - - + + @@ -675,8 +753,8 @@ Schema/Entities/SidearmWeaponWorld.xml - - + + @@ -779,11 +857,11 @@ - + - CrouchStrafeLeftF - + CrouchStrafeRightF + 1 true @@ -791,11 +869,11 @@ - + - CrouchStrafeRightF - + CrouchStrafeLeftF + 1 true @@ -809,7 +887,7 @@ CrouchWalkF - + 1 true @@ -852,42 +930,6 @@ - - - - Walk - Run - 1.2938206818383024e-24 - - - - - - - - WalkF - - 1 - true - - - - - - - - - RunF - - 1 - true - - - - - - - @@ -902,7 +944,7 @@ StrafeRightF - + 1 true @@ -914,7 +956,43 @@ StrafeLeftF - + + 1 + true + + + + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + 1 true @@ -930,7 +1008,7 @@ IdleF - + 1 true @@ -1099,7 +1177,7 @@ IdleAssaultRifleU - + 1 true @@ -1111,7 +1189,7 @@ IdleSecWepU - + 1 true @@ -1159,6 +1237,50 @@ + + + + + + + + + + + Deploy + Idle + 0 + + + Models/Characters/Defender/DefenderShield.mesh + + + + + + + + ActivateDeactiveShieldF + 1 + + + + + + + + + ShieldFrontF + 1 + + + + + + + + + @@ -1191,7 +1313,7 @@ - Insert name here + Fonts/DroidSans.ttf,100 diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml index 6ec4b452..24b18f68 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -3,11 +3,9 @@ - Models/Weapons/Blue/DefenderGunBlue.mesh + Models/Weapons/Blue/DefenderWeaponBlue.mesh - - - + @@ -34,7 +32,7 @@ - + diff --git a/resources/Schema/Entities/WeaponDefenderBlueWorld.xml b/resources/Schema/Entities/WeaponDefenderBlueWorld.xml index 826301b4..6c750964 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueWorld.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueWorld.xml @@ -2,17 +2,10 @@ - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/DefenderGunBlue.mesh + Models/Weapons/Blue/DefenderWeaponBlue.mesh - - - - + diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index cdb0a563..0fd987ae 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -39,6 +39,8 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& ammo = glm::max(0, ammo - (magSize - magAmmo)); magAmmo = glm::min(magSize, ammo); isReloading = false; + wi.FirstPersonEntity["Model"]["Visible"] = true; + wi.ThirdPersonEntity["Model"]["Visible"] = true; } // Restore view angle @@ -57,19 +59,18 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& } // Update first person run animation - /*ComponentWrapper cPlayer = wi.Player["Player"]; + ComponentWrapper cPlayer = wi.Player["Player"]; ComponentWrapper cPhysics = wi.Player["Physics"]; const float& movementSpeed = cPlayer["MovementSpeed"]; float speed = glm::length((const glm::vec3&)cPhysics["Velocity"]); - float animationSpeed = glm::max(speed, movementSpeed) / movementSpeed; + float animationWeight = glm::min(speed, movementSpeed) / movementSpeed; EntityWrapper rootNode = wi.FirstPersonEntity.FirstParentWithComponent("Model"); if (rootNode.Valid()) { - EntityWrapper animationNode = rootNode.FirstChildByName("Run"); - if (animationNode.Valid()) { - (bool&)animationNode["Animation"]["Play"] = animationSpeed > 0; - (double&)animationNode["Animation"]["Speed"] = animationSpeed; + EntityWrapper blend = rootNode.FirstChildByName("MovementBlend"); + if (blend.Valid()) { + (double&)blend["Blend"]["Weight"] = animationWeight; } - }*/ + } // Fire if we're able to fire if (canFire(cWeapon, wi)) { @@ -122,6 +123,8 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner"); if (reloadEffectSpawner.Valid()) { SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); + wi.FirstPersonEntity["Model"]["Visible"] = false; + wi.ThirdPersonEntity["Model"]["Visible"] = false; } } diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 3a4ed3a4..2d6ab74b 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -36,6 +36,7 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& m_EventBroker->Publish(e); } else { isReloading = false; + playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Idle"); } } @@ -96,6 +97,9 @@ void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) // Start reload isReloading = true; reloadTimer = reloadTime; + + // Play animation + playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Reload"); } void DefenderWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) @@ -115,8 +119,40 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf if (attachment.Valid()) { if (e.Value > 0) { SpawnerSystem::Spawn(attachment, attachment); + + EntityWrapper root = wi.FirstPersonEntity.FirstParentWithComponent("Model"); + if (root.Valid()) { + EntityWrapper subTree = root.FirstChildByName("FinalBlend"); + if (subTree.Valid()) { + EntityWrapper animationNode = subTree.FirstChildByName("Shield"); + if (animationNode.Valid()) { + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = root; + eFireBlend.NodeName = "Shield"; + eFireBlend.Restart = true; + eFireBlend.Start = true; + m_EventBroker->Publish(eFireBlend); + } + } + } } else { attachment.DeleteChildren(); + + EntityWrapper root = wi.FirstPersonEntity.FirstParentWithComponent("Model"); + if (root.Valid()) { + EntityWrapper subTree = root.FirstChildByName("FinalBlend"); + if (subTree.Valid()) { + EntityWrapper animationNode = subTree.FirstChildByName("ActionBlend"); + if (animationNode.Valid()) { + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = root; + eFireBlend.NodeName = "ActionBlend"; + eFireBlend.Restart = true; + eFireBlend.Start = true; + m_EventBroker->Publish(eFireBlend); + } + } + } } } } @@ -195,6 +231,9 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi } } + // Play animation + playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeDefenderWeapon", "Fire"); + // Sound Events::PlaySoundOnEntity e; e.EmitterID = wi.Player.ID; From e2674d915ecf0a9828945f9eaa35b6a582977dc7 Mon Sep 17 00:00:00 2001 From: Jocke Date: Fri, 4 Mar 2016 08:55:55 +0100 Subject: [PATCH 81/94] Constrained weapon behavior to client side only --- include/Game/Systems/Weapon/WeaponBehaviour.h | 6 ++++-- src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp | 11 ++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index 3cda172e..a823f9dd 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -242,8 +242,10 @@ private: // Spawn the weapon(s) EntityWrapper firstPersonWeapon; EntityWrapper thirdPersonWeapon; - if (firstPersonAttachment.Valid()) { - firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment); + if (IsClient) { + if (firstPersonAttachment.Valid()) { + firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment); + } } if (thirdPersonAttachment.Valid()) { thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment); diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index cdb0a563..4c970500 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -117,11 +117,12 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) // Play animation playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Reload"); - - // Spawn explosion effect - EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner"); - if (reloadEffectSpawner.Valid()) { - SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); + if (IsClient) { + // Spawn explosion effect + EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner"); + if (reloadEffectSpawner.Valid()) { + SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); + } } } From ebd4c58c41c903dc680d7d8aadd3bcc1edf27aeb Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 09:23:18 +0100 Subject: [PATCH 82/94] "Fixed" weapon spawning over network --- include/Game/Systems/Weapon/WeaponBehaviour.h | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index 60675d67..e2d5980b 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -32,6 +32,21 @@ public: virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) override { + EntityWrapper firstPersonWeapon = entity.FirstChildByName("Hands").FirstChildByName("AssaultWeapon"); + EntityWrapper thirdPersonWeapon = entity.FirstChildByName("PlayerModel").FirstChildByName("AssaultWeapon"); + if (IsClient && (firstPersonWeapon.Valid() || thirdPersonWeapon.Valid())) { + if (m_ActiveWeapons.count(entity) == 0) { + + WeaponInfo& wi = m_ActiveWeapons[entity]; + wi.Player = entity; + wi.WeaponEntity = entity; + wi.FirstPersonEntity = firstPersonWeapon; + wi.ThirdPersonEntity = thirdPersonWeapon; + + OnEquip(cWeapon, wi); + } + } + auto weapon = getActiveWeapon(entity); if (!weapon) { return; @@ -239,6 +254,10 @@ private: void selectWeapon(ComponentWrapper cWeapon, EntityWrapper player) { + if (!IsServer) { + return; + } + // Don't reselect weapon if it's already active if (getActiveWeapon(player)) { return; @@ -268,11 +287,11 @@ private: // Spawn the weapon(s) EntityWrapper firstPersonWeapon; EntityWrapper thirdPersonWeapon; - if (IsClient) { + //if (IsClient) { if (firstPersonAttachment.Valid()) { firstPersonWeapon = SpawnerSystem::Spawn(firstPersonAttachment, firstPersonAttachment); } - } + //} if (thirdPersonAttachment.Valid()) { thirdPersonWeapon = SpawnerSystem::Spawn(thirdPersonAttachment, thirdPersonAttachment); } From 3ac8a5c7ef4c8bf62063c965d576c94d858f9497 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 09:38:38 +0100 Subject: [PATCH 83/94] Working map --- .../Schema/Entities/NewMap2version5NEW.xml | 8623 ++++++++--------- .../Schema/Entities/PlayerAssaultBlue.xml | 72 +- .../Schema/Entities/PlayerAssaultRed.xml | 1258 +++ .../Schema/Entities/WeaponAssaultRedView.xml | 109 + .../Schema/Entities/WeaponAssaultRedWorld.xml | 34 + 5 files changed, 5747 insertions(+), 4349 deletions(-) create mode 100644 resources/Schema/Entities/PlayerAssaultRed.xml create mode 100644 resources/Schema/Entities/WeaponAssaultRedView.xml create mode 100644 resources/Schema/Entities/WeaponAssaultRedWorld.xml diff --git a/resources/Schema/Entities/NewMap2version5NEW.xml b/resources/Schema/Entities/NewMap2version5NEW.xml index 2925f516..aa709967 100644 --- a/resources/Schema/Entities/NewMap2version5NEW.xml +++ b/resources/Schema/Entities/NewMap2version5NEW.xml @@ -2,6 +2,9 @@ + + 2.4355835422707059 + @@ -29,29 +32,6 @@ - - - - - Models/Props/Walls/SciFiWallBig.mesh - - - - - - - - - - - - Models/Props/Walls/SciFiWallBig.mesh - true - - - - - @@ -82,6 +62,29 @@ + + + + + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + + + + + + Models/Props/Walls/SciFiWallBig.mesh + true + + + + + @@ -676,6 +679,42 @@ + + + + + Models/Highgrounds/Hg8.mesh + + + + + + + + + + + + Models/Highgrounds/Hg10.mesh + + + + + + + + + + + + Models/Highgrounds/Hg4.mesh + + + + + + + @@ -751,42 +790,6 @@ - - - - - Models/Highgrounds/Hg8.mesh - - - - - - - - - - - - Models/Highgrounds/Hg10.mesh - - - - - - - - - - - - Models/Highgrounds/Hg4.mesh - - - - - - - @@ -1924,6 +1927,68 @@ + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + + + + + Models/Props/Flora/SpecialRoot.mesh + + + + + + + + + + @@ -2526,392 +2591,7 @@ - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - + @@ -2920,12 +2600,12 @@ - Models/Props/Flora/SpecialRoot.mesh + Models/Props/Pillars/StonePillar.mesh - - - + + + @@ -2934,12 +2614,11 @@ - Models/Props/Flora/SpecialRoot.mesh + Models/Props/Pillars/SciFiPillar2Red.mesh - - - + + @@ -2948,11 +2627,13 @@ - Models/Props/Flora/SpecialRoot.mesh + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh - - + + + @@ -2961,32 +2642,10 @@ - Models/Props/Flora/SpecialRoot.mesh + Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - + @@ -2995,496 +2654,11 @@ - Models/Props/SciFiHolder1.mesh + Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - + + @@ -3494,573 +2668,16 @@ - Models/Props/Stones/SmallStone1.mesh + Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - + + - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - @@ -4068,6 +2685,19 @@ + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + @@ -4108,19 +2738,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - @@ -4137,579 +2754,6 @@ - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar1Red.mesh - - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Core/UnitPlane.mesh - - true - - - - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - @@ -4729,232 +2773,6 @@ - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/smallWall3.mesh - - - - - - - - - - - @@ -4966,8 +2784,8 @@ Models/Props/PickUps/PickUpHolder.mesh - - + + @@ -4975,49 +2793,7 @@ - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - + @@ -5034,7 +2810,343 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + @@ -5046,324 +3158,11 @@ - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -5371,593 +3170,8 @@ Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 4 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 3 - - - - - - - - - - - - 2 - - - - - - - - - - - - 2 - 1 - - - - - - - - - - - - - - 4 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - + + @@ -5976,6 +3190,46 @@ + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + @@ -5983,8 +3237,195 @@ Models/Props/Stones/BigStone.mesh - - + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + @@ -5997,8 +3438,8 @@ - - + + @@ -6010,8 +3451,308 @@ Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + @@ -6044,20 +3785,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6071,46 +3798,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -6118,48 +3805,8 @@ Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - + + @@ -6185,8 +3832,114 @@ Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + @@ -6199,8 +3952,22 @@ Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + @@ -6212,75 +3979,8 @@ Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - + + @@ -6298,47 +3998,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - @@ -6352,18 +4011,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - @@ -6418,112 +4065,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6531,13 +4072,41 @@ Models/Props/Stones/MediumStone2.mesh - - + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + @@ -6551,71 +4120,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6629,75 +4133,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6712,6 +4147,1958 @@ + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/smallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 3 + + + + + + + + + + + + 2 + 1 + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 4 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + @@ -6733,9 +6120,211 @@ Models/Props/Stones/SmallStone1.mesh - - - + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + @@ -6754,6 +6343,192 @@ + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + @@ -6767,6 +6542,73 @@ + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + @@ -6774,9 +6616,170 @@ Models/Props/Stones/SmallStone1.mesh - - - + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + @@ -6816,90 +6819,6 @@ - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - @@ -6932,7 +6851,7 @@ - + @@ -6948,8 +6867,8 @@ Models/Props/PickUps/PickUpHolder.mesh - - + + @@ -6957,49 +6876,7 @@ - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - + @@ -7016,7 +6893,7 @@ - + @@ -7058,7 +6935,133 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + @@ -7100,7 +7103,7 @@ - + @@ -7112,11 +7115,100 @@ + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + @@ -7130,6 +7222,20 @@ + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + @@ -7145,20 +7251,6 @@ - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - @@ -7173,95 +7265,6 @@ - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - - - - - @@ -7413,19 +7416,6 @@ - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - @@ -7453,6 +7443,19 @@ + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + @@ -7542,9 +7545,8 @@ Models/Props/Flora/SpecialRoot.mesh - - - + + @@ -7556,8 +7558,9 @@ Models/Props/Flora/SpecialRoot.mesh - - + + + @@ -7601,12 +7604,11 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Walls/MediumWall3.mesh - - - + + @@ -7618,8 +7620,76 @@ Models/Props/Walls/MediumWall3.mesh - - + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + @@ -7657,48 +7727,8 @@ Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - + + @@ -7718,6 +7748,20 @@ + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + @@ -7725,12 +7769,26 @@ Models/Props/Walls/BigWallBlue.mesh - + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + @@ -7751,8 +7809,7 @@ Models/Props/Walls/SmallWall3.mesh - - + @@ -7765,8 +7822,21 @@ Models/Props/Walls/MediumWall3.mesh - - + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + @@ -7792,8 +7862,8 @@ Models/Props/Walls/SmallWall3.mesh - - + + @@ -7806,49 +7876,9 @@ Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - + + + @@ -7866,6 +7896,19 @@ + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -7883,11 +7926,39 @@ - Models/Props/Walls/BigWallBlue.mesh + Models/Props/Walls/SmallWall3.mesh - - + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + @@ -7905,32 +7976,6 @@ - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - @@ -7944,48 +7989,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -8008,19 +8011,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - @@ -8048,6 +8038,19 @@ + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + @@ -8144,13 +8147,12 @@ - 4 - Models/Props/Pillars/SciFiPillar3Blue.mesh + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh - - - + + @@ -8177,8 +8179,9 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - + + + @@ -8187,12 +8190,12 @@ - 6 - Models/Props/Pillars/SciFiPillar1Blue.mesh + Models/Props/Pillars/SciFiPillar2Blue.mesh - - + + + @@ -8220,8 +8223,8 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - + + @@ -8240,6 +8243,49 @@ + + + + + 4 + Models/Props/Pillars/SciFiPillar3Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + @@ -8255,49 +8301,6 @@ - - - - - 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - @@ -8352,26 +8355,6 @@ - - - - 10 - - - - - - - - - - - 1 - - - - - @@ -8383,17 +8366,6 @@ - - - - 10 - - - - - - - @@ -8406,6 +8378,17 @@ + + + + 10 + + + + + + + @@ -8429,6 +8412,26 @@ + + + + 1 + + + + + + + + + 10 + + + + + + + @@ -8440,7 +8443,7 @@ - Schema/Entities/PlayerRed.xml + Schema/Entities/PlayerAssaultRed.xml @@ -8702,61 +8705,55 @@ - Schema/Entities/Player.xml + Schema/Entities/PlayerAssaultBlue.xml - + - + - Models/Characters/Assault/AssaultTPose.mesh - false + Models/Core/UnitCube.mesh + + + + + + + + + + Models/Core/UnitCube.mesh - + - + - Models/Characters/Assault/AssaultTPose.mesh - false + Models/Core/UnitCube.mesh - + - + - Models/Characters/Assault/AssaultTPose.mesh - false + Models/Core/UnitCube.mesh - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - + diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index bcf4b5e5..c918dcd6 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -871,42 +871,6 @@ - - - - Walk - Run - 1.2938206818383024e-24 - - - - - - - - WalkF - - 1 - true - - - - - - - - - RunF - - 1 - true - - - - - - - @@ -943,6 +907,42 @@ + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + diff --git a/resources/Schema/Entities/PlayerAssaultRed.xml b/resources/Schema/Entities/PlayerAssaultRed.xml new file mode 100644 index 00000000..af0ba963 --- /dev/null +++ b/resources/Schema/Entities/PlayerAssaultRed.xml @@ -0,0 +1,1258 @@ + + + + + + + + + + + + + + + + + + + + + + + 5 + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + + + + + + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + + + + + + + + Textures/Weapons/Crosshair/SmallThickHoleDot.png + + false + + + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + + + + + 1 + + + + + Textures/HealthHUD3.png + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 2 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 3 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + 4 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 1 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/Arrow5.mesh + + + + + + + + + + + + + + + MovementBlend + FinalBlend + + + Models/Characters/Assault/FirstPersonAssaultRed.mesh + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + Schema/Entities/WeaponAssaultRedView.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + Schema/Entities/SidearmWeaponView.xml + + + + + + + + + + + + BlendTreeAssaultWeapon + BlendTreeSecondaryWeapon + 0 + true + + + + + + + + Fire + Reload + 0 + true + + + + + + + + ShootRifleF + 1 + false + + + + + + + + + ReloadSwitchF + 1 + false + + + + + + + + + + + + + + + + + + + Idle + Run + 0 + true + + + + + + + + RunF + 1 + true + true + + + + + + + + + IdleF + 1 + true + true + + + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultRed.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultRedWorld.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + true + + + + + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + MovementBlend + + + + + + + + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 + true + + + + + + + + StandMovement + CrouchMovement + 0 + true + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + Walk + StrafeLRBlend + 0 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + + + + + + CrouchWalkF + + 1 + true + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + Jump + DashBlend + 1 + true + + + + + + + + JumpF + + 1 + false + + + + + + + + + DashFBBlend + DashLRBlend + 0.014621149736541383 + + + + + + + + DashForward + DashBackward + 0.014363533804961248 + + + + + + + + DashForwardF + + 1 + false + + + + + + + + + DashBackwardF + + 1 + false + + + + + + + + + + + DashLeft + DashRight + 4.3244885367500671e-16 + + + + + + + + DashLeftF + + 1 + false + + + + + + + + + DashRightF + + 1 + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + Insert name here + Fonts/DroidSans.ttf,100 + + + + + + + + + + + + + + Textures/Icons/Arrow.png + + false + + + + + 50 + true + + + + + + + + + + + + Schema/Entities/DefenderShield.xml + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponAssaultRedView.xml b/resources/Schema/Entities/WeaponAssaultRedView.xml new file mode 100644 index 00000000..0a9b65b2 --- /dev/null +++ b/resources/Schema/Entities/WeaponAssaultRedView.xml @@ -0,0 +1,109 @@ + + + + + + Models/Weapons/Red/AssaultWeaponRed.mesh + + + + + + + + + Schema/Entities/RayRed.xml + + + + + + + + + + + + Schema/Entities/ReloadEffectView.xml + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + 32 + Fonts/DroidSans.ttf,64 + + + + Player + AssaultWeapon + MagazineAmmo + + + + + + + + + + + 320 + Fonts/DroidSans.ttf,64 + + + + Player + AssaultWeapon + Ammo + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponAssaultRedWorld.xml b/resources/Schema/Entities/WeaponAssaultRedWorld.xml new file mode 100644 index 00000000..68d78d03 --- /dev/null +++ b/resources/Schema/Entities/WeaponAssaultRedWorld.xml @@ -0,0 +1,34 @@ + + + + + + Models/Weapons/Red/AssaultWeaponRed.mesh + + + + + + + + + Schema/Entities/RayRed.xml + + + + + + + + + + + Schema/Entities/ReloadEffectWorld.xml + + + + + + + + From c1f5cf65a7211ea1029084e48d68f8066ed53630 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 4 Mar 2016 09:39:16 +0100 Subject: [PATCH 84/94] Movement animations --- .../Engine/Input/FirstPersonInputController.h | 13 +- resources/Schema/Entities/Player.xml | 16 +- src/Game/Systems/PlayerMovementSystem.cpp | 139 ++++++++++++------ 3 files changed, 117 insertions(+), 51 deletions(-) diff --git a/include/Engine/Input/FirstPersonInputController.h b/include/Engine/Input/FirstPersonInputController.h index 2c7013e4..00f36ac7 100644 --- a/include/Engine/Input/FirstPersonInputController.h +++ b/include/Engine/Input/FirstPersonInputController.h @@ -129,14 +129,23 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm if (val > 0) { Events::AutoAnimationBlend aeb; aeb.Duration = 0.1; - aeb.NodeName = "Run"; + + if(m_Crouching) { + aeb.NodeName = "Walk"; + } else { + aeb.NodeName = "Run"; + } aeb.RootNode = playerModel; aeb.Start = true; m_EventBroker->Publish(aeb); } else if (val < 0) { Events::AutoAnimationBlend aeb; aeb.Duration = 0.1; - aeb.NodeName = "Run"; + if (m_Crouching) { + aeb.NodeName = "Walk"; + } else { + aeb.NodeName = "Run"; + } aeb.RootNode = playerModel; aeb.Start = true; aeb.Reverse = true; diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 4ff512ac..475acf78 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -894,11 +894,11 @@ - + - StrafeLeftF - + StrafeRightF + 1 true @@ -906,11 +906,11 @@ - + - StrafeRightF - + StrafeLeftF + 1 true @@ -1022,7 +1022,7 @@ DashLeftF - 3 + 2 false @@ -1034,7 +1034,7 @@ DashRightF - 3 + 2 false diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index 8fddbe96..3d897bf7 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -343,52 +343,109 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e) EntityWrapper dashEffect = entityFile->MergeInto(m_World); EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); -/* - auto playerEntityModel = playerModel["Model"]; - + for (auto& kv : m_PlayerInputControllers) { + EntityWrapper player = kv.first; + auto& controller = kv.second; - if (player.HasComponent("Physics")) { - glm::vec3 velocity = (glm::vec3)player["Physics"]["Velocity"]; - - glm::vec2 direction = glm::vec2(velocity.x, velocity.z); - - std::string DashName = ""; - if (glm::abs(direction.x) > glm::abs(direction.y)) { - if(glm::sign(direction.x) > 0) { - DashName = "DashRight"; - } else { - DashName = "DashLeft"; - } - } else { - if (glm::sign(direction.y) > 0) { - DashName = "DashForward"; - } else { - DashName = "DashBackward"; - } + if (!player.Valid()) { + continue; } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.1; - aeb.NodeName = DashName; - aeb.RootNode = playerModel; - aeb.Restart = true; - aeb.Start = true; - m_EventBroker->Publish(aeb); - } - { - Events::AutoAnimationBlend aeb; - aeb.Duration = 0.3; - aeb.NodeName = "StandCrouchBlend"; - aeb.RootNode = playerModel; - aeb.Delay = 0.3; - aeb.Start = true; - aeb.Restart = false; - aeb.AnimationEntity = playerModel.FirstChildByName(DashName); - m_EventBroker->Publish(aeb); + if (player.Valid()) { + EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); + if (playerModel.Valid()) { + if (glm::abs(controller->Movement().x) > glm::abs(controller->Movement().z)) { + if (controller->Movement().x > 0) { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "DashRight"; + aeb.RootNode = playerModel; + aeb.Restart = true; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "StandCrouchBlend"; + aeb.RootNode = playerModel; + aeb.Delay = -0.3; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = playerModel.FirstChildByName("DashForward"); + m_EventBroker->Publish(aeb); + } + } else { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "DashLeft"; + aeb.RootNode = playerModel; + aeb.Restart = true; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "StandCrouchBlend"; + aeb.RootNode = playerModel; + aeb.Delay = -0.3; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = playerModel.FirstChildByName("DashForward"); + m_EventBroker->Publish(aeb); + } + } + } else { + if (controller->Movement().z < 0) { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "DashForward"; + aeb.RootNode = playerModel; + aeb.Restart = true; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "StandCrouchBlend"; + aeb.RootNode = playerModel; + aeb.Delay = -0.3; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = playerModel.FirstChildByName("DashForward"); + m_EventBroker->Publish(aeb); + } + } else { + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "DashBackward"; + aeb.RootNode = playerModel; + aeb.Restart = true; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.3; + aeb.NodeName = "StandCrouchBlend"; + aeb.RootNode = playerModel; + aeb.Delay = -0.3; + aeb.Start = true; + aeb.Restart = false; + aeb.AnimationEntity = playerModel.FirstChildByName("DashForward"); + m_EventBroker->Publish(aeb); + } + } + } + } } } - */ /* auto playerEntityAnimation = playerModel["Animation"]; From 4557455e491387b141faed830b3b7c3152ce2bac Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 09:41:12 +0100 Subject: [PATCH 85/94] HUD stuff --- .../Schema/Entities/PlayerAssaultBlue.xml | 368 +++++++++--------- .../Schema/Entities/PlayerAssaultRed.xml | 368 +++++++++--------- 2 files changed, 376 insertions(+), 360 deletions(-) diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index c918dcd6..18125e2c 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -84,150 +84,6 @@ - - - - - - - - - 1 - - - - - Textures/HealthHUD3.png - - - - - - - - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - 0.0 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - 1 - - - - 100/100 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - @@ -481,6 +337,158 @@ + + + + + + + + + + + + 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 + + + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + false + + + + + + + + + + + + + @@ -871,42 +879,6 @@ - - - - Left - Right - 0.033793529385008014 - - - - - - - - StrafeRightF - - 1 - true - - - - - - - - - StrafeLeftF - - 1 - true - - - - - - - @@ -943,6 +915,42 @@ + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + diff --git a/resources/Schema/Entities/PlayerAssaultRed.xml b/resources/Schema/Entities/PlayerAssaultRed.xml index af0ba963..6dfc94bc 100644 --- a/resources/Schema/Entities/PlayerAssaultRed.xml +++ b/resources/Schema/Entities/PlayerAssaultRed.xml @@ -84,150 +84,6 @@ - - - - - - - - - 1 - - - - - Textures/HealthHUD3.png - - - - - - - - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - - - - - - - - - Textures/Core/White.png - - false - - - - - - - - - - - 0.0 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - 1 - - - - 100/100 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - @@ -481,6 +337,158 @@ + + + + + + + + + + + + 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 + + + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + false + + + + + + + + + + + + + @@ -871,42 +879,6 @@ - - - - Left - Right - 0.033793529385008014 - - - - - - - - StrafeRightF - - 1 - true - - - - - - - - - StrafeLeftF - - 1 - true - - - - - - - @@ -943,6 +915,42 @@ + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + From 434ff1e7eb55e53a0e925e951f3a6c31da98f063 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 10:03:06 +0100 Subject: [PATCH 86/94] ???? --- resources/Schema/Entities/MovementTest.xml | 6 +- resources/Schema/Entities/Player.xml | 189 +++-- .../Schema/Entities/PlayerAssaultBlue.xml | 658 +++++++++--------- .../Schema/Entities/PlayerAssaultRed.xml | 658 +++++++++--------- resources/Schema/Entities/PlayerModel.xml | 542 +++++++++++++++ .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 12 + 6 files changed, 1300 insertions(+), 765 deletions(-) create mode 100644 resources/Schema/Entities/PlayerModel.xml diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 8202bff3..50f77401 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -83,7 +83,7 @@ - Schema/Entities/Player.xml + Schema/Entities/PlayerAssaultBlue.xml @@ -98,7 +98,7 @@ - + @@ -111,7 +111,7 @@ - + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 70b387bb..475acf78 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -484,12 +484,14 @@ - - MovementBlend - FinalBlend - + + BlendTreeAssaultWeapon + BlendTreeSecondaryWeapon + 0 + true + - Models/Characters/Assault/FirstPersonAssaultBlue.mesh + Models/Characters/Defender/FirstPersonDefenderBlue.mesh @@ -506,8 +508,8 @@ Schema/Entities/WeaponAssaultBlueView.xml - - + + @@ -524,30 +526,29 @@ Schema/Entities/SidearmWeaponView.xml - - + + - + - BlendTreeAssaultWeapon - BlendTreeSecondaryWeapon + Idle + WeaponAction 0 true - + Fire Reload - 0 - true + 1 @@ -555,8 +556,9 @@ - ShootRifleF + ShootShotgunF 1 + true false @@ -567,8 +569,9 @@ ReloadSwitchF + 1 - false + true @@ -576,50 +579,25 @@ - + + + IdleF + + 1 + true + - + - - Idle - Run - 0 - true - - - - - - RunF - 1 - true - true - - - - - - - - - IdleF - 1 - true - true - - - - - - + @@ -653,7 +631,6 @@ Models/Characters/Assault/AssaultBlue.mesh - false @@ -673,8 +650,8 @@ Schema/Entities/WeaponAssaultBlueWorld.xml - - + + @@ -694,8 +671,8 @@ Schema/Entities/SidearmWeaponWorld.xml - - + + @@ -741,12 +718,12 @@ ReloadSwitchBlend - MovementBlend + FinalMovementBlend - + StandCrouchBlend @@ -802,7 +779,7 @@ CrouchStrafeLeftF - + 1 true @@ -814,7 +791,7 @@ CrouchStrafeRightF - + 1 true @@ -828,7 +805,7 @@ CrouchWalkF - + 1 true @@ -871,42 +848,6 @@ - - - - Left - Right - 0.033793529385008014 - - - - - - - - StrafeRightF - - 1 - true - - - - - - - - - StrafeLeftF - - 1 - true - - - - - - - @@ -921,7 +862,7 @@ WalkF - + 1 true @@ -933,7 +874,43 @@ RunF - + + 1 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + StrafeLeftF + 1 true @@ -949,7 +926,7 @@ IdleF - + 1 true @@ -1009,7 +986,7 @@ DashForwardF - 1 + 2 false @@ -1021,7 +998,7 @@ DashBackwardF - 1 + 2 false @@ -1045,7 +1022,7 @@ DashLeftF - 1 + 2 false @@ -1057,7 +1034,7 @@ DashRightF - 1 + 2 false @@ -1118,7 +1095,7 @@ IdleAssaultRifleU - + 1 true @@ -1130,7 +1107,7 @@ IdleSecWepU - + 1 true diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index 18125e2c..057a0abb 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -652,191 +652,179 @@ + + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultBlue.mesh + + false + + + + + + - - BlendTreeAim - BlendTreeAssault - - - - - Models/Characters/Assault/AssaultBlue.mesh - - + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultBlueWorld.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + true + - + - - R_Arm_Weapon_Joint - - - AssaultWeapon - - - - - - Schema/Entities/WeaponAssaultBlueWorld.xml - - - - - + + AimSecWepA + + false + true + + - + - - R_Arm_Weapon_Joint - - - SidearmWeapon - - - - - - Schema/Entities/SidearmWeaponWorld.xml - - - - - + + AimRifleA + + false + true + + - + + + + + + ReloadSwitchBlend + FinalMovementBlend + + + + + - AimPrimary - AimSecondary - 0 + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 true - - - - AimSecWepA - - false - true - - - - - - - - - AimRifleA - - false - true - - - - - - - - - - - ReloadSwitchBlend - MovementBlend - - - - - + - StandCrouchBlend - JumpDashBlend - 2.5146881298480398e-63 + StandMovement + CrouchMovement + 0 true - + - StandMovement - CrouchMovement - 0 - true + MovementBlend + Idle + 1 - + - MovementBlend - Idle - 1 + Walk + StrafeLRBlend + 0 - + - Walk - StrafeLRBlend - 0 + Left + Right + 0.033793529385008014 - - - - Left - Right - 0.033793529385008014 - - - - - - - - CrouchStrafeLeftF - - 1 - true - - - - - - - - - CrouchStrafeRightF - - 1 - true - - - - - - - - + - CrouchWalkF - + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + 1 true @@ -846,118 +834,11 @@ - + - CrouchF - - 1 - - - - - - - - - - - MovementBlend - Idle - 1 - - - - - - - - RunWalkBlend - StrafeLRBlend - 2.4565650245976452e-16 - - - - - - - - Walk - Run - 1.2938206818383024e-24 - - - - - - - - WalkF - - 1 - true - - - - - - - - - RunF - - 1 - true - - - - - - - - - - - Left - Right - 0.033793529385008014 - - - - - - - - StrafeRightF - - 1 - true - - - - - - - - - StrafeLeftF - - 1 - true - - - - - - - - - - - - - IdleF - + CrouchWalkF + 1 true @@ -967,70 +848,68 @@ - - - - - - Jump - DashBlend - 1 - true - - - - - + - JumpF - + CrouchF + 1 - false - + + + + + + MovementBlend + Idle + 1 + + + + + - DashFBBlend - DashLRBlend - 0.014621149736541383 + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 - + - DashForward - DashBackward - 0.014363533804961248 + Walk + Run + 1.2938206818383024e-24 - + - DashForwardF - + WalkF + 1 - false + true - + - DashBackwardF - + RunF + 1 - false + true @@ -1038,35 +917,35 @@ - + - DashLeft - DashRight - 4.3244885367500671e-16 + Left + Right + 0.033793529385008014 - + - DashLeftF - + StrafeLeftF + 1 - false + true - + - DashRightF - + StrafeRightF + 1 - false + true @@ -1076,71 +955,84 @@ + + + + IdleF + + 1 + true + + + + + - + - ReloadSwitch - WeaponActionBlend + Jump + DashBlend 1 true - + - ReloadSwitchU - + JumpF + 1 + false - + - IdleBlend - ShootBlend - 0 + DashFBBlend + DashLRBlend + 0.014621149736541383 - + - IdlePrimary - IdleSecondary - 0 + DashForward + DashBackward + 0.014363533804961248 - + - IdleAssaultRifleU - - 1 - true + DashForwardF + + 2 + false - + - IdleSecWepU - - 1 - true + DashBackwardF + + 2 + false @@ -1148,31 +1040,35 @@ - + - ShootPrimary - ShootSecondary - 0 + DashLeft + DashRight + 4.3244885367500671e-16 - + - ShootFastRifleU - - 1 + DashLeftF + + 2 + false - + - ShootSecWepFastU + DashRightF + + 2 + false @@ -1186,8 +1082,114 @@ + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/PlayerAssaultRed.xml b/resources/Schema/Entities/PlayerAssaultRed.xml index 6dfc94bc..5811cc74 100644 --- a/resources/Schema/Entities/PlayerAssaultRed.xml +++ b/resources/Schema/Entities/PlayerAssaultRed.xml @@ -652,191 +652,179 @@ + + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultRed.mesh + + false + + + + + + - - BlendTreeAim - BlendTreeAssault - - - - - Models/Characters/Assault/AssaultRed.mesh - - + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultRedWorld.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + true + - + - - R_Arm_Weapon_Joint - - - AssaultWeapon - - - - - - Schema/Entities/WeaponAssaultRedWorld.xml - - - - - + + AimSecWepA + + false + true + + - + - - R_Arm_Weapon_Joint - - - SidearmWeapon - - - - - - Schema/Entities/SidearmWeaponWorld.xml - - - - - + + AimRifleA + + false + true + + - + + + + + + ReloadSwitchBlend + FinalMovementBlend + + + + + - AimPrimary - AimSecondary - 0 + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 true - - - - AimSecWepA - - false - true - - - - - - - - - AimRifleA - - false - true - - - - - - - - - - - ReloadSwitchBlend - MovementBlend - - - - - + - StandCrouchBlend - JumpDashBlend - 2.5146881298480398e-63 + StandMovement + CrouchMovement + 0 true - + - StandMovement - CrouchMovement - 0 - true + MovementBlend + Idle + 1 - + - MovementBlend - Idle - 1 + Walk + StrafeLRBlend + 0 - + - Walk - StrafeLRBlend - 0 + Left + Right + 0.033793529385008014 - - - - Left - Right - 0.033793529385008014 - - - - - - - - CrouchStrafeLeftF - - 1 - true - - - - - - - - - CrouchStrafeRightF - - 1 - true - - - - - - - - + - CrouchWalkF - + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + 1 true @@ -846,118 +834,11 @@ - + - CrouchF - - 1 - - - - - - - - - - - MovementBlend - Idle - 1 - - - - - - - - RunWalkBlend - StrafeLRBlend - 2.4565650245976452e-16 - - - - - - - - Walk - Run - 1.2938206818383024e-24 - - - - - - - - WalkF - - 1 - true - - - - - - - - - RunF - - 1 - true - - - - - - - - - - - Left - Right - 0.033793529385008014 - - - - - - - - StrafeRightF - - 1 - true - - - - - - - - - StrafeLeftF - - 1 - true - - - - - - - - - - - - - IdleF - + CrouchWalkF + 1 true @@ -967,70 +848,68 @@ - - - - - - Jump - DashBlend - 1 - true - - - - - + - JumpF - + CrouchF + 1 - false - + + + + + + MovementBlend + Idle + 1 + + + + + - DashFBBlend - DashLRBlend - 0.014621149736541383 + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 - + - DashForward - DashBackward - 0.014363533804961248 + Walk + Run + 1.2938206818383024e-24 - + - DashForwardF - + WalkF + 1 - false + true - + - DashBackwardF - + RunF + 1 - false + true @@ -1038,35 +917,35 @@ - + - DashLeft - DashRight - 4.3244885367500671e-16 + Left + Right + 0.033793529385008014 - + - DashLeftF - + StrafeLeftF + 1 - false + true - + - DashRightF - + StrafeRightF + 1 - false + true @@ -1076,71 +955,84 @@ + + + + IdleF + + 1 + true + + + + + - + - ReloadSwitch - WeaponActionBlend + Jump + DashBlend 1 true - + - ReloadSwitchU - + JumpF + 1 + false - + - IdleBlend - ShootBlend - 0 + DashFBBlend + DashLRBlend + 0.014621149736541383 - + - IdlePrimary - IdleSecondary - 0 + DashForward + DashBackward + 0.014363533804961248 - + - IdleAssaultRifleU - - 1 - true + DashForwardF + + 2 + false - + - IdleSecWepU - - 1 - true + DashBackwardF + + 2 + false @@ -1148,31 +1040,35 @@ - + - ShootPrimary - ShootSecondary - 0 + DashLeft + DashRight + 4.3244885367500671e-16 - + - ShootFastRifleU - - 1 + DashLeftF + + 2 + false - + - ShootSecWepFastU + DashRightF + + 2 + false @@ -1186,8 +1082,114 @@ + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/PlayerModel.xml b/resources/Schema/Entities/PlayerModel.xml new file mode 100644 index 00000000..a26fbc08 --- /dev/null +++ b/resources/Schema/Entities/PlayerModel.xml @@ -0,0 +1,542 @@ + + + + + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultBlue.mesh + + false + + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultBlueWorld.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + true + + + + + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + FinalMovementBlend + + + + + + + + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 + true + + + + + + + + StandMovement + CrouchMovement + 0 + true + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + Walk + StrafeLRBlend + 0 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + + + + + + CrouchWalkF + + 1 + true + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + Jump + DashBlend + 1 + true + + + + + + + + JumpF + + 1 + false + + + + + + + + + DashFBBlend + DashLRBlend + 0.014621149736541383 + + + + + + + + DashForward + DashBackward + 0.014363533804961248 + + + + + + + + DashForwardF + + 2 + false + + + + + + + + + DashBackwardF + + 2 + false + + + + + + + + + + + DashLeft + DashRight + 4.3244885367500671e-16 + + + + + + + + DashLeftF + + 2 + false + + + + + + + + + DashRightF + + 2 + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + + + + diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 3e97fe85..2e21bc18 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -127,6 +127,12 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) wi.FirstPersonEntity["Model"]["Visible"] = false; wi.ThirdPersonEntity["Model"]["Visible"] = false; } + + // Sound + Events::PlaySoundOnEntity e; + e.EmitterID = wi.Player.ID; + e.FilePath = "Audio/weapon/Assault/AssaultWeaponReload.wav"; + m_EventBroker->Publish(e); } void AssaultWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) @@ -208,6 +214,12 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi // Play animation playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Fire"); + + // Sound + Events::PlaySoundOnEntity e; + e.EmitterID = wi.Player.ID; + e.FilePath = "Audio/weapon/Assault/AssaultWeaponFire.wav"; + m_EventBroker->Publish(e); } bool AssaultWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi) From b7a7f7fd5e4279af002ecfa03cc44c4ee7a37ec4 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Fri, 4 Mar 2016 15:02:01 +0100 Subject: [PATCH 87/94] ???? --- include/Engine/Network/Client.h | 2 +- include/Engine/Network/Server.h | 2 +- .../Schema/Entities/PlayerAssaultBlue.xml | 771 ++++++++++-------- .../Schema/Entities/PlayerAssaultRed.xml | 771 ++++++++++-------- src/Engine/Network/Client.cpp | 28 +- src/Engine/Network/Server.cpp | 71 +- src/Engine/Network/UDPServer.cpp | 11 +- .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 16 +- 8 files changed, 951 insertions(+), 721 deletions(-) diff --git a/include/Engine/Network/Client.h b/include/Engine/Network/Client.h index 4ee071d2..2fa81549 100644 --- a/include/Engine/Network/Client.h +++ b/include/Engine/Network/Client.h @@ -52,7 +52,7 @@ public: void Connect(std::string address, int port); void Update() override; private: - UDPClient m_Unreliable; + //UDPClient m_Unreliable; TCPClient m_Reliable; std::vector m_PlayerSpawnEvents; void parseSpawnEvents(); diff --git a/include/Engine/Network/Server.h b/include/Engine/Network/Server.h index 395c80c7..48b7bcfa 100644 --- a/include/Engine/Network/Server.h +++ b/include/Engine/Network/Server.h @@ -36,7 +36,7 @@ public: private: // Network channels TCPServer m_Reliable; - UDPServer m_Unreliable; + //UDPServer m_Unreliable; UDPServer m_ServerlistRequest; // dont forget to set these in the childrens receive logic boost::asio::ip::address m_Address; diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index 057a0abb..7773235b 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -6,7 +6,9 @@ - + + 0.5 + @@ -519,7 +521,113 @@ - + + + + + Models/Weapons/Blue/AssaultWeaponBlue.mesh + + + + + + + + + + + + + + Schema/Entities/RayBlue.xml + + + + + + + + + + + + Schema/Entities/ReloadEffectView.xml + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + 32 + Fonts/DroidSans.ttf,64 + + + + PlayerAssault + AssaultWeapon + MagazineAmmo + + + + + + + + + + + 320 + Fonts/DroidSans.ttf,64 + + + + PlayerAssault + AssaultWeapon + Ammo + + + + + + + + + + + + + + + @@ -652,179 +760,192 @@ - - - BlendTreeAim - BlendTreeAssault - - - - - Models/Characters/Assault/AssaultBlue.mesh - - false - - - - - - - - R_Arm_Weapon_Joint - - - AssaultWeapon - - - - - - Schema/Entities/WeaponAssaultBlueWorld.xml - - - - - - - - - - - - R_Arm_Weapon_Joint - - - SidearmWeapon - - - - - - Schema/Entities/SidearmWeaponWorld.xml - - - - - - - - - - - - AimPrimary - AimSecondary - 0 - true - + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultBlue.mesh + + true + - + - - AimSecWepA - - false - true - - + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultBlueWorld.xml + + + + + - + - - AimRifleA - - false - true - - + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + - - - - - - ReloadSwitchBlend - FinalMovementBlend - - - - - + - StandCrouchBlend - JumpDashBlend - 2.5146881298480398e-63 + AimPrimary + AimSecondary + 0 true - + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + FinalMovementBlend + + + + + - StandMovement - CrouchMovement - 0 + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 true - + - MovementBlend - Idle - 1 + StandMovement + CrouchMovement + 0 + true - + - Walk - StrafeLRBlend - 0 + MovementBlend + Idle + 1 - + - Left - Right - 0.033793529385008014 + Walk + StrafeLRBlend + 0 - + - - CrouchStrafeLeftF - - 1 - true - + + Left + Right + 0.033793529385008014 + - + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + - + - CrouchStrafeRightF - + CrouchWalkF + 1 true @@ -834,11 +955,118 @@ - + - CrouchWalkF - + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + + + IdleF + 1 true @@ -848,68 +1076,70 @@ - + + + + + + Jump + DashBlend + 1 + true + + + + + - CrouchF - + JumpF + 1 + false - - - - - - MovementBlend - Idle - 1 - - - - - + - RunWalkBlend - StrafeLRBlend - 2.4565650245976452e-16 + DashFBBlend + DashLRBlend + 0.014621149736541383 - + - Walk - Run - 1.2938206818383024e-24 + DashForward + DashBackward + 0.014363533804961248 - + - WalkF - - 1 - true + DashForwardF + + 2 + false - + - RunF - - 1 - true + DashBackwardF + + 2 + false @@ -917,35 +1147,35 @@ - + - Left - Right - 0.033793529385008014 + DashLeft + DashRight + 4.3244885367500671e-16 - + - StrafeLeftF - - 1 - true + DashLeftF + + 2 + false - + - StrafeRightF - - 1 - true + DashRightF + + 2 + false @@ -955,84 +1185,71 @@ - - - - IdleF - - 1 - true - - - - - - + - Jump - DashBlend + ReloadSwitch + WeaponActionBlend 1 true - + - JumpF - + ReloadSwitchU + 1 - false - + - DashFBBlend - DashLRBlend - 0.014621149736541383 + IdleBlend + ShootBlend + 0 - + - DashForward - DashBackward - 0.014363533804961248 + IdlePrimary + IdleSecondary + 0 - + - DashForwardF - - 2 - false + IdleAssaultRifleU + + 1 + true - + - DashBackwardF - - 2 - false + IdleSecWepU + + 1 + true @@ -1040,35 +1257,31 @@ - + - DashLeft - DashRight - 4.3244885367500671e-16 + ShootPrimary + ShootSecondary + 0 - + - DashLeftF - - 2 - false + ShootFastRifleU + + 1 - + - DashRightF - - 2 - false + ShootSecWepFastU @@ -1082,114 +1295,8 @@ - - - - ReloadSwitch - WeaponActionBlend - 1 - true - - - - - - - - ReloadSwitchU - - 1 - - - - - - - - - IdleBlend - ShootBlend - 0 - - - - - - - - IdlePrimary - IdleSecondary - 0 - - - - - - - - IdleAssaultRifleU - - 1 - true - - - - - - - - - IdleSecWepU - - 1 - true - - - - - - - - - - - ShootPrimary - ShootSecondary - 0 - - - - - - - - ShootFastRifleU - - 1 - - - - - - - - - ShootSecWepFastU - - - - - - - - - - - - - diff --git a/resources/Schema/Entities/PlayerAssaultRed.xml b/resources/Schema/Entities/PlayerAssaultRed.xml index 5811cc74..a198196e 100644 --- a/resources/Schema/Entities/PlayerAssaultRed.xml +++ b/resources/Schema/Entities/PlayerAssaultRed.xml @@ -6,7 +6,9 @@ - + + 0.5 + @@ -519,7 +521,113 @@ - + + + + + Models/Weapons/Red/AssaultWeaponRed.mesh + + + + + + + + + + + + + + Schema/Entities/RayRed.xml + + + + + + + + + + + + Schema/Entities/ReloadEffectView.xml + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + 32 + Fonts/DroidSans.ttf,64 + + + + PlayerAssault + AssaultWeapon + MagazineAmmo + + + + + + + + + + + 320 + Fonts/DroidSans.ttf,64 + + + + PlayerAssault + AssaultWeapon + Ammo + + + + + + + + + + + + + + + @@ -652,179 +760,192 @@ - - - BlendTreeAim - BlendTreeAssault - - - - - Models/Characters/Assault/AssaultRed.mesh - - false - - - - - - - - R_Arm_Weapon_Joint - - - AssaultWeapon - - - - - - Schema/Entities/WeaponAssaultRedWorld.xml - - - - - - - - - - - - R_Arm_Weapon_Joint - - - SidearmWeapon - - - - - - Schema/Entities/SidearmWeaponWorld.xml - - - - - - - - - - - - AimPrimary - AimSecondary - 0 - true - + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultRed.mesh + + true + - + - - AimSecWepA - - false - true - - + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultRedWorld.xml + + + + + - + - - AimRifleA - - false - true - - + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + - - - - - - ReloadSwitchBlend - FinalMovementBlend - - - - - + - StandCrouchBlend - JumpDashBlend - 2.5146881298480398e-63 + AimPrimary + AimSecondary + 0 true - + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + FinalMovementBlend + + + + + - StandMovement - CrouchMovement - 0 + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 true - + - MovementBlend - Idle - 1 + StandMovement + CrouchMovement + 0 + true - + - Walk - StrafeLRBlend - 0 + MovementBlend + Idle + 1 - + - Left - Right - 0.033793529385008014 + Walk + StrafeLRBlend + 0 - + - - CrouchStrafeLeftF - - 1 - true - + + Left + Right + 0.033793529385008014 + - + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + - + - CrouchStrafeRightF - + CrouchWalkF + 1 true @@ -834,11 +955,118 @@ - + - CrouchWalkF - + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + + + IdleF + 1 true @@ -848,68 +1076,70 @@ - + + + + + + Jump + DashBlend + 1 + true + + + + + - CrouchF - + JumpF + 1 + false - - - - - - MovementBlend - Idle - 1 - - - - - + - RunWalkBlend - StrafeLRBlend - 2.4565650245976452e-16 + DashFBBlend + DashLRBlend + 0.014621149736541383 - + - Walk - Run - 1.2938206818383024e-24 + DashForward + DashBackward + 0.014363533804961248 - + - WalkF - - 1 - true + DashForwardF + + 2 + false - + - RunF - - 1 - true + DashBackwardF + + 2 + false @@ -917,35 +1147,35 @@ - + - Left - Right - 0.033793529385008014 + DashLeft + DashRight + 4.3244885367500671e-16 - + - StrafeLeftF - - 1 - true + DashLeftF + + 2 + false - + - StrafeRightF - - 1 - true + DashRightF + + 2 + false @@ -955,84 +1185,71 @@ - - - - IdleF - - 1 - true - - - - - - + - Jump - DashBlend + ReloadSwitch + WeaponActionBlend 1 true - + - JumpF - + ReloadSwitchU + 1 - false - + - DashFBBlend - DashLRBlend - 0.014621149736541383 + IdleBlend + ShootBlend + 0 - + - DashForward - DashBackward - 0.014363533804961248 + IdlePrimary + IdleSecondary + 0 - + - DashForwardF - - 2 - false + IdleAssaultRifleU + + 1 + true - + - DashBackwardF - - 2 - false + IdleSecWepU + + 1 + true @@ -1040,35 +1257,31 @@ - + - DashLeft - DashRight - 4.3244885367500671e-16 + ShootPrimary + ShootSecondary + 0 - + - DashLeftF - - 2 - false + ShootFastRifleU + + 1 - + - DashRightF - - 2 - false + ShootSecWepFastU @@ -1082,114 +1295,8 @@ - - - - ReloadSwitch - WeaponActionBlend - 1 - true - - - - - - - - ReloadSwitchU - - 1 - - - - - - - - - IdleBlend - ShootBlend - 0 - - - - - - - - IdlePrimary - IdleSecondary - 0 - - - - - - - - IdleAssaultRifleU - - 1 - true - - - - - - - - - IdleSecWepU - - 1 - true - - - - - - - - - - - ShootPrimary - ShootSecondary - 0 - - - - - - - - ShootFastRifleU - - 1 - - - - - - - - - ShootSecWepFastU - - - - - - - - - - - - - diff --git a/src/Engine/Network/Client.cpp b/src/Engine/Network/Client.cpp index d666e550..e29c4755 100644 --- a/src/Engine/Network/Client.cpp +++ b/src/Engine/Network/Client.cpp @@ -49,16 +49,16 @@ void Client::Connect(std::string address, int port) void Client::Update() { m_EventBroker->Process(); - while (m_Unreliable.IsSocketAvailable()) { - // Packet will get real data in receive - Packet packet(MessageType::Invalid); - m_Unreliable.Receive(packet); - if (packet.GetMessageType() == MessageType::Connect) { - parseUDPConnect(packet); - } else { - parseMessageType(packet); - } - } + //while (m_Unreliable.IsSocketAvailable()) { + // // Packet will get real data in receive + // Packet packet(MessageType::Invalid); + // m_Unreliable.Receive(packet); + // if (packet.GetMessageType() == MessageType::Connect) { + // parseUDPConnect(packet); + // } else { + // parseMessageType(packet); + // } + //} while (m_Reliable.IsSocketAvailable()) { // Packet will get real data in receive Packet packet(MessageType::Invalid); @@ -177,8 +177,8 @@ void Client::parseTCPConnect(Packet& packet) Packet UnreliablePacket(MessageType::Connect, m_SendPacketID); // Add player id and other stuff packet.WritePrimitive(m_PlayerID); - m_Unreliable.Send(packet); - LOG_INFO("Sent UDP Connect Server"); + // m_Unreliable.Send(packet); + // LOG_INFO("Sent UDP Connect Server"); } void Client::parsePlayerConnected(Packet & packet) @@ -476,7 +476,7 @@ bool Client::OnInputCommand(const Events::InputCommand & e) if (e.Command == "ConnectToServer") { // Connect for now if (e.Value > 0) { m_Reliable.Connect(m_PlayerName, m_Address, m_Port); - m_Unreliable.Connect(m_PlayerName, m_Address, m_Port); + // m_Unreliable.Connect(m_PlayerName, m_Address, m_Port); } //LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID); return true; @@ -613,7 +613,7 @@ void Client::sendLocalPlayerTransform() packet.WritePrimitive((int)cAssaultWeapon["Ammo"]); } - m_Unreliable.Send(packet); + m_Reliable.Send(packet); } void Client::identifyPacketLoss() diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index 0927a675..5bfb4000 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -47,19 +47,19 @@ void Server::Update() } } - PlayerDefinition pd; - while (m_Unreliable.IsSocketAvailable()) { - // Packet will get real data in receive - Packet packet(MessageType::Invalid); - m_Unreliable.Receive(packet, pd); - m_Address = pd.Endpoint.address(); - m_Port = pd.Endpoint.port(); - if (packet.GetMessageType() == MessageType::Connect) { - parseUDPConnect(packet); - } else { - parseMessageType(packet); - } - } + //PlayerDefinition pd; + //while (m_Unreliable.IsSocketAvailable()) { + // // Packet will get real data in receive + // Packet packet(MessageType::Invalid); + // m_Unreliable.Receive(packet, pd); + // m_Address = pd.Endpoint.address(); + // m_Port = pd.Endpoint.port(); + // if (packet.GetMessageType() == MessageType::Connect) { + // parseUDPConnect(packet); + // } else { + // parseMessageType(packet); + // } + //} while (m_ServerlistRequest.IsSocketAvailable()) { Packet packet(MessageType::Invalid); @@ -162,7 +162,7 @@ void Server::unreliableBroadcast(Packet& packet) { for (auto& kv : m_ConnectedPlayers) { packet.ChangePacketID(kv.second.PacketID); - m_Unreliable.Send(packet, kv.second); +// m_Unreliable.Send(packet, kv.second); } } @@ -172,7 +172,7 @@ void Server::sendSnapshot() Packet packet(MessageType::Snapshot); addInputCommandsToPacket(packet); addPlayersToPacket(packet, EntityID_Invalid); - unreliableBroadcast(packet); + reliableBroadcast(packet); } void Server::addInputCommandsToPacket(Packet& packet) @@ -320,25 +320,28 @@ void Server::checkForTimeOuts() } } -void Server::parseUDPConnect(Packet & packet) -{ - // Pop size of message int - packet.ReadPrimitive(); - int messageType = packet.ReadPrimitive(); - // Read packet ID - m_PreviousPacketID = m_PacketID; // Set previous packet id - m_PacketID = packet.ReadPrimitive(); //Read new packet id - // parse player id and other stuff - PlayerID playerID = packet.ReadPrimitive(); - // Do something here? - boost::asio::ip::udp::endpoint endpoint(m_Address, m_Port); - m_ConnectedPlayers.at(playerID).Endpoint = endpoint; - LOG_INFO("parseUDPConnect: Spectator \"%s\" connected on IP: %s", m_ConnectedPlayers.at(playerID).Name.c_str(), m_ConnectedPlayers.at(playerID).Endpoint.address().to_string().c_str()); - // Send a message to the player that connected - Packet connnectPacket(MessageType::Connect, m_ConnectedPlayers.at(playerID).PacketID); - m_Unreliable.Send(connnectPacket); - LOG_INFO("UDP Connect sent to client"); -} +//void Server::parseUDPConnect(Packet & packet) +//{ +// // Pop size of message int +// packet.ReadPrimitive(); +// int messageType = packet.ReadPrimitive(); +// // Read packet ID +// m_PreviousPacketID = m_PacketID; // Set previous packet id +// m_PacketID = packet.ReadPrimitive(); //Read new packet id +// // parse player id and other stuff +// PlayerID playerID = packet.ReadPrimitive(); +// if (!EntityWrapper(m_World, playerID).Valid()) { +// +// } +// // Do something here? +// boost::asio::ip::udp::endpoint endpoint(m_Address, m_Port); +// m_ConnectedPlayers.at(playerID).Endpoint = endpoint; +// LOG_INFO("parseUDPConnect: Spectator \"%s\" connected on IP: %s", m_ConnectedPlayers.at(playerID).Name.c_str(), m_ConnectedPlayers.at(playerID).Endpoint.address().to_string().c_str()); +// // Send a message to the player that connected +// Packet connnectPacket(MessageType::Connect, m_ConnectedPlayers.at(playerID).PacketID); +// m_Unreliable.Send(connnectPacket); +// LOG_INFO("UDP Connect sent to client"); +//} void Server::parseTCPConnect(Packet & packet) { diff --git a/src/Engine/Network/UDPServer.cpp b/src/Engine/Network/UDPServer.cpp index 8c9950dc..bfa27d69 100644 --- a/src/Engine/Network/UDPServer.cpp +++ b/src/Engine/Network/UDPServer.cpp @@ -21,33 +21,38 @@ void UDPServer::Send(Packet& packet, PlayerDefinition & playerDefinition) boost::asio::buffer(packet.Data(), packet.Size()), playerDefinition.Endpoint, 0); + LOG_INFO("Size of packet is %i", bytesSent); } catch (const boost::system::system_error& e) { + LOG_INFO(e.what()); // TODO: Clean up invalid endpoints out of m_ConnectedPlayers later playerDefinition.Endpoint = boost::asio::ip::udp::endpoint(); } + } // Send back to endpoint of received packet void UDPServer::Send(Packet & packet) { packet.UpdateSize(); - m_Socket->send_to( + size_t bytesSent = m_Socket->send_to( boost::asio::buffer( packet.Data(), packet.Size()), m_ReceiverEndpoint, 0); + LOG_INFO("Size of packet is %i", bytesSent); } // Broadcasting respond specific logic void UDPServer::Send(Packet & packet, boost::asio::ip::udp::endpoint endpoint) { packet.UpdateSize(); - m_Socket->send_to( + size_t bytesSent = m_Socket->send_to( boost::asio::buffer( packet.Data(), packet.Size()), endpoint, 0); + LOG_INFO("Size of packet is %i", bytesSent); } // Broadcasting @@ -55,7 +60,7 @@ void UDPServer::Broadcast(Packet & packet, int port) { packet.UpdateSize(); m_Socket->set_option(boost::asio::socket_base::broadcast(true)); - m_Socket->send_to( + size_t bytesSent = m_Socket->send_to( boost::asio::buffer( packet.Data(), packet.Size()), diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 2e21bc18..fc5334c9 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -39,8 +39,12 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& ammo = glm::max(0, ammo - (magSize - magAmmo)); magAmmo = glm::min(magSize, ammo); isReloading = false; - wi.FirstPersonEntity["Model"]["Visible"] = true; - wi.ThirdPersonEntity["Model"]["Visible"] = true; + if (wi.FirstPersonEntity.Valid()) { + wi.FirstPersonEntity["Model"]["Visible"] = true; + } + if (wi.ThirdPersonEntity.Valid()) { + wi.ThirdPersonEntity["Model"]["Visible"] = true; + } } // Restore view angle @@ -124,8 +128,12 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) if (reloadEffectSpawner.Valid()) { SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); } - wi.FirstPersonEntity["Model"]["Visible"] = false; - wi.ThirdPersonEntity["Model"]["Visible"] = false; + if (wi.FirstPersonEntity.Valid()) { + wi.FirstPersonEntity["Model"]["Visible"] = false; + } + if (wi.ThirdPersonEntity.Valid()) { + wi.ThirdPersonEntity["Model"]["Visible"] = false; + } } // Sound From a8f2d0a8e6edddca2ece78fc2538aea5001fb836 Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 7 Mar 2016 10:48:46 +0100 Subject: [PATCH 88/94] Some assets, some fixes to the scoreboard --- assets | 2 +- resources/Schema/Entities/CP_Rocky.xml | 2288 ++++++++--------- resources/Schema/Entities/ScoreBoard_Main.xml | 4 +- src/Game/Systems/ScoreScreenSystem.cpp | 2 +- 4 files changed, 1148 insertions(+), 1148 deletions(-) diff --git a/assets b/assets index 7a6d7078..0ae73657 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 7a6d70787b036d8ae8763b69ae6ad098bf221c22 +Subproject commit 0ae736570b5600c2ad05f556ccaec4f5341c2b06 diff --git a/resources/Schema/Entities/CP_Rocky.xml b/resources/Schema/Entities/CP_Rocky.xml index a9c4aaac..d034be78 100644 --- a/resources/Schema/Entities/CP_Rocky.xml +++ b/resources/Schema/Entities/CP_Rocky.xml @@ -21,6 +21,27 @@ + + + + + Models/Props/Highground5.mesh + + + + + + + + + + Models/Props/Highground6.mesh + + + + + + @@ -46,11 +67,9 @@ - Models/Props/Walls/SciFiWallBig.mesh + Models/Props/Walls/SciFiWallSmall1.mesh - - - + @@ -69,9 +88,11 @@ - Models/Props/Walls/SciFiWallMedium.mesh + Models/Props/Walls/SciFiWallBig.mesh - + + + @@ -79,7 +100,7 @@ - Models/Props/Walls/SciFiWallSmall1.mesh + Models/Props/Walls/SciFiWallMedium.mesh @@ -149,8 +170,8 @@ Models/Core/UnitCube.mesh - - + + @@ -462,8 +483,8 @@ Models/Core/UnitCube.mesh - - + + @@ -494,23 +515,23 @@ - Schema/Entities/ScoreBoard_Blue.xml + Schema/Entities/ScoreBoard_Red.xml - + - + - + Models/Core/UnitCube.mesh - + @@ -519,14 +540,14 @@ - + - + @@ -623,23 +644,23 @@ - Schema/Entities/ScoreBoard_Red.xml + Schema/Entities/ScoreBoard_Blue.xml - + - + - + Models/Core/UnitCube.mesh - + @@ -648,14 +669,14 @@ - + - + @@ -798,27 +819,6 @@ - - - - - Models/Props/Highground5.mesh - - - - - - - - - - Models/Props/Highground6.mesh - - - - - - @@ -944,6 +944,20 @@ + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + @@ -1103,20 +1117,6 @@ - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - @@ -1430,11 +1430,11 @@ 2 - + - + @@ -1451,7 +1451,7 @@ - + @@ -1477,11 +1477,11 @@ 2 - + - + @@ -1498,7 +1498,7 @@ - + @@ -1524,11 +1524,11 @@ 2 - + - + @@ -1545,7 +1545,7 @@ - + @@ -1571,11 +1571,11 @@ 2 - + - + @@ -1592,7 +1592,7 @@ - + @@ -1618,11 +1618,11 @@ 2 - + - + @@ -1639,7 +1639,7 @@ - + @@ -1665,11 +1665,11 @@ 2 - + - + @@ -1686,7 +1686,7 @@ - + @@ -1712,11 +1712,11 @@ 2 - + - + @@ -1733,7 +1733,7 @@ - + @@ -2981,11 +2981,11 @@ 2 - + - + @@ -3002,7 +3002,7 @@ - + @@ -3028,11 +3028,11 @@ 2 - + - + @@ -3049,7 +3049,7 @@ - + @@ -3301,19 +3301,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - @@ -3382,237 +3369,21 @@ - - - - - - - - Models/Props/Walls/SmallWall3.mesh + Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall1.mesh - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall1.mesh - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall2.mesh - - - - + + - - - - Models/Core/UnitPlane.mesh - - true - - - - - - - - - @@ -3630,58 +3401,6 @@ - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - @@ -3734,6 +3453,58 @@ + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + @@ -3826,6 +3597,235 @@ + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall1.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall2.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + @@ -3855,37 +3855,11 @@ - Models/Props/Stones/BigStone.mesh + Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - + + @@ -3917,6 +3891,164 @@ + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone1.mesh + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + @@ -3948,11 +4080,103 @@ - Models/Props/Stones/SmallStone1.mesh + Models/Props/Stones/BigStone.mesh - - + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + @@ -3970,6 +4194,19 @@ + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + @@ -4038,98 +4275,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -4144,151 +4289,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -4304,9 +4304,59 @@ Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + @@ -4347,47 +4397,27 @@ Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - + + + - - - - - - - - - - - - - - - - - 2 - - - - - - - - - - - - - - - - - - - + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + @@ -4403,21 +4433,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -4433,6 +4448,18 @@ + + + + + 3 + + + + + + + @@ -4458,18 +4485,6 @@ - - - - - 3 - - - - - - - @@ -4487,21 +4502,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -4509,6 +4509,53 @@ + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + @@ -4525,11 +4572,11 @@ 2 - + - + @@ -4546,54 +4593,7 @@ - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - + @@ -4619,11 +4619,11 @@ 2 - + - + @@ -4640,148 +4640,7 @@ - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - + @@ -4807,11 +4666,11 @@ 2 - + - + @@ -4828,7 +4687,148 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + @@ -4845,21 +4845,6 @@ - - - - - 6 - Models/Props/Pillars/SciFiPillar1Blue.mesh - - - - - - - - - @@ -4888,6 +4873,21 @@ + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + @@ -4906,84 +4906,70 @@ - + - + + + Schema/Entities/Player.xml + + + + + + + + + - + - - 10 - + + + Models/Characters/Assault/AssaultTPose.mesh + false + - + - + - - 1 - - - - - - - - - - 10 - + + + Models/Characters/Assault/AssaultTPose.mesh + false + - + - + - - - 10 - + + + Models/Characters/Assault/AssaultTPose.mesh + false + - + - + - - 10 - + + + Models/Characters/Assault/AssaultTPose.mesh + false + - - - - - - - - - 10 - - - - - - - - - - - 0.40000000596046448 - - - + @@ -5006,19 +4992,6 @@ - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - @@ -5032,19 +5005,6 @@ - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - @@ -5058,6 +5018,116 @@ + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + Models/Characters/Assault/AssaultTPose.mesh + false + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + 0.40000000596046448 + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + + 10 + + + + + + + + + + + 1 + + + + + + + + + 10 + + + + + + + @@ -5065,6 +5135,38 @@ + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 1 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + @@ -5105,38 +5207,6 @@ - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 3 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - @@ -5169,38 +5239,6 @@ - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 1 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - @@ -5240,75 +5278,37 @@ - - - - - - - Schema/Entities/Player.xml - - - - - - - - - - - - + - + - Models/Characters/Assault/AssaultTPose.mesh - false + Models/Props/CapturePoint/CapturePointNeutral.mesh - + - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - - - - - - - Models/Characters/Assault/AssaultTPose.mesh - false - - - - - - + + + + + 3 + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + diff --git a/resources/Schema/Entities/ScoreBoard_Main.xml b/resources/Schema/Entities/ScoreBoard_Main.xml index 565fb57b..ccc1df68 100644 --- a/resources/Schema/Entities/ScoreBoard_Main.xml +++ b/resources/Schema/Entities/ScoreBoard_Main.xml @@ -21,11 +21,11 @@ - + - + diff --git a/src/Game/Systems/ScoreScreenSystem.cpp b/src/Game/Systems/ScoreScreenSystem.cpp index 6166e892..94674432 100644 --- a/src/Game/Systems/ScoreScreenSystem.cpp +++ b/src/Game/Systems/ScoreScreenSystem.cpp @@ -78,7 +78,7 @@ void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& if (it == m_PlayerIdentities.end()) { break; - } + } if(found == false) { if(it->second.Team != currentTeam) { From 388fe7c259fd71418fbe67c101a14d0b45f44eeb Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 7 Mar 2016 11:28:10 +0100 Subject: [PATCH 89/94] 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 90/94] 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 64df3fd7ad4e78d66634a9c703eec9fef49256a2 Mon Sep 17 00:00:00 2001 From: verysecrethero Date: Mon, 7 Mar 2016 14:27:12 +0100 Subject: [PATCH 91/94] CapturePoints now have red/blue/spectator model-children --- resources/Schema/Entities/CP_RockHard.xml | 7936 ++++++++--------- resources/Schema/Entities/CapturePoint.xml | 35 +- resources/Schema/Entities/aim_rays.xml | 40 +- .../Entities/aim_rays_with_capturep.xml | 336 + src/Game/Systems/CapturePointSystem.cpp | 12 + 5 files changed, 4362 insertions(+), 3997 deletions(-) create mode 100644 resources/Schema/Entities/aim_rays_with_capturep.xml diff --git a/resources/Schema/Entities/CP_RockHard.xml b/resources/Schema/Entities/CP_RockHard.xml index 2231df59..9f11d052 100644 --- a/resources/Schema/Entities/CP_RockHard.xml +++ b/resources/Schema/Entities/CP_RockHard.xml @@ -3,8 +3,8 @@ - 1.2059834585982117 - 4 + 0.58443805362486501 + 3 @@ -34,27 +34,6 @@ - - - - - Models/Props/Walls/SciFiWallBig.mesh - true - - - - - - - - - - Models/Props/Walls/SciFiWallMedium.mesh - - - - - @@ -87,6 +66,27 @@ + + + + + Models/Props/Walls/SciFiWallBig.mesh + true + + + + + + + + + + Models/Props/Walls/SciFiWallMedium.mesh + + + + + @@ -708,6 +708,43 @@ + + + + + Models/Highgrounds/Hg7.mesh + + + + + + + + + + + + Models/Highgrounds/Hg17.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg19.mesh + + + + + + + @@ -758,43 +795,6 @@ - - - - - Models/Highgrounds/Hg7.mesh - - - - - - - - - - - - Models/Highgrounds/Hg17.mesh - - - - - - - - - - - - - Models/Highgrounds/Hg19.mesh - - - - - - - @@ -1930,6 +1930,78 @@ + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + + + + + + + @@ -2309,7 +2381,7 @@ - + @@ -2318,11 +2390,38 @@ - Models/Props/Bridges/SciFiBridge1Red.mesh + Models/Props/Stones/SmallStone2.mesh - - + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + @@ -2330,116 +2429,12 @@ - Models/Props/Bridges/SciFiBridge1Red.mesh + Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Pillars/SciFiBridgePillar1.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - + + + @@ -2450,16 +2445,1521 @@ - Models/Props/Pillars/SciFiBridgePillar1.mesh + Models/Props/Stones/SmallStone1.mesh - - - + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Red.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + Models/Props/Walls/SpecialWall1.mesh + + + + + + + + + + + + + + + + @@ -2578,6 +4078,152 @@ + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridge1Red.mesh + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + Models/Props/Pillars/SciFiBridgePillar1.mesh + + + + + + + + + @@ -2594,95 +4240,6 @@ - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar1Red.mesh - - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - @@ -2701,6 +4258,20 @@ + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + @@ -2741,1575 +4312,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Core/UnitPlane.mesh - - true - - - - - - - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - - - - - @@ -4324,78 +4326,13 @@ Models/Props/Walls/SmallWall3.mesh - + + - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - @@ -4403,53 +4340,13 @@ Models/Props/Walls/SmallWall3.mesh - + - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -4467,12 +4364,11 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Walls/MediumWall3.mesh - - - + + @@ -4484,7 +4380,21 @@ Models/Props/Walls/BigWallRed.mesh - + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + @@ -4494,12 +4404,24 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Walls/MediumWall3.mesh - - - + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + @@ -4511,8 +4433,8 @@ Models/Props/Walls/SmallWall3.mesh - - + + @@ -4538,26 +4460,13 @@ Models/Props/Walls/SmallWall3.mesh - + - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - @@ -4565,54 +4474,13 @@ Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - + + - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -4620,22 +4488,8 @@ Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - + + @@ -4670,11 +4524,11 @@ - Models/Props/Walls/MediumWall3.mesh + Models/Props/Walls/BigWallRed.mesh - - + + @@ -4686,13 +4540,188 @@ Models/Props/Walls/SmallWall3.mesh - - + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -4706,36 +4735,9 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - - + @@ -4744,12 +4746,11 @@ - Models/Props/Walls/SpecialWall1.mesh + Models/Props/Stones/AssaultHolder.mesh - - - + + @@ -4758,12 +4759,11 @@ - Models/Props/Walls/SpecialWall1.mesh + Models/Props/Stones/AssaultHolder.mesh - - - + + @@ -4772,32 +4772,32 @@ - Models/Props/Walls/SpecialWall1.mesh + Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Walls/SpecialWall1.mesh - - - - - + + + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + @@ -4805,6 +4805,43 @@ + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + @@ -4817,8 +4854,8 @@ Models/Props/Stones/AssaultHolder.mesh - - + + @@ -4844,21 +4881,8 @@ Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - + + @@ -4884,8 +4908,8 @@ Models/Props/Stones/AssaultHolder.mesh - - + + @@ -4897,89 +4921,8 @@ Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - + + @@ -4997,33 +4940,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - @@ -5045,8 +4961,129 @@ Models/Props/Stones/AssaultHolder.mesh - - + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + @@ -5058,6 +5095,60 @@ + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallRed.mesh + + + + + + + + @@ -5075,11 +5166,12 @@ - Models/Props/Walls/MediumWall3.mesh + Models/Props/Walls/SmallWall3.mesh - - + + + @@ -5098,6 +5190,19 @@ + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -5132,22 +5237,29 @@ Models/Props/Walls/SmallWall3.mesh - - + + + + + + + + + - Models/Props/Walls/BigWallRed.mesh + Models/Props/Stones/BigStone.mesh - - + + @@ -5156,11 +5268,11 @@ - Models/Props/Walls/BigWallBlue.mesh + Models/Props/Stones/MediumStone2.mesh - - + + @@ -5169,12 +5281,11 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Pillars/StonePillar.mesh - - - + + @@ -5183,11 +5294,52 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + @@ -5197,12 +5349,226 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Stones/MediumStone2.mesh - - - + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + @@ -5246,7 +5612,7 @@ - + @@ -5288,7 +5654,7 @@ - + @@ -5300,372 +5666,6 @@ - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - @@ -5688,24 +5688,9 @@ Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - + + + @@ -5739,9 +5724,10 @@ + 2 - + @@ -5750,10 +5736,9 @@ - 2 - + @@ -5764,27 +5749,13 @@ - 5 + 4 Models/Props/Stones/ShinyStoneCrystalBlue.mesh + - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - + + @@ -5818,6 +5789,21 @@ + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + @@ -5833,36 +5819,6 @@ - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -5878,6 +5834,19 @@ + + + + + 2 + 1 + + + + + + + @@ -5902,32 +5871,63 @@ - - - - - 2 - 1 - - - - - - - - 4 + 6 Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - + + + + + + + + + + + + 5 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + @@ -5959,37 +5959,11 @@ - Models/Props/Stones/SmallStone1.mesh + Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - + + @@ -5999,11 +5973,25 @@ - Models/Props/Stones/MediumStone2.mesh + Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + @@ -6035,193 +6023,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -6249,6 +6050,32 @@ + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + @@ -6256,9 +6083,8 @@ Models/Props/Stones/SmallStone2.mesh - - - + + @@ -6267,51 +6093,11 @@ - Models/Props/Stones/SmallStone1.mesh + Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - + + @@ -6336,106 +6122,13 @@ Models/Props/Stones/SmallStone1.mesh - - + + - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6450,20 +6143,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - @@ -6471,54 +6150,13 @@ Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - + + - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6526,22 +6164,8 @@ Models/Props/Stones/BigStone.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - + + @@ -6567,8 +6191,128 @@ Models/Props/Stones/SmallStone2.mesh - - + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + @@ -6586,6 +6330,112 @@ + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + @@ -6607,9 +6457,9 @@ Models/Props/Stones/SmallStone1.mesh - - - + + + @@ -6618,10 +6468,11 @@ - Models/Props/Stones/SmallStone2.mesh + Models/Props/Stones/BigStone.mesh - + + @@ -6633,26 +6484,26 @@ Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - @@ -6660,8 +6511,9 @@ Models/Props/Stones/SmallStone2.mesh - - + + + @@ -6670,37 +6522,12 @@ - Models/Props/Stones/SmallStone2.mesh + Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - + + + @@ -6732,33 +6559,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6780,13 +6580,213 @@ Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + @@ -6822,90 +6822,6 @@ - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - @@ -6938,7 +6854,7 @@ - + @@ -6980,7 +6896,7 @@ - + @@ -7022,7 +6938,91 @@ - + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/HealthPickUp.mesh + + + + @@ -7064,7 +7064,7 @@ - + @@ -7106,7 +7106,7 @@ - + @@ -7193,7 +7193,37 @@ Models/Props/Pillars/StonePillar.mesh - + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + @@ -7212,6 +7242,18 @@ + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + @@ -7226,48 +7268,6 @@ - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar1Blue.mesh - - - - - - - - - @@ -7548,9 +7548,8 @@ Models/Props/Flora/SpecialRoot.mesh - - - + + @@ -7562,8 +7561,9 @@ Models/Props/Flora/SpecialRoot.mesh - - + + + @@ -7610,7 +7610,7 @@ Models/Props/Walls/SmallWall3.mesh - + @@ -7624,7 +7624,8 @@ Models/Props/Walls/SmallWall3.mesh - + + @@ -7637,61 +7638,9 @@ Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - + + + @@ -7717,88 +7666,7 @@ Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - + @@ -7851,13 +7719,38 @@ Models/Props/Walls/SmallWall3.mesh - - + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -7865,27 +7758,13 @@ Models/Props/Walls/SmallWall3.mesh - - + + - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -7899,6 +7778,32 @@ + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -7906,7 +7811,89 @@ Models/Props/Walls/SmallWall3.mesh - + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/BigWallBlue.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + @@ -7939,6 +7926,59 @@ + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + @@ -7952,46 +7992,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - @@ -8151,12 +8151,11 @@ 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh + Models/Props/Pillars/SciFiPillar1Blue.mesh - - - + + @@ -8180,12 +8179,12 @@ 4 - Models/Props/Pillars/SciFiPillar2Red.mesh + Models/Props/Pillars/SciFiPillar3Blue.mesh - - - + + + @@ -8198,8 +8197,8 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - + + @@ -8222,12 +8221,13 @@ - Models/Props/Pillars/SciFiPillar2Blue.mesh + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh - - - + + + @@ -8255,37 +8255,9 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - 4 - Models/Props/Pillars/SciFiPillar3Blue.mesh - - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar1Blue.mesh - - - - + + + @@ -8298,8 +8270,36 @@ Models/Props/Pillars/SciFiPillar2Blue.mesh - - + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + @@ -8353,283 +8353,6 @@ - - - - - - - - - 10 - - - - - - - - - - - - 10 - - - - - - - - - - - 0.40000000596046448 - - - - - - - - - - - 0.69999998807907104 - 1.6000000238418579 - - - - - - - - - 10 - - - - - - - - - - - 10 - - - - - - - - - - - - 10 - - - - - - - - - - - - - - - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 15 - 2 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - - - - - - Models/Props/CapturePoint/CapturePointBlue.mesh - - - - - - - - - - -15 - - - - 4 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 15 - 1 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 3 - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - - Models/Props/CapturePoint/CapturePointRed.mesh - - - - - - - - - - 15 - - - - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - - - @@ -8637,15 +8360,15 @@ - - - Schema/Entities/PlayerAssaultFallbackBlue.xml - + + + Schema/Entities/PlayerAssaultFallbackBlue.xml + @@ -8657,9 +8380,7 @@ Models/Characters/Assault/Test/AssaultTPose.mesh - - - + @@ -8693,7 +8414,9 @@ Models/Characters/Assault/Test/AssaultTPose.mesh - + + + @@ -8725,20 +8448,32 @@ - - - Schema/Entities/PlayerAssaultFallbackRed.xml - + + + Schema/Entities/PlayerAssaultFallbackRed.xml + + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + @@ -8751,6 +8486,18 @@ + + + + + Models/Characters/Assault/Test/AssaultTPose.mesh + + + + + + + @@ -8775,18 +8522,6 @@ - - - - - Models/Characters/Assault/Test/AssaultTPose.mesh - - - - - - - @@ -8797,14 +8532,269 @@ + + + + + + + + + + + + + + 10 + + + + + + + + + + + 10 + + + + + + + + + + + + 10 + + + + + + + + + + + 0.40000000596046448 + + + + + + + + + + + 10 + + + + + + + + + + + 0.69999998807907104 + 1.6000000238418579 + + + + + + + + + 10 + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + - + + 3 + + + - Models/Characters/Assault/Test/AssaultTPose.mesh + Models/Core/UnitCylinder.mesh + + true - + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 1 + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointBlue.mesh + + + + + + + + + + -15 + + + + 4 + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 2 + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointRed.mesh + + + + + + + + + + 15 + + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + @@ -8821,7 +8811,7 @@ - + @@ -8859,7 +8849,7 @@ Textures/Core/UnitHexagon.png - + @@ -8868,20 +8858,53 @@ + + + 2 - - 1 - - Textures/Core/UnitHexagon_Rotated.png - + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 1 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + @@ -8903,12 +8926,12 @@ + + + 3 - - - Textures/Core/UnitHexagon_Rotated.png @@ -8923,76 +8946,6 @@ - - - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - 4 - - - 1 - - - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - 1 - - - 1 - - - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - @@ -9007,11 +8960,11 @@ - 1 + Textures/Core/UnitHexagon_Rotated.png @@ -9026,6 +8979,41 @@ + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + 4 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + diff --git a/resources/Schema/Entities/CapturePoint.xml b/resources/Schema/Entities/CapturePoint.xml index 9f33c4de..35c89e3e 100644 --- a/resources/Schema/Entities/CapturePoint.xml +++ b/resources/Schema/Entities/CapturePoint.xml @@ -4,14 +4,39 @@ - - Models/Core/UnitSphere.mesh - - + - + + + + + models/core/unitcube.mesh + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + models/core/unitcube.mesh + + + + + + diff --git a/resources/Schema/Entities/aim_rays.xml b/resources/Schema/Entities/aim_rays.xml index c8dac9a3..1d953bf1 100644 --- a/resources/Schema/Entities/aim_rays.xml +++ b/resources/Schema/Entities/aim_rays.xml @@ -92,15 +92,15 @@ - - - Schema/Entities/Player.xml - + + + Schema/Entities/Player.xml + @@ -143,15 +143,15 @@ - - - Schema/Entities/Player.xml - + + + Schema/Entities/Player.xml + @@ -209,24 +209,26 @@ + -15 - - Models\Core\UnitCube.mesh - - + + + Models\Core\UnitCube.mesh + + true + - @@ -234,25 +236,27 @@ + 15 1 - - Models\Core\UnitCube.mesh - - + + + Models\Core\UnitCube.mesh + + true + - diff --git a/resources/Schema/Entities/aim_rays_with_capturep.xml b/resources/Schema/Entities/aim_rays_with_capturep.xml new file mode 100644 index 00000000..6aa3246a --- /dev/null +++ b/resources/Schema/Entities/aim_rays_with_capturep.xml @@ -0,0 +1,336 @@ + + + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + + + + + + + + Schema/Entities/Player.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/Player.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + + + + + + + 15 + + + + + + + + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + + + + + + + + + + -15 + + + + 1 + + + + + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + models/core/unitcube.mesh + + + + + + + + + + + + + + diff --git a/src/Game/Systems/CapturePointSystem.cpp b/src/Game/Systems/CapturePointSystem.cpp index 0d6089c5..4647d1b7 100644 --- a/src/Game/Systems/CapturePointSystem.cpp +++ b/src/Game/Systems/CapturePointSystem.cpp @@ -69,6 +69,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp int ownedBy = teamComponent["Team"]; int redTeamPlayersStandingInside = 0; int blueTeamPlayersStandingInside = 0; + //note: old color system if (capturePointEntity.HasComponent("Model")) { //Now sets team color to the capturepoint, or white if it is uncaptured. capturePointEntity["Model"]["Color"] = ownedBy == blueTeam ? glm::vec4(0, 0.0f, 1, 0.3) : ownedBy == redTeam ? glm::vec4(1, 0.0f, 0, 0.3) : glm::vec4(1, 1, 1, 0.3); @@ -102,7 +103,18 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp nextPossibleCapturePoint["Blue"] = i - 1; } } + if (m_RecentlyCapturedNeedNextCapturePointNow) { + //change what model is displaying (change all in case 2 capturepoints has been captured on the same frame) + for (int i = 0; i < m_NumberOfCapturePoints; i++) { + auto owner = (int)m_CapturePointNumberToEntityMap[i]["Team"]["Team"]; + if (m_CapturePointNumberToEntityMap[i].FirstChildByName("Red").ID != EntityID_Invalid) { + (bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Red")["Model"]["Visible"] = owner == redTeam ? true : false; + (bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Blue")["Model"]["Visible"] = owner == blueTeam ? true : false; + (bool&)m_CapturePointNumberToEntityMap[i].FirstChildByName("Spectator")["Model"]["Visible"] = owner == spectatorTeam ? true : false; + } + } + //save the next cap points and publish the captured event m_CapturedEvent.BlueTeamNextCapturePoint = m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Blue"]]; m_CapturedEvent.RedTeamNextCapturePoint = m_CapturePointNumberToEntityMap[nextPossibleCapturePoint["Red"]]; m_EventBroker->Publish(m_CapturedEvent); From 47ece6a5bf7ac1b5f7feb2d15a26e7a97ff38401 Mon Sep 17 00:00:00 2001 From: Tleety Date: Mon, 7 Mar 2016 14:42:50 +0100 Subject: [PATCH 92/94] 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; } + + + } } From 3eaad275ba6a84d1d8282d313aec81bc4692fe7e Mon Sep 17 00:00:00 2001 From: verysecrethero Date: Mon, 7 Mar 2016 14:50:31 +0100 Subject: [PATCH 93/94] New CapturePointAddition fixed to work on Network by Joachim --- src/Engine/Network/Server.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index 5bfb4000..9de3e419 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -162,7 +162,7 @@ void Server::unreliableBroadcast(Packet& packet) { for (auto& kv : m_ConnectedPlayers) { packet.ChangePacketID(kv.second.PacketID); -// m_Unreliable.Send(packet, kv.second); + // m_Unreliable.Send(packet, kv.second); } } @@ -649,13 +649,14 @@ bool Server::shouldSendToClient(EntityWrapper childEntity) return true; } } - return childEntity.HasComponent("Player") + return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid() - || childEntity.HasComponent("CapturePoint") + || childEntity.HasComponent("CapturePoint") || childEntity.HasComponent("HealthPickup") || childEntity.HasComponent("AmmoPickup") || childEntity.HasComponent("ScoreScreen") - || childEntity.FirstParentWithComponent("ScoreScreen").Valid(); + || childEntity.FirstParentWithComponent("ScoreScreen").Valid() + || childEntity.FirstParentWithComponent("CapturePoint").Valid(); } PlayerID Server::getPlayerIDFromEndpoint() @@ -674,7 +675,7 @@ PlayerID Server::getPlayerIDFromEndpoint() PlayerID Server::getPlayerIDFromEntityID(EntityID entityID) { - for(auto& kv : m_ConnectedPlayers) { + for (auto& kv : m_ConnectedPlayers) { if (entityID == kv.second.EntityID) { return kv.first; } From fc3a3a8f2e53e17511d3273997795339fa77348d Mon Sep 17 00:00:00 2001 From: verysecrethero Date: Mon, 7 Mar 2016 17:16:18 +0100 Subject: [PATCH 94/94] Fixed a crashbug in Ammo/HealthPickup which was actually caused by systems being added twice in Game.cpp. This is also a possible fix for DamageIndicator,Capturepoint,TextField,KillFeed --- src/Game/Game.cpp | 7 ------- src/Game/Systems/AmmoPickupSystem.cpp | 9 +++++---- src/Game/Systems/PickupSpawnSystem.cpp | 4 ++++ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 8f589e34..69a9ad57 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -137,20 +137,13 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); - m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); diff --git a/src/Game/Systems/AmmoPickupSystem.cpp b/src/Game/Systems/AmmoPickupSystem.cpp index 062efe94..e28c38ff 100644 --- a/src/Game/Systems/AmmoPickupSystem.cpp +++ b/src/Game/Systems/AmmoPickupSystem.cpp @@ -96,6 +96,7 @@ bool AmmoPickupSystem::OnAmmoPickup(Events::AmmoPickup & e) } currentAmmo = std::min(currentAmmo + e.AmmoGain, maxWeaponAmmo); + return false; } @@ -114,8 +115,11 @@ bool AmmoPickupSystem::OnTriggerLeave(Events::TriggerLeave& e) { } void AmmoPickupSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) { + //trigger should be valid but if it isnt we just return (to avoid crash) + if (!trigger.Valid()) { + return; + } int maxWeaponAmmo = (int)player["AssaultWeapon"]["MaxAmmo"]; - int& currentAmmo = (int)player["AssaultWeapon"]["Ammo"]; int ammoGiven = 0.01*(double)trigger["AmmoPickup"]["AmmoGain"] * maxWeaponAmmo; Events::AmmoPickup ePlayerAmmoPickup; @@ -123,9 +127,6 @@ void AmmoPickupSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) { ePlayerAmmoPickup.Player = player; m_EventBroker->Publish(ePlayerAmmoPickup); - //immediately give the player the ammo (on server) - currentAmmo = std::min(currentAmmo + ammoGiven, maxWeaponAmmo); - //copy position, ammogain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object) //we need to copy all values since each value can be different for each ammoPickup m_ETriggerTouchVector.push_back({ (glm::vec3)trigger["Transform"]["Position"], trigger["AmmoPickup"]["AmmoGain"], diff --git a/src/Game/Systems/PickupSpawnSystem.cpp b/src/Game/Systems/PickupSpawnSystem.cpp index 99da931f..b0efd696 100644 --- a/src/Game/Systems/PickupSpawnSystem.cpp +++ b/src/Game/Systems/PickupSpawnSystem.cpp @@ -83,6 +83,10 @@ bool PickupSpawnSystem::OnTriggerLeave(Events::TriggerLeave& e) } void PickupSpawnSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) { + //trigger should be valid but if it isnt we just return (to avoid crash) + if (!trigger.Valid()) { + return; + } double healthGiven = 0.01*(double)trigger["HealthPickup"]["HealthGain"] * (double)player["Health"]["MaxHealth"]; //only the server will increase the players hp and set it in the next delta