From 59e487f9bb5a21f278a0b820a203e4fcb4b074e3 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 10 Mar 2016 16:05:46 +0100 Subject: [PATCH 01/44] PlayerDefenderBlue Updated blendtree --- .../Schema/Entities/PlayerDefenderBlue.xml | 1134 ++++++----------- 1 file changed, 415 insertions(+), 719 deletions(-) diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index 24bfee2b..d7c47f7e 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -2,7 +2,6 @@ - @@ -22,6 +21,7 @@ 150 150 + @@ -38,6 +38,26 @@ + + + + Textures/Icons/Arrow.png + + false + + + + + 50 + true + + + + + + + + @@ -183,10 +203,11 @@ + inf - Textures/Core/White.png + Textures\Icons\Abilities\SheildDots-01.png false @@ -493,195 +514,35 @@ - + - - MovementBlend - FinalBlend - - - Models/Characters/Defender/FirstPersonDefenderBlue.mesh - - - R_Arm_Weapon_Joint - - - DefenderWeapon - Schema/Entities/WeaponDefenderBlueView.xml - - - - + + + DefenderWeapon + - - R_Arm_Weapon_Joint - - - SidearmWeapon - - Schema/Entities/SidearmWeaponView.xml + Schema/Entities/WeaponDefenderBlueView.xml - - - - + + + DefenderWeapon + - - - - BlendTreeDefenderWeapon - BlendTreeSecondaryWeapon - 0 - true - - - - - - - - ActionBlend - Shield - 0 - true - - - - - - - - ActivateDeactiveShieldF - - 1 - false - - - - - - - - - Idle - ActionBlend2 - 0 - true - - - - - - - - IdleF - - - - - - - - - Fire - Reload - 0 - - - - - - - - ShootShotgunF - - 1 - false - - - - - - - - - ShotgunReloadTwoF - - 1 - false - - - - - - - - - - - - - - - - - - - - - - - Idle - Run - 0 - true - - - - - - - - RunF - - 1 - true - true - - - - - - - - - IdleF - - 1 - true - true - - - - - - - @@ -705,539 +566,18 @@ - - BlendTreeAim - BlendTreeAssault - + + BlendTreeUpper + BlendTreeLower + Models/Characters/Defender/DefenderBlue.mesh - - - - - R_Arm_Weapon_Joint - - - AssaultWeapon - - - - - - Schema/Entities/WeaponDefenderBlueWorld.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 - - - - - - - - CrouchStrafeRightF - - 1 - true - - - - - - - - - CrouchStrafeLeftF - - 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 - - - - - - - - - - - - - @@ -1262,7 +602,6 @@ ActivateDeactiveShieldF - 1 @@ -1272,7 +611,384 @@ ShieldFrontF - 1 + + + + + + + + + + + + + MovementBlend + Jump + 0 + true + + + + + + + + StandMovement + CrouchMovement + 0 + true + + + + + + + + DirectionBlend + Idle + 0 + + + + + + + + IdleF + + true + + + + + + + + + RunWalkBlend + StrafeLRBlend + 0 + + + + + + + + Walk + Run + 1 + + + + + + + + WalkF + + true + + + + + + + + + RunF + + 2 + true + + + + + + + + + + + Left + Right + + + + + + + + StrafeLeftF + + 2 + true + + + + + + + + + StrafeRightF + + 2 + true + + + + + + + + + + + + + + + DirectionBlend + Idle + + + + + + + + Walk + StrafeLRBlend + + + + + + + + Left + Right + + + + + + + + CrouchStrafeLeftF + + true + + + + + + + + + CrouchStrafeRightF + + true + + + + + + + + + + + CrouchWalkF + + true + + + + + + + + + + + CrouchF + + true + + + + + + + + + + + + + JumpF + + false + + + + + + + + + + + R_Arm_Weapon_Joint + + + Schema/Entities/WeaponDefenderBlueWorld.xml + + + + + + + DefenderWeapon + + + + + + + + + + + R_Arm_Weapon_Joint + + + Schema/Entities/WeaponDefenderBlueWorld.xml + + + + + + + DefenderWeapon + + + + + + + + + + + AssaultWeaponBlend + SidearmWeapon + 0 + true + + + + + + + + Aim + WeaponBlend + + + + + + + + MovementBlend + ActionBlend + + + + + + + + Fire + Reload + 1 + + + + + + + + ReloadSwitchU + 0.5 + false + + + + + + + + + ShootFastRifleU + false + + + + + + + + + + + Idle + Run + 0 + + + + + + + + IdleAssaultRifleU + + true + true + + + + + + + + + IdleAssaultRifleU + + true + true + + + + + + + + + + + + + AimRifleA + + 0.10000000149011612 + false + true @@ -1326,26 +1042,6 @@ - - - - Textures/Icons/Arrow.png - - false - - - - - 50 - true - - - - - - - - From 35a8d45fa42c30e3e330bf270782a05fbb0f14c7 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 10 Mar 2016 19:20:21 +0100 Subject: [PATCH 02/44] Fixed skinned models not being able to be shielded --- src/Engine/Rendering/DrawFinalPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index d03b0c2b..a538f818 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -1232,7 +1232,7 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::listSkeleton->GetTPose(); } - glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); + glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); } else { if (lastShader != m_FillDepthStencilBufferProgram->GetHandle()) { From c82be79bb8ded6fc0114a60d4af1b6c528f66d19 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 10 Mar 2016 19:20:33 +0100 Subject: [PATCH 03/44] Functionally working defender weapon --- .../Systems/Weapon/DefenderWeaponBehaviour.h | 4 +- .../Schema/Components/DefenderWeapon.xml | 4 +- .../Schema/Components/DefenderWeapon.xsd | 2 +- resources/Schema/Entities/DefenderShield.xml | 102 ++++++++++--- resources/Schema/Entities/HitTest.xml | 27 ++++ .../Weapon/DefenderWeaponBehaviour.cpp | 134 +++++++++++------- 6 files changed, 194 insertions(+), 79 deletions(-) create mode 100644 resources/Schema/Entities/HitTest.xml diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index 9e7d4991..e8e73e8f 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -27,9 +27,11 @@ private: std::random_device m_RandomDevice; std::mt19937 m_RandomEngine; + + // Weapon functions void fireShell(ComponentWrapper cWeapon, WeaponInfo& wi); - void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage); + void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, const std::vector& pattern); bool canFire(ComponentWrapper cWeapon, WeaponInfo& wi); // Utility diff --git a/resources/Schema/Components/DefenderWeapon.xml b/resources/Schema/Components/DefenderWeapon.xml index b01955bc..6f7e5a84 100755 --- a/resources/Schema/Components/DefenderWeapon.xml +++ b/resources/Schema/Components/DefenderWeapon.xml @@ -6,9 +6,9 @@ 64 64 90 - 0.174533 + 10 0.174533 - 10 + 9 120 0.03 0.2 diff --git a/resources/Schema/Components/DefenderWeapon.xsd b/resources/Schema/Components/DefenderWeapon.xsd index 53200952..4968fa5d 100755 --- a/resources/Schema/Components/DefenderWeapon.xsd +++ b/resources/Schema/Components/DefenderWeapon.xsd @@ -36,7 +36,7 @@ Damage dealt if all shotgun pellets hit - Spread angle in radians + The spread angle radius. Maximum vertical aim travel angle in radians diff --git a/resources/Schema/Entities/DefenderShield.xml b/resources/Schema/Entities/DefenderShield.xml index 5cb72116..845f7d90 100755 --- a/resources/Schema/Entities/DefenderShield.xml +++ b/resources/Schema/Entities/DefenderShield.xml @@ -1,39 +1,95 @@ - + - - Deploy - Idle - 0 - - - Models/Characters/Defender/DefenderShield.mesh - - + + + - + - - ActivateDeactiveShieldF - - 1 - + + Deploy + Idle + 0 + + + + Models/Characters/Defender/DefenderShieldBack.mesh + + false + true + false + false + false + false + - + + + + + ActivateDeactiveShieldF + true + + + + + + + + + ShieldFrontF + + + + + + - + - - ShieldFrontF - 1 - + + Deploy + Idle + 0 + + + Models/Characters/Defender/DefenderShieldFront.mesh + + false + true + false + false + false + false + - + + + + + ActivateDeactiveShieldF + true + + + + + + + + + ShieldFrontF + + + + + + diff --git a/resources/Schema/Entities/HitTest.xml b/resources/Schema/Entities/HitTest.xml new file mode 100644 index 00000000..bea1c6c9 --- /dev/null +++ b/resources/Schema/Entities/HitTest.xml @@ -0,0 +1,27 @@ + + + + + + 1 + + + + 1 + true + true + + + Models/Core/UnitSphere.mesh + + false + true + + + + + + + + + diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 835b5378..81873dc9 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -190,19 +190,28 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi magAmmo -= 1; } - int numPellets = cWeapon["NumPellets"]; - float spreadAngle = cWeapon["SpreadAngle"]; - std::uniform_real_distribution randomSpreadAngle(-spreadAngle, spreadAngle); - - // Calculate pellet angles - // HACK: Random for now? - // TODO: Make distribution even for each quadrant - std::vector pelletAngles; - for (int i = 0; i < numPellets; i++) { - pelletAngles.push_back(glm::vec2(randomSpreadAngle(m_RandomEngine), randomSpreadAngle(m_RandomEngine))); + // We can't really do any valuable calculations without a valid camera + if (!m_CurrentCamera.Valid()) { + return; } - double pelletDamage = (double)cWeapon["BaseDamage"] / numPellets; + int numPellets = cWeapon["NumPellets"]; + + // Create a spread pattern + std::vector pattern; + // The first pellet is always centered + pattern.push_back(glm::vec2(0, 0)); + // Any additional pellets form circles around the middle + int numOuterPellets = numPellets - 1; + float angleIncrement = glm::two_pi() / numOuterPellets; + for (int i = 0; i < numOuterPellets; ++i) { + float angle = angleIncrement * i; + glm::vec2 pellet = glm::vec2(glm::cos(angle), glm::sin(angle)); + pattern.push_back(pellet); + } + + // Deal damage (clientside) + dealDamage(cWeapon, wi, pattern); // View punch if (IsClient) { @@ -224,7 +233,7 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi } // Tracers - EntityWrapper weaponModelEntity; + /* EntityWrapper weaponModelEntity; if (wi.Player == LocalPlayer) { weaponModelEntity = wi.FirstPersonEntity; } else { @@ -243,7 +252,7 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi glm::vec3 trajectory = direction * distance; dealDamage(cWeapon, wi, direction, pelletDamage); } - } + }*/ // Play animation playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Fire"); @@ -255,7 +264,7 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi m_EventBroker->Publish(e); } -void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, glm::vec3 direction, double damage) +void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, const std::vector& pattern) { // Only deal damage client side if (!IsClient) { @@ -271,47 +280,68 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w if (!wi.Player.Valid()) { return; } - - glm::vec3 maxRange = direction * 2.f; - EntityWrapper camera = wi.Player.FirstChildByName("Camera"); - glm::vec3 cameraPosition = Transform::AbsolutePosition(camera); - if (!camera.Valid()) { - return; - } - Rectangle screenResolution = m_Renderer->GetViewportSize(); - glm::vec2 centerScreen = glm::vec2(screenResolution.Width / 2, screenResolution.Height / 2); - glm::vec2 screenCoords = cameraFromEntity(m_CurrentCamera).WorldToScreen(cameraPosition + maxRange, m_Renderer->GetViewportSize()); - PickData pickData = m_Renderer->Pick(centerScreen + screenCoords); - EntityWrapper victim(m_World, pickData.Entity); - if (!victim.Valid()) { - return; + + // Convert the spread angle to screen coordinates, taking FOV into account + Rectangle res = m_Renderer->GetViewportSize(); + float spreadAngle = glm::radians((float)cWeapon["SpreadAngle"]); + float nearClip = glm::radians((double)m_CurrentCamera["Camera"]["NearClip"]); + float yFOV = glm::radians((double)m_CurrentCamera["Camera"]["FOV"]); + float yRefFOV = glm::radians(59.f); + float yRef = glm::tan(yRefFOV) * nearClip; + float yRatio = yRef / (glm::tan(yFOV) * nearClip); + float yMax = (yRatio / 2.f) * spreadAngle * (res.Height / 2.f); + + double pelletDamage = (double)cWeapon["BaseDamage"] / pattern.size(); + + // Pick! + std::unordered_map damageSum; + glm::vec2 screenCenter(res.Width / 2.f, res.Height / 2.f); + for (auto& pellet : pattern) { + glm::vec2 pickCoord = screenCenter + (pellet * glm::vec2(yMax, yMax)); + PickData pick = m_Renderer->Pick(pickCoord); + + EntityWrapper victim(m_World, pick.Entity); + if (!victim.Valid()) { + continue; + } + + // Temp hit decal + EntityWrapper hit = ResourceManager::Load("Schema/Entities/HitTest.xml")->MergeInto(m_World); + hit["Transform"]["Position"] = pick.Position; + + // Don't let us shoot ourselves in the foot somehow + if (victim == LocalPlayer) { + continue; + } + + // Only care about players being hit + if (!victim.HasComponent("Player")) { + victim = victim.FirstParentWithComponent("Player"); + if (!victim.Valid()) { + continue; + } + } + + // Check for friendly fire + if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) { + // TODO: Ammo sharing + continue; + } + + damageSum[victim] += pelletDamage; + ((glm::vec3&)hit["Model"]["Color"]).b = 1.f; } - // Don't let us shoot ourselves in the foot somehow - if (victim == LocalPlayer) { - return; + // Deal damage! + for (auto& kv : damageSum) { + // Deal damage! + Events::PlayerDamage ePlayerDamage; + ePlayerDamage.Inflictor = wi.Player; + ePlayerDamage.Victim = kv.first; + ePlayerDamage.Damage = kv.second; + m_EventBroker->Publish(ePlayerDamage); + LOG_DEBUG("Dealt %f damage to #%i", kv.second, kv.first.ID); } - - // Only care about players being hit - if (!victim.HasComponent("Player")) { - victim = victim.FirstParentWithComponent("Player"); - } - if (!victim.Valid()) { - return; - } - - // Check for friendly fire - if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) { - return; - } - - // Deal damage! - Events::PlayerDamage ePlayerDamage; - ePlayerDamage.Inflictor = wi.Player; - ePlayerDamage.Victim = victim; - ePlayerDamage.Damage = damage; - m_EventBroker->Publish(ePlayerDamage); - LOG_DEBUG("Damage: %f", damage); } bool DefenderWeaponBehaviour::canFire(ComponentWrapper cWeapon, WeaponInfo& wi) From 1992b6cde1a5e562f32dbda0d1b5615aaff4bb4b Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Thu, 10 Mar 2016 21:15:27 +0100 Subject: [PATCH 04/44] WIP Defender tracers --- assets | 2 +- .../Systems/Weapon/DefenderWeaponBehaviour.h | 1 + .../Schema/Components/DefenderWeapon.xml | 2 +- resources/Schema/Entities/10Degrees.xml | 94 ++++++++++++++++ resources/Schema/Entities/HitTest.xml | 2 +- resources/Schema/Entities/MovementTest.xml | 100 +++++++++++++++++- resources/Schema/Entities/RayBlue.xml | 2 +- src/Engine/Core/EntityWrapper.cpp | 14 ++- .../Weapon/DefenderWeaponBehaviour.cpp | 99 ++++++++++------- 9 files changed, 266 insertions(+), 50 deletions(-) create mode 100644 resources/Schema/Entities/10Degrees.xml diff --git a/assets b/assets index 85d96f6f..298641b1 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 85d96f6f3d2269e46962492f9713ec67c54e8ece +Subproject commit 298641b1afe313ebde00d77a0c4d75e6c6a0533d diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index e8e73e8f..a32d65f1 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -32,6 +32,7 @@ private: // Weapon functions void fireShell(ComponentWrapper cWeapon, WeaponInfo& wi); void dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, const std::vector& pattern); + void spawnTracers(ComponentWrapper cWeapon, WeaponInfo& wi, std::vector pattern); bool canFire(ComponentWrapper cWeapon, WeaponInfo& wi); // Utility diff --git a/resources/Schema/Components/DefenderWeapon.xml b/resources/Schema/Components/DefenderWeapon.xml index 6f7e5a84..9c3861cd 100755 --- a/resources/Schema/Components/DefenderWeapon.xml +++ b/resources/Schema/Components/DefenderWeapon.xml @@ -1,7 +1,7 @@ - 8 + 9999 8 64 64 diff --git a/resources/Schema/Entities/10Degrees.xml b/resources/Schema/Entities/10Degrees.xml new file mode 100644 index 00000000..0039ca82 --- /dev/null +++ b/resources/Schema/Entities/10Degrees.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/Ray.png + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/Ray.png + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/Ray.png + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/Ray.png + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/HitTest.xml b/resources/Schema/Entities/HitTest.xml index bea1c6c9..4649072b 100644 --- a/resources/Schema/Entities/HitTest.xml +++ b/resources/Schema/Entities/HitTest.xml @@ -3,7 +3,7 @@ - 1 + 10 diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 8a99df55..604aaca4 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -103,7 +103,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -157,14 +157,106 @@ Models/Weapons/Blue/DefenderWeaponBlue.mesh - - + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/Ray.png + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/Ray.png + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/Ray.png + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/Ray.png + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/RayBlue.xml b/resources/Schema/Entities/RayBlue.xml index 83adbe51..64ff3619 100644 --- a/resources/Schema/Entities/RayBlue.xml +++ b/resources/Schema/Entities/RayBlue.xml @@ -3,7 +3,7 @@ - 0.10000000149011612 + 10 diff --git a/src/Engine/Core/EntityWrapper.cpp b/src/Engine/Core/EntityWrapper.cpp index a85127ad..83a31fa7 100644 --- a/src/Engine/Core/EntityWrapper.cpp +++ b/src/Engine/Core/EntityWrapper.cpp @@ -27,7 +27,7 @@ void EntityWrapper::AttachComponent(const char* componentName) EntityWrapper EntityWrapper::Parent() { - if (this->World == nullptr || this->ID == EntityID_Invalid) { + if (!Valid()) { return EntityWrapper::Invalid; } else { return EntityWrapper(this->World, this->World->GetParent(this->ID)); @@ -36,6 +36,10 @@ EntityWrapper EntityWrapper::Parent() EntityWrapper EntityWrapper::FirstParentByName(const std::string& parentEntityName) { + if (!Valid()) { + return EntityWrapper::Invalid; + } + EntityWrapper entity = *this; while (entity.Parent().Valid()) { entity = entity.Parent(); @@ -48,6 +52,10 @@ EntityWrapper EntityWrapper::FirstParentByName(const std::string& parentEntityNa EntityWrapper EntityWrapper::FirstChildByName(const std::string& name) { + if (!Valid()) { + return EntityWrapper::Invalid; + } + return firstChildByNameRecursive(name, this->ID); } @@ -78,6 +86,10 @@ EntityWrapper EntityWrapper::FirstLevelChildByName(const std::string& name) EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& componentType) { + if (!Valid()) { + return EntityWrapper::Invalid; + } + EntityWrapper entity = *this; while (entity.Parent().Valid()) { entity = entity.Parent(); diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 81873dc9..ca12ec91 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -213,46 +213,27 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi // Deal damage (clientside) dealDamage(cWeapon, wi, pattern); - // 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; - } - } - } + // Spawn tracers + spawnTracers(cWeapon, wi, pattern); - // Tracers - /* EntityWrapper weaponModelEntity; - if (wi.Player == LocalPlayer) { - weaponModelEntity = wi.FirstPersonEntity; - } else { - weaponModelEntity = wi.ThirdPersonEntity; - } - if (weaponModelEntity.Valid()) { - EntityWrapper spawner = weaponModelEntity.FirstChildByName("WeaponMuzzle"); - for (auto& angles : pelletAngles) { - glm::vec3 direction = Transform::AbsoluteOrientation(spawner) * glm::quat(glm::vec3(angles, 0.f)) * glm::vec3(0, 0, -1); - float distance = traceRayDistance(Transform::AbsolutePosition(spawner), direction); - EntityWrapper ray = SpawnerSystem::Spawn(spawner); - ((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f); - glm::vec3& orientation = ray["Transform"]["Orientation"]; - orientation.x += angles.x; - orientation.y += angles.y; - glm::vec3 trajectory = direction * distance; - dealDamage(cWeapon, wi, direction, pelletDamage); - } - }*/ + // 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; + // } + // } + //} // Play animation playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Fire"); @@ -264,6 +245,34 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi m_EventBroker->Publish(e); } +void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& wi, std::vector pattern) +{ + EntityWrapper muzzle = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzle"); + if (!muzzle.Valid()) { + return; + } + + float spreadAngle = glm::radians((float)cWeapon["SpreadAngle"]); + + for (auto& pellet : pattern) { + glm::quat pelletRotation = glm::quat(Transform::AbsoluteOrientationEuler(wi.Player.FirstChildByName("Camera"))) * glm::quat(glm::vec3(pellet.y, pellet.x, 0) * spreadAngle); + glm::vec3 origin = Transform::AbsolutePosition(wi.Player.FirstChildByName("Camera")); + glm::vec3 direction = pelletRotation * glm::vec3(0, 0, -1); + float distance = traceRayDistance(origin, direction); + EntityWrapper ray = SpawnerSystem::Spawn(muzzle); + if (ray.Valid()) { + ComponentWrapper cTransform = ray["Transform"]; + glm::vec3& position = cTransform["Position"]; + glm::vec3& orientation = cTransform["Orientation"]; + glm::vec3& scale = cTransform["Scale"]; + + position = Transform::AbsolutePosition(wi.Player.FirstChildByName("Camera")); + orientation = glm::eulerAngles(pelletRotation); + scale.z = distance; + } + } +} + void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi, const std::vector& pattern) { // Only deal damage client side @@ -284,13 +293,21 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w // Convert the spread angle to screen coordinates, taking FOV into account Rectangle res = m_Renderer->GetViewportSize(); float spreadAngle = glm::radians((float)cWeapon["SpreadAngle"]); - float nearClip = glm::radians((double)m_CurrentCamera["Camera"]["NearClip"]); + float nearClip = (double)m_CurrentCamera["Camera"]["NearClip"]; + float farClip = (double)m_CurrentCamera["Camera"]["FarClip"]; float yFOV = glm::radians((double)m_CurrentCamera["Camera"]["FOV"]); + //float yRefFOV = glm::radians(59.f); + //float yRef = glm::tan(yRefFOV) * nearClip; + //float yRatio = yRef / (glm::tan(yFOV) * nearClip); + //float yMax = (yRatio / 2.f) * spreadAngle * (res.Height / 2.f); float yRefFOV = glm::radians(59.f); float yRef = glm::tan(yRefFOV) * nearClip; float yRatio = yRef / (glm::tan(yFOV) * nearClip); - float yMax = (yRatio / 2.f) * spreadAngle * (res.Height / 2.f); + float yMax = yRatio * (glm::tan(spreadAngle) * farClip); + LOG_DEBUG("Ratio: %f", yRatio); + LOG_DEBUG("fatClip: %f", farClip); + LOG_DEBUG("yMax: %f", yMax); double pelletDamage = (double)cWeapon["BaseDamage"] / pattern.size(); // Pick! From cc127ad772579fd5dc115088e81a2967fe4c61c5 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 10 Mar 2016 21:31:19 +0100 Subject: [PATCH 05/44] Updated defender blendtree --- resources/Schema/Entities/MovementTest.xml | 7 +- .../Schema/Entities/PlayerDefenderBlue.xml | 186 ++++++++++++------ 2 files changed, 125 insertions(+), 68 deletions(-) diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 8a99df55..6a3fe47f 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -103,7 +103,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -157,8 +157,7 @@ Models/Weapons/Blue/DefenderWeaponBlue.mesh - - + diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index d7c47f7e..8da1a67a 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -41,9 +41,10 @@ - Textures/Icons/Arrow.png - false + Models/Core/UnitQuad.mesh + + Textures/Icons/Arrow.png @@ -93,9 +94,10 @@ - Textures/Weapons/Crosshair/SmallThickHoleDot.png - false + Models/Core/UnitQuad.mesh + + Textures/Weapons/Crosshair/SmallThickHoleDot.png @@ -126,8 +128,9 @@ - Textures/HealthHUD3.png + Models/Core/UnitQuad.mesh + Textures/HealthHUD3.png @@ -149,9 +152,10 @@ - Textures/Core/White.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png @@ -167,9 +171,10 @@ - Textures/Core/White.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png @@ -185,9 +190,10 @@ - Textures/Core/White.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png @@ -207,9 +213,10 @@ - Textures\Icons\Abilities\SheildDots-01.png - false + Models/Core/UnitQuad.mesh + + Textures\Icons\Abilities\SheildDots-01.png @@ -269,8 +276,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -287,8 +295,9 @@ 2 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -303,8 +312,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -321,8 +331,9 @@ 3 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -337,8 +348,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -356,8 +368,9 @@ 4 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -372,8 +385,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -390,8 +404,9 @@ 1 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -406,8 +421,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -423,8 +439,9 @@ - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -848,8 +865,8 @@ Schema/Entities/WeaponDefenderBlueWorld.xml - - + + DefenderWeapon @@ -869,8 +886,8 @@ Schema/Entities/WeaponDefenderBlueWorld.xml - - + + DefenderWeapon @@ -884,7 +901,7 @@ - AssaultWeaponBlend + DefenderWeaponBlend SidearmWeapon 0 true @@ -892,7 +909,7 @@ - + Aim @@ -904,45 +921,12 @@ - MovementBlend - ActionBlend + MovementBlend2 + FinalBlend - - - - Fire - Reload - 1 - - - - - - - - ReloadSwitchU - 0.5 - false - - - - - - - - - ShootFastRifleU - false - - - - - - - @@ -979,6 +963,80 @@ + + + + ShieldBlend + ActionBlend + + + + + + + + Fire + Reload + 1 + + + + + + + + ShootgunReloadU + 0.5 + + + + + + + + + ShootRifleU + false + + + + + + + + + + + ActivateShield + SheildFront + + + + + + + + ShieldFrontU + true + + + + + + + + + ActivateShieldU + false + + + + + + + + + From e0a6b09d36e0da7b8a2e116d0d37dee633069155 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 11 Mar 2016 19:16:34 +0100 Subject: [PATCH 06/44] Defender early alpha --- assets | 2 +- .../Systems/Weapon/DefenderWeaponBehaviour.h | 2 + resources/Schema/Entities/DefenderShield.xml | 19 +- resources/Schema/Entities/MovementTest.xml | 4 +- .../Schema/Entities/PlayerDefenderBlue.xml | 889 ++++++++++-------- .../Entities/SidearmWeaponBlueWorld.xml | 25 + .../Entities/WeaponDefenderBlueView.xml | 11 +- .../WeaponSidearmDefenderBlueView.xml | 195 ++++ .../Weapon/DefenderWeaponBehaviour.cpp | 106 ++- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 26 +- 10 files changed, 839 insertions(+), 440 deletions(-) create mode 100644 resources/Schema/Entities/SidearmWeaponBlueWorld.xml create mode 100644 resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml diff --git a/assets b/assets index 298641b1..69ddae17 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 298641b1afe313ebde00d77a0c4d75e6c6a0533d +Subproject commit 69ddae179ac02d5c1582a8c6834451b3f5e4bbaf diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index a32d65f1..9244bb60 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -22,6 +22,8 @@ public: 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; + void OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) override; + private: std::random_device m_RandomDevice; diff --git a/resources/Schema/Entities/DefenderShield.xml b/resources/Schema/Entities/DefenderShield.xml index 845f7d90..d2cca1da 100755 --- a/resources/Schema/Entities/DefenderShield.xml +++ b/resources/Schema/Entities/DefenderShield.xml @@ -2,9 +2,7 @@ - - - + @@ -32,8 +30,8 @@ - ActivateDeactiveShieldF - true + ActivateShieldU + false @@ -42,7 +40,8 @@ - ShieldFrontF + ShieldFrontU + true @@ -67,14 +66,15 @@ false false + - ActivateDeactiveShieldF - true + ActivateShieldU + false @@ -83,7 +83,8 @@ - ShieldFrontF + ShieldFrontU + false diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 604aaca4..b4db78d9 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -103,7 +103,7 @@ - + @@ -116,7 +116,7 @@ - + diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index 8da1a67a..5fcc6c64 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -8,15 +8,14 @@ - + - 4 - 52 + 8 - + 150 150 @@ -24,41 +23,18 @@ - - true + 5 - - + - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Arrow.png - - - - - 50 - true - - - - - - - - @@ -67,7 +43,6 @@ - @@ -84,6 +59,37 @@ + + + + + + + + + Schema/Entities/WeaponDefenderBlueView.xml + + + + DefenderWeapon + + + + + + + + Schema/Entities/WeaponSidearmDefenderBlueView.xml + + + + SidearmWeapon + + + + + + @@ -115,156 +121,6 @@ - - - - - - - - - 1 - - - - - Models/Core/UnitQuad.mesh - - Textures/HealthHUD3.png - - - - - - - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - - - - - - - - - - - - - - - - inf - - - - false - Models/Core/UnitQuad.mesh - - Textures\Icons\Abilities\SheildDots-01.png - - - - - - - - - - - 0.0 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - 1 - - - - 150/150 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - @@ -276,6 +132,7 @@ + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon.png @@ -295,6 +152,7 @@ 2 + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png @@ -312,6 +170,7 @@ + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon.png @@ -331,6 +190,7 @@ 3 + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png @@ -348,6 +208,7 @@ + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon.png @@ -368,6 +229,7 @@ 4 + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png @@ -385,6 +247,7 @@ + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon.png @@ -404,6 +267,7 @@ 1 + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png @@ -421,6 +285,7 @@ + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon.png @@ -439,6 +304,7 @@ + false Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png @@ -469,7 +335,6 @@ Fonts/DroidSans.ttf,64 - @@ -522,43 +387,152 @@ Models/Widgets/Arrows/Arrow5.mesh - - - + + - - - - - - - - + - - Schema/Entities/WeaponDefenderBlueView.xml - - - - DefenderWeapon - + + + + - - - - - - Schema/Entities/WeaponDefenderBlueView.xml - - - - DefenderWeapon - - - + + + + + 1 + + + + 150/150 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + 1 + + + + + Models/Core/UnitQuad.mesh + + Textures/HealthHUD3.png + + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Assault-01.png + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Defender-01.png + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Sniper-01.png + + + + + + + + + + + + + + + + + inf + + + + false + Models/Core/UnitQuad.mesh + + Textures\Icons\Abilities\SheildDots-01.png + + + + + + + + + + + @@ -595,47 +569,47 @@ - + + + R_Arm_Weapon_Joint + + + Schema/Entities/WeaponDefenderBlueWorld.xml + - + + + + DefenderWeapon + + + + - - - - - Deploy - Idle - 0 - - - Models/Characters/Defender/DefenderShield.mesh - - - - - - - - ActivateDeactiveShieldF - - - - - - - - - ShieldFrontF - - - - - - - - + + + + + + R_Arm_Weapon_Joint + + + Schema/Entities/SidearmWeaponBlueWorld.xml + + + + + + + SidearmWeapon + + + + + + @@ -659,116 +633,12 @@ - - - - DirectionBlend - Idle - 0 - - - - - - - - IdleF - - true - - - - - - - - - RunWalkBlend - StrafeLRBlend - 0 - - - - - - - - Walk - Run - 1 - - - - - - - - WalkF - - true - - - - - - - - - RunF - - 2 - true - - - - - - - - - - - Left - Right - - - - - - - - StrafeLeftF - - 2 - true - - - - - - - - - StrafeRightF - - 2 - true - - - - - - - - - - - DirectionBlend Idle + 1 @@ -778,6 +648,7 @@ Walk StrafeLRBlend + 0 @@ -787,6 +658,7 @@ Left Right + 0.033793529385008014 @@ -795,7 +667,7 @@ CrouchStrafeLeftF - + true @@ -806,7 +678,7 @@ CrouchStrafeRightF - + true @@ -819,7 +691,7 @@ CrouchWalkF - + true @@ -832,7 +704,113 @@ CrouchF - + + true + + + + + + + + + + + DirectionBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + true + + + + + + + + + RunF + + 2 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeLeftF + + 2 + true + + + + + + + + + StrafeRightF + + 2 + true + + + + + + + + + + + + + IdleF + true @@ -856,60 +834,18 @@ - - - - R_Arm_Weapon_Joint - - - Schema/Entities/WeaponDefenderBlueWorld.xml - - - - - - - DefenderWeapon - - - - - - - - - - - R_Arm_Weapon_Joint - - - Schema/Entities/WeaponDefenderBlueWorld.xml - - - - - - - DefenderWeapon - - - - - - - - DefenderWeaponBlend + DefenderWeapon SidearmWeapon - 0 + 1 true - + Aim @@ -941,7 +877,7 @@ IdleAssaultRifleU - + true true @@ -953,7 +889,7 @@ IdleAssaultRifleU - + true true @@ -968,6 +904,7 @@ ShieldBlend ActionBlend + 1 @@ -977,7 +914,7 @@ Fire Reload - 1 + 0 @@ -986,6 +923,7 @@ ShootgunReloadU + 0.5 @@ -996,6 +934,7 @@ ShootRifleU + false @@ -1009,25 +948,29 @@ ActivateShield SheildFront + 1 - + - ShieldFrontU - true + ActivateShieldU + + 2 + false - + - ActivateShieldU - false + ShieldFrontU + + true @@ -1044,6 +987,101 @@ AimRifleA + true + + + + + + + + + + + Aim + WeaponBlend + + + + + + + + MovementBlend2 + ActionBlend + + + + + + + + Reload + Fire + + + + + + + + ReloadSwitchU + false + + + + + + + + + ShootSecWepU + false + + + + + + + + + + + Idle + Run + + + + + + + + IdleSecWepU + true + + + + + + + + + IdleSecWepU + true + + + + + + + + + + + + + AimSecWepA + 0.10000000149011612 false true @@ -1093,21 +1131,40 @@ - + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Arrow.png + + + + + 50 + true + + + + + + + + Schema/Entities/DefenderShield.xml - - - + diff --git a/resources/Schema/Entities/SidearmWeaponBlueWorld.xml b/resources/Schema/Entities/SidearmWeaponBlueWorld.xml new file mode 100644 index 00000000..d497e955 --- /dev/null +++ b/resources/Schema/Entities/SidearmWeaponBlueWorld.xml @@ -0,0 +1,25 @@ + + + + + + Models/Weapons/Blue/SecondaryWeaponBlue.mesh + + + + + + + + + Schema/Entities/RayBlue.xml + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml index c22e7200..fac92111 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -27,7 +27,7 @@ - ActivateDeactivateShieldF + ActivateShieldF false @@ -156,7 +156,7 @@ - + @@ -190,16 +190,17 @@ - - + + - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png diff --git a/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml b/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml new file mode 100644 index 00000000..45f18c33 --- /dev/null +++ b/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml @@ -0,0 +1,195 @@ + + + + + + MovementBlend + ActionBlend + + + Models/Characters/Defender/FirstPersonDefenderBlue.mesh + + + + + + + + + Idle + Run + 1 + true + + + + + + + + IdleSecF + true + true + + + + + + + + + RunSecF + true + true + + + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/SecondaryWeaponBlue.mesh + + + + + + + + + + + Schema/Entities/RayBlue.xml + + + + + + + + + + + Schema/Entities/ReloadEffectView.xml + + + + + + + + + + + R_Ammo_Joint + true + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + 38 + Fonts/DroidSans.ttf,64 + + + + + Sidearm + Ammo + + + + + + + + + + + + 5 + Fonts/DroidSans.ttf,64 + + + + + Sidearm + MagazineAmmo + + + + + + + + + + + + + + + Fire + Reload + 0 + + + + + + + + ShootSecF + false + + + + + + + + + ReloadSwitchSecF + false + + + + + + + + + + diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index ca12ec91..cf611c44 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -37,6 +37,16 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& } else { isReloading = false; playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "ReloadEnd"); + + if (wi.ThirdPersonPlayerModel.Valid()) { + Events::AutoAnimationBlend eFireIdle; + eFireIdle.Duration = 0.2; + eFireIdle.RootNode = wi.ThirdPersonPlayerModel; + eFireIdle.NodeName = "Fire"; + eFireIdle.Start = false; + m_EventBroker->Publish(eFireIdle); + } + } } @@ -114,6 +124,16 @@ void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) eBlendLoop.AnimationEntity = wi.FirstPersonEntity.FirstChildByName("ReloadStart"); m_EventBroker->Publish(eBlendLoop); } + + if(wi.ThirdPersonPlayerModel.Valid()) { + Events::AutoAnimationBlend eReload; + eReload.Duration = 0.2; + eReload.RootNode = wi.ThirdPersonPlayerModel; + eReload.NodeName = "Reload"; + eReload.Restart = true; + eReload.Start = true; + m_EventBroker->Publish(eReload); + } } void DefenderWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) @@ -136,17 +156,58 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf SpawnerSystem::Spawn(attachment, attachment); } + EntityWrapper backAttachment = attachment.FirstChildByName("Back"); + if (backAttachment.Valid()) { + Events::AutoAnimationBlend eDeployShieldAttachement; + eDeployShieldAttachement.RootNode = backAttachment; + eDeployShieldAttachement.NodeName = "Deploy"; + eDeployShieldAttachement.Restart = true; + eDeployShieldAttachement.Start = true; + m_EventBroker->Publish(eDeployShieldAttachement); + } + EntityWrapper frontAttachment = attachment.FirstChildByName("Front"); + if (frontAttachment.Valid()) { + Events::AutoAnimationBlend eDeployShieldAttachement; + eDeployShieldAttachement.RootNode = frontAttachment; + eDeployShieldAttachement.NodeName = "Deploy"; + eDeployShieldAttachement.Restart = true; + eDeployShieldAttachement.Start = true; + m_EventBroker->Publish(eDeployShieldAttachement); + + } + if (IsClient) { EntityWrapper root = wi.FirstPersonEntity; if (root.Valid()) { EntityWrapper animationNode = root.FirstChildByName("Shield"); if (animationNode.Valid()) { - Events::AutoAnimationBlend eFireBlend; - eFireBlend.RootNode = root; - eFireBlend.NodeName = "Shield"; - eFireBlend.Restart = true; - eFireBlend.Start = true; - m_EventBroker->Publish(eFireBlend); + Events::AutoAnimationBlend eShieldBlend; + eShieldBlend.RootNode = root; + eShieldBlend.NodeName = "Shield"; + eShieldBlend.Restart = true; + eShieldBlend.Start = true; + m_EventBroker->Publish(eShieldBlend); + } + } + } else { // server only + EntityWrapper root = wi.ThirdPersonPlayerModel; + if (root.Valid()) { + Events::AutoAnimationBlend eShieldActivateBlend; + eShieldActivateBlend.RootNode = root; + eShieldActivateBlend.NodeName = "ActivateShield"; + eShieldActivateBlend.Restart = true; + eShieldActivateBlend.Start = true; + m_EventBroker->Publish(eShieldActivateBlend); + + EntityWrapper animationNode = root.FirstChildByName("ActivateShield"); + if (animationNode.Valid()) { + Events::AutoAnimationBlend eShieldIdleBlend; + eShieldIdleBlend.RootNode = root; + eShieldIdleBlend.NodeName = "ShieldFront"; + eShieldIdleBlend.Restart = true; + eShieldIdleBlend.Start = true; + eShieldIdleBlend.AnimationEntity = animationNode; + m_EventBroker->Publish(eShieldIdleBlend); } } } @@ -166,6 +227,26 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf m_EventBroker->Publish(eFireBlend); } } + } else { // server only + EntityWrapper root = wi.ThirdPersonPlayerModel; + if (root.Valid()) { + Events::AutoAnimationBlend eShieldDeactivateBlend; + eShieldDeactivateBlend.RootNode = root; + eShieldDeactivateBlend.NodeName = "ActivateShield"; + eShieldDeactivateBlend.Restart = true; + eShieldDeactivateBlend.Start = true; + eShieldDeactivateBlend.Reverse = true; + m_EventBroker->Publish(eShieldDeactivateBlend); + + EntityWrapper animationNode = root.FirstChildByName("ActivateShield"); + if (animationNode.Valid()) { + Events::AutoAnimationBlend eActionBlend; + eActionBlend.RootNode = root; + eActionBlend.NodeName = "ActionBlend"; + eActionBlend.AnimationEntity = animationNode; + m_EventBroker->Publish(eActionBlend); + } + } } } } @@ -174,6 +255,18 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf return false; } + +void DefenderWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + if (wi.ThirdPersonPlayerModel.Valid()) { + Events::AutoAnimationBlend b1; + b1.RootNode = wi.ThirdPersonPlayerModel; + b1.NodeName = "DefenderWeapon"; + b1.SingleLevelBlend = true; + m_EventBroker->Publish(b1); + } +} + void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi) { cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"]; @@ -237,6 +330,7 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi // Play animation playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Fire"); + playAnimationAndReturn(wi.ThirdPersonPlayerModel, "FinalBlend", "Fire"); // Sound Events::PlaySoundOnEntity e; diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index cba3d5e8..db5a9ede 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -35,6 +35,14 @@ void SidearmWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapon void SidearmWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) { cWeapon["FireCooldown"] = (double)cWeapon["EquipTime"]; + + if(wi.ThirdPersonPlayerModel.Valid()) { + Events::AutoAnimationBlend b1; + b1.RootNode = wi.ThirdPersonPlayerModel; + b1.NodeName = "SidearmWeapon"; + b1.SingleLevelBlend = true; + m_EventBroker->Publish(b1); + } } void SidearmWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) @@ -64,7 +72,23 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi 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); + if (ray.Valid()) { + ((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f); + } + } + + + // Play animation + playAnimationAndReturn(wi.FirstPersonEntity, "ActionBlend", "Fire"); + + // Third person anim + if (wi.ThirdPersonPlayerModel.Valid()) { + Events::AutoAnimationBlend b1; + b1.RootNode = wi.ThirdPersonPlayerModel; + b1.NodeName = "Fire"; + b1.Restart = true; + b1.Start = true; + m_EventBroker->Publish(b1); } } From 2a209c5d8ecd090f51888d308792cda76fa6d054 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 11 Mar 2016 23:58:26 +0100 Subject: [PATCH 07/44] AmmoSharing beta --- .../Systems/Weapon/SidearmWeaponBehaviour.h | 12 + resources/Schema/Components/SidearmWeapon.xml | 1 + resources/Schema/Components/SidearmWeapon.xsd | 1 + resources/Schema/Entities/FriendlyAmmoHUD.xml | 49 +++ .../Schema/Entities/PlayerAssaultBlue.xml | 218 +++++++++--- .../Entities/SidearmWeaponBlendTree.xlm | 101 ++++++ .../Entities/WeaponSidearmAssaultBlueView.xml | 202 +++++++++++ .../WeaponSidearmReloadEffectView.xml | 54 +++ src/Engine/Rendering/AnimationSystem.cpp | 6 +- .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 8 + .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 325 +++++++++++++++++- 11 files changed, 915 insertions(+), 62 deletions(-) create mode 100644 resources/Schema/Entities/FriendlyAmmoHUD.xml create mode 100644 resources/Schema/Entities/SidearmWeaponBlendTree.xlm create mode 100644 resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml create mode 100644 resources/Schema/Entities/WeaponSidearmReloadEffectView.xml diff --git a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h index 10e6105a..7aa20025 100644 --- a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h @@ -4,6 +4,8 @@ #include "WeaponBehaviour.h" #include "Collision/Collision.h" #include "Core/EPlayerDamage.h" +#include "Sound/EPlaySoundOnEntity.h" +#include "Rendering/EAutoAnimationBlend.h" class SidearmWeaponBehaviour : public WeaponBehaviour { @@ -18,6 +20,7 @@ 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 OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) override; void OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) override; @@ -32,6 +35,15 @@ private: // Utility bool canFire(ComponentWrapper cWeapon); bool playerInFirstPerson(EntityWrapper player); + + bool dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi); + void giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver); + + + void CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi); + void RemoveFrindlyAmmoHUD(WeaponInfo& wi); + + //float traceRayDistance(glm::vec3 origin, glm::vec3 direction); }; diff --git a/resources/Schema/Components/SidearmWeapon.xml b/resources/Schema/Components/SidearmWeapon.xml index bc90c067..968306a6 100644 --- a/resources/Schema/Components/SidearmWeapon.xml +++ b/resources/Schema/Components/SidearmWeapon.xml @@ -11,6 +11,7 @@ 0.5 false 0 + false false 0 \ No newline at end of file diff --git a/resources/Schema/Components/SidearmWeapon.xsd b/resources/Schema/Components/SidearmWeapon.xsd index 514bf354..2c1df4a1 100644 --- a/resources/Schema/Components/SidearmWeapon.xsd +++ b/resources/Schema/Components/SidearmWeapon.xsd @@ -44,6 +44,7 @@ + diff --git a/resources/Schema/Entities/FriendlyAmmoHUD.xml b/resources/Schema/Entities/FriendlyAmmoHUD.xml new file mode 100644 index 00000000..5ab1b754 --- /dev/null +++ b/resources/Schema/Entities/FriendlyAmmoHUD.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + + 88 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index 64141757..7a2010e6 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -14,12 +14,8 @@ - - - - - + @@ -30,7 +26,6 @@ - @@ -70,9 +65,10 @@ - Textures/Weapons/Crosshair/SmallThickHoleDot.png - false + Models/Core/UnitQuad.mesh + + Textures/Weapons/Crosshair/SmallThickHoleDot.png @@ -101,8 +97,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -119,8 +116,9 @@ 2 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -135,8 +133,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -153,8 +152,9 @@ 3 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -169,8 +169,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -188,8 +189,9 @@ 4 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -204,8 +206,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -222,8 +225,9 @@ 1 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -238,8 +242,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -255,8 +260,9 @@ - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -379,8 +385,9 @@ - Textures/HealthHUD3.png + Models/Core/UnitQuad.mesh + Textures/HealthHUD3.png @@ -403,9 +410,10 @@ - Textures/Icons/Boosts/Assault-01.png - false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Assault-01.png @@ -422,9 +430,10 @@ - Textures/Icons/Boosts/Defender-01.png - false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Defender-01.png @@ -441,9 +450,10 @@ - Textures/Icons/Boosts/Sniper-01.png - false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Sniper-01.png @@ -463,9 +473,10 @@ - Textures\Icons\Abilities\Superman-01.png - false + Models/Core/UnitQuad.mesh + + Textures\Icons\Abilities\Superman-01.png @@ -517,11 +528,11 @@ - Schema/Entities/WeaponDefenderBlueView.xml + Schema/Entities/WeaponSidearmAssaultBlueView.xml - DefenderWeapon + SidearmWeapon @@ -570,8 +581,8 @@ Schema/Entities/WeaponAssaultBlueWorld.xml - - + + AssaultWeapon @@ -588,11 +599,11 @@ R_Arm_Weapon_Joint - Schema/Entities/SidearmWeaponWorld.xml + Schema/Entities/SidearmWeaponBlueWorld.xml - - + + SidearmWeapon @@ -659,7 +670,7 @@ CrouchStrafeLeftF - + true @@ -670,7 +681,7 @@ CrouchStrafeRightF - + true @@ -683,7 +694,7 @@ CrouchWalkF - + true @@ -696,7 +707,7 @@ CrouchF - + true @@ -739,7 +750,7 @@ WalkF - + true @@ -750,7 +761,7 @@ RunF - + 2 true @@ -774,7 +785,7 @@ StrafeLeftF - + 2 true @@ -786,7 +797,7 @@ StrafeRightF - + 2 true @@ -802,7 +813,7 @@ IdleF - + true @@ -891,10 +902,10 @@ - + - DashRightF + DashLeftF 1.7999999523162842 false @@ -903,10 +914,10 @@ - + - DashLeftF + DashRightF 1.7999999523162842 false @@ -926,15 +937,15 @@ - AssaultWeaponBlend + AssaultWeapon SidearmWeapon - 0 + 1 true - + Aim @@ -999,7 +1010,7 @@ IdleAssaultRifleU - + true true @@ -1011,7 +1022,7 @@ IdleAssaultRifleU - + true true @@ -1038,6 +1049,104 @@ + + + + Aim + WeaponBlend + + + + + + + + MovementBlend2 + ActionBlend + + + + + + + + Idle + Run + 0 + + + + + + + + IdleSecWepU + true + + + + + + + + + IdleSecWepU + true + + + + + + + + + + + Reload + Fire + 1 + + + + + + + + ReloadSwitchU + false + + + + + + + + + ShootSecWepU + false + + + + + + + + + + + + + AimSecWepA + + false + true + + + + + + + @@ -1087,9 +1196,10 @@ - Textures/Icons/Arrow.png - false + Models/Core/UnitQuad.mesh + + Textures/Icons/Arrow.png diff --git a/resources/Schema/Entities/SidearmWeaponBlendTree.xlm b/resources/Schema/Entities/SidearmWeaponBlendTree.xlm new file mode 100644 index 00000000..8a3dfb8e --- /dev/null +++ b/resources/Schema/Entities/SidearmWeaponBlendTree.xlm @@ -0,0 +1,101 @@ + + + + + + Aim + WeaponBlend + + + + + + + + + MovementBlend2 + ActionBlend + + + + + + + + Reload + Fire + + + + + + + + ReloadSwitchU + false + + + + + + + + + ShootSecWepU + false + + + + + + + + + + + Idle + Run + + + + + + + + IdleSecWepU + true + + + + + + + + + IdleSecWepU + true + + + + + + + + + + + + + AimSecWepA + + 0.10000000149011612 + false + true + + + + + + + + diff --git a/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml b/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml new file mode 100644 index 00000000..c3c06142 --- /dev/null +++ b/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml @@ -0,0 +1,202 @@ + + + + + + MovementBlend + ActionBlend + + + Models/Characters/Assault/FirstPersonAssaultBlue.mesh + + + + + + + + + Idle + Run + 1 + true + + + + + + + + IdleSecF + true + true + + + + + + + + + RunSecF + true + true + + + + + + + + + + + Fire + Reload + 0 + + + + + + + + ShootSecF + false + + + + + + + + + ReloadSwitchSecF + false + + + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/SecondaryWeaponBlue.mesh + + + + + + + + + + + Schema/Entities/Ray2Red.xml + + + + + + + + + + + Schema/Entities/WeaponSidearmReloadEffectView.xml + + + + + + + + + + + R_Ammo_Joint + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + 16 + Fonts/DroidSans.ttf,64 + + + + + SidearmWeapon + MagazineAmmo + + + + + + + + + + + + 8 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + Schema/Entities/FriendlyAmmoHUD.xml + + + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponSidearmReloadEffectView.xml b/resources/Schema/Entities/WeaponSidearmReloadEffectView.xml new file mode 100644 index 00000000..fce19d7f --- /dev/null +++ b/resources/Schema/Entities/WeaponSidearmReloadEffectView.xml @@ -0,0 +1,54 @@ + + + + + + 2 + + + + + + + + + + + 1 + 1 + -1 + 1 + + true + + + Models/Weapons/Blue/SecondaryWeaponBlue.mesh + true + + + + + + + + + 1 + + + + + 1 + + true + + + Models/Weapons/Blue/SecondaryWeaponBlue.mesh + true + + + + + + + + diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index fad64d77..e30c2e9f 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -75,18 +75,18 @@ void AnimationSystem::UpdateAnimations(double dt) try { model = ResourceManager::Load<::Model, true>(modelEntity["Model"]["Resource"]); } catch (const std::exception&) { - return; + continue; } Skeleton* skeleton = model->m_RawModel->m_Skeleton; if (skeleton == nullptr) { - return; + continue; } const Skeleton::Animation* animation = skeleton->GetAnimation(animationC["AnimationName"]); if (animation == nullptr) { - continue;; + continue; } double animationSpeed = (double)animationC["Speed"]; diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 8c92b35b..cf2aa9c5 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -166,6 +166,14 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) void AssaultWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) { cWeapon["FireCooldown"] = (double)cWeapon["EquipTime"]; + + if (wi.ThirdPersonPlayerModel.Valid()) { + Events::AutoAnimationBlend b1; + b1.RootNode = wi.ThirdPersonPlayerModel; + b1.NodeName = "AssaultWeapon"; + b1.SingleLevelBlend = true; + m_EventBroker->Publish(b1); + } } void AssaultWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index db5a9ede..7ac802de 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -14,6 +14,62 @@ void SidearmWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWra void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { + + CheckAmmo(cWeapon, wi); + + // Start reloading automatically if at 0 mag ammo + int& magAmmo = cWeapon["MagazineAmmo"]; + if (m_ConfigAutoReload && magAmmo <= 0) { + OnReload(cWeapon, wi); + } + + // 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"]; + + magAmmo = magSize; + isReloading = false; + if (wi.FirstPersonEntity.Valid()) { + wi.FirstPersonEntity.FirstChildByName("ViewModel")["Model"]["Visible"] = true; + } + if (wi.ThirdPersonEntity.Valid()) { + wi.ThirdPersonEntity["Model"]["Visible"] = true; + } + } + double reloadTime = cWeapon["ReloadTime"]; + if (isReloading && reloadTimer <= reloadTime / 2) { + + } + + // 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 animationWeight = glm::min(speed, movementSpeed) / movementSpeed; + EntityWrapper rootNode = wi.FirstPersonEntity; + if (rootNode.Valid()) { + EntityWrapper blend = rootNode.FirstChildByName("MovementBlend"); + if (blend.Valid()) { + (double&)blend["Blend"]["Weight"] = animationWeight; + } + } + if ((bool)cWeapon["Automatic"] && canFire(cWeapon)) { fireBullet(cWeapon, wi); } @@ -32,6 +88,67 @@ void SidearmWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapon cWeapon["TriggerHeld"] = false; } + +void SidearmWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + bool& reloadQueued = cWeapon["ReloadQueued"]; + bool& isReloading = cWeapon["IsReloading"]; + if (reloadQueued || isReloading) { + return; + } + + int& magAmmo = cWeapon["MagazineAmmo"]; + int& magSize = cWeapon["MagazineSize"]; + if (magAmmo >= magSize) { + return; + } + + double reloadTime = cWeapon["ReloadTime"]; + double& reloadTimer = cWeapon["ReloadTimer"]; + + // Start reload + reloadQueued = true; + reloadTimer = reloadTime; + + // Play animation + playAnimationAndReturn(wi.FirstPersonEntity, "ActionBlend", "Reload"); + // Third person anim + Events::AutoAnimationBlend eReloadBlend; + eReloadBlend.RootNode = wi.ThirdPersonPlayerModel; + eReloadBlend.NodeName = "Reload"; + eReloadBlend.Restart = true; + eReloadBlend.Start = true; + m_EventBroker->Publish(eReloadBlend); + + // Spawn explosion effect + if (wi.FirstPersonEntity.Valid()) { + if (IsClient) { + EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("ReloadSpawner"); + if (reloadEffectSpawner.Valid()) { + reloadEffectSpawner.DeleteChildren(); + SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); + } + } + wi.FirstPersonEntity.FirstChildByName("ViewModel")["Model"]["Visible"] = false; + } + if (wi.ThirdPersonEntity.Valid()) { + if (IsServer) { + EntityWrapper reloadEffectSpawner = wi.ThirdPersonEntity.FirstChildByName("ReloadSpawner"); + if (reloadEffectSpawner.Valid()) { + reloadEffectSpawner.DeleteChildren(); + SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); + } + } + 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 SidearmWeaponBehaviour::OnEquip(ComponentWrapper cWeapon, WeaponInfo& wi) { cWeapon["FireCooldown"] = (double)cWeapon["EquipTime"]; @@ -59,6 +176,14 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi { cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"]; + // Ammo + int& magAmmo = cWeapon["MagazineAmmo"]; + if (magAmmo <= 0) { + return; + } else { + magAmmo -= 1; + } + // Get weapon model based on current person EntityWrapper weaponModelEntity = getRelevantWeaponEntity(wi); if (!weaponModelEntity.Valid()) { @@ -73,7 +198,20 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi float distance = traceRayDistance(origin, direction); EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner); if (ray.Valid()) { - ((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f); + ((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); } } @@ -95,7 +233,184 @@ 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 + bool cooldownPassed = (double)cWeapon["FireCooldown"] <= 0.0; + bool isNotReloading = !(bool)cWeapon["IsReloading"]; + return triggerHeld && cooldownPassed && isNotReloading; +} + +bool SidearmWeaponBehaviour::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; + giveAmmo(cWeapon, wi, victim); + } + + // Deal damage! + Events::PlayerDamage ePlayerDamage; + ePlayerDamage.Inflictor = wi.Player; + ePlayerDamage.Victim = victim; + ePlayerDamage.Damage = damage; + m_EventBroker->Publish(ePlayerDamage); + + return damage > 0; +} + +void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver) +{ + if (receiver.HasComponent("AssaultWeapon")) { + int magazineSize = receiver["AssaultWeapon"]["MagazineSize"]; + int& magazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"]; + + int maxAmmo = receiver["AssaultWeapon"]["MaxAmmo"]; + int& ammo = receiver["AssaultWeapon"]["Ammo"]; + + if(magazineAmmo < magazineSize) { + magazineAmmo += 1; + } else if (ammo < maxAmmo) { + ammo += 1; + } + } else if (receiver.HasComponent("DefenderWeapon")) { + int magazineSize = receiver["DefenderWeapon"]["MagazineSize"]; + int& magazineAmmo = receiver["DefenderWeapon"]["MagazineAmmo"]; + + int maxAmmo = receiver["DefenderWeapon"]["MaxAmmo"]; + int& ammo = receiver["DefenderWeapon"]["Ammo"]; + + if (magazineAmmo < magazineSize) { + magazineAmmo += 1; + } else if (ammo < maxAmmo) { + ammo += 1; + } + } +} + +void SidearmWeaponBehaviour::CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + // Only check ammo client side + if (!IsClient) { + return; + } + + // Only handle ammo check for the local player + if (wi.Player != LocalPlayer) { + return; + } + + // Make sure the player isn't checking from the grave + if (!wi.Player.Valid()) { + return; + } + + // 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()) { + RemoveFrindlyAmmoHUD(wi); + return; + } + + // Don't let us somehow shoot ourselves in the foot + if (victim == LocalPlayer) { + RemoveFrindlyAmmoHUD(wi); + return; + } + + // Only care about players being hit + if (!victim.HasComponent("Player")) { + victim = victim.FirstParentWithComponent("Player"); + } + if (!victim.Valid()) { + RemoveFrindlyAmmoHUD(wi); + return; + } + + + // 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"]) { + int magazineAmmo = 0; + if (victim.HasComponent("AssaultWeapon")) { + magazineAmmo = (int)victim["AssaultWeapon"]["MagazineAmmo"]; + + } else if (victim.HasComponent("DefenderWeapon")) { + magazineAmmo = (int)victim["DefenderWeapon"]["MagazineAmmo"]; + } + + + EntityWrapper friendlyAmmoHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyAmmoAttachment"); + if(friendlyAmmoHudSpawner.Valid()) { + + auto children = m_World->GetDirectChildren(friendlyAmmoHudSpawner.ID); + + if (children.first == children.second) { + EntityWrapper friendlyAmmoHud = SpawnerSystem::Spawn(friendlyAmmoHudSpawner, friendlyAmmoHudSpawner); + if (friendlyAmmoHud.Valid()) { + EntityWrapper textEntity = friendlyAmmoHud.FirstChildByName("MagazineAmmo"); + if (textEntity.Valid()) { + if (textEntity.HasComponent("Text")) { + (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + } + } + } + } else { + EntityWrapper textEntity = friendlyAmmoHudSpawner.FirstChildByName("MagazineAmmo"); + if (textEntity.Valid()) { + if (textEntity.HasComponent("Text")) { + (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + } + } + } + + } + } +} + +void SidearmWeaponBehaviour::RemoveFrindlyAmmoHUD(WeaponInfo& wi) +{ + EntityWrapper friendlyAmmoHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyAmmoAttachment"); + if (friendlyAmmoHudSpawner.Valid()) { + friendlyAmmoHudSpawner.DeleteChildren(); + } +} From 060585a388a19c139e79ad33906cd42093f12d2f Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sat, 12 Mar 2016 02:39:06 +0100 Subject: [PATCH 08/44] Aim fixed for all weapons --- include/Game/Systems/PlayerMovementSystem.h | 2 + .../Schema/Entities/AmmoShareEffectView.xml | 33 +++ resources/Schema/Entities/FriendlyAmmoHUD.xml | 22 +- .../Schema/Entities/PlayerAssaultBlue.xml | 12 +- .../Entities/WeaponSidearmAssaultBlueView.xml | 11 +- .../WeaponSidearmDefenderBlueView.xml | 236 ++++++++++-------- src/Game/Systems/PlayerMovementSystem.cpp | 33 ++- .../Weapon/DefenderWeaponBehaviour.cpp | 5 +- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 52 +++- 9 files changed, 268 insertions(+), 138 deletions(-) create mode 100644 resources/Schema/Entities/AmmoShareEffectView.xml diff --git a/include/Game/Systems/PlayerMovementSystem.h b/include/Game/Systems/PlayerMovementSystem.h index 981fc13a..6ad52a95 100644 --- a/include/Game/Systems/PlayerMovementSystem.h +++ b/include/Game/Systems/PlayerMovementSystem.h @@ -46,4 +46,6 @@ private: void updateMovementControllers(double dt); void updateVelocity(EntityWrapper player, double dt); + + void setAim(EntityWrapper root, std::string weaponNodeName, double time); }; \ No newline at end of file diff --git a/resources/Schema/Entities/AmmoShareEffectView.xml b/resources/Schema/Entities/AmmoShareEffectView.xml new file mode 100644 index 00000000..651d1621 --- /dev/null +++ b/resources/Schema/Entities/AmmoShareEffectView.xml @@ -0,0 +1,33 @@ + + + + + + 1.2000000476837158 + + + + + 1.2000000476837158 + -1 + 1.2000000476837158 + + true + true + + + 16.040000915527344 + Models/Effects/JumpEffectHexagon.mesh + + true + + + + + + + + + + + diff --git a/resources/Schema/Entities/FriendlyAmmoHUD.xml b/resources/Schema/Entities/FriendlyAmmoHUD.xml index 5ab1b754..57209829 100644 --- a/resources/Schema/Entities/FriendlyAmmoHUD.xml +++ b/resources/Schema/Entities/FriendlyAmmoHUD.xml @@ -16,7 +16,7 @@ - + @@ -33,11 +33,25 @@ 88 Fonts/DroidSans.ttf,64 - + - - + + + + + + + + + + 88 + Fonts/DroidSans.ttf,64 + + + + + diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index 7a2010e6..4ca636da 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -15,7 +15,9 @@ - + + 10 + @@ -902,10 +904,10 @@ - + - DashLeftF + DashRightF 1.7999999523162842 false @@ -914,10 +916,10 @@ - + - DashRightF + DashLeftF 1.7999999523162842 false diff --git a/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml b/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml index c3c06142..620d9416 100644 --- a/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml @@ -190,11 +190,20 @@ Schema/Entities/FriendlyAmmoHUD.xml - + + + + + Schema/Entities/AmmoShareEffectView.xml + + + + + diff --git a/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml b/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml index 45f18c33..3ff8b0a2 100644 --- a/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml @@ -48,116 +48,6 @@ - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/SecondaryWeaponBlue.mesh - - - - - - - - - - - Schema/Entities/RayBlue.xml - - - - - - - - - - - Schema/Entities/ReloadEffectView.xml - - - - - - - - - - - R_Ammo_Joint - true - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - - - - - 38 - Fonts/DroidSans.ttf,64 - - - - - Sidearm - Ammo - - - - - - - - - - - - 5 - Fonts/DroidSans.ttf,64 - - - - - Sidearm - MagazineAmmo - - - - - - - - - - - @@ -190,6 +80,132 @@ + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/SecondaryWeaponBlue.mesh + + + + + + + + + + + Schema/Entities/Ray2Red.xml + + + + + + + + + + + Schema/Entities/WeaponSidearmReloadEffectView.xml + + + + + + + + + + + R_Ammo_Joint + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + 16 + Fonts/DroidSans.ttf,64 + + + + + SidearmWeapon + MagazineAmmo + + + + + + + + + + + + 8 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + Schema/Entities/FriendlyAmmoHUD.xml + + + + + + + + + + + Schema/Entities/AmmoShareEffectView.xml + + + + + + + diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index cfe7356c..b86d4140 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -82,17 +82,15 @@ void PlayerMovementSystem::updateMovementControllers(double dt) // Limit camera pitch so we don't break our necks cameraOrientation.x = glm::clamp(cameraOrientation.x, -glm::half_pi(), glm::half_pi()); + float pitch = cameraOrientation.x; + double time = ((pitch + glm::half_pi()) / glm::pi()); + // Set third person model aim pitch EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); if (playerModel.Valid()) { - EntityWrapper aimPrimaryEntity = playerModel.FirstChildByName("Aim"); - if(aimPrimaryEntity.Valid()){ - if(aimPrimaryEntity.HasComponent("Animation")) { - float pitch = cameraOrientation.x; - double time = ((pitch + glm::half_pi()) / glm::pi()); - (double&)aimPrimaryEntity["Animation"]["Time"] = time; - } - } + setAim(playerModel, "SidearmWeapon", time); + setAim(playerModel, "AssaultWeapon", time); + setAim(playerModel, "DefenderWeapon", time); } } @@ -308,6 +306,25 @@ void PlayerMovementSystem::updateVelocity(EntityWrapper player, double dt) position += velocity * (float)dt; } + +void PlayerMovementSystem::setAim(EntityWrapper root, std::string weaponNodeName, double time) +{ + if (root.Valid()) { + EntityWrapper blendTreeUpper = root.FirstChildByName("BlendTreeUpper"); + if (blendTreeUpper.Valid()) { + EntityWrapper weapon = blendTreeUpper.FirstChildByName(weaponNodeName); + if(weapon.Valid()) { + EntityWrapper aim = weapon.FirstChildByName("Aim"); + if (aim.Valid()) { + if (aim.HasComponent("Animation")) { + (double&)aim["Animation"]["Time"] = time; + } + } + } + } + } +} + void PlayerMovementSystem::playerStep(double dt) { if (!m_LocalPlayer.Valid()) { diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index cf611c44..f342f291 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -353,6 +353,9 @@ void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& glm::vec3 origin = Transform::AbsolutePosition(wi.Player.FirstChildByName("Camera")); glm::vec3 direction = pelletRotation * glm::vec3(0, 0, -1); float distance = traceRayDistance(origin, direction); + + // Collision::EntityFirstHitByRay(Ray(origin, direction), m_CollisionOctree, distance, pos); + EntityWrapper ray = SpawnerSystem::Spawn(muzzle); if (ray.Valid()) { ComponentWrapper cTransform = ray["Transform"]; @@ -397,7 +400,7 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w float yRefFOV = glm::radians(59.f); float yRef = glm::tan(yRefFOV) * nearClip; float yRatio = yRef / (glm::tan(yFOV) * nearClip); - float yMax = yRatio * (glm::tan(spreadAngle) * farClip); + float yMax = yRatio * (glm::tan(spreadAngle) * (farClip - nearClip)) * glm::pi(); // ????? Good enough???? LOG_DEBUG("Ratio: %f", yRatio); LOG_DEBUG("fatClip: %f", farClip); diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index 7ac802de..9c12bb2c 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -297,6 +297,8 @@ bool SidearmWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver) { + bool gaveAmmo = false; + if (receiver.HasComponent("AssaultWeapon")) { int magazineSize = receiver["AssaultWeapon"]["MagazineSize"]; int& magazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"]; @@ -306,8 +308,10 @@ void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, if(magazineAmmo < magazineSize) { magazineAmmo += 1; + gaveAmmo = true; } else if (ammo < maxAmmo) { ammo += 1; + gaveAmmo = true; } } else if (receiver.HasComponent("DefenderWeapon")) { int magazineSize = receiver["DefenderWeapon"]["MagazineSize"]; @@ -318,8 +322,20 @@ void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, if (magazineAmmo < magazineSize) { magazineAmmo += 1; + gaveAmmo = true; } else if (ammo < maxAmmo) { ammo += 1; + gaveAmmo = true; + } + } + + + if(gaveAmmo) { + EntityWrapper effectSpawner = wi.FirstPersonEntity.FirstChildByName("AmmoShareEffectSpawner"); + if(effectSpawner.Valid()) { + if (effectSpawner.HasComponent("Spawner")) { + SpawnerSystem::Spawn(effectSpawner, effectSpawner); + } } } } @@ -371,26 +387,38 @@ void SidearmWeaponBehaviour::CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi) // 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"]) { int magazineAmmo = 0; + int ammo = 0; if (victim.HasComponent("AssaultWeapon")) { magazineAmmo = (int)victim["AssaultWeapon"]["MagazineAmmo"]; + ammo = (int)victim["AssaultWeapon"]["Ammo"]; } else if (victim.HasComponent("DefenderWeapon")) { magazineAmmo = (int)victim["DefenderWeapon"]["MagazineAmmo"]; + ammo = (int)victim["DefenderWeapon"]["Ammo"]; } - + EntityWrapper friendlyAmmoHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyAmmoAttachment"); - if(friendlyAmmoHudSpawner.Valid()) { + if (friendlyAmmoHudSpawner.Valid()) { auto children = m_World->GetDirectChildren(friendlyAmmoHudSpawner.ID); if (children.first == children.second) { - EntityWrapper friendlyAmmoHud = SpawnerSystem::Spawn(friendlyAmmoHudSpawner, friendlyAmmoHudSpawner); - if (friendlyAmmoHud.Valid()) { - EntityWrapper textEntity = friendlyAmmoHud.FirstChildByName("MagazineAmmo"); - if (textEntity.Valid()) { - if (textEntity.HasComponent("Text")) { - (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + if (friendlyAmmoHudSpawner.HasComponent("Spawner")) { + EntityWrapper friendlyAmmoHud = SpawnerSystem::Spawn(friendlyAmmoHudSpawner, friendlyAmmoHudSpawner); + if (friendlyAmmoHud.Valid()) { + EntityWrapper textEntity = friendlyAmmoHud.FirstChildByName("MagazineAmmo"); + if (textEntity.Valid()) { + if (textEntity.HasComponent("Text")) { + (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + } + } + + EntityWrapper ammoTextEntity = friendlyAmmoHud.FirstChildByName("Ammo"); + if (ammoTextEntity.Valid()) { + if (ammoTextEntity.HasComponent("Text")) { + (std::string&)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); + } } } } @@ -401,8 +429,14 @@ void SidearmWeaponBehaviour::CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi) (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); } } + + EntityWrapper ammoTextEntity = friendlyAmmoHudSpawner.FirstChildByName("Ammo"); + if (ammoTextEntity.Valid()) { + if (ammoTextEntity.HasComponent("Text")) { + (std::string&)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); + } + } } - } } } From 8e266984f4ce9560cf6912e14216fc978d083ff5 Mon Sep 17 00:00:00 2001 From: Tleety Date: Sat, 12 Mar 2016 14:37:26 +0100 Subject: [PATCH 09/44] Player HUD should now be ok, color of health still shit tho --- assets | 2 +- .../Schema/Entities/PlayerAssaultBlue.xml | 890 +++++++++--------- .../Schema/Entities/PlayerDefenderBlue.xml | 839 +++++++++-------- resources/Schema/Entities/PlayerHUD.xml | 183 ++-- .../Schema/Entities/StartMenu_simple.xml | 440 +++++++++ resources/Shaders/Sprite.frag.glsl | 4 +- src/Game/Systems/AbilityCooldownHUDSystem.cpp | 13 +- 7 files changed, 1448 insertions(+), 923 deletions(-) create mode 100644 resources/Schema/Entities/StartMenu_simple.xml diff --git a/assets b/assets index 69ddae17..40f6ae62 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 69ddae179ac02d5c1582a8c6834451b3f5e4bbaf +Subproject commit 40f6ae6201adb94e99ee084b081fc8467f80953a diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index 4ca636da..33f1df73 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -57,449 +57,468 @@ - + - - - + + Schema/Entities/PlayerHUD.xml + + - - - - false - Models/Core/UnitQuad.mesh - - Textures/Weapons/Crosshair/SmallThickHoleDot.png - - - - - - - - - - - - Schema/Entities/HitMarker.xml - - - - - - + - - + - + - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 2 - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 3 - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 1 - - - - 4 - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 1 - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 1 - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - - - - Models/Widgets/Arrows/Arrow5.mesh - - - - - - - - - - - - - - - - - - - - - 1 - - - - 100/100 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - 1 - - - - - Models/Core/UnitQuad.mesh - - Textures/HealthHUD3.png - - - - - - - - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Assault-01.png - - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Defender-01.png - - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Sniper-01.png - - - - - - - - - - - - - - - - - - false Models/Core/UnitQuad.mesh - Textures\Icons\Abilities\Superman-01.png - + Textures/Weapons/Crosshair/SmallThickHoleDot.png - - - + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + - + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + 1 + + + + 4 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 1 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + 1 + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + + + + + + + + + - 0.0 + Fonts/DroidSans.ttf,64 - - false + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + - - - + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/ArrowBlue.mesh + + + + + + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + 1 + + + + + Models/Core/UnitQuad.mesh + + Textures/HealthHUD3.png + + true + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Assault-01.png + + true + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Defender-01.png + + true + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Sniper-01.png + + false + true + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Abilities/Long/Superman-01.png + + true + + + + + @@ -570,6 +589,7 @@ Models/Characters/Assault/AssaultBlue.mesh + false @@ -583,8 +603,8 @@ Schema/Entities/WeaponAssaultBlueWorld.xml - - + + AssaultWeapon @@ -604,8 +624,8 @@ Schema/Entities/SidearmWeaponBlueWorld.xml - - + + SidearmWeapon @@ -672,7 +692,7 @@ CrouchStrafeLeftF - + true @@ -683,7 +703,7 @@ CrouchStrafeRightF - + true @@ -696,7 +716,7 @@ CrouchWalkF - + true @@ -709,7 +729,7 @@ CrouchF - + true @@ -752,7 +772,7 @@ WalkF - + true @@ -763,7 +783,7 @@ RunF - + 2 true @@ -787,7 +807,7 @@ StrafeLeftF - + 2 true @@ -799,7 +819,7 @@ StrafeRightF - + 2 true @@ -815,7 +835,7 @@ IdleF - + true @@ -1012,7 +1032,7 @@ IdleAssaultRifleU - + true true @@ -1024,7 +1044,7 @@ IdleAssaultRifleU - + true true diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index 5fcc6c64..30b0a3a1 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -30,6 +30,7 @@ + @@ -90,448 +91,475 @@ - + - - - + + Schema/Entities/PlayerHUD.xml + + - - - - false - Models/Core/UnitQuad.mesh - - Textures/Weapons/Crosshair/SmallThickHoleDot.png - - - - - - - - - - - - Schema/Entities/HitMarker.xml - - - - - - + - - + - + false Models/Core/UnitQuad.mesh - Textures/Core/UnitHexagon.png - + Textures/Weapons/Crosshair/SmallThickHoleDot.png - + + - - - - - - - - 2 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - + - + - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 3 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 1 - - - - 4 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 1 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 1 - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - + + Schema/Entities/HitMarker.xml + - + - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - - - - Models/Widgets/Arrows/Arrow5.mesh - - - - - - - - - - - - - - - - - - - - 1 - - - - 150/150 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - 1 - - - - - Models/Core/UnitQuad.mesh - - Textures/HealthHUD3.png - - - - - - - - - - - - - + + - + - - - false Models/Core/UnitQuad.mesh - Textures/Icons/Boosts/Assault-01.png - + Textures/Core/UnitHexagon.png + + true - - - + + + + + + + + 1 + + + + 4 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 1 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + 1 + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + - + - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Defender-01.png - - + + + Fonts/DroidSans.ttf,64 + + + + - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Sniper-01.png - - - - - - + - + - - - inf - - - - false - Models/Core/UnitQuad.mesh - - Textures\Icons\Abilities\SheildDots-01.png - - + + + + + + + + Models/Widgets/Arrows/ArrowBlue.mesh + - - - + + + + + + + + + + + + + + + 1 + + + + 150/150 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + 1 + + + + + Models/Core/UnitQuad.mesh + + Textures/HealthHUD3.png + + true + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Assault-01.png + + true + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Defender-01.png + + true + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Sniper-01.png + + false + true + + + + + + + + + + + + + + + + 1 + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Abilities/Long/SheildDots-01.png + + true + + + + + + + + + + + @@ -564,6 +592,7 @@ + 1.7999999523162842 Models/Characters/Defender/DefenderBlue.mesh @@ -578,8 +607,8 @@ Schema/Entities/WeaponDefenderBlueWorld.xml - - + + DefenderWeapon @@ -599,8 +628,8 @@ Schema/Entities/SidearmWeaponBlueWorld.xml - - + + SidearmWeapon @@ -667,7 +696,7 @@ CrouchStrafeLeftF - + true @@ -678,7 +707,7 @@ CrouchStrafeRightF - + true @@ -691,7 +720,7 @@ CrouchWalkF - + true @@ -704,7 +733,7 @@ CrouchF - + true @@ -747,7 +776,7 @@ WalkF - + true @@ -758,7 +787,7 @@ RunF - + 2 true @@ -782,7 +811,7 @@ StrafeLeftF - + 2 true @@ -794,7 +823,7 @@ StrafeRightF - + 2 true @@ -810,7 +839,7 @@ IdleF - + true @@ -877,7 +906,7 @@ IdleAssaultRifleU - + true true @@ -889,7 +918,7 @@ IdleAssaultRifleU - + true true @@ -969,7 +998,7 @@ ShieldFrontU - + true diff --git a/resources/Schema/Entities/PlayerHUD.xml b/resources/Schema/Entities/PlayerHUD.xml index cf07bc56..5891362d 100644 --- a/resources/Schema/Entities/PlayerHUD.xml +++ b/resources/Schema/Entities/PlayerHUD.xml @@ -11,9 +11,10 @@ - Textures/Weapons/Crosshair/SmallThickHoleDot.png - false + Models/Core/UnitQuad.mesh + + Textures/Weapons/Crosshair/SmallThickHoleDot.png @@ -42,10 +43,52 @@ - Textures/Core/UnitHexagon.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + true + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true @@ -61,9 +104,11 @@ 3 - Textures/Core/UnitHexagon_Rotated.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true @@ -78,10 +123,12 @@ - Textures/Core/UnitHexagon.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + true @@ -98,9 +145,11 @@ 4 - Textures/Core/UnitHexagon_Rotated.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true @@ -115,46 +164,12 @@ - Textures/Core/UnitHexagon.png - false - - - - - - - - - - - - - - 2 - - - Textures/Core/UnitHexagon_Rotated.png - - false - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh - false + Textures/Core/UnitHexagon.png + true @@ -170,9 +185,11 @@ 1 - Textures/Core/UnitHexagon_Rotated.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true @@ -187,10 +204,12 @@ - Textures/Core/UnitHexagon.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + true @@ -205,9 +224,11 @@ - Textures/Core/UnitHexagon_Rotated.png - false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true @@ -284,10 +305,11 @@ - Models/Widgets/Arrows/Arrow5.mesh + Models/Widgets/Arrows/ArrowBlue.mesh + @@ -310,7 +332,7 @@ 100/100 Fonts/DroidSans.ttf,64 - + @@ -329,9 +351,11 @@ - Textures/HealthHUD3.png + Models/Core/UnitQuad.mesh + Textures/HealthHUD3.png + true @@ -350,16 +374,18 @@ - + - Textures/Icons/Boosts/Assault-01.png - false - + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Assault-01.png + + true - + @@ -369,16 +395,18 @@ - + - Textures/Icons/Boosts/Defender-01.png - false - + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Defender-01.png + + true - + @@ -388,13 +416,16 @@ - + - Textures/Icons/Boosts/Sniper-01.png - false - + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Sniper-01.png + + false + true @@ -413,15 +444,17 @@ - Textures/Icons/Abilities/Superman-01.png - false - + Models/Core/UnitQuad.mesh + + Textures/Test/aM4ME4GR.png + + true - - + + diff --git a/resources/Schema/Entities/StartMenu_simple.xml b/resources/Schema/Entities/StartMenu_simple.xml new file mode 100644 index 00000000..944c51b5 --- /dev/null +++ b/resources/Schema/Entities/StartMenu_simple.xml @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + Schema/Entities/NewMap2version5NEW.xml + + + + + + + + + + + + + + + + 0.10000000149011612 + + + + + + + + + + + 0.20000000298023224 + + + + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/MainMenu.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + Play + 1 + + + + + + + + + + + Play + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + Credits + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + Option + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + Quit + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + + + + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/ServerList.xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Shaders/Sprite.frag.glsl b/resources/Shaders/Sprite.frag.glsl index 5b6567eb..6a7169e1 100644 --- a/resources/Shaders/Sprite.frag.glsl +++ b/resources/Shaders/Sprite.frag.glsl @@ -29,9 +29,9 @@ void main() vec4 color_result = Color * diffuseTexel; float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0; - float fillResult = floor(pos*FillPercentage); + float fillResult = clamp(floor(pos/FillPercentage), 0, 1); - color_result = FillColor*diffuseTexel.a*fillResult + color_result*(1-fillResult); + color_result = FillColor*diffuseTexel.a*(1 - fillResult) + color_result*fillResult; sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1)); diff --git a/src/Game/Systems/AbilityCooldownHUDSystem.cpp b/src/Game/Systems/AbilityCooldownHUDSystem.cpp index 07461f95..23e9a6b7 100644 --- a/src/Game/Systems/AbilityCooldownHUDSystem.cpp +++ b/src/Game/Systems/AbilityCooldownHUDSystem.cpp @@ -23,26 +23,29 @@ void AbilityCooldownHUDSystem::Update(double dt) if (!abilityEntity.Valid()) { //If we dont have a shield ability, we return, since we cannot do anything. + if (entity.HasComponent("Sprite")) { + (std::string&)entity["Sprite"]["DiffuseTexture"] = "Textures/Test/aM4ME4GR.png"; + } 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"; + (std::string&)entity["Sprite"]["DiffuseTexture"] = "Textures/Icons/Abilities/Long/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"; + (std::string&)entity["Sprite"]["DiffuseTexture"] = "Textures/Icons/Abilities/Long/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"; + (std::string&)entity["Sprite"]["DiffuseTexture"] = "Textures/Icons/Abilities/Long/Superman-01.png"; } } @@ -63,12 +66,12 @@ void AbilityCooldownHUDSystem::Update(double dt) } if (abilityName == "ShieldAbility") { - maxAbilityCD = 0.0; + maxAbilityCD = 1.0; currentAbilityCD = 1 - (bool)abilityEntity[abilityName]["Active"]; } if (abilityName == "SprintAbility") { - maxAbilityCD = 0.0; + maxAbilityCD = 1.0; currentAbilityCD = 1 - (bool)abilityEntity[abilityName]["Active"]; } From 4334ea067e0fc25387ba57338731b951af198868 Mon Sep 17 00:00:00 2001 From: Tleety Date: Sat, 12 Mar 2016 14:44:03 +0100 Subject: [PATCH 10/44] System skeleton --- include/Game/Systems/WinScreenSystem.h | 17 +++++++++++++++++ src/Game/Systems/WinScreenSystem.cpp | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 include/Game/Systems/WinScreenSystem.h create mode 100644 src/Game/Systems/WinScreenSystem.cpp diff --git a/include/Game/Systems/WinScreenSystem.h b/include/Game/Systems/WinScreenSystem.h new file mode 100644 index 00000000..2563b4b5 --- /dev/null +++ b/include/Game/Systems/WinScreenSystem.h @@ -0,0 +1,17 @@ +#ifndef WinScreenSystem_h__ +#define WinScreenSystem_h__ + +#include "Core/System.h" +#include "Input/EInputCommand.h" + +class WinScreenSystem : public ImpureSystem +{ +public: + WinScreenSystem(SystemParams params); + + virtual void Update(double dt) override; + +private: +}; + +#endif \ No newline at end of file diff --git a/src/Game/Systems/WinScreenSystem.cpp b/src/Game/Systems/WinScreenSystem.cpp new file mode 100644 index 00000000..97cc0747 --- /dev/null +++ b/src/Game/Systems/WinScreenSystem.cpp @@ -0,0 +1,12 @@ +#include "Systems/WinScreenSystem.h" +#include "Rendering/ESetCamera.h" +#include "Core/ELockMouse.h" + +WinScreenSystem::WinScreenSystem(SystemParams params) + : System(params) +{ +} + +void WinScreenSystem::Update(double dt) +{ +} \ No newline at end of file From 8c2a665ccb99b17b5daa18ab059daffb9fc123ad Mon Sep 17 00:00:00 2001 From: Tleety Date: Sat, 12 Mar 2016 15:45:07 +0100 Subject: [PATCH 11/44] Some Entities for endscreen and some basic logic in the EndScreenSystem --- include/Game/Systems/EndScreenSystem.h | 21 +++++ include/Game/Systems/WinScreenSystem.h | 17 ---- resources/Schema/Components.xsd | 1 + resources/Schema/Components/EndScreen.xml | 3 + resources/Schema/Components/EndScreen.xsd | 10 +++ resources/Schema/Entities/EndScreen.xml | 88 +++++++++++++++++++ resources/Schema/Entities/ScoreBoard_Main.xml | 15 +++- resources/Schema/Types/Entity.xsd | 1 + src/Game/Systems/EndScreenSystem.cpp | 18 ++++ src/Game/Systems/WinScreenSystem.cpp | 12 --- 10 files changed, 154 insertions(+), 32 deletions(-) create mode 100644 include/Game/Systems/EndScreenSystem.h delete mode 100644 include/Game/Systems/WinScreenSystem.h create mode 100644 resources/Schema/Components/EndScreen.xml create mode 100644 resources/Schema/Components/EndScreen.xsd create mode 100644 resources/Schema/Entities/EndScreen.xml create mode 100644 src/Game/Systems/EndScreenSystem.cpp delete mode 100644 src/Game/Systems/WinScreenSystem.cpp diff --git a/include/Game/Systems/EndScreenSystem.h b/include/Game/Systems/EndScreenSystem.h new file mode 100644 index 00000000..ec4702ca --- /dev/null +++ b/include/Game/Systems/EndScreenSystem.h @@ -0,0 +1,21 @@ +#ifndef EndScreenSystem_h__ +#define EndScreenSystem_h__ + +#include "Core/System.h" +#include "Input/EInputCommand.h" +#include "Rendering/ESetCamera.h" +#include "Core/EWin.h" + +class EndScreenSystem : public ImpureSystem +{ +public: + EndScreenSystem(SystemParams params); + + virtual void Update(double dt) override; + +private: + EventRelay m_EWin; + bool OnWin(const Events::Win&); +}; + +#endif \ No newline at end of file diff --git a/include/Game/Systems/WinScreenSystem.h b/include/Game/Systems/WinScreenSystem.h deleted file mode 100644 index 2563b4b5..00000000 --- a/include/Game/Systems/WinScreenSystem.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef WinScreenSystem_h__ -#define WinScreenSystem_h__ - -#include "Core/System.h" -#include "Input/EInputCommand.h" - -class WinScreenSystem : public ImpureSystem -{ -public: - WinScreenSystem(SystemParams params); - - virtual void Update(double dt) override; - -private: -}; - -#endif \ No newline at end of file diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index bc6da932..f124272f 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -68,4 +68,5 @@ + \ No newline at end of file diff --git a/resources/Schema/Components/EndScreen.xml b/resources/Schema/Components/EndScreen.xml new file mode 100644 index 00000000..8a556256 --- /dev/null +++ b/resources/Schema/Components/EndScreen.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/resources/Schema/Components/EndScreen.xsd b/resources/Schema/Components/EndScreen.xsd new file mode 100644 index 00000000..9056f210 --- /dev/null +++ b/resources/Schema/Components/EndScreen.xsd @@ -0,0 +1,10 @@ + + + + + + + Put this on the camera that will show the final screen. + + + \ No newline at end of file diff --git a/resources/Schema/Entities/EndScreen.xml b/resources/Schema/Entities/EndScreen.xml new file mode 100644 index 00000000..11ddc201 --- /dev/null +++ b/resources/Schema/Entities/EndScreen.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + false + + + + + + + + + + + Blue team win! + Fonts/DroidSans.ttf,64 + false + + + + + + + + + + + + Red team win! + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/ScoreBoard_Main.xml b/resources/Schema/Entities/ScoreBoard_Main.xml index ccc1df68..48d0782f 100644 --- a/resources/Schema/Entities/ScoreBoard_Main.xml +++ b/resources/Schema/Entities/ScoreBoard_Main.xml @@ -20,10 +20,10 @@ + - @@ -44,7 +44,7 @@ - + Schema/Entities/ScoreBoard_Red.xml @@ -55,7 +55,7 @@ - + Schema/Entities/ScoreBoard_Blue.xml @@ -63,6 +63,15 @@ + + + + Schema/Entities/EndScreen.xml + + + + + diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index c0ac15aa..2d24590c 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -71,6 +71,7 @@ + diff --git a/src/Game/Systems/EndScreenSystem.cpp b/src/Game/Systems/EndScreenSystem.cpp new file mode 100644 index 00000000..e750cca3 --- /dev/null +++ b/src/Game/Systems/EndScreenSystem.cpp @@ -0,0 +1,18 @@ +#include "Systems/EndScreenSystem.h" + + +EndScreenSystem::EndScreenSystem(SystemParams params) + : System(params) +{ + EVENT_SUBSCRIBE_MEMBER(m_EWin, &EndScreenSystem::OnWin); +} + +void EndScreenSystem::Update(double dt) +{ + +} + +bool EndScreenSystem::OnWin(const Events::Win&) +{ + +} diff --git a/src/Game/Systems/WinScreenSystem.cpp b/src/Game/Systems/WinScreenSystem.cpp deleted file mode 100644 index 97cc0747..00000000 --- a/src/Game/Systems/WinScreenSystem.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "Systems/WinScreenSystem.h" -#include "Rendering/ESetCamera.h" -#include "Core/ELockMouse.h" - -WinScreenSystem::WinScreenSystem(SystemParams params) - : System(params) -{ -} - -void WinScreenSystem::Update(double dt) -{ -} \ No newline at end of file From 0b26f23188e38caae27cf69fcdffd1e6aab49394 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sat, 12 Mar 2016 15:47:19 +0100 Subject: [PATCH 12/44] 3rd person animations idle bug fixed --- .../Engine/Input/FirstPersonInputController.h | 19 ++-- include/Engine/Rendering/BlendTree.h | 3 +- .../Schema/Entities/PlayerAssaultBlue.xml | 94 +++++-------------- .../Schema/Entities/PlayerDefenderBlue.xml | 85 ++++------------- src/Engine/Rendering/AnimationSystem.cpp | 12 ++- src/Game/Systems/PlayerMovementSystem.cpp | 2 + .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 2 +- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 3 +- 8 files changed, 67 insertions(+), 153 deletions(-) diff --git a/include/Engine/Input/FirstPersonInputController.h b/include/Engine/Input/FirstPersonInputController.h index 30d1f945..68c8a430 100644 --- a/include/Engine/Input/FirstPersonInputController.h +++ b/include/Engine/Input/FirstPersonInputController.h @@ -163,6 +163,7 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm aeb.Duration = 0.1; aeb.NodeName = "Run"; aeb.RootNode = firstPersonModel; + aeb.SingleLevelBlend = true; aeb.Start = true; m_EventBroker->Publish(aeb); } @@ -172,6 +173,7 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm aeb.Duration = 0.1; aeb.NodeName = "Run"; aeb.RootNode = firstPersonModel; + aeb.SingleLevelBlend = true; aeb.Start = true; aeb.Reverse = true; m_EventBroker->Publish(aeb); @@ -211,10 +213,10 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm } } - //Animation - if (glm::length2(m_Movement) < 0.25f) { - //Blend to Idle - if (m_PlayerEntity.Valid()) { + if (m_PlayerEntity.Valid()) { + glm::vec2 movementXZ = glm::vec2(m_Movement.x, m_Movement.z); + if (glm::length(movementXZ) < 0.1f) { + //Blend to Idle EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel"); if (playerModel.Valid()) { Events::AutoAnimationBlend aeb; @@ -233,10 +235,8 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm aeb.Start = true; m_EventBroker->Publish(aeb); } - } - } else { - //Blend to movement - if (m_PlayerEntity.Valid()) { + } else { + //Blend to movement EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel"); if (playerModel.Valid()) { Events::AutoAnimationBlend aeb; @@ -248,8 +248,7 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm } } - - if (glm::length2(m_Movement) > 0) { + if (glm::length(m_Movement) > 0) { m_Movement = glm::normalize(m_Movement); //Animation diff --git a/include/Engine/Rendering/BlendTree.h b/include/Engine/Rendering/BlendTree.h index 502a1cc9..46ea7f0c 100644 --- a/include/Engine/Rendering/BlendTree.h +++ b/include/Engine/Rendering/BlendTree.h @@ -49,9 +49,7 @@ public: next = next->Child[0]; } } - return next; - } }; @@ -82,6 +80,7 @@ public: BlendTree::Node* FirstCommonParent(Node* node1, Node* node2); EntityWrapper GetSubTreeRoot(std::string nodeName); + std::vector GetSubTreeRoots(std::string nodeName); std::vector GetSingleLevelRoots(std::string name); std::vector GetEntitesByName(std::string name); diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index 4ca636da..4797ec09 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -583,8 +583,8 @@ Schema/Entities/WeaponAssaultBlueWorld.xml - - + + AssaultWeapon @@ -604,8 +604,8 @@ Schema/Entities/SidearmWeaponBlueWorld.xml - - + + SidearmWeapon @@ -959,7 +959,7 @@ - MovementBlend + IdleAssault ActionBlend @@ -998,41 +998,17 @@ - + - - Idle - Run - 0 - + + IdleAssaultRifleU + + true + true + - - - - - IdleAssaultRifleU - - true - true - - - - - - - - - IdleAssaultRifleU - - true - true - - - - - - + @@ -1063,44 +1039,12 @@ - MovementBlend2 + IdleSidearm ActionBlend - - - - Idle - Run - 0 - - - - - - - - IdleSecWepU - true - - - - - - - - - IdleSecWepU - true - - - - - - - @@ -1133,6 +1077,16 @@ + + + + IdleSecWepU + true + + + + + diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index 5fcc6c64..84324379 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -857,48 +857,12 @@ - MovementBlend2 + IdleDefender FinalBlend - - - - Idle - Run - 0 - - - - - - - - IdleAssaultRifleU - - true - true - - - - - - - - - IdleAssaultRifleU - - true - true - - - - - - - @@ -980,6 +944,18 @@ + + + + IdleAssaultRifleU + + true + true + + + + + @@ -1007,7 +983,7 @@ - MovementBlend2 + IdleSidearm ActionBlend @@ -1044,36 +1020,15 @@ - + - - Idle - Run - + + IdleSecWepU + true + - - - - - IdleSecWepU - true - - - - - - - - - IdleSecWepU - true - - - - - - + diff --git a/src/Engine/Rendering/AnimationSystem.cpp b/src/Engine/Rendering/AnimationSystem.cpp index e30c2e9f..3895dc4a 100644 --- a/src/Engine/Rendering/AnimationSystem.cpp +++ b/src/Engine/Rendering/AnimationSystem.cpp @@ -127,8 +127,8 @@ void AnimationSystem::UpdateAnimations(double dt) void AnimationSystem::UpdateWeights(double dt) { for (auto it = m_AutoBlendQueues.begin(); it != m_AutoBlendQueues.end(); ) { - /* LOG_INFO("%s", it->first.Name().c_str()); - it->second.PrintQueue();*/ + //LOG_INFO("%s", it->first.Name().c_str()); + //it->second.PrintQueue(); if(it->second.HasActiveBlendJob()) { AutoBlendQueue::AutoBlendJob& blendJob = it->second.GetActiveBlendJob(); @@ -158,12 +158,13 @@ void AnimationSystem::UpdateWeights(double dt) bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) { - if (!e.RootNode.Valid()) { + LOG_ERROR("%s, RootNode invalid %s", e.NodeName, e.RootNode.Name().c_str()); return false; } if (!e.RootNode.HasComponent("Model")) { + LOG_ERROR("%s, RootNode has no model %s", e.NodeName, e.RootNode.Name().c_str()); return false; } @@ -171,11 +172,13 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) try { model = ResourceManager::Load<::Model, true>((std::string)e.RootNode["Model"]["Resource"]); } catch (const std::exception&) { + LOG_ERROR("%s, RootNode model not finished loading %s", e.NodeName, e.RootNode.Name().c_str()); return false; } Skeleton* skeleton = model->m_RawModel->m_Skeleton; if (skeleton == nullptr) { + LOG_ERROR("%s, RootNode skeleton invalid %s", e.NodeName, e.RootNode.Name().c_str()); return false; } @@ -183,6 +186,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) if (skeleton->BlendTrees.find(e.RootNode) != skeleton->BlendTrees.end()) { blendTree = skeleton->BlendTrees.at(e.RootNode); } else { + LOG_ERROR("%s, No blendtree was found invalid %s", e.NodeName, e.RootNode.Name().c_str()); return false; } @@ -193,6 +197,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) subTreeRoot = blendTree->GetSubTreeRoot(e.NodeName); if (!subTreeRoot.Valid()) { + LOG_ERROR("%s, subTreeRoot invalid", e.NodeName); return false; } @@ -237,6 +242,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) subTreeRoot = entity; if (!subTreeRoot.Valid()) { + LOG_ERROR("%s, subTreeRoot invalid", e.NodeName); return false; } diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index b86d4140..51d7bcef 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -24,6 +24,8 @@ void PlayerMovementSystem::Update(double dt) if (LocalPlayer.Valid()){ updateVelocity(LocalPlayer, dt); } + + m_SprintEffectTimer += dt; if (m_SprintEffectTimer < 0.016f) { return; diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index cf2aa9c5..0662cbaa 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -74,7 +74,7 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& float animationWeight = glm::min(speed, movementSpeed) / movementSpeed; EntityWrapper rootNode = wi.FirstPersonEntity; if (rootNode.Valid()) { - EntityWrapper blend = rootNode.FirstChildByName("MovementBlend"); + EntityWrapper blend = rootNode.FirstChildByName("MovementBlendAssault"); if (blend.Valid()) { (double&)blend["Blend"]["Weight"] = animationWeight; } diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index 9c12bb2c..f87f1f81 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -14,7 +14,6 @@ void SidearmWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWra void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { - CheckAmmo(cWeapon, wi); // Start reloading automatically if at 0 mag ammo @@ -64,7 +63,7 @@ void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& float animationWeight = glm::min(speed, movementSpeed) / movementSpeed; EntityWrapper rootNode = wi.FirstPersonEntity; if (rootNode.Valid()) { - EntityWrapper blend = rootNode.FirstChildByName("MovementBlend"); + EntityWrapper blend = rootNode.FirstChildByName("MovementBlendSidearm"); if (blend.Valid()) { (double&)blend["Blend"]["Weight"] = animationWeight; } From 4ba011a098c3adbd82821c67ce518d83c118dc57 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sat, 12 Mar 2016 17:01:46 +0100 Subject: [PATCH 13/44] Ammosharing over network test WIP --- include/Game/Systems/BoostSystem.h | 3 + .../Systems/Weapon/SidearmWeaponBehaviour.h | 2 +- include/Game/Systems/Weapon/WeaponBehaviour.h | 2 + .../Schema/Entities/PlayerAssaultBlue.xml | 865 +++++++++--------- .../Schema/Entities/PlayerDefenderBlue.xml | 803 ++++++++-------- src/Game/Systems/BoostSystem.cpp | 94 +- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 5 +- 7 files changed, 941 insertions(+), 833 deletions(-) diff --git a/include/Game/Systems/BoostSystem.h b/include/Game/Systems/BoostSystem.h index f02e9472..925ef438 100644 --- a/include/Game/Systems/BoostSystem.h +++ b/include/Game/Systems/BoostSystem.h @@ -6,6 +6,7 @@ #include "Core/EntityFile.h" #include "Core/EPlayerDamage.h" #include "Common.h" +#include "SpawnerSystem.h" class BoostSystem : public System { @@ -17,5 +18,7 @@ private: bool OnPlayerDamage(Events::PlayerDamage& e); std::string DetermineClass(EntityWrapper player); + + void giveAmmo(EntityWrapper giver, EntityWrapper receiver); }; #endif \ No newline at end of file diff --git a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h index 7aa20025..3123b460 100644 --- a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h @@ -37,7 +37,7 @@ private: bool playerInFirstPerson(EntityWrapper player); bool dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi); - void giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver); + // void giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver); void CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi); diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index cd067f36..6d13e741 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -305,6 +305,8 @@ private: wi.ThirdPersonEntity = thirdPersonWeapon; wi.ThirdPersonPlayerModel = thirdPersonWeapon.FirstParentWithComponent("Model"); + player["Player"]["CurrentWeapon"] = cWeapon.Info.Name; + OnEquip(cWeapon, wi); } diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index 4797ec09..c73a4c46 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -59,447 +59,466 @@ - - - + + Schema/Entities/PlayerHUD.xml + + - - - - false - Models/Core/UnitQuad.mesh - - Textures/Weapons/Crosshair/SmallThickHoleDot.png - - - - - - - - - - - - Schema/Entities/HitMarker.xml - - - - - - + - - + - + - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 2 - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 3 - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 1 - - - - 4 - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 1 - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 1 - - - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - - - - Models/Widgets/Arrows/Arrow5.mesh - - - - - - - - - - - - - - - - - - - - - 1 - - - - 100/100 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - 1 - - - - - Models/Core/UnitQuad.mesh - - Textures/HealthHUD3.png - - - - - - - - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Assault-01.png - - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Defender-01.png - - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Sniper-01.png - - - - - - - - - - - - - - - - - - false Models/Core/UnitQuad.mesh - Textures\Icons\Abilities\Superman-01.png - + Textures/Weapons/Crosshair/SmallThickHoleDot.png - - - + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + - + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + 1 + + + + 4 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 1 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + 1 + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + + + + + + + + + - 0.0 + Fonts/DroidSans.ttf,64 - - false + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + - - - + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/ArrowBlue.mesh + + + + + + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + 1 + + + + + Models/Core/UnitQuad.mesh + + Textures/HealthHUD3.png + + true + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Assault-01.png + + true + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Defender-01.png + + true + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Sniper-01.png + + false + true + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Abilities/Long/Superman-01.png + + true + + + + + @@ -904,10 +923,10 @@ - + - DashRightF + DashLeftF 1.7999999523162842 false @@ -916,10 +935,10 @@ - + - DashLeftF + DashRightF 1.7999999523162842 false diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index 84324379..c75f50fd 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -92,446 +92,473 @@ - - - + + Schema/Entities/PlayerHUD.xml + + - - - - false - Models/Core/UnitQuad.mesh - - Textures/Weapons/Crosshair/SmallThickHoleDot.png - - - - - - - - - - - - Schema/Entities/HitMarker.xml - - - - - - + - - + - + false Models/Core/UnitQuad.mesh - Textures/Core/UnitHexagon.png - + Textures/Weapons/Crosshair/SmallThickHoleDot.png - + + - - - - - - - - 2 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - + - + - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 3 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 1 - - - - 4 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 1 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 1 - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - + + Schema/Entities/HitMarker.xml + - + - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - - - - Models/Widgets/Arrows/Arrow5.mesh - - - - - - - - - - - - - - - - - - - - 1 - - - - 150/150 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - 1 - - - - - Models/Core/UnitQuad.mesh - - Textures/HealthHUD3.png - - - - - - - - - - - - - + + - + - - - false Models/Core/UnitQuad.mesh - Textures/Icons/Boosts/Assault-01.png - + Textures/Core/UnitHexagon.png + + true - - - + + + + + + + + 1 + + + + 4 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + + + + 1 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + + + + + + + + 1 + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + true + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + - + - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Defender-01.png - - + + + Fonts/DroidSans.ttf,64 + + + + - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Boosts/Sniper-01.png - - - - - - + - + - - - inf - - - - false - Models/Core/UnitQuad.mesh - - Textures\Icons\Abilities\SheildDots-01.png - - + + + + + + + + Models/Widgets/Arrows/ArrowBlue.mesh + - - - + + + + + + + + + + + + + + + 1 + + + + 150/150 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + 1 + + + + + Models/Core/UnitQuad.mesh + + Textures/HealthHUD3.png + + true + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Assault-01.png + + true + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Defender-01.png + + true + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Boosts/Sniper-01.png + + false + true + + + + + + + + + + + + + + + + 1 + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Abilities/Long/SheildDots-01.png + + true + + + + + + + + + + + diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index c3dc1f2b..2ebfff73 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -35,19 +35,25 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) return false; } - //get the XML file, example: "Schema/Entities/BoostclassName.xml" - std::string classXML = "Schema/Entities/" + className + ".xml"; - //check if player already has a child with the component, if so delete that child - auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); - if (playerBoostAssaultEntity.Valid()) { - m_World->DeleteEntity(playerBoostAssaultEntity.ID); + LOG_INFO("intflictor: %s, vicitm: %s", e.Inflictor.Name().c_str(), e.Victim.Name().c_str()); + if(className == "SidearmWeapon") { // give ammo + giveAmmo(e.Inflictor, e.Victim); + } else { //give boost + //get the XML file, example: "Schema/Entities/BoostclassName.xml" + std::string classXML = "Schema/Entities/" + className + ".xml"; + + //check if player already has a child with the component, if so delete that child + auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); + if (playerBoostAssaultEntity.Valid()) { + m_World->DeleteEntity(playerBoostAssaultEntity.ID); + } + //load boost XML file, set it entity parented with the victim player + auto entityFile = ResourceManager::Load(classXML); + EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World); + m_World->SetName(boostAssaultEntity.ID, className); + m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID); } - //load boost XML file, set it entity parented with the victim player - auto entityFile = ResourceManager::Load(classXML); - EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World); - m_World->SetName(boostAssaultEntity.ID, className); - m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID); return true; } @@ -55,14 +61,64 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) std::string BoostSystem::DetermineClass(EntityWrapper inflictorPlayer) { //determine the class based on what component the inflictor-player has - if (m_World->HasComponent(inflictorPlayer.ID, "DashAbility")) { - return "BoostAssault"; - } - if (m_World->HasComponent(inflictorPlayer.ID, "ShieldAbility")) { - return "BoostDefender"; - } - if (m_World->HasComponent(inflictorPlayer.ID, "SprintAbility")) { - return "BoostSniper"; + if (inflictorPlayer.HasComponent("Player")) { + if ((std::string)inflictorPlayer["Player"]["CurrentWeapon"] == "AssaultWeapon") { + return "BoostAssault"; + } + if ((std::string)inflictorPlayer["Player"]["CurrentWeapon"] == "DefenderWeapon") { + return "BoostDefender"; + } + if ((std::string)inflictorPlayer["Player"]["CurrentWeapon"] == "SniperWeapon") { + return "BoostSniper"; + } + if ((std::string)inflictorPlayer["Player"]["CurrentWeapon"] == "SidearmWeapon") { + return "SidearmWeapon"; + } } return ""; } + +void BoostSystem::giveAmmo(EntityWrapper giver, EntityWrapper receiver) +{ + bool gaveAmmo = false; + + if (receiver.HasComponent("AssaultWeapon")) { + int magazineSize = receiver["AssaultWeapon"]["MagazineSize"]; + int& magazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"]; + + int maxAmmo = receiver["AssaultWeapon"]["MaxAmmo"]; + int& ammo = receiver["AssaultWeapon"]["Ammo"]; + + if (magazineAmmo < magazineSize) { + magazineAmmo += 1; + gaveAmmo = true; + } else if (ammo < maxAmmo) { + ammo += 1; + gaveAmmo = true; + } + } else if (receiver.HasComponent("DefenderWeapon")) { + int magazineSize = receiver["DefenderWeapon"]["MagazineSize"]; + int& magazineAmmo = receiver["DefenderWeapon"]["MagazineAmmo"]; + + int maxAmmo = receiver["DefenderWeapon"]["MaxAmmo"]; + int& ammo = receiver["DefenderWeapon"]["Ammo"]; + + if (magazineAmmo < magazineSize) { + magazineAmmo += 1; + gaveAmmo = true; + } else if (ammo < maxAmmo) { + ammo += 1; + gaveAmmo = true; + } + } + + + if (gaveAmmo) { + EntityWrapper effectSpawner = giver.FirstChildByName("AmmoShareEffectSpawner"); + if (effectSpawner.Valid()) { + if (effectSpawner.HasComponent("Spawner")) { + SpawnerSystem::Spawn(effectSpawner, effectSpawner); + } + } + } +} diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index f87f1f81..517d17fb 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -281,7 +281,7 @@ bool SidearmWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi // 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; - giveAmmo(cWeapon, wi, victim); + //giveAmmo(cWeapon, wi, victim); } // Deal damage! @@ -293,6 +293,7 @@ bool SidearmWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi return damage > 0; } +/* void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver) { @@ -337,7 +338,7 @@ void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, } } } -} +}*/ void SidearmWeaponBehaviour::CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi) { From 548efeb11ec9b09352a03d1539330cfafb0c34ae Mon Sep 17 00:00:00 2001 From: Tleety Date: Sat, 12 Mar 2016 17:03:50 +0100 Subject: [PATCH 14/44] EndScreen should now show when a team win --- include/Game/Systems/EndScreenSystem.h | 4 +- resources/DefaultConfig.ini | 8 +- resources/Schema/Entities/CP_Rocky2.xml | 9944 +++++++++++------------ resources/Schema/Entities/EndScreen.xml | 35 +- src/Game/Game.cpp | 2 + src/Game/Systems/EndScreenSystem.cpp | 60 +- 6 files changed, 4967 insertions(+), 5086 deletions(-) diff --git a/include/Game/Systems/EndScreenSystem.h b/include/Game/Systems/EndScreenSystem.h index ec4702ca..1dabbb5e 100644 --- a/include/Game/Systems/EndScreenSystem.h +++ b/include/Game/Systems/EndScreenSystem.h @@ -14,8 +14,8 @@ public: virtual void Update(double dt) override; private: - EventRelay m_EWin; - bool OnWin(const Events::Win&); + EventRelay m_EWin; + bool OnWin(const Events::Win& e); }; #endif \ No newline at end of file diff --git a/resources/DefaultConfig.ini b/resources/DefaultConfig.ini index 92e7bad3..5daddb56 100644 --- a/resources/DefaultConfig.ini +++ b/resources/DefaultConfig.ini @@ -75,13 +75,13 @@ NumIterations=9 TextureQuality=0 [GLOW] -Quality=3 +Quality=1 [GLOW1] -NumIterations=5 +NumIterations=2 [GLOW2] -NumIterations=9 +NumIterations=4 [GLOW3] -NumIterations=13 \ No newline at end of file +NumIterations=6 \ No newline at end of file diff --git a/resources/Schema/Entities/CP_Rocky2.xml b/resources/Schema/Entities/CP_Rocky2.xml index 93b7fd77..469966e6 100644 --- a/resources/Schema/Entities/CP_Rocky2.xml +++ b/resources/Schema/Entities/CP_Rocky2.xml @@ -30,6 +30,28 @@ + + + + + 2 + Models/Props/Walls/SciFiWallBig.mesh + + + + + + + + + + 2 + Models/Props/Walls/SciFiWallMedium.mesh + + + + + @@ -65,28 +87,6 @@ - - - - - 2 - Models/Props/Walls/SciFiWallBig.mesh - - - - - - - - - - 2 - Models/Props/Walls/SciFiWallMedium.mesh - - - - - @@ -684,6 +684,32 @@ + + + + + Models/Highgrounds/Hg18.mesh + + + + + + + + + + + + + Models/Highgrounds/Hg20.mesh + + + + + + + + @@ -771,32 +797,6 @@ - - - - - Models/Highgrounds/Hg18.mesh - - - - - - - - - - - - - Models/Highgrounds/Hg20.mesh - - - - - - - - @@ -1607,11 +1607,11 @@ 12 - + - + @@ -1661,11 +1661,11 @@ 12 - + - + @@ -1730,11 +1730,11 @@ 12 - + - + @@ -2779,6 +2779,312 @@ + + + + + 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/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/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.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/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + @@ -2805,6 +3111,20 @@ + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + @@ -2966,6 +3286,20 @@ + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + @@ -3130,20 +3464,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -3157,19 +3477,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3184,20 +3491,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -3211,20 +3504,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -3239,19 +3518,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -3292,32 +3558,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - @@ -3331,47 +3571,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -3385,46 +3584,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3439,45 +3598,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -3492,45 +3612,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -3545,46 +3626,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -3598,47 +3639,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -3646,19 +3646,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - @@ -3685,6 +3672,19 @@ + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + @@ -3711,54 +3711,6 @@ - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - @@ -3775,18 +3727,17 @@ 2 - + - + - 8 @@ -3797,57 +3748,10 @@ - + - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.mesh - - - - - - - @@ -3861,7 +3765,7 @@ Models/Props/PickUps/PickUpHolder.mesh - + @@ -3871,31 +3775,31 @@ 2 - + - + - - + 8 - Models/Props/PickUps/AmmoPickUp.mesh + Models/Props/PickUps/HealthPickUp.mesh - + + @@ -3919,18 +3823,17 @@ 2 - + - + - 8 @@ -3941,9 +3844,10 @@ - + + @@ -3967,18 +3871,17 @@ 2 - + - + - 8 @@ -3989,9 +3892,58 @@ - + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + @@ -4015,18 +3967,17 @@ 2 - + - + - 8 @@ -4037,9 +3988,58 @@ - + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + @@ -4107,12 +4107,12 @@ 4 - Models/Props/Pillars/SciFiPillar3Red.mesh + Models/Props/Pillars/SciFiPillar2Red.mesh - - - + + + @@ -4139,56 +4139,13 @@ Models/Props/Pillars/SciFiPillar2Red.mesh - + + - - - - - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - - - - 4 - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - - - - 4 - Models/Props/Pillars/SciFiPillar3Red.mesh - - - - - - - - - @@ -4211,23 +4168,8 @@ Models/Props/Pillars/SciFiPillar2Red.mesh - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar2Red.mesh - - - - + + @@ -4237,12 +4179,12 @@ 4 - Models/Props/Pillars/SciFiPillar2Red.mesh + Models/Props/Pillars/SciFiPillar3Red.mesh - - - + + + @@ -4251,13 +4193,12 @@ - 6 Models/Props/Pillars/SciFiPillar2Red.mesh - - - + + + @@ -4277,6 +4218,65 @@ + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar3Red.mesh + + + + + + + + + + + + + + 4 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Red.mesh + + + + + + + + @@ -4284,51 +4284,6 @@ - - - - - 15 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 10 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - 15 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - @@ -4336,35 +4291,8 @@ Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - 15 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - + + @@ -4383,47 +4311,6 @@ - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - - Models/Props/Pillars/SciFiPillar1Blue.mesh - - - - - - - - - @@ -4432,35 +4319,8 @@ Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - 15 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - + + @@ -4471,6 +4331,21 @@ + + + + Models/Props/Flora/HangingBush4.mesh + true + false + + + + + + + + + @@ -4498,21 +4373,6 @@ - - - - Models/Props/Flora/HangingBush4.mesh - true - false - - - - - - - - - @@ -4528,6 +4388,174 @@ + + + + + 10 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 15 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar1Blue.mesh + + + + + + + + + + + + + + 15 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + 15 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + + + + + + + 15 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + + 15 + Models/Props/Stones/ShinyStoneCrystalBlue.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + @@ -4567,34 +4595,6 @@ - - - - - 15 - Models/Props/Stones/ShinyStoneCrystalBlue.mesh - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - @@ -4628,630 +4628,6 @@ - - - - Models/Core/UnitPlane.mesh - - true - - - - - - - - - - - - - - - - - - - Models/Props/Flora/Root.mesh - - - - - - - - - - - - - - Models/Props/Flora/Root.mesh - - - - - - - - - - - - - - Models/Props/Flora/Root.mesh - - - - - - - - - - - - - - Models/Props/Flora/Root.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 - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - 1.5 - 1 - 0.30000001192092896 - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/AmmoPickUp.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 - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - Models/Props/PickUps/PickUpHolder.mesh - - - - - - - - - - - - 2 - - - - - - - - - - - - - - 8 - - - - Models/Props/PickUps/HealthPickUp.mesh - - - - - - - - - - - - - - - - @@ -5264,8 +4640,8 @@ Models/Props/Walls/SpecialWall1.mesh - - + + @@ -5278,8 +4654,8 @@ Models/Props/Walls/SpecialWall1.mesh - - + + @@ -5306,8 +4682,8 @@ Models/Props/Walls/SpecialWall1.mesh - - + + @@ -5315,288 +4691,26 @@ + + + + Models/Core/UnitPlane.mesh + + true + + + + + + + + + - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Top_Red.mesh - - - - - - - - - - - - 12 - - - - - - - - - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Middle_Red.mesh - - - - - - - - - - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Bot_Red.mesh - - - - - - - - - - - - - - Models/Props/Bridges/Bridge1_SciFi_Red.mesh - - - - - - - - - - - - - - Models/Props/Bridges/Bridge1_SciFi_Red.mesh - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/Bridge1_SciFi_Red.mesh - - - - - - - - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Top_Red.mesh - - - - - - - - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Bot_Red.mesh - - - - - - - - - - - 12 - - - - - - - - - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Middle_Red.mesh - - - - - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Top_Red.mesh - - - - - - - - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Bot_Red.mesh - - - - - - - - - - - 12 - - - - - - - - - - - - - Models/Props/Bridges/SciFi_Bridge_Support_Middle_Red.mesh - - - - - - - - - - - - - - - - Models/Props/Bridges/SciFiBridgeDefense.mesh - - - - - - - - - - @@ -5715,6 +4829,892 @@ + + + + + Models/Props/Bridges/Bridge1_SciFi_Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Top_Red.mesh + + + + + + + + + + + 12 + + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Middle_Red.mesh + + + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Bot_Red.mesh + + + + + + + + + + + + + + Models/Props/Bridges/Bridge1_SciFi_Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Top_Red.mesh + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Bot_Red.mesh + + + + + + + + + + + 12 + + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Middle_Red.mesh + + + + + + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFiBridgeDefense.mesh + + + + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Top_Red.mesh + + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Bot_Red.mesh + + + + + + + + + + + 12 + + + + + + + + + + + + + Models/Props/Bridges/SciFi_Bridge_Support_Middle_Red.mesh + + + + + + + + + + + + + + + + Models/Props/Bridges/Bridge1_SciFi_Red.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 + + + + + + + + + + + + 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 + + + + + 1.5 + 1 + 0.30000001192092896 + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.mesh + + + + + + + + + + + + + + + + + + + Models/Props/PickUps/PickUpHolder.mesh + + + + + + + + + + + + 2 + + + + + + + + + + + + + 8 + + + + Models/Props/PickUps/AmmoPickUp.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 + + + + + + + + + + + + + + + + + + + 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/Flora/Root.mesh + + + + + + + + + + + + + + Models/Props/Flora/Root.mesh + + + + + + + + + + + + + + Models/Props/Flora/Root.mesh + + + + + + + + + + + + + + Models/Props/Flora/Root.mesh + + + + + + + + + @@ -5743,7 +5743,7 @@ Models/Props/Walls/BigWallRed.mesh - + @@ -5763,6 +5763,20 @@ + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + @@ -5780,11 +5794,11 @@ - Models/Props/Walls/SmallWall3.mesh + Models/Props/Walls/MediumWall3.mesh - - + + @@ -5796,8 +5810,8 @@ Models/Props/Walls/MediumWall3.mesh - - + + @@ -5809,7 +5823,74 @@ 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/SmallWall3.mesh + + + @@ -5829,6 +5910,19 @@ + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -5843,6 +5937,114 @@ + + + + + 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/BigWallRed.mesh + + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + + + + + @@ -5882,47 +6084,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -5937,47 +6098,6 @@ - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -5991,46 +6111,6 @@ - - - - - Models/Props/Walls/BigWallBlue.mesh - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - @@ -6044,46 +6124,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - @@ -6098,46 +6138,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - Models/Props/Walls/MediumWall3.mesh - - - - - - - - @@ -6165,21 +6165,8 @@ Models/Props/SciFiHolder1.mesh - - - - - - - - - - - Models/Props/SciFiHolder1.mesh - - - - + + @@ -6204,8 +6191,21 @@ Models/Props/SciFiHolder1.mesh - - + + + + + + + + + + + Models/Props/SciFiHolder1.mesh + + + + @@ -6236,6 +6236,20 @@ + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + @@ -6243,8 +6257,22 @@ Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + @@ -6256,8 +6284,358 @@ 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/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/mediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.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/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/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + @@ -6293,11 +6671,26 @@ - Models/Props/Stones/MediumStone2.mesh + Models/Props/Stones/mediumStone2.mesh - - + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + @@ -6309,9 +6702,48 @@ Models/Props/Stones/SmallStone2.mesh - - - + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + @@ -6323,9 +6755,90 @@ Models/Props/Stones/mediumStone2.mesh - - - + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/BigStone.mesh + + + + @@ -6344,46 +6857,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -6397,46 +6870,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -6450,47 +6883,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6503,47 +6895,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6558,47 +6909,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6613,20 +6923,6 @@ - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - - @@ -6640,20 +6936,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -6668,46 +6950,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6721,19 +6963,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -6747,19 +6976,6 @@ - - - - - Models/Props/Stones/mediumStone2.mesh - - - - - - - - @@ -6774,46 +6990,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -6855,33 +7031,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6908,20 +7057,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -6936,19 +7071,6 @@ - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - @@ -6963,19 +7085,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -7004,33 +7113,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -7072,33 +7154,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/MediumStone2.mesh - - - - - - - - - @@ -7126,20 +7181,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -7180,20 +7221,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -7220,33 +7247,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - @@ -7254,19 +7254,6 @@ - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - @@ -7293,6 +7280,19 @@ + + + + + Models/Props/Stones/AssaultHolder.mesh + + + + + + + + @@ -7308,9 +7308,9 @@ Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - + + + @@ -7319,17 +7319,61 @@ - 6 + 7 Models/Props/Stones/ShinyStoneCrystalRed.mesh - - + + + + + + + + + + + 7 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 7 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + 7 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + @@ -7353,9 +7397,39 @@ Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - + + + + + + + + + + + + 7 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + + + + + + + + + + 6 + Models/Props/Stones/ShinyStoneCrystalRed.mesh + + + + + @@ -7389,21 +7463,6 @@ - - - - - 7 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - @@ -7419,21 +7478,6 @@ - - - - - 7 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - @@ -7449,20 +7493,6 @@ - - - - - 7 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - @@ -7493,36 +7523,6 @@ - - - - - 7 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - - - - - - 7 - Models/Props/Stones/ShinyStoneCrystalRed.mesh - - - - - - - - - @@ -7530,20 +7530,6 @@ - - - - - Models/Props/Pillars/StonePillar.mesh - - - - - - - - - @@ -7570,6 +7556,20 @@ + + + + + Models/Props/Pillars/StonePillar.mesh + + + + + + + + + @@ -7641,6 +7641,78 @@ + + + + + 4 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + + + + + + + 6 + Models/Props/Pillars/SciFiPillar2Blue.mesh + + + + + + + + @@ -7670,21 +7742,6 @@ - - - - - 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - @@ -7700,21 +7757,6 @@ - - - - - 4 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - @@ -7729,20 +7771,6 @@ - - - - - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - @@ -7771,34 +7799,6 @@ - - - - - 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - - - - - - 6 - Models/Props/Pillars/SciFiPillar2Blue.mesh - - - - - - - - @@ -7841,138 +7841,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 - - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - - - - - - Models/Props/Stones/AssaultHolder.mesh - - - - - - - - @@ -8007,8 +7875,9 @@ Models/Props/Stones/AssaultHolder.mesh - - + + + @@ -8020,8 +7889,8 @@ Models/Props/Stones/AssaultHolder.mesh - - + + @@ -8054,6 +7923,137 @@ + + + + + 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 + + + + + + + + @@ -8079,11 +8079,39 @@ - Models/Props/Walls/MediumWall3.mesh + Models/Props/Walls/BigWallRed.mesh - - + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + + + + + + + + + + Models/Props/Walls/SmallWall3.mesh + + + + + @@ -8108,9 +8136,22 @@ Models/Props/Walls/SmallWall3.mesh - - - + + + + + + + + + + + + Models/Props/Walls/MediumWall3.mesh + + + + @@ -8122,9 +8163,9 @@ Models/Props/Walls/SmallWall3.mesh - - - + + + @@ -8142,19 +8183,6 @@ - - - - - Models/Props/Walls/BigWallRed.mesh - - - - - - - - @@ -8182,34 +8210,6 @@ - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - - - - - - Models/Props/Walls/SmallWall3.mesh - - - - - - - - - @@ -8247,18 +8247,17 @@ 2 - + - + - 8 @@ -8269,9 +8268,10 @@ - + + @@ -8295,18 +8295,17 @@ 2 - + - + - 8 @@ -8317,9 +8316,10 @@ - + + @@ -8334,6 +8334,60 @@ + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone2.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + @@ -8351,11 +8405,37 @@ - Models/Props/Stones/MediumStone2.mesh + Models/Props/Stones/SmallStone1.mesh - - + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + @@ -8373,6 +8453,46 @@ + + + + + Models/Props/Stones/BigStone.mesh + + + + + + + + + + + + + Models/Props/Stones/SmallStone1.mesh + + + + + + + + + + + + + + Models/Props/Stones/MediumStone2.mesh + + + + + + + + @@ -8400,32 +8520,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - @@ -8453,33 +8547,6 @@ - - - - - Models/Props/Stones/BigStone.mesh - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - @@ -8507,19 +8574,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -8533,20 +8587,6 @@ - - - - - Models/Props/Stones/SmallStone2.mesh - - - - - - - - - @@ -8561,19 +8601,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -8601,33 +8628,6 @@ - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - - - - - - - Models/Props/Stones/SmallStone1.mesh - - - - - - - - @@ -8699,721 +8699,19 @@ - - - - 0.049999997019767761 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pick Class - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - Textures/Icons/Classes/Defender-01.png - - false - - - PickClass - 2 - - - - - - - - - - - Defender - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - Textures/Icons/Classes/Assault-01.png - - false - - - PickClass - 1 - - - - - - - - - - - Assault - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - Textures/Icons/Classes/Sniper-01.png - - false - - - PickClass - 3 - - - - - - - - - - - Sniper - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - SwapToTeamPick - 1 - - - - - - - - - - - Team - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - Change - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - PickTeam - 1 - - - - - - - - - - - Spectator - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - Pick Team - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - PickTeam - 2 - - - - - - - - - - - Red - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - PickTeam - 3 - - - - - - - - - - - Blue - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - false - - - SwapToClassPick - 1 - - - - - - - - - - - Change - Fonts/DroidSans.ttf,64 - false - - - - - - - - - - - - Class - Fonts/DroidSans.ttf,64 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - - - - - - - - - - - 2 - - - Textures/Core/UnitHexagon_Rotated.png - - false - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - - - - - - - - - - - 1 - - - Textures/Core/UnitHexagon_Rotated.png - - false - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - - - - - - - - 1 - - - - 4 - - - Textures/Core/UnitHexagon_Rotated.png - - false - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - - - - - - - - 1 - - - - - Textures/Core/UnitHexagon_Rotated.png - - false - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - - - - - - - - - - - 3 - - - Textures/Core/UnitHexagon_Rotated.png - - false - - - - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - SwapToTeamPick - 1 - - - - - - - - - - - Team - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - Change - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Textures/Core/UnitHexagon.png - - false - - - - SwapToClassPick - 1 - - - - - - - - - - - Class - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - Change - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - + - + - Schema/Entities/PlayerRed.xml + Schema/Entities/Player.xml - + @@ -9425,7 +8723,7 @@ false - + @@ -9438,7 +8736,7 @@ false - + @@ -9451,7 +8749,7 @@ false - + @@ -9464,830 +8762,18 @@ false - + - - - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - Schema/Entities/ScoreBoard_Red.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Kills - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - KD - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Deaths - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Name - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - ID - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - Schema/Entities/ScoreBoard_Blue.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Kills - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - KD - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - ID - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Deaths - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Schema/Entities/ScoreBoard_Blue.xml - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - - - - - - - - - - - - - - - ID - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Deaths - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Name - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Kills - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - KD - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - Schema/Entities/ScoreBoard_Red.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Kills - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Name - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - KD - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - ID - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - Deaths - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 3 - - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - - Models/Props/CapturePoint/CapturePointRed.mesh - - - - - - - - - - 15 - - - - - - - - - - - - Models/Core/UnitCylinder.mesh - - true - - - - - - - - - - - - - - - - Models/Props/CapturePoint/CapturePointNeutral.mesh - - - - - - - - - - 2 - - - - - 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 - - - - - - - - - - - - - - - - - - 10 - - - - - - - @@ -10304,6 +8790,72 @@ + + + + 4 + + + + + + + + + + + 5 + + + + + + + + + + + 4 + + + + + + + + + + + 4 + + + + + + + + + + + 4 + + + + + + + + + + + 4 + + + + + + + @@ -10337,28 +8889,6 @@ - - - - 4 - - - - - - - - - - - 4 - - - - - - - @@ -10393,28 +8923,6 @@ - - - - 4 - - - - - - - - - - - 5 - - - - - - - @@ -10438,17 +8946,6 @@ - - - - 4 - - - - - - - @@ -10460,27 +8957,16 @@ - - - - 4 - - - - - - - - - - 0.80000001192092896 - 1.2000000476837158 - - + + 10 + + + + @@ -10497,7 +8983,81 @@ - + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + @@ -10510,7 +9070,7 @@ 0.5 - + @@ -10524,7 +9084,7 @@ 0.5 - + @@ -10534,7 +9094,81 @@ - + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + @@ -10608,7 +9242,7 @@ - + @@ -10621,11 +9255,34 @@ 0.5 - + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + + + + @@ -10640,6 +9297,20 @@ + + + + + 5 + 2 + 0.5 + + + + + + + @@ -10649,20 +9320,6 @@ - - - - - 5 - 2 - 0.5 - - - - - - - @@ -10677,6 +9334,20 @@ + + + + + 5 + 2 + 0.5 + + + + + + + @@ -10685,43 +9356,6 @@ - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - - - - @@ -10790,43 +9424,6 @@ - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - @@ -10864,43 +9461,6 @@ - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - @@ -10908,20 +9468,6 @@ - - - - - 5 - 2 - 0.5 - - - - - - - @@ -10936,6 +9482,20 @@ + + + + + 5 + 2 + 0.5 + + + + + + + @@ -10944,80 +9504,6 @@ - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - - - - @@ -11186,6 +9672,41 @@ + + + + + 10 + + + + + + + + + + + + 10 + + + + + + + + + + + + 0.80000001192092896 + 1.2000000476837158 + + + + + @@ -11209,29 +9730,6 @@ - - - - - 10 - - - - - - - - - - - 10 - - - - - - - @@ -11248,172 +9746,57 @@ - + - - - 15 - 1 - - - - + - + + + + + + 10 + 1 + + + + + + + + + + + + 10 + 1 + + + + + + + + + + + + 10 + 1 + + + + + + + + - - - - - - - - - - - - 5 - 1 - 0.5 - - - - - - - - - - - - 5 - 1 - 0.5 - - - - - - - - - - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - - - @@ -11454,7 +9837,44 @@ - + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + @@ -11528,61 +9948,10 @@ - + - - - - - 5 - 1 - 0.5 - - - - - - - - - - - - 5 - 1 - 0.5 - - - - - - - - - - - - - - - - - - - - - 5 - 2 - 0.5 - - - - - - - @@ -11597,15 +9966,6 @@ - - - - - - - - - @@ -11620,20 +9980,6 @@ - - - - - 5 - 2 - 0.5 - - - - - - - @@ -11676,7 +10022,44 @@ - + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + @@ -11713,7 +10096,44 @@ - + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + @@ -11731,6 +10151,103 @@ + + + + + 5 + 1 + 0.5 + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + 5 + 2 + 0.5 + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0.5 + + + + + + + + + + + + 5 + 1 + 0.5 + + + + + + + + + + + + + + + + @@ -11745,73 +10262,54 @@ + + + + + 5 + 1 + 0.5 + + + + + + + - + - + + + 15 + 1 + + + + - - - - - - 10 - 1 - - - - - - - - - - - - 10 - 1 - - - - - - - - - - - - 10 - 1 - - - - - - - - + - + - + - Schema/Entities/Player.xml + Schema/Entities/PlayerRed.xml - + @@ -11823,7 +10321,7 @@ false - + @@ -11836,7 +10334,7 @@ false - + @@ -11849,7 +10347,7 @@ false - + @@ -11862,13 +10360,1337 @@ false - + + + + + 0.049999997019767761 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Sniper-01.png + + + PickClass + 3 + + + + + + + + + + + Sniper + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Defender-01.png + + + PickClass + 2 + + + + + + + + + + + Defender + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Pick Class + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Assault-01.png + + + PickClass + 1 + + + + + + + + + + + Assault + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToTeamPick + 1 + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Team + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + 1 + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + 1 + + + + 4 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 1 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + 7 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToTeamPick + 1 + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Team + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToClassPick + 1 + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Class + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + PickTeam + 2 + + + + + + + + + + + Red + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + Pick Team + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + false + + + SwapToClassPick + 1 + + + + + + + + + + + Class + Fonts/DroidSans.ttf,64 + false + + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + false + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + PickTeam + 1 + + + + + + + + + + + Spectator + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + PickTeam + 3 + + + + + + + + + + + Blue + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + + + Schema/Entities/ScoreBoard_Main.xml + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + + + + + + + + + + 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_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/EndScreen.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + false + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + Blue team win! + Fonts/DroidSans.ttf,64 + false + + + + + + + + + + + + Red team win! + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointRed.mesh + + + + + + + + + + 15 + + + + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + + + + Models/Props/CapturePoint/CapturePointNeutral.mesh + + + + + + + + + + 1 + + + + 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/CapturePointBlue.mesh + + + + + + + + + + -15 + + + + 4 + + + + + + + + Models/Core/UnitCylinder.mesh + + true + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/EndScreen.xml b/resources/Schema/Entities/EndScreen.xml index 11ddc201..7b8b055f 100644 --- a/resources/Schema/Entities/EndScreen.xml +++ b/resources/Schema/Entities/EndScreen.xml @@ -11,6 +11,7 @@ + @@ -21,6 +22,22 @@ + + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + false + + + + + + + @@ -28,8 +45,7 @@ Textures/Core/White.png true - - false + @@ -64,21 +80,6 @@ - - - - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - true - - - - - - - - diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 7b80727e..74cc5fe8 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -40,6 +40,7 @@ #include "Game/Systems/MainMenuSystem.h" #include "Game/Systems/ServerListSystem.h" #include "Game/Systems/StartSystem.h" +#include "Game/Systems/EndScreenSystem.h" #include "Rendering/TextureSprite.h" @@ -157,6 +158,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel); 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/EndScreenSystem.cpp b/src/Game/Systems/EndScreenSystem.cpp index e750cca3..6a7ee90e 100644 --- a/src/Game/Systems/EndScreenSystem.cpp +++ b/src/Game/Systems/EndScreenSystem.cpp @@ -3,6 +3,7 @@ EndScreenSystem::EndScreenSystem(SystemParams params) : System(params) + , ImpureSystem() { EVENT_SUBSCRIBE_MEMBER(m_EWin, &EndScreenSystem::OnWin); } @@ -12,7 +13,62 @@ void EndScreenSystem::Update(double dt) } -bool EndScreenSystem::OnWin(const Events::Win&) +bool EndScreenSystem::OnWin(const Events::Win& e) { - + auto endScreenCameras = m_World->GetComponents("EndScreen"); + if(endScreenCameras == nullptr) { + LOG_ERROR("Win event recieved but no Endscreen camera is present."); + return 1; + } + for(auto& camera : *endScreenCameras) { + EntityWrapper entity = EntityWrapper(m_World, camera.EntityID); + + Events::SetCamera event; + event.CameraEntity = entity; + m_EventBroker->Publish(event); + + EntityWrapper redSprite = entity.FirstChildByName("SpriteRed"); + EntityWrapper blueSprite = entity.FirstChildByName("SpriteBlue"); + EntityWrapper redText = entity.FirstChildByName("TextRed"); + EntityWrapper blueText = entity.FirstChildByName("TextBlue"); + + if (e.TeamThatWon == 2) { + //Red team won + if(redSprite.HasComponent("Sprite")) + (bool&)redSprite["Sprite"]["Visible"] = true; + if (redText.HasComponent("Text")) + (bool&)redText["Text"]["Visible"] = true; + + if (blueSprite.HasComponent("Sprite")) + (bool&)blueSprite["Sprite"]["Visible"] = false; + if (blueText.HasComponent("Text")) + (bool&)blueText["Text"]["Visible"] = false; + + }else if (e.TeamThatWon == 1) { + //Blue team won + if (redSprite.HasComponent("Sprite")) + (bool&)redSprite["Sprite"]["Visible"] = false; + if (redText.HasComponent("Text")) + (bool&)redText["Text"]["Visible"] = false; + + if (blueSprite.HasComponent("Sprite")) + (bool&)blueSprite["Sprite"]["Visible"] = true; + if (blueText.HasComponent("Text")) + (bool&)blueText["Text"]["Visible"] = true; + } else { + //No team won? + if (redSprite.HasComponent("Sprite")) + (bool&)redSprite["Sprite"]["Visible"] = false; + if (blueSprite.HasComponent("Sprite")) + (bool&)blueSprite["Sprite"]["Visible"] = false; + + if (redText.HasComponent("Text")) + (bool&)redText["Text"]["Visible"] = false; + if (blueText.HasComponent("Text")) + (bool&)blueText["Text"]["Visible"] = false; + } + } + + + return 1; } From f7363eeea4b26aff973643b703b09a3915a5eae6 Mon Sep 17 00:00:00 2001 From: Tleety Date: Sat, 12 Mar 2016 17:30:28 +0100 Subject: [PATCH 15/44] Boost icon fix --- src/Game/Systems/BoostIconsHUDSystem.cpp | 14 ++++++++------ src/Game/Systems/EndScreenSystem.cpp | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Game/Systems/BoostIconsHUDSystem.cpp b/src/Game/Systems/BoostIconsHUDSystem.cpp index f83278ff..d151a044 100644 --- a/src/Game/Systems/BoostIconsHUDSystem.cpp +++ b/src/Game/Systems/BoostIconsHUDSystem.cpp @@ -5,11 +5,13 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe EntityWrapper assaultEntity = entity.FirstChildByName("Assault"); EntityWrapper defenderEntity = entity.FirstChildByName("Defender"); EntityWrapper sniperEntity = entity.FirstChildByName("Sniper"); + EntityWrapper player = entity.FirstParentWithComponent("Player"); + if(assaultEntity.Valid()) { if (assaultEntity.HasComponent("Fill")) { - EntityWrapper parentWithAssaultBoost = assaultEntity.FirstParentWithComponent("BoostAssault"); - if (parentWithAssaultBoost.Valid()) { + EntityWrapper assaultBoost = player.FirstChildByName("BoostAssault"); + if (assaultBoost.Valid()) { (double&)assaultEntity["Fill"]["Percentage"] = 1.0; } else { (double&)assaultEntity["Fill"]["Percentage"] = 0.0; @@ -19,8 +21,8 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe if (defenderEntity.Valid()) { if (defenderEntity.HasComponent("Fill")) { - EntityWrapper parentWithAssaultBoost = defenderEntity.FirstParentWithComponent("BoostDefender"); - if (parentWithAssaultBoost.Valid()) { + EntityWrapper defenderBoost = player.FirstChildByName("BoostDefender"); + if (defenderBoost.Valid()) { (double&)defenderEntity["Fill"]["Percentage"] = 1.0; } else { (double&)defenderEntity["Fill"]["Percentage"] = 0.0; @@ -30,8 +32,8 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe if (sniperEntity.Valid()) { if (sniperEntity.HasComponent("Fill")) { - EntityWrapper parentWithAssaultBoost = sniperEntity.FirstParentWithComponent("BoostSniper"); - if (parentWithAssaultBoost.Valid()) { + EntityWrapper sniperBoost = player.FirstChildByName("BoostSniper"); + if (sniperBoost.Valid()) { (double&)sniperEntity["Fill"]["Percentage"] = 1.0; } else { (double&)sniperEntity["Fill"]["Percentage"] = 0.0; diff --git a/src/Game/Systems/EndScreenSystem.cpp b/src/Game/Systems/EndScreenSystem.cpp index 6a7ee90e..f16adf83 100644 --- a/src/Game/Systems/EndScreenSystem.cpp +++ b/src/Game/Systems/EndScreenSystem.cpp @@ -44,7 +44,7 @@ bool EndScreenSystem::OnWin(const Events::Win& e) if (blueText.HasComponent("Text")) (bool&)blueText["Text"]["Visible"] = false; - }else if (e.TeamThatWon == 1) { + }else if (e.TeamThatWon == 3) { //Blue team won if (redSprite.HasComponent("Sprite")) (bool&)redSprite["Sprite"]["Visible"] = false; From 944d10f4bbdebbea7d2f51a2478a92d8377a78e9 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sat, 12 Mar 2016 17:34:32 +0100 Subject: [PATCH 16/44] Some network fixes with sidearm --- .../Network/MultiplayerSnapshotFilter.cpp | 1 + src/Game/Systems/BoostSystem.cpp | 87 ++++++++++--------- 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/src/Game/Network/MultiplayerSnapshotFilter.cpp b/src/Game/Network/MultiplayerSnapshotFilter.cpp index 1131424b..db3d998e 100644 --- a/src/Game/Network/MultiplayerSnapshotFilter.cpp +++ b/src/Game/Network/MultiplayerSnapshotFilter.cpp @@ -14,6 +14,7 @@ bool MultiplayerSnapshotFilter::FilterComponent(EntityWrapper entity, SharedComp || component.Info.Name == "Physics" || component.Info.Name == "AssaultWeapon" || component.Info.Name == "DefenderWeapon" + || component.Info.Name == "SidearmWeapon" || component.Info.Name == "Animation" || component.Info.Name == "Blend" || component.Info.Name == "BlendAdditive" diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index 2ebfff73..5074e1c7 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -8,51 +8,52 @@ BoostSystem::BoostSystem(SystemParams params) bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) { - if (e.Victim.ID == e.Inflictor.ID) { - return false; - } + if (!IsClient) { - if (!e.Victim.Valid() || !LocalPlayer.Valid()) { - return false; - } - - if (e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { - return false; - } - - if (!e.Inflictor.Valid()) { - return false; - } - - //if its not friendly fire, return - if ((int)m_World->GetComponent(e.Inflictor.ID, "Team")["Team"] != (int)m_World->GetComponent(e.Victim.ID, "Team")["Team"]) { - return false; - } - - //determine the inflictors class - auto className = DetermineClass(e.Inflictor); - if (className == "") { - return false; - } - - - LOG_INFO("intflictor: %s, vicitm: %s", e.Inflictor.Name().c_str(), e.Victim.Name().c_str()); - if(className == "SidearmWeapon") { // give ammo - giveAmmo(e.Inflictor, e.Victim); - } else { //give boost - //get the XML file, example: "Schema/Entities/BoostclassName.xml" - std::string classXML = "Schema/Entities/" + className + ".xml"; - - //check if player already has a child with the component, if so delete that child - auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); - if (playerBoostAssaultEntity.Valid()) { - m_World->DeleteEntity(playerBoostAssaultEntity.ID); + if (e.Victim.ID == e.Inflictor.ID) { + return false; + } + + if (!e.Victim.Valid() || !LocalPlayer.Valid()) { + return false; + } + + if (e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { + return false; + } + + if (!e.Inflictor.Valid()) { + return false; + } + + //if its not friendly fire, return + if ((int)m_World->GetComponent(e.Inflictor.ID, "Team")["Team"] != (int)m_World->GetComponent(e.Victim.ID, "Team")["Team"]) { + return false; + } + + //determine the inflictors class + auto className = DetermineClass(e.Inflictor); + if (className == "") { + return false; + } + + if (className == "SidearmWeapon") { // give ammo + giveAmmo(e.Inflictor, e.Victim); + } else { //give boost + //get the XML file, example: "Schema/Entities/BoostclassName.xml" + std::string classXML = "Schema/Entities/" + className + ".xml"; + + //check if player already has a child with the component, if so delete that child + auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); + if (playerBoostAssaultEntity.Valid()) { + m_World->DeleteEntity(playerBoostAssaultEntity.ID); + } + //load boost XML file, set it entity parented with the victim player + auto entityFile = ResourceManager::Load(classXML); + EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World); + m_World->SetName(boostAssaultEntity.ID, className); + m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID); } - //load boost XML file, set it entity parented with the victim player - auto entityFile = ResourceManager::Load(classXML); - EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World); - m_World->SetName(boostAssaultEntity.ID, className); - m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID); } return true; From dfc30f4693bb3c59cd3d6c794a6d6455617ae6ee Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sat, 12 Mar 2016 17:39:50 +0100 Subject: [PATCH 17/44] Boost fixes? --- src/Game/Systems/BoostSystem.cpp | 90 ++++++++++++++++---------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index 5074e1c7..f6148192 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -8,54 +8,52 @@ BoostSystem::BoostSystem(SystemParams params) bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) { - if (!IsClient) { - - if (e.Victim.ID == e.Inflictor.ID) { - return false; - } - - if (!e.Victim.Valid() || !LocalPlayer.Valid()) { - return false; - } - - if (e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { - return false; - } - - if (!e.Inflictor.Valid()) { - return false; - } - - //if its not friendly fire, return - if ((int)m_World->GetComponent(e.Inflictor.ID, "Team")["Team"] != (int)m_World->GetComponent(e.Victim.ID, "Team")["Team"]) { - return false; - } - - //determine the inflictors class - auto className = DetermineClass(e.Inflictor); - if (className == "") { - return false; - } - - if (className == "SidearmWeapon") { // give ammo - giveAmmo(e.Inflictor, e.Victim); - } else { //give boost - //get the XML file, example: "Schema/Entities/BoostclassName.xml" - std::string classXML = "Schema/Entities/" + className + ".xml"; - - //check if player already has a child with the component, if so delete that child - auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); - if (playerBoostAssaultEntity.Valid()) { - m_World->DeleteEntity(playerBoostAssaultEntity.ID); - } - //load boost XML file, set it entity parented with the victim player - auto entityFile = ResourceManager::Load(classXML); - EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World); - m_World->SetName(boostAssaultEntity.ID, className); - m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID); - } + if (e.Victim.ID == e.Inflictor.ID) { + return false; } + if (!e.Victim.Valid() || !LocalPlayer.Valid()) { + return false; + } + + if (e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { + return false; + } + + if (!e.Inflictor.Valid()) { + return false; + } + + //if its not friendly fire, return + if ((int)m_World->GetComponent(e.Inflictor.ID, "Team")["Team"] != (int)m_World->GetComponent(e.Victim.ID, "Team")["Team"]) { + return false; + } + + //determine the inflictors class + auto className = DetermineClass(e.Inflictor); + if (className == "") { + return false; + } + + if (className == "SidearmWeapon") { // give ammo + giveAmmo(e.Inflictor, e.Victim); + } else { //give boost + //get the XML file, example: "Schema/Entities/BoostclassName.xml" + std::string classXML = "Schema/Entities/" + className + ".xml"; + + //check if player already has a child with the component, if so delete that child + auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); + if (playerBoostAssaultEntity.Valid()) { + m_World->DeleteEntity(playerBoostAssaultEntity.ID); + } + //load boost XML file, set it entity parented with the victim player + auto entityFile = ResourceManager::Load(classXML); + EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World); + m_World->SetName(boostAssaultEntity.ID, className); + m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID); + } + + return true; } From 51b8846b3a4bfd3d2a96979ed2da4522821a6b46 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sat, 12 Mar 2016 18:29:49 +0100 Subject: [PATCH 18/44] Ammo sharing done --- .../Schema/Entities/AmmoShareEffectView.xml | 1 + src/Game/Systems/BoostSystem.cpp | 42 ++++++++----------- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 39 ++++++++++++++++- 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/resources/Schema/Entities/AmmoShareEffectView.xml b/resources/Schema/Entities/AmmoShareEffectView.xml index 651d1621..28997ab0 100644 --- a/resources/Schema/Entities/AmmoShareEffectView.xml +++ b/resources/Schema/Entities/AmmoShareEffectView.xml @@ -21,6 +21,7 @@ true + diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index f6148192..b695aa96 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -79,45 +79,37 @@ std::string BoostSystem::DetermineClass(EntityWrapper inflictorPlayer) void BoostSystem::giveAmmo(EntityWrapper giver, EntityWrapper receiver) { - bool gaveAmmo = false; - if (receiver.HasComponent("AssaultWeapon")) { int magazineSize = receiver["AssaultWeapon"]["MagazineSize"]; int& magazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"]; - + int prevMagazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"]; int maxAmmo = receiver["AssaultWeapon"]["MaxAmmo"]; int& ammo = receiver["AssaultWeapon"]["Ammo"]; - if (magazineAmmo < magazineSize) { - magazineAmmo += 1; - gaveAmmo = true; - } else if (ammo < maxAmmo) { - ammo += 1; - gaveAmmo = true; + int givenAmmo = 3; + + magazineAmmo = glm::clamp(magazineAmmo + givenAmmo, 0, magazineSize); + if (magazineAmmo > prevMagazineAmmo) { + givenAmmo = prevMagazineAmmo + givenAmmo - magazineSize; + } + if (givenAmmo > 0) { + ammo = glm::clamp(ammo + givenAmmo, 0, maxAmmo); } } else if (receiver.HasComponent("DefenderWeapon")) { int magazineSize = receiver["DefenderWeapon"]["MagazineSize"]; int& magazineAmmo = receiver["DefenderWeapon"]["MagazineAmmo"]; - + int prevMagazineAmmo = receiver["DefenderWeapon"]["MagazineAmmo"]; int maxAmmo = receiver["DefenderWeapon"]["MaxAmmo"]; int& ammo = receiver["DefenderWeapon"]["Ammo"]; - if (magazineAmmo < magazineSize) { - magazineAmmo += 1; - gaveAmmo = true; - } else if (ammo < maxAmmo) { - ammo += 1; - gaveAmmo = true; + int givenAmmo = 1; + + magazineAmmo = glm::clamp(magazineAmmo + givenAmmo, 0, magazineSize); + if (magazineAmmo > prevMagazineAmmo) { + givenAmmo = prevMagazineAmmo + givenAmmo - magazineSize; } - } - - - if (gaveAmmo) { - EntityWrapper effectSpawner = giver.FirstChildByName("AmmoShareEffectSpawner"); - if (effectSpawner.Valid()) { - if (effectSpawner.HasComponent("Spawner")) { - SpawnerSystem::Spawn(effectSpawner, effectSpawner); - } + if (givenAmmo > 0) { + ammo = glm::clamp(ammo + givenAmmo, 0, maxAmmo); } } } diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index 517d17fb..1364894d 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -281,7 +281,44 @@ bool SidearmWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi // 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; - //giveAmmo(cWeapon, wi, victim); + + bool gaveAmmo = false; + + if (victim.HasComponent("AssaultWeapon")) { + int magazineSize = victim["AssaultWeapon"]["MagazineSize"]; + int magazineAmmo = victim["AssaultWeapon"]["MagazineAmmo"]; + + int maxAmmo = victim["AssaultWeapon"]["MaxAmmo"]; + int ammo = victim["AssaultWeapon"]["Ammo"]; + + if (magazineAmmo < magazineSize) { + gaveAmmo = true; + } else if (ammo < maxAmmo) { + gaveAmmo = true; + } + } else if (victim.HasComponent("DefenderWeapon")) { + int magazineSize = victim["DefenderWeapon"]["MagazineSize"]; + int magazineAmmo = victim["DefenderWeapon"]["MagazineAmmo"]; + + int maxAmmo = victim["DefenderWeapon"]["MaxAmmo"]; + int ammo = victim["DefenderWeapon"]["Ammo"]; + + if (magazineAmmo < magazineSize) { + gaveAmmo = true; + } else if (ammo < maxAmmo) { + gaveAmmo = true; + } + } + + + if (gaveAmmo) { + EntityWrapper effectSpawner = wi.FirstPersonEntity.FirstChildByName("AmmoShareEffectSpawner"); + if (effectSpawner.Valid()) { + if (effectSpawner.HasComponent("Spawner")) { + SpawnerSystem::Spawn(effectSpawner, effectSpawner); + } + } + } } // Deal damage! From c0fc36845ffe9525371661584429b8f8a5d861e3 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sat, 12 Mar 2016 18:43:04 +0100 Subject: [PATCH 19/44] Defender ability HUD fixed --- src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index f342f291..f33eea26 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -152,6 +152,13 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf EntityWrapper attachment = wi.Player.FirstChildByName("ShieldAttachment"); if (attachment.Valid()) { if (e.Value > 0) { + + if(wi.Player.Valid()) { + if(wi.Player.HasComponent("ShieldAbility")) { + (bool&)wi.Player["ShieldAbility"]["Active"] = true; + } + } + if (IsServer) { SpawnerSystem::Spawn(attachment, attachment); } @@ -214,6 +221,12 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf } else { attachment.DeleteChildren(); + if (wi.Player.Valid()) { + if (wi.Player.HasComponent("ShieldAbility")) { + (bool&)wi.Player["ShieldAbility"]["Active"] = false; + } + } + if (IsClient) { EntityWrapper root = wi.FirstPersonEntity; if (root.Valid()) { From f6a8534c15aa00f3e13233981e61433cac37ddaf Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 01:23:51 +0100 Subject: [PATCH 20/44] New assets, FadeOutComponent, Some MuzzleFlash entities, Changes to ray. Muzzleflash rotation --- assets | 2 +- include/Engine/Rendering/SpriteJob.h | 6 +- include/Game/Systems/FadeOutSystem.h | 21 ++ resources/Schema/Components.xsd | 1 + resources/Schema/Components/FadeOut.xml | 4 + resources/Schema/Components/FadeOut.xsd | 13 + resources/Schema/Entities/MuzzleFlashBlue.xml | 195 +++++++++++++ resources/Schema/Entities/MuzzleFlashFire.xml | 135 +++++++++ .../Schema/Entities/MuzzleFlashGreen.xml | 135 +++++++++ .../Schema/Entities/MuzzleFlashLightBlue.xml | 135 +++++++++ resources/Schema/Entities/MuzzleFlashPink.xml | 135 +++++++++ .../Schema/Entities/MuzzleFlashPurple.xml | 135 +++++++++ .../Schema/Entities/MuzzleFlashRainbow.xml | 135 +++++++++ resources/Schema/Entities/MuzzleFlashRed.xml | 135 +++++++++ .../Schema/Entities/MuzzleFlashWhite.xml | 135 +++++++++ .../Schema/Entities/MuzzleFlashYellow.xml | 135 +++++++++ .../Schema/Entities/QualityAssurance.xml | 260 ++++++++++-------- resources/Schema/Entities/RayBlue.xml | 24 +- .../Schema/Entities/WeaponAssaultBlueView.xml | 57 ++-- resources/Schema/Types/Entity.xsd | 1 + src/Game/Game.cpp | 1 + src/Game/Systems/FadeOutSystem.cpp | 19 ++ .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 71 ++--- 23 files changed, 1713 insertions(+), 177 deletions(-) create mode 100644 include/Game/Systems/FadeOutSystem.h create mode 100644 resources/Schema/Components/FadeOut.xml create mode 100644 resources/Schema/Components/FadeOut.xsd create mode 100644 resources/Schema/Entities/MuzzleFlashBlue.xml create mode 100644 resources/Schema/Entities/MuzzleFlashFire.xml create mode 100644 resources/Schema/Entities/MuzzleFlashGreen.xml create mode 100644 resources/Schema/Entities/MuzzleFlashLightBlue.xml create mode 100644 resources/Schema/Entities/MuzzleFlashPink.xml create mode 100644 resources/Schema/Entities/MuzzleFlashPurple.xml create mode 100644 resources/Schema/Entities/MuzzleFlashRainbow.xml create mode 100644 resources/Schema/Entities/MuzzleFlashRed.xml create mode 100644 resources/Schema/Entities/MuzzleFlashWhite.xml create mode 100644 resources/Schema/Entities/MuzzleFlashYellow.xml create mode 100644 src/Game/Systems/FadeOutSystem.cpp diff --git a/assets b/assets index 40f6ae62..d97e6ce5 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 40f6ae6201adb94e99ee084b081fc8467f80953a +Subproject commit d97e6ce5b99b9f8a2d5fe6dbfa1dbd11444f62ae diff --git a/include/Engine/Rendering/SpriteJob.h b/include/Engine/Rendering/SpriteJob.h index 3d55e721..1410a682 100644 --- a/include/Engine/Rendering/SpriteJob.h +++ b/include/Engine/Rendering/SpriteJob.h @@ -54,7 +54,7 @@ struct SpriteJob : RenderJob if((bool)cSprite["KeepRatio"] == true) { if(scale.y >= scale.x) { - ScaleY = (scale.x)/(scale.y); + ScaleY = (scale.y)/(scale.x); ScaleX = 1.f; } else { ScaleY = 1.f; @@ -90,8 +90,8 @@ struct SpriteJob : RenderJob bool Pickable; bool IsIndicator = false; bool BlurBackground = false; - float ScaleX = 1; - float ScaleY = 1; + float ScaleX = 1.f; + float ScaleY = 1.f; bool Linear = false; glm::vec4 FillColor = glm::vec4(0); diff --git a/include/Game/Systems/FadeOutSystem.h b/include/Game/Systems/FadeOutSystem.h new file mode 100644 index 00000000..a327577d --- /dev/null +++ b/include/Game/Systems/FadeOutSystem.h @@ -0,0 +1,21 @@ +#ifndef FadeOutSystem_h__ +#define FadeOutSystem_h__ + +#include "Core/System.h" + +class FadeOutSystem : public PureSystem +{ +public: + FadeOutSystem(SystemParams params) + : System(params) + , PureSystem("FadeOut") + { + + } + + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFadeOut, double dt) override; + +private: +}; + +#endif \ No newline at end of file diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index f124272f..a57f55a7 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -69,4 +69,5 @@ + \ No newline at end of file diff --git a/resources/Schema/Components/FadeOut.xml b/resources/Schema/Components/FadeOut.xml new file mode 100644 index 00000000..f322d1b7 --- /dev/null +++ b/resources/Schema/Components/FadeOut.xml @@ -0,0 +1,4 @@ + + + 0 + \ No newline at end of file diff --git a/resources/Schema/Components/FadeOut.xsd b/resources/Schema/Components/FadeOut.xsd new file mode 100644 index 00000000..d5c240d6 --- /dev/null +++ b/resources/Schema/Components/FadeOut.xsd @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/Schema/Entities/MuzzleFlashBlue.xml b/resources/Schema/Entities/MuzzleFlashBlue.xml new file mode 100644 index 00000000..f984f6bc --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashBlue.xml @@ -0,0 +1,195 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Blue/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Blue/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Blue/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Blue/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Blue/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Blue/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Blue/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Blue/PlaneDown.mesh + false + true + + + + + + + + + + + + + + + + Models/Core/UnitSphere.mesh + false + false + + + + + + + + + + + + + + + Models/Core/UnitSphere.mesh + + false + false + + + + 0.40000000596046448 + + + + + + + + + + + + Models/Core/UnitSphere.mesh + false + false + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashFire.xml b/resources/Schema/Entities/MuzzleFlashFire.xml new file mode 100644 index 00000000..c1d47b2a --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashFire.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Fire/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Fire/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Fire/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Fire/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Fire/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Fire/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Fire/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Fire/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashGreen.xml b/resources/Schema/Entities/MuzzleFlashGreen.xml new file mode 100644 index 00000000..966a2c8d --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashGreen.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Green/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Green/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Green/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Green/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Green/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Green/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Green/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Green/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashLightBlue.xml b/resources/Schema/Entities/MuzzleFlashLightBlue.xml new file mode 100644 index 00000000..86c0b76c --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashLightBlue.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/LightBlue/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/LightBlue/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/LightBlue/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/LightBlue/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/LightBlue/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/LightBlue/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/LightBlue/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/LightBlue/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashPink.xml b/resources/Schema/Entities/MuzzleFlashPink.xml new file mode 100644 index 00000000..7664cf0f --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashPink.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Pink/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Pink/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Pink/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Pink/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Pink/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Pink/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Pink/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Pink/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashPurple.xml b/resources/Schema/Entities/MuzzleFlashPurple.xml new file mode 100644 index 00000000..c867fbc2 --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashPurple.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Purple/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Purple/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Purple/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Purple/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Purple/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Purple/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Purple/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Purple/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashRainbow.xml b/resources/Schema/Entities/MuzzleFlashRainbow.xml new file mode 100644 index 00000000..27da23d0 --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashRainbow.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Rainbow/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Rainbow/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Rainbow/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Rainbow/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Rainbow/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Rainbow/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Rainbow/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Rainbow/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashRed.xml b/resources/Schema/Entities/MuzzleFlashRed.xml new file mode 100644 index 00000000..50b22d6c --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashRed.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Red/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Red/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Red/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Red/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Red/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Red/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Red/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Red/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashWhite.xml b/resources/Schema/Entities/MuzzleFlashWhite.xml new file mode 100644 index 00000000..a810631a --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashWhite.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/White/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/White/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/White/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/White/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/White/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/White/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/White/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/White/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashYellow.xml b/resources/Schema/Entities/MuzzleFlashYellow.xml new file mode 100644 index 00000000..c6c3b4cf --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashYellow.xml @@ -0,0 +1,135 @@ + + + + + + 0.039999999105930328 + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Yellow/Cone1Outside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Yellow/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Yellow/Cone2Inside.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Yellow/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Yellow/PlaneLeft.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Yellow/PlaneRight.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Yellow/PlaneUp.mesh + false + true + + + + + + + + + 2 + Models/Effects/MuzzleFlash/Yellow/PlaneDown.mesh + false + true + + + + + + + + + + diff --git a/resources/Schema/Entities/QualityAssurance.xml b/resources/Schema/Entities/QualityAssurance.xml index 2fbd9527..cd89d64a 100644 --- a/resources/Schema/Entities/QualityAssurance.xml +++ b/resources/Schema/Entities/QualityAssurance.xml @@ -3,7 +3,7 @@ - 3.6154132075906489 + 6.5024371606521605 @@ -11,6 +11,15 @@ + + + + + + + + + @@ -69,15 +78,6 @@ - - - - - - - - - @@ -85,7 +85,7 @@ - + @@ -105,6 +105,15 @@ + + + + + + + + + @@ -141,7 +150,7 @@ - + @@ -194,7 +203,7 @@ - + @@ -222,7 +231,7 @@ - + @@ -286,7 +295,7 @@ - + @@ -318,7 +327,7 @@ - + @@ -641,6 +650,52 @@ + + + + Models/Core/UnitCylinder.mesh + + + + + + + + + + + + + + + + + + + + 0.5 + + + + + + + + + + + Models/Test/AssaultTPoseSoftEdge.mesh + + + + + + + + + + + @@ -668,7 +723,7 @@ - + @@ -715,7 +770,7 @@ - + @@ -775,7 +830,7 @@ - + @@ -795,52 +850,6 @@ - - - - Models/Core/UnitCylinder.mesh - - - - - - - - - - - - - - - - - - - - 0.5 - - - - - - - - - - - Models/Test/AssaultTPoseSoftEdge.mesh - - - - - - - - - - - @@ -868,7 +877,7 @@ - + @@ -915,7 +924,7 @@ - + @@ -962,7 +971,7 @@ - + @@ -1027,7 +1036,6 @@ - Models/Core/UnitCube.mesh @@ -1037,6 +1045,7 @@ + @@ -1073,7 +1082,6 @@ 1 - Models/Core/UnitCube.mesh @@ -1083,6 +1091,7 @@ + @@ -1117,7 +1126,6 @@ 2 - Models/Core/UnitCube.mesh @@ -1127,6 +1135,7 @@ + @@ -1163,7 +1172,6 @@ 3 - Models/Core/UnitCube.mesh @@ -1173,6 +1181,7 @@ + @@ -1217,7 +1226,6 @@ - Models/Core/UnitCube.mesh @@ -1227,6 +1235,7 @@ + @@ -1376,19 +1385,19 @@ - + - true - 1.5712751414989441 + 1.3579803859829696 3.7999999523162842 true + true Models/Weapons/Blue/AssaultWeaponBlue.mesh @@ -1432,7 +1441,7 @@ - + @@ -1441,7 +1450,7 @@ - 0.85439856235552725 + 0.79164215554514783 Models/Characters/Assault/AssaultTPose.mesh @@ -1484,7 +1493,7 @@ - + @@ -1494,12 +1503,12 @@ - true - 0.85439856235552725 + 0.79164215554514783 true + true Models/Characters/Assault/AssaultAnimated.mesh @@ -1542,21 +1551,21 @@ - + - true - 7.5223549108000043 + 7.7876951610054306 10 3 true + true Models/Core/UnitSphere.mesh @@ -1600,20 +1609,20 @@ - + - true - 0.39702717854592606 - true + 2.6357521906414902 5 true + true + true Models/Assault.mesh @@ -1791,12 +1800,12 @@ - true - 1.5712751414989441 + 1.3579803859829696 3.7999999523162842 true + true Models/AssaultWeaponRed.mesh @@ -1939,8 +1948,9 @@ - Textures/Props/FoliageDiff.png + Models/Core/UnitQuad.mesh + Textures/Props/FoliageDiff.png @@ -1949,8 +1959,9 @@ - Textures/Props/FoliageDiff.png + Models/Core/UnitQuad.mesh + Textures/Props/FoliageDiff.png @@ -1970,8 +1981,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -1988,8 +2000,9 @@ 2 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -2004,8 +2017,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -2022,8 +2036,9 @@ 3 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -2038,8 +2053,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -2057,8 +2073,9 @@ 4 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -2073,8 +2090,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -2091,8 +2109,9 @@ 1 - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -2107,8 +2126,9 @@ - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png @@ -2124,8 +2144,9 @@ - Textures/Core/UnitHexagon_Rotated.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon_Rotated.png @@ -2173,7 +2194,7 @@ - + @@ -2203,8 +2224,9 @@ - Textures/Core/ErrorTexture.png + Models/Core/UnitQuad.mesh + Textures/Core/ErrorTexture.png @@ -2215,8 +2237,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png @@ -2244,8 +2267,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png @@ -2273,8 +2297,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png @@ -2302,8 +2327,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png @@ -2331,8 +2357,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png @@ -2373,9 +2400,10 @@ + Models/Core/UnitQuad.mesh + Textures/Core/ErrorTexture.png true - @@ -2387,8 +2415,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png false @@ -2418,8 +2447,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png false @@ -2449,8 +2479,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png @@ -2478,8 +2509,9 @@ - Textures/Core/White.png + Models/Core/UnitQuad.mesh + Textures/Core/White.png diff --git a/resources/Schema/Entities/RayBlue.xml b/resources/Schema/Entities/RayBlue.xml index 64ff3619..c358a4d5 100644 --- a/resources/Schema/Entities/RayBlue.xml +++ b/resources/Schema/Entities/RayBlue.xml @@ -3,25 +3,26 @@ - 10 + 0.079999998211860657 - - - + - Textures/Effects/Ray.png + Models/Core/UnitQuad.mesh - + Textures/Effects/NewRay5.png + + true + true - + @@ -29,14 +30,17 @@ - Textures/Effects/Ray.png + Models/Core/UnitQuad.mesh - + Textures/Effects/NewRay5.png + + true + true - + diff --git a/resources/Schema/Entities/WeaponAssaultBlueView.xml b/resources/Schema/Entities/WeaponAssaultBlueView.xml index 520c9906..6d7e6fa0 100644 --- a/resources/Schema/Entities/WeaponAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponAssaultBlueView.xml @@ -91,23 +91,11 @@ Models/Weapons/Blue/AssaultWeaponBlue.mesh - - + + - - - - Schema/Entities/RayBlue.xml - - - - - - - - @@ -117,6 +105,38 @@ + + + + + + + + + + + + Schema/Entities/MuzzleFlashBlue.xml + + + + + + + + + + + Schema/Entities/RayBlue.xml + + + + + + + + + @@ -127,17 +147,18 @@ true - - - + + + - Textures/Core/UnitHexagon.png + Models/Core/UnitQuad.mesh + Textures/Core/UnitHexagon.png diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index 2d24590c..363f65e7 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -72,6 +72,7 @@ + diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 74cc5fe8..359f0b57 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -41,6 +41,7 @@ #include "Game/Systems/ServerListSystem.h" #include "Game/Systems/StartSystem.h" #include "Game/Systems/EndScreenSystem.h" +#include "Game/Systems/FadeOutSystem.h" #include "Rendering/TextureSprite.h" diff --git a/src/Game/Systems/FadeOutSystem.cpp b/src/Game/Systems/FadeOutSystem.cpp new file mode 100644 index 00000000..96a11b83 --- /dev/null +++ b/src/Game/Systems/FadeOutSystem.cpp @@ -0,0 +1,19 @@ +#include "Systems/FadeOutSystem.h" + +void FadeOutSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFadeOut, double dt) +{ + //if (dt == 0.0) { + // return; + //} + + //if (!entity.Valid()) { + // return; + //} + + //double& lifetime = cLifetime["Lifetime"]; + //lifetime -= dt; + + //if (lifetime <= 0.0) { + // m_Deletions.push_back(entity); + //} +} \ No newline at end of file diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 0662cbaa..ca53ce0f 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -198,6 +198,46 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi magAmmo -= 1; } + // Get weapon model based on current person + EntityWrapper weaponModelEntity = getRelevantWeaponEntity(wi); + if (!weaponModelEntity.Valid()) { + return; + } + + // Tracer + EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleRay"); + 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, tracerSpawner); + if (ray.Valid()) { + ((glm::vec3&)ray["Transform"]["Scale"]).z = distance; + } + } + //MuzzleFlash + EntityWrapper muzzleFlashSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleFlash"); + if (muzzleFlashSpawner.Valid()) { + std::uniform_real_distribution randomSpreadAngle(0.f, 3.1415f*2); + EntityWrapper flash = SpawnerSystem::Spawn(muzzleFlashSpawner, muzzleFlashSpawner); + if (flash.Valid()) { + ((glm::vec3&)flash["Transform"]["Orientation"]).z = randomSpreadAngle(m_RandomEngine); + } + } + + // 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); + } + } + // View punch if (IsClient) { EntityWrapper camera = wi.Player.FirstChildByName("Camera"); @@ -216,37 +256,6 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi } } } - - // Get weapon model based on current person - EntityWrapper weaponModelEntity = getRelevantWeaponEntity(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); - } - } // Play animation playAnimationAndReturn(wi.FirstPersonEntity, "ActionBlend", "Fire"); From bbe61f300cd8c5aed5feb57ba9bf440e8b2feb42 Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 02:03:49 +0100 Subject: [PATCH 21/44] Fade in/out should now work with models and sprites --- include/Engine/Core/System.h | 2 +- .../Systems/{FadeOutSystem.h => FadeSystem.h} | 11 +++--- resources/Schema/Components.xsd | 2 +- resources/Schema/Components/Fade.xml | 6 +++ resources/Schema/Components/Fade.xsd | 17 +++++++++ resources/Schema/Components/FadeOut.xml | 4 -- resources/Schema/Components/FadeOut.xsd | 13 ------- resources/Schema/Types/Entity.xsd | 2 +- src/Game/Game.cpp | 3 +- src/Game/Systems/FadeOutSystem.cpp | 19 ---------- src/Game/Systems/FadeSystem.cpp | 37 +++++++++++++++++++ 11 files changed, 71 insertions(+), 45 deletions(-) rename include/Game/Systems/{FadeOutSystem.h => FadeSystem.h} (54%) create mode 100644 resources/Schema/Components/Fade.xml create mode 100644 resources/Schema/Components/Fade.xsd delete mode 100644 resources/Schema/Components/FadeOut.xml delete mode 100644 resources/Schema/Components/FadeOut.xsd delete mode 100644 src/Game/Systems/FadeOutSystem.cpp create mode 100644 src/Game/Systems/FadeSystem.cpp diff --git a/include/Engine/Core/System.h b/include/Engine/Core/System.h index 1ca1c824..8077fcc7 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& scoreScreen, double dt) = 0; + virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFade, double dt) = 0; }; class ImpureSystem : public virtual System diff --git a/include/Game/Systems/FadeOutSystem.h b/include/Game/Systems/FadeSystem.h similarity index 54% rename from include/Game/Systems/FadeOutSystem.h rename to include/Game/Systems/FadeSystem.h index a327577d..e2e930df 100644 --- a/include/Game/Systems/FadeOutSystem.h +++ b/include/Game/Systems/FadeSystem.h @@ -1,14 +1,15 @@ -#ifndef FadeOutSystem_h__ -#define FadeOutSystem_h__ +#ifndef FadeSystem_h__ +#define FadeSystem_h__ #include "Core/System.h" +#include "GLM.h" -class FadeOutSystem : public PureSystem +class FadeSystem : public PureSystem { public: - FadeOutSystem(SystemParams params) + FadeSystem(SystemParams params) : System(params) - , PureSystem("FadeOut") + , PureSystem("Fade") { } diff --git a/resources/Schema/Components.xsd b/resources/Schema/Components.xsd index a57f55a7..aa303da9 100644 --- a/resources/Schema/Components.xsd +++ b/resources/Schema/Components.xsd @@ -69,5 +69,5 @@ - + \ No newline at end of file diff --git a/resources/Schema/Components/Fade.xml b/resources/Schema/Components/Fade.xml new file mode 100644 index 00000000..6a8ac525 --- /dev/null +++ b/resources/Schema/Components/Fade.xml @@ -0,0 +1,6 @@ + + + 1 + + true + \ No newline at end of file diff --git a/resources/Schema/Components/Fade.xsd b/resources/Schema/Components/Fade.xsd new file mode 100644 index 00000000..b0c5152a --- /dev/null +++ b/resources/Schema/Components/Fade.xsd @@ -0,0 +1,17 @@ + + + + + + + + + + + + If the entity should fade out or in. + + + + + \ No newline at end of file diff --git a/resources/Schema/Components/FadeOut.xml b/resources/Schema/Components/FadeOut.xml deleted file mode 100644 index f322d1b7..00000000 --- a/resources/Schema/Components/FadeOut.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - 0 - \ No newline at end of file diff --git a/resources/Schema/Components/FadeOut.xsd b/resources/Schema/Components/FadeOut.xsd deleted file mode 100644 index d5c240d6..00000000 --- a/resources/Schema/Components/FadeOut.xsd +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index 363f65e7..9da41687 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -72,7 +72,7 @@ - + diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 359f0b57..a9d3f2d5 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -41,7 +41,7 @@ #include "Game/Systems/ServerListSystem.h" #include "Game/Systems/StartSystem.h" #include "Game/Systems/EndScreenSystem.h" -#include "Game/Systems/FadeOutSystem.h" +#include "Game/Systems/FadeSystem.h" #include "Rendering/TextureSprite.h" @@ -160,6 +160,7 @@ Game::Game(int argc, char* argv[]) m_SystemPipeline->AddSystem(updateOrderLevel, m_Renderer); m_SystemPipeline->AddSystem(updateOrderLevel); 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/FadeOutSystem.cpp b/src/Game/Systems/FadeOutSystem.cpp deleted file mode 100644 index 96a11b83..00000000 --- a/src/Game/Systems/FadeOutSystem.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "Systems/FadeOutSystem.h" - -void FadeOutSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFadeOut, double dt) -{ - //if (dt == 0.0) { - // return; - //} - - //if (!entity.Valid()) { - // return; - //} - - //double& lifetime = cLifetime["Lifetime"]; - //lifetime -= dt; - - //if (lifetime <= 0.0) { - // m_Deletions.push_back(entity); - //} -} \ No newline at end of file diff --git a/src/Game/Systems/FadeSystem.cpp b/src/Game/Systems/FadeSystem.cpp new file mode 100644 index 00000000..f71bd316 --- /dev/null +++ b/src/Game/Systems/FadeSystem.cpp @@ -0,0 +1,37 @@ +#include "Systems/FadeSystem.h" + +void FadeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFade, double dt) +{ + double dTime = dt; + if (dTime == 0.0) { + return; + } + + if (!entity.Valid()) { + return; + } + + if (!(bool)cFade["Out"]) { + dTime *= -1; + } + + double fadeTime = cFade["FadeTime"]; + double& currentTime = cFade["Time"]; + currentTime += dTime; + + if(currentTime > fadeTime) { + currentTime = 0.0; + } + if(currentTime < 0.0) { + currentTime = fadeTime; + } + double ratio = currentTime/fadeTime; + + if(entity.HasComponent("Model")){ + ((glm::vec4&)entity["Model"]["Color"]).a = ratio; + } + if (entity.HasComponent("Sprite")) { + ((glm::vec4&)entity["Sprite"]["Color"]).a = ratio; + + } +} \ No newline at end of file From 8d809f30f7196f806c1e8a63a3e67b051c8d70dc Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 02:25:11 +0100 Subject: [PATCH 22/44] Muzzleflash now very nice --- resources/Schema/Components/Fade.xml | 1 + resources/Schema/Components/Fade.xsd | 3 ++ resources/Schema/Entities/MuzzleFlashBlue.xml | 34 ++++++++++++++++++- src/Game/Systems/FadeSystem.cpp | 12 +++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/resources/Schema/Components/Fade.xml b/resources/Schema/Components/Fade.xml index 6a8ac525..94c942ca 100644 --- a/resources/Schema/Components/Fade.xml +++ b/resources/Schema/Components/Fade.xml @@ -3,4 +3,5 @@ 1 true + false \ No newline at end of file diff --git a/resources/Schema/Components/Fade.xsd b/resources/Schema/Components/Fade.xsd index b0c5152a..9c638258 100644 --- a/resources/Schema/Components/Fade.xsd +++ b/resources/Schema/Components/Fade.xsd @@ -11,6 +11,9 @@ If the entity should fade out or in. + + If the entity should reverse the fade after finishing, this will double the speed. + diff --git a/resources/Schema/Entities/MuzzleFlashBlue.xml b/resources/Schema/Entities/MuzzleFlashBlue.xml index f984f6bc..840a2365 100644 --- a/resources/Schema/Entities/MuzzleFlashBlue.xml +++ b/resources/Schema/Entities/MuzzleFlashBlue.xml @@ -3,7 +3,7 @@ - 0.039999999105930328 + 0.08 @@ -16,6 +16,10 @@ + + 0.08 + true + 2 Models/Effects/MuzzleFlash/Blue/Cone1Outside.mesh @@ -28,6 +32,10 @@ + + 0.08 + true + 2 Models/Effects/MuzzleFlash/Blue/Cone1Inside.mesh @@ -49,6 +57,10 @@ + + 0.08 + true + 2 Models/Effects/MuzzleFlash/Blue/Cone2Inside.mesh @@ -61,6 +73,10 @@ + + 0.08 + true + 2 Models/Effects/MuzzleFlash/Blue/Cone2Outside.mesh @@ -82,6 +98,10 @@ + + 0.08 + true + 2 Models/Effects/MuzzleFlash/Blue/PlaneLeft.mesh @@ -94,6 +114,10 @@ + + 0.08 + true + 2 Models/Effects/MuzzleFlash/Blue/PlaneRight.mesh @@ -106,6 +130,10 @@ + + 0.08 + true + 2 Models/Effects/MuzzleFlash/Blue/PlaneUp.mesh @@ -118,6 +146,10 @@ + + 0.08 + true + 2 Models/Effects/MuzzleFlash/Blue/PlaneDown.mesh diff --git a/src/Game/Systems/FadeSystem.cpp b/src/Game/Systems/FadeSystem.cpp index f71bd316..0ed98ddb 100644 --- a/src/Game/Systems/FadeSystem.cpp +++ b/src/Game/Systems/FadeSystem.cpp @@ -15,15 +15,27 @@ void FadeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFade, dTime *= -1; } + if((bool)cFade["Reverse"]) { + dTime *= 2; + } + double fadeTime = cFade["FadeTime"]; double& currentTime = cFade["Time"]; currentTime += dTime; if(currentTime > fadeTime) { currentTime = 0.0; + if ((bool)cFade["Reverse"]) { + (bool&)cFade["Out"] = !(bool)cFade["Out"]; + currentTime = fadeTime; + } } if(currentTime < 0.0) { currentTime = fadeTime; + if ((bool)cFade["Reverse"]) { + (bool&)cFade["Out"] = !(bool)cFade["Out"]; + currentTime = 0.0; + } } double ratio = currentTime/fadeTime; From 60c6aa24868c8652a6604dd865059097dfe3851f Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 02:35:02 +0100 Subject: [PATCH 23/44] Defender first person tracers done --- .../Systems/Weapon/DefenderWeaponBehaviour.h | 1 + .../Entities/WeaponDefenderBlueView.xml | 2 +- .../Weapon/DefenderWeaponBehaviour.cpp | 35 +++++++++++++------ 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index 9244bb60..51f9c2cd 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -5,6 +5,7 @@ #include "Collision/Collision.h" #include "Core/EPlayerDamage.h" #include "Sound/EPlaySoundOnEntity.h" +#include class DefenderWeaponBehaviour : public WeaponBehaviour { diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml index fac92111..2bcdbcb7 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -166,7 +166,7 @@ Schema/Entities/RayBlue.xml - + diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index f33eea26..442be142 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -359,26 +359,41 @@ void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& return; } + EntityWrapper camera = wi.Player.FirstChildByName("Camera"); + if (!camera.Valid()) { + return; + } + float spreadAngle = glm::radians((float)cWeapon["SpreadAngle"]); for (auto& pellet : pattern) { - glm::quat pelletRotation = glm::quat(Transform::AbsoluteOrientationEuler(wi.Player.FirstChildByName("Camera"))) * glm::quat(glm::vec3(pellet.y, pellet.x, 0) * spreadAngle); - glm::vec3 origin = Transform::AbsolutePosition(wi.Player.FirstChildByName("Camera")); + glm::quat pelletRotation = glm::quat(Transform::AbsoluteOrientationEuler(camera)) * glm::quat(glm::vec3(pellet.y, pellet.x, 0) * spreadAngle); + glm::vec3 cameraPosition = Transform::AbsolutePosition(camera); glm::vec3 direction = pelletRotation * glm::vec3(0, 0, -1); - float distance = traceRayDistance(origin, direction); - // Collision::EntityFirstHitByRay(Ray(origin, direction), m_CollisionOctree, distance, pos); + float distance; + glm::vec3 hitPosition; + Collision::EntityFirstHitByRay(Ray(cameraPosition, direction), m_CollisionOctree, distance, hitPosition); EntityWrapper ray = SpawnerSystem::Spawn(muzzle); if (ray.Valid()) { ComponentWrapper cTransform = ray["Transform"]; - glm::vec3& position = cTransform["Position"]; - glm::vec3& orientation = cTransform["Orientation"]; - glm::vec3& scale = cTransform["Scale"]; + glm::vec3& rayOrigin = cTransform["Position"]; + glm::vec3& rayOrientation = cTransform["Orientation"]; + glm::vec3& rayScale = cTransform["Scale"]; - position = Transform::AbsolutePosition(wi.Player.FirstChildByName("Camera")); - orientation = glm::eulerAngles(pelletRotation); - scale.z = distance; + glm::vec3 muzzlePosition = Transform::AbsolutePosition(muzzle); + glm::quat muzzleOrientation = Transform::AbsoluteOrientation(muzzle); + + rayOrigin = muzzlePosition; + + glm::vec3 muzzleToHit = hitPosition - muzzlePosition; + glm::vec3 lookVector = glm::normalize(-muzzleToHit); + float pitch = std::asin(-lookVector.y); + float yaw = std::atan2(lookVector.x, lookVector.z); + glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0)); + rayOrientation = glm::eulerAngles(orientation); + rayScale.z = glm::length(muzzleToHit); } } } From bfb7a4139d5ac5719f572b6f6d7c6078cfc4b8ef Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 13:41:28 +0100 Subject: [PATCH 24/44] Tweaking --- .../Systems/Weapon/AssaultWeaponBehaviour.h | 1 - .../Systems/Weapon/SidearmWeaponBehaviour.h | 1 + resources/Schema/Entities/DefenderRayBlue.xml | 50 +++++++++++++++++++ .../Schema/Entities/PlayerDefenderBlue.xml | 6 ++- .../Entities/WeaponDefenderBlueView.xml | 2 +- .../Entities/WeaponDefenderBlueWorld.xml | 2 +- .../Entities/WeaponSidearmAssaultBlueView.xml | 2 +- .../Weapon/DefenderWeaponBehaviour.cpp | 43 ++++++++-------- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 45 +++++++++++++++++ 9 files changed, 126 insertions(+), 26 deletions(-) create mode 100644 resources/Schema/Entities/DefenderRayBlue.xml diff --git a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h index d577e22f..3e019268 100644 --- a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h @@ -31,7 +31,6 @@ private: // 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); diff --git a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h index 3123b460..7eaca082 100644 --- a/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/SidearmWeaponBehaviour.h @@ -39,6 +39,7 @@ private: bool dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi); // void giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver); + void spawnTracer(ComponentWrapper cWeapon, WeaponInfo& wi); void CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi); void RemoveFrindlyAmmoHUD(WeaponInfo& wi); diff --git a/resources/Schema/Entities/DefenderRayBlue.xml b/resources/Schema/Entities/DefenderRayBlue.xml new file mode 100644 index 00000000..7680f1da --- /dev/null +++ b/resources/Schema/Entities/DefenderRayBlue.xml @@ -0,0 +1,50 @@ + + + + + + 0.5 + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/NewRay3.png + + true + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/NewRay3.png + + true + + + + + + + + + + + + diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index c75f50fd..25fc54d2 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -13,9 +13,13 @@ + 120 8 + 5 - + + 10 + 150 150 diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml index 2bcdbcb7..8c8da6a3 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -163,7 +163,7 @@ - Schema/Entities/RayBlue.xml + Schema/Entities/DefenderRayBlue.xml diff --git a/resources/Schema/Entities/WeaponDefenderBlueWorld.xml b/resources/Schema/Entities/WeaponDefenderBlueWorld.xml index 6c750964..bf87a789 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueWorld.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueWorld.xml @@ -12,7 +12,7 @@ - Schema/Entities/RayBlue.xml + Schema/Entities/DefenderRayBlue.xml diff --git a/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml b/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml index 620d9416..0d7e2172 100644 --- a/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml @@ -97,7 +97,7 @@ - Schema/Entities/Ray2Red.xml + Schema/Entities/RayBlue.xml diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 442be142..0686aebf 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -373,27 +373,28 @@ void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& float distance; glm::vec3 hitPosition; - Collision::EntityFirstHitByRay(Ray(cameraPosition, direction), m_CollisionOctree, distance, hitPosition); + if (Collision::EntityFirstHitByRay(Ray(cameraPosition, direction), m_CollisionOctree, distance, hitPosition) != boost::none) { // don't spawn ray if you "miss the world" - EntityWrapper ray = SpawnerSystem::Spawn(muzzle); - if (ray.Valid()) { - ComponentWrapper cTransform = ray["Transform"]; - glm::vec3& rayOrigin = cTransform["Position"]; - glm::vec3& rayOrientation = cTransform["Orientation"]; - glm::vec3& rayScale = cTransform["Scale"]; + EntityWrapper ray = SpawnerSystem::Spawn(muzzle); + if (ray.Valid()) { + ComponentWrapper cTransform = ray["Transform"]; + glm::vec3& rayOrigin = cTransform["Position"]; + glm::vec3& rayOrientation = cTransform["Orientation"]; + glm::vec3& rayScale = cTransform["Scale"]; - glm::vec3 muzzlePosition = Transform::AbsolutePosition(muzzle); - glm::quat muzzleOrientation = Transform::AbsoluteOrientation(muzzle); - - rayOrigin = muzzlePosition; + glm::vec3 muzzlePosition = Transform::AbsolutePosition(muzzle); + glm::quat muzzleOrientation = Transform::AbsoluteOrientation(muzzle); - glm::vec3 muzzleToHit = hitPosition - muzzlePosition; - glm::vec3 lookVector = glm::normalize(-muzzleToHit); - float pitch = std::asin(-lookVector.y); - float yaw = std::atan2(lookVector.x, lookVector.z); - glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0)); - rayOrientation = glm::eulerAngles(orientation); - rayScale.z = glm::length(muzzleToHit); + rayOrigin = muzzlePosition; + + glm::vec3 muzzleToHit = hitPosition - muzzlePosition; + glm::vec3 lookVector = glm::normalize(-muzzleToHit); + float pitch = std::asin(-lookVector.y); + float yaw = std::atan2(lookVector.x, lookVector.z); + glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0)); + rayOrientation = glm::eulerAngles(orientation); + rayScale.z = glm::length(muzzleToHit); + } } } } @@ -448,8 +449,8 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w } // Temp hit decal - EntityWrapper hit = ResourceManager::Load("Schema/Entities/HitTest.xml")->MergeInto(m_World); - hit["Transform"]["Position"] = pick.Position; + // EntityWrapper hit = ResourceManager::Load("Schema/Entities/HitTest.xml")->MergeInto(m_World); + // hit["Transform"]["Position"] = pick.Position; // Don't let us shoot ourselves in the foot somehow if (victim == LocalPlayer) { @@ -471,7 +472,7 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w } damageSum[victim] += pelletDamage; - ((glm::vec3&)hit["Model"]["Color"]).b = 1.f; + // ((glm::vec3&)hit["Model"]["Color"]).b = 1.f; } // Deal damage! diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index 1364894d..c9272127 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -321,6 +321,8 @@ bool SidearmWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi } } + spawnTracer(cWeapon, wi); + // Deal damage! Events::PlayerDamage ePlayerDamage; ePlayerDamage.Inflictor = wi.Player; @@ -330,6 +332,49 @@ bool SidearmWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi return damage > 0; } + +void SidearmWeaponBehaviour::spawnTracer(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + EntityWrapper muzzle = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzle"); + if (!muzzle.Valid()) { + return; + } + + EntityWrapper camera = wi.Player.FirstChildByName("Camera"); + if (!camera.Valid()) { + return; + } + + glm::vec3 cameraPosition = Transform::AbsolutePosition(camera); + glm::vec3 direction = glm::vec3(0, 0, -1); + + float distance; + glm::vec3 hitPosition; + Collision::EntityFirstHitByRay(Ray(cameraPosition, direction), m_CollisionOctree, distance, hitPosition); + + EntityWrapper ray = SpawnerSystem::Spawn(muzzle); + if (ray.Valid()) { + ComponentWrapper cTransform = ray["Transform"]; + glm::vec3& rayOrigin = cTransform["Position"]; + glm::vec3& rayOrientation = cTransform["Orientation"]; + glm::vec3& rayScale = cTransform["Scale"]; + + glm::vec3 muzzlePosition = Transform::AbsolutePosition(muzzle); + glm::quat muzzleOrientation = Transform::AbsoluteOrientation(muzzle); + + rayOrigin = muzzlePosition; + + glm::vec3 muzzleToHit = hitPosition - muzzlePosition; + glm::vec3 lookVector = glm::normalize(-muzzleToHit); + float pitch = std::asin(-lookVector.y); + float yaw = std::atan2(lookVector.x, lookVector.z); + glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0)); + rayOrientation = glm::eulerAngles(orientation); + rayScale.z = glm::length(muzzleToHit); + } + +} + /* void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver) From 0f4f32188c28ec2713f357c072b9083eecf6112a Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 14:55:29 +0100 Subject: [PATCH 25/44] assault weapon now reloading correctly --- src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index ca53ce0f..089443a3 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -36,8 +36,11 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& int& magSize = cWeapon["MagazineSize"]; int& ammo = cWeapon["Ammo"]; - ammo = glm::max(0, ammo - (magSize - magAmmo)); - magAmmo = glm::min(magSize, ammo); + int usedAmmo = glm::max(0, magSize - magAmmo); + magAmmo = glm::clamp(ammo + magAmmo, 0, magSize); + ammo = glm::max(0, ammo - usedAmmo); + + isReloading = false; if (wi.FirstPersonEntity.Valid()) { wi.FirstPersonEntity.FirstChildByName("ViewModel")["Model"]["Visible"] = true; From 7d899a989c5564928008b87196ff5c3ae9ff8bc4 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 15:09:50 +0100 Subject: [PATCH 26/44] Started working on boost HUD thingy --- .../Systems/Weapon/AssaultWeaponBehaviour.h | 4 + .../Schema/Entities/WeaponAssaultBlueView.xml | 20 ++++ .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 96 +++++++++++++++++++ 3 files changed, 120 insertions(+) diff --git a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h index 3e019268..231cc020 100644 --- a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h @@ -36,6 +36,10 @@ private: // Utility //Camera cameraFromEntity(EntityWrapper camera); + + void CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi); + void RemoveBoostCheckHUD(WeaponInfo& wi); + }; #endif \ No newline at end of file diff --git a/resources/Schema/Entities/WeaponAssaultBlueView.xml b/resources/Schema/Entities/WeaponAssaultBlueView.xml index 6d7e6fa0..910fe8b3 100644 --- a/resources/Schema/Entities/WeaponAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponAssaultBlueView.xml @@ -212,6 +212,26 @@ + + + + Schema/Entities/FriendlyAmmoHUD.xml + + + + + + + + + + + Schema/Entities/AmmoShareEffectView.xml + + + + + diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 089443a3..1af0e927 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -341,3 +341,99 @@ bool AssaultWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi return damage > 0; } + +void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + // Only check ammo client side + if (!IsClient) { + return; + } + + // Only handle ammo check for the local player + if (wi.Player != LocalPlayer) { + return; + } + + // Make sure the player isn't checking from the grave + if (!wi.Player.Valid()) { + return; + } + + // 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()) { + RemoveBoostCheckHUD(wi); + return; + } + + // Don't let us somehow shoot ourselves in the foot + if (victim == LocalPlayer) { + RemoveBoostCheckHUD(wi); + return; + } + + // Only care about players being hit + if (!victim.HasComponent("Player")) { + victim = victim.FirstParentWithComponent("Player"); + } + if (!victim.Valid()) { + RemoveBoostCheckHUD(wi); + return; + } + + + // 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"]) { + + EntityWrapper friendlyBoostHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyBoostAttachment"); + if (friendlyBoostHudSpawner.Valid()) { + + auto children = m_World->GetDirectChildren(friendlyBoostHudSpawner.ID); + + if (children.first == children.second) { + if (friendlyBoostHudSpawner.HasComponent("Spawner")) { + EntityWrapper friendlyAmmoHud = SpawnerSystem::Spawn(friendlyBoostHudSpawner, friendlyBoostHudSpawner); + if (friendlyAmmoHud.Valid()) { + EntityWrapper textEntity = friendlyAmmoHud.FirstChildByName("MagazineAmmo"); + if (textEntity.Valid()) { + if (textEntity.HasComponent("Text")) { + // (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + } + } + + EntityWrapper ammoTextEntity = friendlyAmmoHud.FirstChildByName("Ammo"); + if (ammoTextEntity.Valid()) { + if (ammoTextEntity.HasComponent("Text")) { + // (std::string&)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); + } + } + } + } + } else { + EntityWrapper textEntity = friendlyBoostHudSpawner.FirstChildByName("MagazineAmmo"); + if (textEntity.Valid()) { + if (textEntity.HasComponent("Text")) { + // (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + } + } + + EntityWrapper ammoTextEntity = friendlyBoostHudSpawner.FirstChildByName("Ammo"); + if (ammoTextEntity.Valid()) { + if (ammoTextEntity.HasComponent("Text")) { + // (std::string&)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); + } + } + } + } + } + +} + +void AssaultWeaponBehaviour::RemoveBoostCheckHUD(WeaponInfo& wi) +{ + +} From 04288e52432adaa80e2087a26bec1979d870c6e1 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 16:14:13 +0100 Subject: [PATCH 27/44] Merge fixes --- include/Engine/Rendering/SpriteJob.h | 2 +- src/Game/Systems/AbilityCooldownHUDSystem.cpp | 12 ++-- src/Game/Systems/BoostIconsHUDSystem.cpp | 12 ++-- src/Game/Systems/BoostSystem.cpp | 8 +-- src/Game/Systems/EndScreenSystem.cpp | 24 ++++---- src/Game/Systems/FadeSystem.cpp | 10 ++-- src/Game/Systems/PlayerMovementSystem.cpp | 4 +- .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 14 ++--- .../Weapon/DefenderWeaponBehaviour.cpp | 58 +++++++++--------- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 60 +++++++++---------- 10 files changed, 102 insertions(+), 102 deletions(-) diff --git a/include/Engine/Rendering/SpriteJob.h b/include/Engine/Rendering/SpriteJob.h index b0c16bd4..2836e050 100644 --- a/include/Engine/Rendering/SpriteJob.h +++ b/include/Engine/Rendering/SpriteJob.h @@ -21,7 +21,7 @@ struct SpriteJob : RenderJob SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted, bool isIndicator) : RenderJob() { - Model = ResourceManager::Load<::Model>((std::string)cSprite["Model"]); + Model = ResourceManager::Load<::Model>(cSprite["Model"]); ::RawModel::MaterialProperties matProp = Model->MaterialGroups().front(); TextureID = 0; diff --git a/src/Game/Systems/AbilityCooldownHUDSystem.cpp b/src/Game/Systems/AbilityCooldownHUDSystem.cpp index 23e9a6b7..c89b4251 100644 --- a/src/Game/Systems/AbilityCooldownHUDSystem.cpp +++ b/src/Game/Systems/AbilityCooldownHUDSystem.cpp @@ -24,28 +24,28 @@ void AbilityCooldownHUDSystem::Update(double dt) if (!abilityEntity.Valid()) { //If we dont have a shield ability, we return, since we cannot do anything. if (entity.HasComponent("Sprite")) { - (std::string&)entity["Sprite"]["DiffuseTexture"] = "Textures/Test/aM4ME4GR.png"; + (Field)entity["Sprite"]["DiffuseTexture"] = "Textures/Test/aM4ME4GR.png"; } 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/Long/SheildDots-01.png"; + (Field)entity["Sprite"]["DiffuseTexture"] = "Textures/Icons/Abilities/Long/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/Long/Dash-01.png"; + (Field)entity["Sprite"]["DiffuseTexture"] = "Textures/Icons/Abilities/Long/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/Long/Superman-01.png"; + (Field)entity["Sprite"]["DiffuseTexture"] = "Textures/Icons/Abilities/Long/Superman-01.png"; } } @@ -60,7 +60,7 @@ void AbilityCooldownHUDSystem::Update(double dt) if (cooldownTextEntity.Valid()) { if (cooldownTextEntity.HasComponent("Text")) { - std::string t = (std::string&)cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3); + (Field)cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3); } } } @@ -76,7 +76,7 @@ void AbilityCooldownHUDSystem::Update(double dt) } if (entity.HasComponent("Fill")) { - entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD; + (Field)entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD; } diff --git a/src/Game/Systems/BoostIconsHUDSystem.cpp b/src/Game/Systems/BoostIconsHUDSystem.cpp index d151a044..1f0331e2 100644 --- a/src/Game/Systems/BoostIconsHUDSystem.cpp +++ b/src/Game/Systems/BoostIconsHUDSystem.cpp @@ -12,9 +12,9 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe if (assaultEntity.HasComponent("Fill")) { EntityWrapper assaultBoost = player.FirstChildByName("BoostAssault"); if (assaultBoost.Valid()) { - (double&)assaultEntity["Fill"]["Percentage"] = 1.0; + (Field)assaultEntity["Fill"]["Percentage"] = 1.0; } else { - (double&)assaultEntity["Fill"]["Percentage"] = 0.0; + (Field)assaultEntity["Fill"]["Percentage"] = 0.0; } } } @@ -23,9 +23,9 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe if (defenderEntity.HasComponent("Fill")) { EntityWrapper defenderBoost = player.FirstChildByName("BoostDefender"); if (defenderBoost.Valid()) { - (double&)defenderEntity["Fill"]["Percentage"] = 1.0; + (Field)defenderEntity["Fill"]["Percentage"] = 1.0; } else { - (double&)defenderEntity["Fill"]["Percentage"] = 0.0; + (Field)defenderEntity["Fill"]["Percentage"] = 0.0; } } } @@ -34,9 +34,9 @@ void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrappe if (sniperEntity.HasComponent("Fill")) { EntityWrapper sniperBoost = player.FirstChildByName("BoostSniper"); if (sniperBoost.Valid()) { - (double&)sniperEntity["Fill"]["Percentage"] = 1.0; + (Field)sniperEntity["Fill"]["Percentage"] = 1.0; } else { - (double&)sniperEntity["Fill"]["Percentage"] = 0.0; + (Field)sniperEntity["Fill"]["Percentage"] = 0.0; } } } diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index b695aa96..ede147c3 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -81,10 +81,10 @@ void BoostSystem::giveAmmo(EntityWrapper giver, EntityWrapper receiver) { if (receiver.HasComponent("AssaultWeapon")) { int magazineSize = receiver["AssaultWeapon"]["MagazineSize"]; - int& magazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"]; + Field magazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"]; int prevMagazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"]; int maxAmmo = receiver["AssaultWeapon"]["MaxAmmo"]; - int& ammo = receiver["AssaultWeapon"]["Ammo"]; + Field ammo = receiver["AssaultWeapon"]["Ammo"]; int givenAmmo = 3; @@ -97,10 +97,10 @@ void BoostSystem::giveAmmo(EntityWrapper giver, EntityWrapper receiver) } } else if (receiver.HasComponent("DefenderWeapon")) { int magazineSize = receiver["DefenderWeapon"]["MagazineSize"]; - int& magazineAmmo = receiver["DefenderWeapon"]["MagazineAmmo"]; + Field magazineAmmo = receiver["DefenderWeapon"]["MagazineAmmo"]; int prevMagazineAmmo = receiver["DefenderWeapon"]["MagazineAmmo"]; int maxAmmo = receiver["DefenderWeapon"]["MaxAmmo"]; - int& ammo = receiver["DefenderWeapon"]["Ammo"]; + Field ammo = receiver["DefenderWeapon"]["Ammo"]; int givenAmmo = 1; diff --git a/src/Game/Systems/EndScreenSystem.cpp b/src/Game/Systems/EndScreenSystem.cpp index f16adf83..59c261bd 100644 --- a/src/Game/Systems/EndScreenSystem.cpp +++ b/src/Game/Systems/EndScreenSystem.cpp @@ -35,37 +35,37 @@ bool EndScreenSystem::OnWin(const Events::Win& e) if (e.TeamThatWon == 2) { //Red team won if(redSprite.HasComponent("Sprite")) - (bool&)redSprite["Sprite"]["Visible"] = true; + (Field)redSprite["Sprite"]["Visible"] = true; if (redText.HasComponent("Text")) - (bool&)redText["Text"]["Visible"] = true; + (Field)redText["Text"]["Visible"] = true; if (blueSprite.HasComponent("Sprite")) - (bool&)blueSprite["Sprite"]["Visible"] = false; + (Field)blueSprite["Sprite"]["Visible"] = false; if (blueText.HasComponent("Text")) - (bool&)blueText["Text"]["Visible"] = false; + (Field)blueText["Text"]["Visible"] = false; }else if (e.TeamThatWon == 3) { //Blue team won if (redSprite.HasComponent("Sprite")) - (bool&)redSprite["Sprite"]["Visible"] = false; + (Field)redSprite["Sprite"]["Visible"] = false; if (redText.HasComponent("Text")) - (bool&)redText["Text"]["Visible"] = false; + (Field)redText["Text"]["Visible"] = false; if (blueSprite.HasComponent("Sprite")) - (bool&)blueSprite["Sprite"]["Visible"] = true; + (Field)blueSprite["Sprite"]["Visible"] = true; if (blueText.HasComponent("Text")) - (bool&)blueText["Text"]["Visible"] = true; + (Field)blueText["Text"]["Visible"] = true; } else { //No team won? if (redSprite.HasComponent("Sprite")) - (bool&)redSprite["Sprite"]["Visible"] = false; + (Field)redSprite["Sprite"]["Visible"] = false; if (blueSprite.HasComponent("Sprite")) - (bool&)blueSprite["Sprite"]["Visible"] = false; + (Field)blueSprite["Sprite"]["Visible"] = false; if (redText.HasComponent("Text")) - (bool&)redText["Text"]["Visible"] = false; + (Field)redText["Text"]["Visible"] = false; if (blueText.HasComponent("Text")) - (bool&)blueText["Text"]["Visible"] = false; + (Field)blueText["Text"]["Visible"] = false; } } diff --git a/src/Game/Systems/FadeSystem.cpp b/src/Game/Systems/FadeSystem.cpp index 0ed98ddb..5c33f8af 100644 --- a/src/Game/Systems/FadeSystem.cpp +++ b/src/Game/Systems/FadeSystem.cpp @@ -20,30 +20,30 @@ void FadeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFade, } double fadeTime = cFade["FadeTime"]; - double& currentTime = cFade["Time"]; + Field currentTime = cFade["Time"]; currentTime += dTime; if(currentTime > fadeTime) { currentTime = 0.0; if ((bool)cFade["Reverse"]) { - (bool&)cFade["Out"] = !(bool)cFade["Out"]; + (Field)cFade["Out"] = !(bool)cFade["Out"]; currentTime = fadeTime; } } if(currentTime < 0.0) { currentTime = fadeTime; if ((bool)cFade["Reverse"]) { - (bool&)cFade["Out"] = !(bool)cFade["Out"]; + (Field)cFade["Out"] = !(bool)cFade["Out"]; currentTime = 0.0; } } double ratio = currentTime/fadeTime; if(entity.HasComponent("Model")){ - ((glm::vec4&)entity["Model"]["Color"]).a = ratio; + ((Field)entity["Model"]["Color"]).w(ratio); } if (entity.HasComponent("Sprite")) { - ((glm::vec4&)entity["Sprite"]["Color"]).a = ratio; + ((Field)entity["Sprite"]["Color"]).w(ratio); } } \ No newline at end of file diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index 09da8d41..35a7d3cf 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -84,7 +84,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt) // Limit camera pitch so we don't break our necks cameraOrientation.x(glm::clamp(cameraOrientation.x(), -glm::half_pi(), glm::half_pi())); - float pitch = cameraOrientation.x; + float pitch = cameraOrientation.x(); double time = ((pitch + glm::half_pi()) / glm::pi()); // Set third person model aim pitch @@ -325,7 +325,7 @@ void PlayerMovementSystem::setAim(EntityWrapper root, std::string weaponNodeName EntityWrapper aim = weapon.FirstChildByName("Aim"); if (aim.Valid()) { if (aim.HasComponent("Animation")) { - (double&)aim["Animation"]["Time"] = time; + (Field)aim["Animation"]["Time"] = time; } } } diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 60f69609..ad9caae4 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -36,9 +36,9 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& Field magSize = cWeapon["MagazineSize"]; Field ammo = cWeapon["Ammo"]; - int usedAmmo = glm::max(0, magSize - magAmmo); - magAmmo = glm::clamp(ammo + magAmmo, 0, magSize); - ammo = glm::max(0, ammo - usedAmmo); + int usedAmmo = glm::max(0, *magSize - *magAmmo); + magAmmo = glm::clamp(*ammo + *magAmmo, 0, *magSize); + ammo = glm::max(0, *ammo - usedAmmo); isReloading = false; @@ -243,7 +243,7 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi std::uniform_real_distribution randomSpreadAngle(0.f, 3.1415f*2); EntityWrapper flash = SpawnerSystem::Spawn(muzzleFlashSpawner, muzzleFlashSpawner); if (flash.Valid()) { - ((glm::vec3&)flash["Transform"]["Orientation"]).z = randomSpreadAngle(m_RandomEngine); + ((Field)flash["Transform"]["Orientation"]).z(randomSpreadAngle(m_RandomEngine)); } } @@ -264,16 +264,16 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi if (IsClient) { EntityWrapper camera = wi.Player.FirstChildByName("Camera"); if (camera.Valid()) { - glm::vec3& cameraOrientation = camera["Transform"]["Orientation"]; + Field cameraOrientation = camera["Transform"]["Orientation"]; float viewPunch = cWeapon["ViewPunch"]; float maxTravelAngle = cWeapon["MaxTravelAngle"]; - float& currentTravel = cWeapon["CurrentTravel"]; + Field currentTravel = cWeapon["CurrentTravel"]; if (currentTravel < maxTravelAngle) { float change = viewPunch; if (currentTravel + change > maxTravelAngle) { change = maxTravelAngle - currentTravel; } - cameraOrientation.x += change; + cameraOrientation.x(cameraOrientation.x() + change); currentTravel += change; } } diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 0686aebf..39da8399 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -2,7 +2,7 @@ void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) { - double& fireCooldown = cWeapon["FireCooldown"]; + Field fireCooldown = cWeapon["FireCooldown"]; fireCooldown = glm::max(0.0, fireCooldown - dt); WeaponBehaviour::UpdateComponent(entity, cWeapon, dt); @@ -11,27 +11,27 @@ void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWr void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { // Decrement reload timer - double& reloadTimer = cWeapon["ReloadTimer"]; + Field reloadTimer = cWeapon["ReloadTimer"]; reloadTimer = glm::max(0.0, reloadTimer - dt); // Start reloading automatically if at 0 mag ammo - int& magAmmo = cWeapon["MagazineAmmo"]; + Field magAmmo = cWeapon["MagazineAmmo"]; if (m_ConfigAutoReload && magAmmo <= 0) { OnReload(cWeapon, wi); } // Handle reloading - bool& isReloading = cWeapon["IsReloading"]; + Field isReloading = cWeapon["IsReloading"]; if (isReloading && reloadTimer <= 0.0) { double reloadTime = cWeapon["ReloadTime"]; - int& magSize = cWeapon["MagazineSize"]; - int& ammo = cWeapon["Ammo"]; + Field magSize = cWeapon["MagazineSize"]; + Field ammo = cWeapon["Ammo"]; if (magAmmo < magSize && ammo > 0) { ammo -= 1; magAmmo += 1; reloadTimer = reloadTime; Events::PlaySoundOnEntity e; - e.EmitterID = wi.Player.ID; + e.Emitter = wi.Player; e.FilePath = "Audio/weapon/Zoom.wav"; m_EventBroker->Publish(e); } else { @@ -52,15 +52,15 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& // Restore view angle if (IsClient) { - float& currentTravel = cWeapon["CurrentTravel"]; - float& returnSpeed = cWeapon["ViewReturnSpeed"]; + Field currentTravel = cWeapon["CurrentTravel"]; + Field 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; + Field cameraOrientation = camera["Transform"]["Orientation"]; + cameraOrientation.x(cameraOrientation.x() - change); } } } @@ -86,23 +86,23 @@ void DefenderWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapo void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) { - bool& isReloading = cWeapon["IsReloading"]; + Field isReloading = cWeapon["IsReloading"]; if (isReloading) { return; } - int& magAmmo = cWeapon["MagazineAmmo"]; - int& magSize = cWeapon["MagazineSize"]; + Field magAmmo = cWeapon["MagazineAmmo"]; + Field magSize = cWeapon["MagazineSize"]; if (magAmmo >= magSize) { return; } - int& ammo = cWeapon["Ammo"]; + Field ammo = cWeapon["Ammo"]; if (ammo <= 0) { return; } double reloadTime = cWeapon["ReloadTime"]; - double& reloadTimer = cWeapon["ReloadTimer"]; + Field reloadTimer = cWeapon["ReloadTimer"]; // Start reload isReloading = true; @@ -155,7 +155,7 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf if(wi.Player.Valid()) { if(wi.Player.HasComponent("ShieldAbility")) { - (bool&)wi.Player["ShieldAbility"]["Active"] = true; + (Field)wi.Player["ShieldAbility"]["Active"] = true; } } @@ -223,7 +223,7 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf if (wi.Player.Valid()) { if (wi.Player.HasComponent("ShieldAbility")) { - (bool&)wi.Player["ShieldAbility"]["Active"] = false; + (Field)wi.Player["ShieldAbility"]["Active"] = false; } } @@ -285,11 +285,11 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"]; // Stop reloading - bool& isReloading = cWeapon["IsReloading"]; + Field isReloading = cWeapon["IsReloading"]; isReloading = false; // Ammo - int& magAmmo = cWeapon["MagazineAmmo"]; + Field magAmmo = cWeapon["MagazineAmmo"]; if (magAmmo <= 0) { return; } else { @@ -347,7 +347,7 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi // Sound Events::PlaySoundOnEntity e; - e.EmitterID = wi.Player.ID; + e.Emitter = wi.Player; e.FilePath = "Audio/weapon/Blast.wav"; m_EventBroker->Publish(e); } @@ -367,8 +367,8 @@ void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& float spreadAngle = glm::radians((float)cWeapon["SpreadAngle"]); for (auto& pellet : pattern) { - glm::quat pelletRotation = glm::quat(Transform::AbsoluteOrientationEuler(camera)) * glm::quat(glm::vec3(pellet.y, pellet.x, 0) * spreadAngle); - glm::vec3 cameraPosition = Transform::AbsolutePosition(camera); + glm::quat pelletRotation = glm::quat(TransformSystem::AbsoluteOrientationEuler(camera)) * glm::quat(glm::vec3(pellet.y, pellet.x, 0) * spreadAngle); + glm::vec3 cameraPosition = TransformSystem::AbsolutePosition(camera); glm::vec3 direction = pelletRotation * glm::vec3(0, 0, -1); float distance; @@ -378,12 +378,12 @@ void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& EntityWrapper ray = SpawnerSystem::Spawn(muzzle); if (ray.Valid()) { ComponentWrapper cTransform = ray["Transform"]; - glm::vec3& rayOrigin = cTransform["Position"]; - glm::vec3& rayOrientation = cTransform["Orientation"]; - glm::vec3& rayScale = cTransform["Scale"]; + Field rayOrigin = cTransform["Position"]; + Field rayOrientation = cTransform["Orientation"]; + Field rayScale = cTransform["Scale"]; - glm::vec3 muzzlePosition = Transform::AbsolutePosition(muzzle); - glm::quat muzzleOrientation = Transform::AbsoluteOrientation(muzzle); + glm::vec3 muzzlePosition = TransformSystem::AbsolutePosition(muzzle); + glm::quat muzzleOrientation = TransformSystem::AbsoluteOrientation(muzzle); rayOrigin = muzzlePosition; @@ -393,7 +393,7 @@ void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& float yaw = std::atan2(lookVector.x, lookVector.z); glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0)); rayOrientation = glm::eulerAngles(orientation); - rayScale.z = glm::length(muzzleToHit); + rayScale.z(glm::length(muzzleToHit)); } } } diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index c9272127..504130ff 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -2,7 +2,7 @@ void SidearmWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cWeapon, double dt) { - double& cooldown = cWeapon["FireCooldown"]; + Field cooldown = cWeapon["FireCooldown"]; if (cooldown > 0) { cooldown -= dt; if (cooldown < 0) { @@ -17,29 +17,29 @@ void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& CheckAmmo(cWeapon, wi); // Start reloading automatically if at 0 mag ammo - int& magAmmo = cWeapon["MagazineAmmo"]; + Field magAmmo = cWeapon["MagazineAmmo"]; if (m_ConfigAutoReload && magAmmo <= 0) { OnReload(cWeapon, wi); } // Only start reloading once we're done firing - bool& reloadQueued = cWeapon["ReloadQueued"]; - double& fireCooldown = cWeapon["FireCooldown"]; - bool& isReloading = cWeapon["IsReloading"]; + Field reloadQueued = cWeapon["ReloadQueued"]; + Field fireCooldown = cWeapon["FireCooldown"]; + Field isReloading = cWeapon["IsReloading"]; if (reloadQueued && fireCooldown <= 0) { reloadQueued = fireCooldown; isReloading = true; } // Decrement reload timer - double& reloadTimer = cWeapon["ReloadTimer"]; + Field reloadTimer = cWeapon["ReloadTimer"]; if (isReloading) { reloadTimer = glm::max(0.0, reloadTimer - dt); } // Handle reloading if (isReloading && reloadTimer <= 0.0) { - int& magSize = cWeapon["MagazineSize"]; + Field magSize = cWeapon["MagazineSize"]; magAmmo = magSize; isReloading = false; @@ -65,7 +65,7 @@ void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& if (rootNode.Valid()) { EntityWrapper blend = rootNode.FirstChildByName("MovementBlendSidearm"); if (blend.Valid()) { - (double&)blend["Blend"]["Weight"] = animationWeight; + (Field)blend["Blend"]["Weight"] = animationWeight; } } @@ -90,20 +90,20 @@ void SidearmWeaponBehaviour::OnCeasePrimaryFire(ComponentWrapper cWeapon, Weapon void SidearmWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) { - bool& reloadQueued = cWeapon["ReloadQueued"]; - bool& isReloading = cWeapon["IsReloading"]; + Field reloadQueued = cWeapon["ReloadQueued"]; + Field isReloading = cWeapon["IsReloading"]; if (reloadQueued || isReloading) { return; } - int& magAmmo = cWeapon["MagazineAmmo"]; - int& magSize = cWeapon["MagazineSize"]; + Field magAmmo = cWeapon["MagazineAmmo"]; + Field magSize = cWeapon["MagazineSize"]; if (magAmmo >= magSize) { return; } double reloadTime = cWeapon["ReloadTime"]; - double& reloadTimer = cWeapon["ReloadTimer"]; + Field reloadTimer = cWeapon["ReloadTimer"]; // Start reload reloadQueued = true; @@ -143,7 +143,7 @@ void SidearmWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) // Sound Events::PlaySoundOnEntity e; - e.EmitterID = wi.Player.ID; + e.Emitter = wi.Player; e.FilePath = "Audio/weapon/Assault/AssaultWeaponReload.wav"; m_EventBroker->Publish(e); } @@ -176,7 +176,7 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"]; // Ammo - int& magAmmo = cWeapon["MagazineAmmo"]; + Field magAmmo = cWeapon["MagazineAmmo"]; if (magAmmo <= 0) { return; } else { @@ -192,12 +192,12 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi // 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); + glm::vec3 origin = TransformSystem::AbsolutePosition(tracerSpawner); + glm::vec3 direction = TransformSystem::AbsoluteOrientation(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; + ((Field)ray["Transform"]["Scale"]).z(distance); } } @@ -208,7 +208,7 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi if (hitMarkerSpawner.Valid()) { SpawnerSystem::Spawn(hitMarkerSpawner, hitMarkerSpawner); Events::PlaySoundOnEntity e; - e.EmitterID = wi.Player.ID; + e.Emitter = wi.Player; e.FilePath = "Audio/weapon/hitclick.wav"; m_EventBroker->Publish(e); } @@ -345,7 +345,7 @@ void SidearmWeaponBehaviour::spawnTracer(ComponentWrapper cWeapon, WeaponInfo& w return; } - glm::vec3 cameraPosition = Transform::AbsolutePosition(camera); + glm::vec3 cameraPosition = TransformSystem::AbsolutePosition(camera); glm::vec3 direction = glm::vec3(0, 0, -1); float distance; @@ -355,12 +355,12 @@ void SidearmWeaponBehaviour::spawnTracer(ComponentWrapper cWeapon, WeaponInfo& w EntityWrapper ray = SpawnerSystem::Spawn(muzzle); if (ray.Valid()) { ComponentWrapper cTransform = ray["Transform"]; - glm::vec3& rayOrigin = cTransform["Position"]; - glm::vec3& rayOrientation = cTransform["Orientation"]; - glm::vec3& rayScale = cTransform["Scale"]; + Field rayOrigin = cTransform["Position"]; + Field rayOrientation = cTransform["Orientation"]; + Field rayScale = cTransform["Scale"]; - glm::vec3 muzzlePosition = Transform::AbsolutePosition(muzzle); - glm::quat muzzleOrientation = Transform::AbsoluteOrientation(muzzle); + glm::vec3 muzzlePosition = TransformSystem::AbsolutePosition(muzzle); + glm::quat muzzleOrientation = TransformSystem::AbsoluteOrientation(muzzle); rayOrigin = muzzlePosition; @@ -370,7 +370,7 @@ void SidearmWeaponBehaviour::spawnTracer(ComponentWrapper cWeapon, WeaponInfo& w float yaw = std::atan2(lookVector.x, lookVector.z); glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0)); rayOrientation = glm::eulerAngles(orientation); - rayScale.z = glm::length(muzzleToHit); + rayScale.z(glm::length(muzzleToHit)); } } @@ -492,14 +492,14 @@ void SidearmWeaponBehaviour::CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi) EntityWrapper textEntity = friendlyAmmoHud.FirstChildByName("MagazineAmmo"); if (textEntity.Valid()) { if (textEntity.HasComponent("Text")) { - (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + (Field)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); } } EntityWrapper ammoTextEntity = friendlyAmmoHud.FirstChildByName("Ammo"); if (ammoTextEntity.Valid()) { if (ammoTextEntity.HasComponent("Text")) { - (std::string&)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); + (Field)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); } } } @@ -508,14 +508,14 @@ void SidearmWeaponBehaviour::CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi) EntityWrapper textEntity = friendlyAmmoHudSpawner.FirstChildByName("MagazineAmmo"); if (textEntity.Valid()) { if (textEntity.HasComponent("Text")) { - (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + (Field)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); } } EntityWrapper ammoTextEntity = friendlyAmmoHudSpawner.FirstChildByName("Ammo"); if (ammoTextEntity.Valid()) { if (ammoTextEntity.HasComponent("Text")) { - (std::string&)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); + (Field)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); } } } From 9f752ad3e9baa89c4fc1c5e584b589fbdb67f88a Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 16:15:06 +0100 Subject: [PATCH 28/44] Fadesystem, entities, weapon muzzles should now look good. reload for secondary --- resources/Schema/Components/SidearmWeapon.xml | 2 +- resources/Schema/Entities/MovementTest.xml | 733 ++++++++++++++++++ .../Entities/MuzzleFlashSideArmBlue.xml | 219 ++++++ ...DefenderRayBlue.xml => RayAssaultBlue.xml} | 24 +- resources/Schema/Entities/RayDefenderBlue.xml | 50 ++ resources/Schema/Entities/RaySideArmBlue.xml | 53 ++ .../Schema/Entities/WeaponAssaultBlueView.xml | 3 +- .../Entities/WeaponDefenderBlueView.xml | 100 ++- .../Entities/WeaponSidearmAssaultBlueView.xml | 100 ++- .../WeaponSidearmDefenderBlueView.xml | 100 ++- .../WeaponSidearmReloadEffectView.xml | 27 +- src/Game/Systems/FadeSystem.cpp | 2 +- .../Weapon/DefenderWeaponBehaviour.cpp | 11 +- .../Systems/Weapon/SidearmWeaponBehaviour.cpp | 17 +- 14 files changed, 1300 insertions(+), 141 deletions(-) create mode 100644 resources/Schema/Entities/MuzzleFlashSideArmBlue.xml rename resources/Schema/Entities/{DefenderRayBlue.xml => RayAssaultBlue.xml} (65%) create mode 100644 resources/Schema/Entities/RayDefenderBlue.xml create mode 100644 resources/Schema/Entities/RaySideArmBlue.xml diff --git a/resources/Schema/Components/SidearmWeapon.xml b/resources/Schema/Components/SidearmWeapon.xml index 968306a6..a41bc201 100644 --- a/resources/Schema/Components/SidearmWeapon.xml +++ b/resources/Schema/Components/SidearmWeapon.xml @@ -7,7 +7,7 @@ 500 false 0.01 - 0.5 + 1.0 0.5 false 0 diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index b4db78d9..ca0ae6e2 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -2,6 +2,10 @@ + + 2.3827375146874772 + 4 + @@ -257,6 +261,735 @@ + + + + + + + + + 0.049999997019767761 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Sniper-01.png + + + PickClass + 3 + + + + + + + + + + + Sniper + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Assault-01.png + + + PickClass + 1 + + + + + + + + + + + Assault + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Defender-01.png + + + PickClass + 2 + + + + + + + + + + + Defender + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Pick Class + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToTeamPick + 1 + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Team + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pick Team + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + PickTeam + 1 + + + + + + + + + + + Spectator + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + PickTeam + 2 + + + + + + + + + + + Red + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + true + + + PickTeam + 3 + + + + + + + + + + + Blue + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + false + + + SwapToClassPick + 1 + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + false + + + + + + + + + + + + Class + Fonts/DroidSans.ttf,64 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 4 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + 0.10332605343919568 + + + + 1 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToTeamPick + 1 + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Team + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToClassPick + 1 + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Class + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/MuzzleFlashSideArmBlue.xml b/resources/Schema/Entities/MuzzleFlashSideArmBlue.xml new file mode 100644 index 00000000..2d4dd59b --- /dev/null +++ b/resources/Schema/Entities/MuzzleFlashSideArmBlue.xml @@ -0,0 +1,219 @@ + + + + + + 0.08 + + + + + + + + + + + + + + 0.08 + + + 2 + Models/Effects/MuzzleFlash/Blue/Cone1Outside.mesh + false + true + + + + + + + + + 0.08 + + + 2 + Models/Effects/MuzzleFlash/Blue/Cone1Inside.mesh + false + true + + + + + + + + + + + + + + + + + + 0.08 + + + 2 + Models/Effects/MuzzleFlash/Blue/Cone2Inside.mesh + false + true + + + + + + + + + 0.08 + + + 2 + Models/Effects/MuzzleFlash/Blue/Cone2Outside.mesh + false + true + + + + + + + + + + + + + + + + + + 0.08 + + + 2 + Models/Effects/MuzzleFlash/Blue/PlaneLeft.mesh + false + true + + + + + + + + + 0.08 + + + 2 + Models/Effects/MuzzleFlash/Blue/PlaneRight.mesh + false + true + + + + + + + + + 0.08 + + + 2 + Models/Effects/MuzzleFlash/Blue/PlaneUp.mesh + false + true + + + + + + + + + 0.08 + + + 2 + Models/Effects/MuzzleFlash/Blue/PlaneDown.mesh + false + true + + + + + + + + + + + + + + + + Models/Core/UnitSphere.mesh + false + false + + + + + + + + + + + + + + + Models/Core/UnitSphere.mesh + + false + false + + + + 0.40000000596046448 + + + + + + + + + + + + Models/Core/UnitSphere.mesh + false + false + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/DefenderRayBlue.xml b/resources/Schema/Entities/RayAssaultBlue.xml similarity index 65% rename from resources/Schema/Entities/DefenderRayBlue.xml rename to resources/Schema/Entities/RayAssaultBlue.xml index 7680f1da..c358a4d5 100644 --- a/resources/Schema/Entities/DefenderRayBlue.xml +++ b/resources/Schema/Entities/RayAssaultBlue.xml @@ -3,11 +3,9 @@ - 0.5 + 0.079999998211860657 - - - + @@ -16,14 +14,15 @@ Models/Core/UnitQuad.mesh - Textures/Effects/NewRay3.png - - true + Textures/Effects/NewRay5.png + + true + true - + @@ -33,14 +32,15 @@ Models/Core/UnitQuad.mesh - Textures/Effects/NewRay3.png - - true + Textures/Effects/NewRay5.png + + true + true - + diff --git a/resources/Schema/Entities/RayDefenderBlue.xml b/resources/Schema/Entities/RayDefenderBlue.xml new file mode 100644 index 00000000..066f2fb1 --- /dev/null +++ b/resources/Schema/Entities/RayDefenderBlue.xml @@ -0,0 +1,50 @@ + + + + + + 0.079999998211860657 + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/NewRay7.png + + true + true + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/NewRay7.png + + true + true + + + + + + + + + + + + diff --git a/resources/Schema/Entities/RaySideArmBlue.xml b/resources/Schema/Entities/RaySideArmBlue.xml new file mode 100644 index 00000000..072f8e95 --- /dev/null +++ b/resources/Schema/Entities/RaySideArmBlue.xml @@ -0,0 +1,53 @@ + + + + + + 0.08 + + + 0.08 + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/NewRay5.png + + true + true + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Effects/NewRay5.png + + true + true + + + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponAssaultBlueView.xml b/resources/Schema/Entities/WeaponAssaultBlueView.xml index 6d7e6fa0..3b3d418d 100644 --- a/resources/Schema/Entities/WeaponAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponAssaultBlueView.xml @@ -88,6 +88,7 @@ R_Arm_Weapon_Joint + 1.5 Models/Weapons/Blue/AssaultWeaponBlue.mesh @@ -127,7 +128,7 @@ - Schema/Entities/RayBlue.xml + Schema/Entities/RayAssaultBlue.xml diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml index 8c8da6a3..37fd2722 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -146,42 +146,6 @@ - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/DefenderWeaponBlue.mesh - - - - - - - - - - - Schema/Entities/DefenderRayBlue.xml - - - - - - - - - - - Schema/Entities/ReloadEffectView.xml - - - - - - - @@ -256,6 +220,70 @@ + + + + + + + + + R_Arm_Weapon_Joint + + + Models/Weapons/Blue/DefenderWeaponBlue.mesh + + + + + + + + + + + Schema/Entities/ReloadEffectView.xml + + + + + + + + + + + + + + + + + + Schema/Entities/RayDefenderBlue.xml + + + + + + + + + + + Schema/Entities/MuzzleFlashBlue.xml + + + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml b/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml index 0d7e2172..e48cffba 100644 --- a/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponSidearmAssaultBlueView.xml @@ -80,42 +80,6 @@ - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/SecondaryWeaponBlue.mesh - - - - - - - - - - - Schema/Entities/RayBlue.xml - - - - - - - - - - - Schema/Entities/WeaponSidearmReloadEffectView.xml - - - - - - - @@ -206,6 +170,70 @@ + + + + + + + + + R_Arm_Weapon_Joint + + + 1.2999999523162842 + Models/Weapons/Blue/SecondaryWeaponBlue.mesh + + + + + + + + + + + Schema/Entities/WeaponSidearmReloadEffectView.xml + + + + + + + + + + + + + + + + + + Schema/Entities/RaySideArmBlue.xml + + + + + + + + + + + Schema/Entities/MuzzleFlashSideArmBlue.xml + + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml b/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml index 3ff8b0a2..129082ed 100644 --- a/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponSidearmDefenderBlueView.xml @@ -80,42 +80,6 @@ - - - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/SecondaryWeaponBlue.mesh - - - - - - - - - - - Schema/Entities/Ray2Red.xml - - - - - - - - - - - Schema/Entities/WeaponSidearmReloadEffectView.xml - - - - - - - @@ -206,6 +170,70 @@ + + + + + + + + + R_Arm_Weapon_Joint + + + 1.5 + Models/Weapons/Blue/SecondaryWeaponBlue.mesh + + + + + + + + + + + Schema/Entities/WeaponSidearmReloadEffectView.xml + + + + + + + + + + + + + + + + + + Schema/Entities/MuzzleFlashSideArmBlue.xml + + + + + + + + + + + Schema/Entities/RaySideArmBlue.xml + + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponSidearmReloadEffectView.xml b/resources/Schema/Entities/WeaponSidearmReloadEffectView.xml index fce19d7f..bae68bc2 100644 --- a/resources/Schema/Entities/WeaponSidearmReloadEffectView.xml +++ b/resources/Schema/Entities/WeaponSidearmReloadEffectView.xml @@ -2,47 +2,46 @@ - - 2 - - + - - - 1 - 1 + + 0.5 + 0.5 -1 - 1 + 0.5 true + 1.5 Models/Weapons/Blue/SecondaryWeaponBlue.mesh + false true - + - 1 + 0.5 - - - 1 + + 0.5 true + 1.5 Models/Weapons/Blue/SecondaryWeaponBlue.mesh + false true diff --git a/src/Game/Systems/FadeSystem.cpp b/src/Game/Systems/FadeSystem.cpp index 0ed98ddb..e3cf55a9 100644 --- a/src/Game/Systems/FadeSystem.cpp +++ b/src/Game/Systems/FadeSystem.cpp @@ -11,7 +11,7 @@ void FadeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFade, return; } - if (!(bool)cFade["Out"]) { + if ((bool)cFade["Out"]) { dTime *= -1; } diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 0686aebf..ce2b833c 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -354,7 +354,16 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& wi, std::vector pattern) { - EntityWrapper muzzle = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzle"); + EntityWrapper flashSpawner = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzleFlash"); + if (flashSpawner.Valid()) { + std::uniform_real_distribution randomSpreadAngle(0.f, 3.1415f*2); + EntityWrapper flash = SpawnerSystem::Spawn(flashSpawner, flashSpawner); + if (flash.Valid()) { + ((glm::vec3&)flash["Transform"]["Orientation"]).z = randomSpreadAngle(m_RandomEngine); + } + } + + EntityWrapper muzzle = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzleRay"); if (!muzzle.Valid()) { return; } diff --git a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp index c9272127..1b8a3139 100644 --- a/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp @@ -189,18 +189,29 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi return; } - // Tracer - EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzle"); + //Tracer + EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleRay"); 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); + EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner, tracerSpawner); if (ray.Valid()) { ((glm::vec3&)ray["Transform"]["Scale"]).z = distance; } } + //Flash + EntityWrapper flashSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleFlash"); + if (flashSpawner.Valid()) { + std::uniform_real_distribution randomSpreadAngle(0.f, 3.1415f*2); + EntityWrapper flash = SpawnerSystem::Spawn(flashSpawner, flashSpawner); + if(flash.Valid()){ + ((glm::vec3&)flash["Transform"]["Orientation"]).z = randomSpreadAngle(m_RandomEngine); + } + } + + // Deal damage if (dealDamage(cWeapon, wi)) { // Show hit marker From 17007a2a41a2d7d587c39b1267b516f971c04a7c Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 16:28:39 +0100 Subject: [PATCH 29/44] fix fix --- src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 39da8399..cc2f9f7c 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -155,7 +155,7 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf if(wi.Player.Valid()) { if(wi.Player.HasComponent("ShieldAbility")) { - (Field)wi.Player["ShieldAbility"]["Active"] = true; + (Field)wi.Player["ShieldAbility"]["Active"] = true; } } @@ -285,7 +285,7 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"]; // Stop reloading - Field isReloading = cWeapon["IsReloading"]; + Field isReloading = cWeapon["IsReloading"]; isReloading = false; // Ammo From 3cee4e42482e026a393f2682669cb11b8d8c71c5 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 16:42:07 +0100 Subject: [PATCH 30/44] defender ray fixes --- resources/Schema/Entities/DefenderRayBlue.xml | 22 +++++++++---------- .../Weapon/DefenderWeaponBehaviour.cpp | 8 +++---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/resources/Schema/Entities/DefenderRayBlue.xml b/resources/Schema/Entities/DefenderRayBlue.xml index 7680f1da..37a8f80c 100644 --- a/resources/Schema/Entities/DefenderRayBlue.xml +++ b/resources/Schema/Entities/DefenderRayBlue.xml @@ -3,11 +3,9 @@ - 0.5 + 0.079999998211860657 - - - + @@ -16,14 +14,14 @@ Models/Core/UnitQuad.mesh - Textures/Effects/NewRay3.png - - true + Textures/Effects/NewRay5.png + + true - + @@ -33,14 +31,14 @@ Models/Core/UnitQuad.mesh - Textures/Effects/NewRay3.png - - true + Textures/Effects/NewRay5.png + + true - + diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index cc2f9f7c..7fd07e2d 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -393,7 +393,7 @@ void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& float yaw = std::atan2(lookVector.x, lookVector.z); glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0)); rayOrientation = glm::eulerAngles(orientation); - rayScale.z(glm::length(muzzleToHit)); + rayScale.x(glm::length(muzzleToHit)); } } } @@ -449,8 +449,8 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w } // Temp hit decal - // EntityWrapper hit = ResourceManager::Load("Schema/Entities/HitTest.xml")->MergeInto(m_World); - // hit["Transform"]["Position"] = pick.Position; + EntityWrapper hit = ResourceManager::Load("Schema/Entities/HitTest.xml")->MergeInto(m_World); + (Field)hit["Transform"]["Position"] = pick.Position; // Don't let us shoot ourselves in the foot somehow if (victim == LocalPlayer) { @@ -472,7 +472,7 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w } damageSum[victim] += pelletDamage; - // ((glm::vec3&)hit["Model"]["Color"]).b = 1.f; + ((Field)hit["Model"]["Color"]).z(1.f); } // Deal damage! From fc5ad2d38022ce2b5a5aea4fa2b3ef29510e984d Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 17:33:12 +0100 Subject: [PATCH 31/44] Small fix --- assets | 2 +- src/Game/Systems/FadeSystem.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets b/assets index 504752c9..6ffc1ab8 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 504752c94966c432513cac35acf906f8c9a3f965 +Subproject commit 6ffc1ab82aa36a933b84b9eb4d50e013e9ad9911 diff --git a/src/Game/Systems/FadeSystem.cpp b/src/Game/Systems/FadeSystem.cpp index 0abd9896..88460d53 100644 --- a/src/Game/Systems/FadeSystem.cpp +++ b/src/Game/Systems/FadeSystem.cpp @@ -20,7 +20,7 @@ void FadeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFade, } double fadeTime = cFade["FadeTime"]; - Field currentTime = cFade["Time"]; + Field currentTime = cFade["Time"]; currentTime += dTime; if(currentTime > fadeTime) { From 389d27973fb66e345edd3b5bfc169da7d6cfb4b7 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 18:55:45 +0100 Subject: [PATCH 32/44] Assault boost check --- .../Schema/Entities/FriendlyBoostBlueHUD.xml | 145 ++++++++++++++++++ .../Schema/Entities/WeaponAssaultBlueView.xml | 2 +- src/Game/Systems/BoostSystem.cpp | 13 +- .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 99 +++++++++--- 4 files changed, 228 insertions(+), 31 deletions(-) create mode 100644 resources/Schema/Entities/FriendlyBoostBlueHUD.xml diff --git a/resources/Schema/Entities/FriendlyBoostBlueHUD.xml b/resources/Schema/Entities/FriendlyBoostBlueHUD.xml new file mode 100644 index 00000000..296560fa --- /dev/null +++ b/resources/Schema/Entities/FriendlyBoostBlueHUD.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + \1 + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + \1 + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + + + + + + + + + + + \2 + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + \2 + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + + + + + + + + + + + \3 + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + \3 + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/WeaponAssaultBlueView.xml b/resources/Schema/Entities/WeaponAssaultBlueView.xml index c85d4c2d..36fbfc03 100644 --- a/resources/Schema/Entities/WeaponAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponAssaultBlueView.xml @@ -216,7 +216,7 @@ - Schema/Entities/FriendlyAmmoHUD.xml + Schema/Entities/FriendlyBoostBlueHUD.xml diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index ede147c3..0aab545f 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -8,21 +8,18 @@ BoostSystem::BoostSystem(SystemParams params) bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) { - if (e.Victim.ID == e.Inflictor.ID) { + if (!IsServer) { return false; } - if (!e.Victim.Valid() || !LocalPlayer.Valid()) { + if (e.Victim == e.Inflictor) { return false; } - if (e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) { + if (!e.Victim.Valid() || !e.Inflictor.Valid()) { return false; } - if (!e.Inflictor.Valid()) { - return false; - } //if its not friendly fire, return if ((int)m_World->GetComponent(e.Inflictor.ID, "Team")["Team"] != (int)m_World->GetComponent(e.Victim.ID, "Team")["Team"]) { @@ -86,7 +83,7 @@ void BoostSystem::giveAmmo(EntityWrapper giver, EntityWrapper receiver) int maxAmmo = receiver["AssaultWeapon"]["MaxAmmo"]; Field ammo = receiver["AssaultWeapon"]["Ammo"]; - int givenAmmo = 3; + int givenAmmo = 20; magazineAmmo = glm::clamp(magazineAmmo + givenAmmo, 0, magazineSize); if (magazineAmmo > prevMagazineAmmo) { @@ -102,7 +99,7 @@ void BoostSystem::giveAmmo(EntityWrapper giver, EntityWrapper receiver) int maxAmmo = receiver["DefenderWeapon"]["MaxAmmo"]; Field ammo = receiver["DefenderWeapon"]["Ammo"]; - int givenAmmo = 1; + int givenAmmo = 3; magazineAmmo = glm::clamp(magazineAmmo + givenAmmo, 0, magazineSize); if (magazineAmmo > prevMagazineAmmo) { diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index ad9caae4..5a4af4f6 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -10,6 +10,7 @@ void AssaultWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWra void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { + CheckBoost(cWeapon, wi); // Start reloading automatically if at 0 mag ammo Field magAmmo = cWeapon["MagazineAmmo"]; if (m_ConfigAutoReload && magAmmo <= 0) { @@ -407,52 +408,106 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi // 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"]) { - + EntityWrapper friendlyBoostHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyBoostAttachment"); if (friendlyBoostHudSpawner.Valid()) { + EntityWrapper assaultBoost = victim.FirstChildByName("BoostAssault"); + EntityWrapper defenderBoost = victim.FirstChildByName("BoostDefender"); + EntityWrapper sniperBoost = victim.FirstChildByName("BoostSniper"); + auto children = m_World->GetDirectChildren(friendlyBoostHudSpawner.ID); if (children.first == children.second) { if (friendlyBoostHudSpawner.HasComponent("Spawner")) { - EntityWrapper friendlyAmmoHud = SpawnerSystem::Spawn(friendlyBoostHudSpawner, friendlyBoostHudSpawner); - if (friendlyAmmoHud.Valid()) { - EntityWrapper textEntity = friendlyAmmoHud.FirstChildByName("MagazineAmmo"); - if (textEntity.Valid()) { - if (textEntity.HasComponent("Text")) { - // (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + + EntityWrapper friendlyBoostHud = SpawnerSystem::Spawn(friendlyBoostHudSpawner, friendlyBoostHudSpawner); + if (friendlyBoostHud.Valid()) { + EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost"); + if (assaultBoostEntity.Valid()) { + EntityWrapper active = assaultBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (assaultBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } } } - EntityWrapper ammoTextEntity = friendlyAmmoHud.FirstChildByName("Ammo"); - if (ammoTextEntity.Valid()) { - if (ammoTextEntity.HasComponent("Text")) { - // (std::string&)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); + EntityWrapper defenderBoostEntity = friendlyBoostHud.FirstChildByName("DefenderBoost"); + if (defenderBoostEntity.Valid()) { + EntityWrapper active = defenderBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (defenderBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } + } + + EntityWrapper sniperBoostEntity = friendlyBoostHud.FirstChildByName("SniperBoost"); + if (sniperBoostEntity.Valid()) { + EntityWrapper active = sniperBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (sniperBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } } } } } } else { - EntityWrapper textEntity = friendlyBoostHudSpawner.FirstChildByName("MagazineAmmo"); - if (textEntity.Valid()) { - if (textEntity.HasComponent("Text")) { - // (std::string&)textEntity["Text"]["Content"] = std::to_string(magazineAmmo); + EntityWrapper friendlyBoostHud = friendlyBoostHudSpawner.FirstChildByName("FriendlyBoostHUD"); + if (friendlyBoostHud.Valid()) { + EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost"); + if (assaultBoostEntity.Valid()) { + EntityWrapper active = assaultBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (assaultBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } } - } - EntityWrapper ammoTextEntity = friendlyBoostHudSpawner.FirstChildByName("Ammo"); - if (ammoTextEntity.Valid()) { - if (ammoTextEntity.HasComponent("Text")) { - // (std::string&)ammoTextEntity["Text"]["Content"] = std::to_string(ammo); + EntityWrapper defenderBoostEntity = friendlyBoostHud.FirstChildByName("DefenderBoost"); + if (defenderBoostEntity.Valid()) { + EntityWrapper active = defenderBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (defenderBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } + } + + EntityWrapper sniperBoostEntity = friendlyBoostHud.FirstChildByName("SniperBoost"); + if (sniperBoostEntity.Valid()) { + EntityWrapper active = sniperBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (sniperBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } } } } } } - } void AssaultWeaponBehaviour::RemoveBoostCheckHUD(WeaponInfo& wi) { - + EntityWrapper friendlyBoostHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyBoostAttachment"); + if (friendlyBoostHudSpawner.Valid()) { + friendlyBoostHudSpawner.DeleteChildren(); + } } From 1da3ec3c74dfb9d884b5abb1d28a07f152e0a93f Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 20:32:08 +0100 Subject: [PATCH 33/44] ammo share fix? --- .../Game/Systems/Weapon/AssaultWeaponBehaviour.h | 1 - .../Schema/Entities/FriendlyBoostBlueHUD.xml | 12 +++++++++--- src/Game/Systems/BoostSystem.cpp | 7 ++++--- src/Game/Systems/PlayerMovementSystem.cpp | 2 +- .../Systems/Weapon/AssaultWeaponBehaviour.cpp | 16 ++++++---------- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h index 231cc020..5783cf31 100644 --- a/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/AssaultWeaponBehaviour.h @@ -38,7 +38,6 @@ private: //Camera cameraFromEntity(EntityWrapper camera); void CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi); - void RemoveBoostCheckHUD(WeaponInfo& wi); }; diff --git a/resources/Schema/Entities/FriendlyBoostBlueHUD.xml b/resources/Schema/Entities/FriendlyBoostBlueHUD.xml index 296560fa..c181392e 100644 --- a/resources/Schema/Entities/FriendlyBoostBlueHUD.xml +++ b/resources/Schema/Entities/FriendlyBoostBlueHUD.xml @@ -2,6 +2,9 @@ + + 0.5 + @@ -44,6 +47,7 @@ \1 Fonts/Hind-Edited.otf,64 + false @@ -56,7 +60,7 @@ \1 Fonts/Hind-Edited.otf,64 - + @@ -80,6 +84,7 @@ \2 Fonts/Hind-Edited.otf,64 + false @@ -92,7 +97,7 @@ \2 Fonts/Hind-Edited.otf,64 - + @@ -116,6 +121,7 @@ \3 Fonts/Hind-Edited.otf,64 + false @@ -128,7 +134,7 @@ \3 Fonts/Hind-Edited.otf,64 - + diff --git a/src/Game/Systems/BoostSystem.cpp b/src/Game/Systems/BoostSystem.cpp index 0aab545f..5a04e3f8 100644 --- a/src/Game/Systems/BoostSystem.cpp +++ b/src/Game/Systems/BoostSystem.cpp @@ -8,9 +8,7 @@ BoostSystem::BoostSystem(SystemParams params) bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) { - if (!IsServer) { - return false; - } + if (e.Victim == e.Inflictor) { return false; @@ -35,6 +33,9 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e) if (className == "SidearmWeapon") { // give ammo giveAmmo(e.Inflictor, e.Victim); } else { //give boost + if (!IsServer) { + return false; + } //get the XML file, example: "Schema/Entities/BoostclassName.xml" std::string classXML = "Schema/Entities/" + className + ".xml"; diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index 35a7d3cf..d093ee21 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -393,7 +393,7 @@ 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; } diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index 5a4af4f6..b58cf158 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -386,13 +386,11 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi PickData pickData = m_Renderer->Pick(centerScreen); EntityWrapper victim(m_World, pickData.Entity); if (!victim.Valid()) { - RemoveBoostCheckHUD(wi); return; } // Don't let us somehow shoot ourselves in the foot if (victim == LocalPlayer) { - RemoveBoostCheckHUD(wi); return; } @@ -401,7 +399,6 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi victim = victim.FirstParentWithComponent("Player"); } if (!victim.Valid()) { - RemoveBoostCheckHUD(wi); return; } @@ -463,6 +460,12 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi } else { EntityWrapper friendlyBoostHud = friendlyBoostHudSpawner.FirstChildByName("FriendlyBoostHUD"); if (friendlyBoostHud.Valid()) { + if(friendlyBoostHud.HasComponent("Lifetime")) { + (Field)friendlyBoostHud["Lifetime"]["Lifetime"] = 0.5; + } + + + EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost"); if (assaultBoostEntity.Valid()) { EntityWrapper active = assaultBoostEntity.FirstChildByName("Active"); @@ -504,10 +507,3 @@ void AssaultWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi } } -void AssaultWeaponBehaviour::RemoveBoostCheckHUD(WeaponInfo& wi) -{ - EntityWrapper friendlyBoostHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyBoostAttachment"); - if (friendlyBoostHudSpawner.Valid()) { - friendlyBoostHudSpawner.DeleteChildren(); - } -} From ee8d7574b25296a535d4248f27c4967cc404ba44 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 20:46:59 +0100 Subject: [PATCH 34/44] dash fix? --- src/Game/Systems/PlayerMovementSystem.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Game/Systems/PlayerMovementSystem.cpp b/src/Game/Systems/PlayerMovementSystem.cpp index d093ee21..d6b8ad56 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -392,17 +392,22 @@ 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) { + EntityWrapper eventPlayer(m_World, e.Player); + if (!eventPlayer.Valid() || IsServer || eventPlayer.ID == LocalPlayer.ID) { return false; } // auto entityFile = ResourceManager::Load("Schema/Entities/DashEffect.xml"); // EntityWrapper dashEffect = entityFile->MergeInto(m_World); - EntityWrapper playerModel = player.FirstChildByName("PlayerModel"); + EntityWrapper playerModel = eventPlayer.FirstChildByName("PlayerModel"); for (auto& kv : m_PlayerInputControllers) { EntityWrapper player = kv.first; + if(player != eventPlayer) { + continue; + } + + auto& controller = kv.second; if (!player.Valid()) { From e929ecab502058a476190923e3d46cf77f2986fe Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 20:58:53 +0100 Subject: [PATCH 35/44] fix??? --- 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 d6b8ad56..3cf1068d 100644 --- a/src/Game/Systems/PlayerMovementSystem.cpp +++ b/src/Game/Systems/PlayerMovementSystem.cpp @@ -393,7 +393,7 @@ void PlayerMovementSystem::spawnHexagon(EntityWrapper target) bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e) { EntityWrapper eventPlayer(m_World, e.Player); - if (!eventPlayer.Valid() || IsServer || eventPlayer.ID == LocalPlayer.ID) { + if (!eventPlayer.Valid()){// || IsServer || eventPlayer.ID == LocalPlayer.ID) { return false; } From 20e48eeb08d76e8588a1a7377cbd3795b40be387 Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 21:01:04 +0100 Subject: [PATCH 36/44] Killfeed should work now. --- include/Engine/Network/Client.h | 2 + include/Engine/Network/EKillDeath.h | 11 + include/Engine/Network/MessageType.h | 1 + include/Game/Systems/KillFeedSystem.h | 27 +- resources/Schema/Entities/MovementTest.xml | 1259 +++++++++-------- resources/Schema/Entities/OverwatchCamera.xml | 58 +- .../Schema/Entities/PlayerAssaultBlue.xml | 204 ++- .../Schema/Entities/PlayerDefenderBlue.xml | 264 ++-- resources/Schema/Entities/PlayerHUD.xml | 120 +- src/Engine/Network/Client.cpp | 19 + src/Engine/Network/Server.cpp | 39 + src/Game/Systems/KillFeedSystem.cpp | 61 +- 12 files changed, 1106 insertions(+), 959 deletions(-) diff --git a/include/Engine/Network/Client.h b/include/Engine/Network/Client.h index 29e9ac9a..d42ba14a 100644 --- a/include/Engine/Network/Client.h +++ b/include/Engine/Network/Client.h @@ -16,6 +16,7 @@ #include "Network/UDPClient.h" #include "Network/TCPClient.h" #include "Network/SnapshotDefinitions.h" +#include "Network/EKillDeath.h" #include "Core/World.h" #include "Core/EntityFile.h" #include "Core/EventBroker.h" @@ -104,6 +105,7 @@ private: void parseDashEffect(Packet& packet); void parseAmmoPickup(Packet& packet); void parseRemoveWorld(Packet& packet); + void parseKDEvent(Packet& packet); void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType); void parseSnapshot(Packet& packet); void identifyPacketLoss(); diff --git a/include/Engine/Network/EKillDeath.h b/include/Engine/Network/EKillDeath.h index e53f3b8c..04917f39 100644 --- a/include/Engine/Network/EKillDeath.h +++ b/include/Engine/Network/EKillDeath.h @@ -10,8 +10,19 @@ namespace Events struct KillDeath : public Event { + int CasualtyTeam; PlayerID Casualty = -1; + std::string CasualtyName; + + //1 = assault, 2 = defender, 3 = sniper + int CasualtyClass; + + int KillerTeam; PlayerID Killer = -1; + std::string KillerName; + + //1 = assault, 2 = defender, 3 = sniper + int KillerClass; }; } diff --git a/include/Engine/Network/MessageType.h b/include/Engine/Network/MessageType.h index 11fb85be..53821084 100644 --- a/include/Engine/Network/MessageType.h +++ b/include/Engine/Network/MessageType.h @@ -24,6 +24,7 @@ enum class MessageType ServerlistRequest, AmmoPickup, RemoveWorld, + KD, Invalid }; diff --git a/include/Game/Systems/KillFeedSystem.h b/include/Game/Systems/KillFeedSystem.h index 31423999..57c7a98a 100644 --- a/include/Game/Systems/KillFeedSystem.h +++ b/include/Game/Systems/KillFeedSystem.h @@ -3,7 +3,7 @@ #include "../../Engine/Core/System.h" #include "../../Engine/GLM.h" -#include "Core/EPlayerDeath.h" +#include "Network/EKillDeath.h" class KillFeedSystem : public ImpureSystem { @@ -11,8 +11,7 @@ public: KillFeedSystem(SystemParams params) : System(params) { - EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &KillFeedSystem::OnPlayerDeath); - + EVENT_SUBSCRIBE_MEMBER(m_EKillDeath, &KillFeedSystem::OnPlayerKillDeath) } virtual void Update(double dt) override; @@ -22,16 +21,30 @@ private: - EventRelay m_EPlayerDeath; - bool KillFeedSystem::OnPlayerDeath(Events::PlayerDeath& e); + EventRelay m_EKillDeath; + bool KillFeedSystem::OnPlayerKillDeath(Events::KillDeath& e); struct KillFeedInfo { - std::string Content; - glm::vec4 Color; + std::string KillerName = ""; + int KillerClass = 0; + int KillerID = -1; + int KillerTeam = 0; + std::string KillerColor = ""; + + std::string VictimName = ""; + int VictimClass = 0; + int VictimID = -1; + int VictimTeam = 0; + std::string VictimColor = ""; + + bool redused; float TimeToLive = 5.f; }; + std::string m_RedColor = "\\C08366D"; + std::string m_BlueColor = "\\C6A1208"; + std::list m_DeathQueue; }; diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index ca0ae6e2..dd1b3211 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -3,7 +3,7 @@ - 2.3827375146874772 + 2.9023438519963349 4 @@ -107,7 +107,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -265,389 +265,616 @@ + + + + + + 0.049999997019767761 + + + + + + + - + - - 0.049999997019767761 - - - - + + - + - - - - + + - + - - + + + - + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Sniper-01.png + + + PickClass + 3 + - + + - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Classes/Sniper-01.png - - - PickClass - 3 - - - - - - - - - - - Sniper - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Classes/Assault-01.png - - - PickClass - 1 - - - - - - - - - - - Assault - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Icons/Classes/Defender-01.png - - - PickClass - 2 - - - - - - - - - - - Defender - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - + - Pick Class + Sniper Fonts/DroidSans.ttf,64 - - + + - + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Assault-01.png + + + PickClass + 1 + + + + + + + + - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - SwapToTeamPick - 1 - + + Assault + Fonts/DroidSans.ttf,64 + + - - + + - - - - - Change - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - Team - Fonts/DroidSans.ttf,64 - - - - - - - - - + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Icons/Classes/Defender-01.png + + + PickClass + 2 + + + + + + + + + + + Defender + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Pick Class + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToTeamPick + 1 + + + + + + + + + + + Change + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + Team + Fonts/DroidSans.ttf,64 + + + + + + + - + + + + + + + + + - - + + + - + + + Pick Team + Fonts/DroidSans.ttf,64 + + - + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + PickTeam + 1 + + + + - + - Pick Team + Spectator Fonts/DroidSans.ttf,64 - - - + + - + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + PickTeam + 2 + + + + + + + + - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - PickTeam - 1 - + + Red + Fonts/DroidSans.ttf,64 + - - + + - - - - - Spectator - Fonts/DroidSans.ttf,64 - - - - - - - - - + - + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + PickTeam + 3 + + + + + + + + - - - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - true - - - PickTeam - 2 - + + Blue + Fonts/DroidSans.ttf,64 + - - + + - - - - - Red - Fonts/DroidSans.ttf,64 - - - - - - - - - + - + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + false + + + SwapToClassPick + 1 + + + + + + + + - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - true - - - PickTeam - 3 - - - - - - - - - - - Blue - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - + + Change + Fonts/DroidSans.ttf,64 false - - - SwapToClassPick - 1 - + - - + + + + + + + + + + Class + Fonts/DroidSans.ttf,64 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + - + - - Change - Fonts/DroidSans.ttf,64 - false - + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + - - + + + - + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + - - Class - Fonts/DroidSans.ttf,64 - false - + + + + + 4 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + - - + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + 0.10332605343919568 + + + + 1 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + @@ -656,329 +883,153 @@ - - - - - - - - - + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToTeamPick + 1 + - + + - + - 2 + Change Fonts/DroidSans.ttf,64 - - - + + - + + + Team + Fonts/DroidSans.ttf,64 + - - + + - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 3 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 4 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - 2 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - 0.10332605343919568 - - - - 1 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - - - - - - - - - - - - + - + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + SwapToClassPick + 1 + + + + + + + + - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - SwapToTeamPick - 1 - + + Change + Fonts/DroidSans.ttf,64 + - - + + - - - - - Change - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - Team - Fonts/DroidSans.ttf,64 - - - - - - - - - + - + - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - - - SwapToClassPick - 1 - + + Class + Fonts/DroidSans.ttf,64 + - - + + - - - - - Change - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - Class - Fonts/DroidSans.ttf,64 - - - - - - - - - + + + + + + + + + + + + + + + + + \C08366D\1\CFFFFFF Dahl \4 \C08366D\1\CFFFFFF Dahl + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + \C08366D\1\CFFFFFF Dahl \4 \C08366D\1\CFFFFFF Dahl + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + + + + Fonts/Hind-Edited.otf,64 + + + + + + + + + diff --git a/resources/Schema/Entities/OverwatchCamera.xml b/resources/Schema/Entities/OverwatchCamera.xml index 92540e5b..55b2b6a4 100644 --- a/resources/Schema/Entities/OverwatchCamera.xml +++ b/resources/Schema/Entities/OverwatchCamera.xml @@ -8,7 +8,7 @@ - + @@ -275,7 +275,6 @@ Textures/Core/UnitHexagon.png - true PickTeam @@ -311,7 +310,6 @@ Textures/Core/UnitHexagon.png - true PickTeam @@ -715,6 +713,60 @@ + + + + + + + + + + + + + + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + + + + Fonts/Hind-Edited.otf,64 + + + + + + + + + + + + diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml index c73a4c46..76f1718c 100644 --- a/resources/Schema/Entities/PlayerAssaultBlue.xml +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -104,6 +104,82 @@ + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + @@ -112,7 +188,6 @@ Textures/Core/UnitHexagon.png - true @@ -133,7 +208,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -153,87 +227,6 @@ Textures/Core/UnitHexagon.png - true - - - - - - - - - - - - - 2 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - true - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - true - - - - - - - - - - - - - 3 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - true - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - true @@ -253,7 +246,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -273,7 +265,6 @@ Textures/Core/UnitHexagon.png - true @@ -292,7 +283,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -319,7 +309,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -332,7 +322,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -347,7 +337,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -393,12 +383,12 @@ 1 + 100/100 Fonts/DroidSans.ttf,64 - + - @@ -419,7 +409,6 @@ Textures/HealthHUD3.png - true @@ -438,18 +427,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Assault-01.png - - true + - + @@ -459,18 +447,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Defender-01.png - - true + - + @@ -480,19 +467,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Sniper-01.png - - false - true + - + @@ -513,7 +498,6 @@ Textures/Icons/Abilities/Long/Superman-01.png - true @@ -923,10 +907,10 @@ - + - DashLeftF + DashRightF 1.7999999523162842 false @@ -935,10 +919,10 @@ - + - DashRightF + DashLeftF 1.7999999523162842 false diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index 25fc54d2..dd8992be 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -141,6 +141,82 @@ + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + 3 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + @@ -149,7 +225,6 @@ Textures/Core/UnitHexagon.png - true @@ -170,7 +245,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -190,87 +264,6 @@ Textures/Core/UnitHexagon.png - true - - - - - - - - - - - - - 2 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - true - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - true - - - - - - - - - - - - - 3 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - true - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - true @@ -290,7 +283,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -310,7 +302,6 @@ Textures/Core/UnitHexagon.png - true @@ -329,7 +320,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -356,7 +346,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -369,7 +359,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -384,7 +374,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -430,12 +420,12 @@ 1 + 150/150 Fonts/DroidSans.ttf,64 - + - @@ -456,7 +446,6 @@ Textures/HealthHUD3.png - true @@ -475,18 +464,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Assault-01.png - - true + - + @@ -496,18 +484,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Defender-01.png - - true + - + @@ -517,19 +504,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Sniper-01.png - - false - true + - + @@ -551,7 +536,6 @@ Textures/Icons/Abilities/Long/SheildDots-01.png - true @@ -904,40 +888,6 @@ - - - - Fire - Reload - 0 - - - - - - - - ShootgunReloadU - - 0.5 - - - - - - - - - ShootRifleU - - false - - - - - - - @@ -973,6 +923,40 @@ + + + + Fire + Reload + 0 + + + + + + + + ShootgunReloadU + + 0.5 + + + + + + + + + ShootRifleU + + false + + + + + + + diff --git a/resources/Schema/Entities/PlayerHUD.xml b/resources/Schema/Entities/PlayerHUD.xml index 5891362d..48123411 100644 --- a/resources/Schema/Entities/PlayerHUD.xml +++ b/resources/Schema/Entities/PlayerHUD.xml @@ -48,47 +48,6 @@ Textures/Core/UnitHexagon.png - true - - - - - - - - - - - - - 2 - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon_Rotated.png - true - - - - - - - - - - - - - - - false - Models/Core/UnitQuad.mesh - - Textures/Core/UnitHexagon.png - - true @@ -108,7 +67,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -128,7 +86,6 @@ Textures/Core/UnitHexagon.png - true @@ -149,7 +106,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -169,7 +125,44 @@ Textures/Core/UnitHexagon.png - true + + + + + + + + + + + + + 2 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/UnitHexagon.png + @@ -189,7 +182,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -209,7 +201,6 @@ Textures/Core/UnitHexagon.png - true @@ -228,7 +219,6 @@ Models/Core/UnitQuad.mesh Textures/Core/UnitHexagon_Rotated.png - true @@ -255,7 +245,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -268,7 +258,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -283,7 +273,7 @@ - Fonts/DroidSans.ttf,64 + Fonts/Hind-Edited.otf,64 @@ -329,12 +319,12 @@ 1 + 100/100 Fonts/DroidSans.ttf,64 - + - @@ -355,7 +345,6 @@ Textures/HealthHUD3.png - true @@ -374,18 +363,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Assault-01.png - - true + - + @@ -395,18 +383,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Defender-01.png - - true + - + @@ -416,19 +403,17 @@ - + false Models/Core/UnitQuad.mesh Textures/Icons/Boosts/Sniper-01.png - - false - true + - + @@ -449,7 +434,6 @@ Textures/Test/aM4ME4GR.png - true diff --git a/src/Engine/Network/Client.cpp b/src/Engine/Network/Client.cpp index 705872fa..cd395da0 100644 --- a/src/Engine/Network/Client.cpp +++ b/src/Engine/Network/Client.cpp @@ -165,6 +165,9 @@ void Client::parseMessageType(Packet& packet) case MessageType::RemoveWorld: parseRemoveWorld(packet); break; + case MessageType::KD: + parseKDEvent(packet); + break; default: break; } @@ -349,6 +352,22 @@ void Client::parseRemoveWorld(Packet & packet) m_EventBroker->Publish(e); } +void Client::parseKDEvent(Packet & packet) +{ + Events::KillDeath e; + e.Casualty = packet.ReadPrimitive(); + e.CasualtyClass = packet.ReadPrimitive(); + e.CasualtyName = packet.ReadString(); + e.CasualtyTeam = packet.ReadPrimitive(); + + e.Killer = packet.ReadPrimitive(); + e.KillerClass = packet.ReadPrimitive(); + e.KillerName = packet.ReadString(); + e.KillerTeam = packet.ReadPrimitive(); + + m_EventBroker->Publish(e); +} + void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID) { for (auto field : componentInfo.FieldsInOrder) { diff --git a/src/Engine/Network/Server.cpp b/src/Engine/Network/Server.cpp index dc40ea3f..dbaf4752 100644 --- a/src/Engine/Network/Server.cpp +++ b/src/Engine/Network/Server.cpp @@ -560,9 +560,48 @@ bool Server::OnAmmoPickup(const Events::AmmoPickup & e) bool Server::OnPlayerDeath(const Events::PlayerDeath& e) { Events::KillDeath eKD; + auto entity = e; eKD.Casualty = getPlayerIDFromEntityID(e.Player.ID); eKD.Killer = getPlayerIDFromEntityID(e.Killer.ID); + + eKD.CasualtyName = m_ConnectedPlayers.at(getPlayerIDFromEntityID(e.Player.ID)).Name; + eKD.KillerName = m_ConnectedPlayers.at(getPlayerIDFromEntityID(e.Killer.ID)).Name; + + if(entity.Player.HasComponent("Team")) { + eKD.CasualtyTeam = (const int&)entity.Player["Team"]["Team"]; + } + if (entity.Killer.HasComponent("Team")) { + eKD.KillerTeam = (const int&)entity.Killer["Team"]["Team"]; + } + + if(entity.Player.HasComponent("DashAbility")) { + eKD.CasualtyClass = 1; + } else if (entity.Player.HasComponent("ShieldAbility")) { + eKD.CasualtyClass = 2; + } else if (entity.Player.HasComponent("SprintAbility")) { + eKD.CasualtyClass = 3; + } + if (entity.Killer.HasComponent("DashAbility")) { + eKD.KillerClass = 1; + } else if (entity.Killer.HasComponent("ShieldAbility")) { + eKD.KillerClass = 2; + } else if (entity.Killer.HasComponent("SprintAbility")) { + eKD.KillerClass = 3; + } + m_EventBroker->Publish(eKD); + + Packet kdPacket(MessageType::KD); + kdPacket.WritePrimitive(eKD.Casualty); + kdPacket.WritePrimitive(eKD.CasualtyClass); + kdPacket.WriteString(eKD.CasualtyName); + kdPacket.WritePrimitive(eKD.CasualtyTeam); + + kdPacket.WritePrimitive(eKD.Killer); + kdPacket.WritePrimitive(eKD.KillerClass); + kdPacket.WriteString(eKD.KillerName); + kdPacket.WritePrimitive(eKD.KillerTeam); + reliableBroadcast(kdPacket); return false; } diff --git a/src/Game/Systems/KillFeedSystem.cpp b/src/Game/Systems/KillFeedSystem.cpp index eb3e916e..01a474ad 100644 --- a/src/Game/Systems/KillFeedSystem.cpp +++ b/src/Game/Systems/KillFeedSystem.cpp @@ -7,6 +7,10 @@ void KillFeedSystem::Update(double dt) return; } + for (auto it = m_DeathQueue.begin(); it != m_DeathQueue.end(); it++) { + (*it).TimeToLive -= dt; + } + for (auto& killFeedComponent : *killFeeds) { EntityWrapper entity = EntityWrapper(m_World, killFeedComponent.EntityID); @@ -16,10 +20,7 @@ void KillFeedSystem::Update(double dt) (Field)child["Text"]["Content"] = ""; } } - - - - + int feedIndex = 1; for (auto it = m_DeathQueue.begin(); it != m_DeathQueue.end(); ) { bool remove = false; @@ -27,14 +28,19 @@ void KillFeedSystem::Update(double dt) EntityWrapper child = entity.FirstChildByName("KillFeed" + std::to_string(feedIndex)); if (child.HasComponent("Text")) { - (Field)child["Text"]["Content"] = (*it).Content; - (Field)child["Text"]["Color"] = (*it).Color; - (*it).TimeToLive -= dt; + std::string str = ""; + //Add killer to the start of string. + str = (*it).KillerColor + "\\" + std::to_string((*it).KillerClass) + "\\CFFFFFF" + " " + (*it).KillerName + " "; + //Add Weapon to middle of string. + str += "\\" + std::to_string((*it).KillerClass+3) + " "; + //Add victim to the end of string + str += (*it).VictimColor + "\\" + std::to_string((*it).VictimClass) + "\\CFFFFFF" + " " + (*it).VictimName; + + (Field)child["Text"]["Content"] = str; if ((*it).TimeToLive <= 0.f) { (Field)child["Text"]["Content"] = ""; - (Field)child["Text"]["Color"] = (*it).Color; remove = true; } } @@ -52,29 +58,30 @@ void KillFeedSystem::Update(double dt) } } -bool KillFeedSystem::OnPlayerDeath(Events::PlayerDeath& e) +bool KillFeedSystem::OnPlayerKillDeath(Events::KillDeath& e) { - KillFeedInfo kfInfo; + KillFeedInfo info; - if (e.Player.HasComponent("Team")) { - int red = e.Player["Team"].Enum("Team", "Red"); - int blue = e.Player["Team"].Enum("Team", "Blue"); - - if ((int)e.Player["Team"]["Team"] == red) { - kfInfo.Content = "Blue Player killed Red Player"; - kfInfo.Color = glm::vec4(0.f, 0.2f, 1.f, 0.8f); - m_DeathQueue.push_back(kfInfo); - } else if ((int)e.Player["Team"]["Team"] == blue) { - kfInfo.Content = "Red Player killed blue Player"; - kfInfo.Color = glm::vec4(1.f, 0.f, 0.f, 0.8f); - m_DeathQueue.push_back(kfInfo); - } + info.KillerName = e.KillerName; + info.KillerID = e.Killer; + info.KillerClass = e.KillerClass; + info.KillerTeam = e.KillerTeam; + if(info.KillerTeam == 2){ + info.KillerColor = m_BlueColor; + } else if (info.KillerTeam == 3) { + info.KillerColor = m_RedColor; } - - if(m_DeathQueue.size() > 3) { - m_DeathQueue.pop_front(); + info.VictimName = e.CasualtyName; + info.VictimID = e.Casualty; + info.VictimClass = e.CasualtyClass; + info.VictimTeam = e.CasualtyTeam; + if (info.VictimTeam == 2) { + info.VictimColor = m_BlueColor; + } else if (info.VictimTeam == 3) { + info.VictimColor = m_RedColor; } - return true; + m_DeathQueue.push_back(info); + return 1; } From 3a0cff7a8308904adbff875e91208c7474b0c506 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 21:10:22 +0100 Subject: [PATCH 37/44] boost check for defender --- .../Systems/Weapon/DefenderWeaponBehaviour.h | 1 + .../Entities/FriendlyBoostAttachement.xml | 15 ++ .../Schema/Entities/FriendlyBoostBlueHUD.xml | 28 ++-- .../Schema/Entities/WeaponAssaultBlueView.xml | 9 -- .../Entities/WeaponDefenderBlueView.xml | 11 ++ .../Weapon/DefenderWeaponBehaviour.cpp | 146 ++++++++++++++++++ 6 files changed, 187 insertions(+), 23 deletions(-) create mode 100644 resources/Schema/Entities/FriendlyBoostAttachement.xml diff --git a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h index 0035d5eb..178f4eaf 100644 --- a/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h +++ b/include/Game/Systems/Weapon/DefenderWeaponBehaviour.h @@ -41,6 +41,7 @@ private: // Utility Camera cameraFromEntity(EntityWrapper camera); + void CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi); }; #endif \ No newline at end of file diff --git a/resources/Schema/Entities/FriendlyBoostAttachement.xml b/resources/Schema/Entities/FriendlyBoostAttachement.xml new file mode 100644 index 00000000..38ac6643 --- /dev/null +++ b/resources/Schema/Entities/FriendlyBoostAttachement.xml @@ -0,0 +1,15 @@ + + + + + + Schema/Entities/FriendlyBoostBlueHUD.xml + + + + + + + + + diff --git a/resources/Schema/Entities/FriendlyBoostBlueHUD.xml b/resources/Schema/Entities/FriendlyBoostBlueHUD.xml index c181392e..1e0deebb 100644 --- a/resources/Schema/Entities/FriendlyBoostBlueHUD.xml +++ b/resources/Schema/Entities/FriendlyBoostBlueHUD.xml @@ -6,7 +6,7 @@ 0.5 - + @@ -78,6 +78,19 @@ + + + + \2 + Fonts/Hind-Edited.otf,64 + + + + + + + + @@ -92,19 +105,6 @@ - - - - \2 - Fonts/Hind-Edited.otf,64 - - - - - - - - diff --git a/resources/Schema/Entities/WeaponAssaultBlueView.xml b/resources/Schema/Entities/WeaponAssaultBlueView.xml index 36fbfc03..e1d6b852 100644 --- a/resources/Schema/Entities/WeaponAssaultBlueView.xml +++ b/resources/Schema/Entities/WeaponAssaultBlueView.xml @@ -224,15 +224,6 @@ - - - - Schema/Entities/AmmoShareEffectView.xml - - - - - diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml index 37fd2722..a8bdd68b 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -218,6 +218,17 @@ + + + + Schema/Entities/FriendlyBoostBlueHUD.xml + + + + + + + diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 275952d0..603f6991 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -10,6 +10,7 @@ void DefenderWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWr void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) { + CheckBoost(cWeapon, wi); // Decrement reload timer Field reloadTimer = cWeapon["ReloadTimer"]; reloadTimer = glm::max(0.0, reloadTimer - dt); @@ -518,3 +519,148 @@ Camera DefenderWeaponBehaviour::cameraFromEntity(EntityWrapper camera) cam.SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"])); return cam; } + +void DefenderWeaponBehaviour::CheckBoost(ComponentWrapper cWeapon, WeaponInfo& wi) +{ + // Only check ammo client side + if (!IsClient) { + return; + } + + // Only handle ammo check for the local player + if (wi.Player != LocalPlayer) { + return; + } + + // Make sure the player isn't checking from the grave + if (!wi.Player.Valid()) { + return; + } + + // 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; + } + + // Don't let us somehow shoot ourselves in the foot + if (victim == LocalPlayer) { + return; + } + + // Only care about players being hit + if (!victim.HasComponent("Player")) { + victim = victim.FirstParentWithComponent("Player"); + } + if (!victim.Valid()) { + return; + } + + + // 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"]) { + + EntityWrapper friendlyBoostHudSpawner = wi.FirstPersonPlayerModel.FirstChildByName("FriendlyBoostAttachment"); + if (friendlyBoostHudSpawner.Valid()) { + + EntityWrapper assaultBoost = victim.FirstChildByName("BoostAssault"); + EntityWrapper defenderBoost = victim.FirstChildByName("BoostDefender"); + EntityWrapper sniperBoost = victim.FirstChildByName("BoostSniper"); + + auto children = m_World->GetDirectChildren(friendlyBoostHudSpawner.ID); + + if (children.first == children.second) { + if (friendlyBoostHudSpawner.HasComponent("Spawner")) { + + EntityWrapper friendlyBoostHud = SpawnerSystem::Spawn(friendlyBoostHudSpawner, friendlyBoostHudSpawner); + if (friendlyBoostHud.Valid()) { + EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost"); + if (assaultBoostEntity.Valid()) { + EntityWrapper active = assaultBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (assaultBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } + } + + EntityWrapper defenderBoostEntity = friendlyBoostHud.FirstChildByName("DefenderBoost"); + if (defenderBoostEntity.Valid()) { + EntityWrapper active = defenderBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (defenderBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } + } + + EntityWrapper sniperBoostEntity = friendlyBoostHud.FirstChildByName("SniperBoost"); + if (sniperBoostEntity.Valid()) { + EntityWrapper active = sniperBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (sniperBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } + } + } + } + } else { + EntityWrapper friendlyBoostHud = friendlyBoostHudSpawner.FirstChildByName("FriendlyBoostHUD"); + if (friendlyBoostHud.Valid()) { + if (friendlyBoostHud.HasComponent("Lifetime")) { + (Field)friendlyBoostHud["Lifetime"]["Lifetime"] = 0.5; + } + + + + EntityWrapper assaultBoostEntity = friendlyBoostHud.FirstChildByName("AssaultBoost"); + if (assaultBoostEntity.Valid()) { + EntityWrapper active = assaultBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (assaultBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } + } + + EntityWrapper defenderBoostEntity = friendlyBoostHud.FirstChildByName("DefenderBoost"); + if (defenderBoostEntity.Valid()) { + EntityWrapper active = defenderBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (defenderBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } + } + + EntityWrapper sniperBoostEntity = friendlyBoostHud.FirstChildByName("SniperBoost"); + if (sniperBoostEntity.Valid()) { + EntityWrapper active = sniperBoostEntity.FirstChildByName("Active"); + if (active.HasComponent("Text")) { + if (sniperBoost.Valid()) { + (Field)active["Text"]["Visible"] = true; + } else { + (Field)active["Text"]["Visible"] = false; + } + } + } + } + } + } + } +} From 066ca6075dc1819defe5fbe0dbf03208d6279a0c Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 21:19:21 +0100 Subject: [PATCH 38/44] hp fixed? --- src/Game/Systems/HealthSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/Systems/HealthSystem.cpp b/src/Game/Systems/HealthSystem.cpp index c19d1b65..4343eeeb 100644 --- a/src/Game/Systems/HealthSystem.cpp +++ b/src/Game/Systems/HealthSystem.cpp @@ -58,7 +58,7 @@ bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e) ComponentWrapper cHealth = e.Player["Health"]; Field health = cHealth["Health"]; health += e.HealthAmount; - health = std::min((double)health, (double)cHealth["MaxHealth"]); + health = std::min(*health, (const double&)cHealth["MaxHealth"]); return true; } From 148d60f8f8e10adf58137d2b04283656338b613f Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 21:24:27 +0100 Subject: [PATCH 39/44] hp really fixed? --- src/Game/Systems/HealthHUDSystem.cpp | 8 ++++---- src/Game/Systems/PickupSpawnSystem.cpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Game/Systems/HealthHUDSystem.cpp b/src/Game/Systems/HealthHUDSystem.cpp index cd8a428f..efa70167 100644 --- a/src/Game/Systems/HealthHUDSystem.cpp +++ b/src/Game/Systems/HealthHUDSystem.cpp @@ -22,8 +22,8 @@ void HealthHUDSystem::Update(double dt) if (entityIDParent.HasComponent("Health")) { if (entity.HasComponent("Text")) { - Field health = entityIDParent["Health"]["Health"]; - Field maxHealth = entityIDParent["Health"]["Health"]; + double health = (const double&)entityIDParent["Health"]["Health"]; + double maxHealth = (const double&)entityIDParent["Health"]["Health"]; std::string s = ""; s = s + std::to_string((int)health); s = s + "/"; @@ -34,8 +34,8 @@ void HealthHUDSystem::Update(double dt) } if(entity.HasComponent("Fill")) { - Field health = entityIDParent["Health"]["Health"]; - Field maxHealth = entityIDParent["Health"]["Health"]; + double health = (const double&)entityIDParent["Health"]["Health"]; + double maxHealth = (const double&)entityIDParent["Health"]["Health"]; float healthPercentage = health/maxHealth; entity["Fill"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Fill"]["Color"]).a); entity["Fill"]["Percentage"] = (double)healthPercentage; diff --git a/src/Game/Systems/PickupSpawnSystem.cpp b/src/Game/Systems/PickupSpawnSystem.cpp index b0efd696..c05d3bd2 100644 --- a/src/Game/Systems/PickupSpawnSystem.cpp +++ b/src/Game/Systems/PickupSpawnSystem.cpp @@ -45,7 +45,7 @@ void PickupSpawnSystem::Update(double dt) m_PickupAtMaximum.erase(it); break; } - if ((double)it->player["Health"]["Health"] < (double)it->player["Health"]["MaxHealth"]) { + if ((const double&)it->player["Health"]["Health"] < (const double&)it->player["Health"]["MaxHealth"]) { DoPickup(it->player, it->trigger); m_PickupAtMaximum.erase(it); break; @@ -59,7 +59,7 @@ bool PickupSpawnSystem::OnTriggerTouch(Events::TriggerTouch& e) return false; } //if at maxhealth, save the trigger-touch to a vector since standing inside it will not re-trigger the trigger - if ((double)e.Entity["Health"]["Health"] >= (double)e.Entity["Health"]["MaxHealth"]) { + if ((const double&)e.Entity["Health"]["Health"] >= (const double&)e.Entity["Health"]["MaxHealth"]) { m_PickupAtMaximum.push_back({ e.Entity, e.Trigger }); return false; } @@ -87,7 +87,7 @@ void PickupSpawnSystem::DoPickup(EntityWrapper &player, EntityWrapper &trigger) if (!trigger.Valid()) { return; } - double healthGiven = 0.01*(double)trigger["HealthPickup"]["HealthGain"] * (double)player["Health"]["MaxHealth"]; + double healthGiven = 0.01*(const double&)trigger["HealthPickup"]["HealthGain"] * (const double&)player["Health"]["MaxHealth"]; //only the server will increase the players hp and set it in the next delta Events::PlayerHealthPickup ePlayerHealthPickup; From 83ae87594fd3570e44b49927d0373a87293eaaaf Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 22:00:48 +0100 Subject: [PATCH 40/44] Fixed maxhealth probably --- src/Game/Systems/HealthHUDSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/Systems/HealthHUDSystem.cpp b/src/Game/Systems/HealthHUDSystem.cpp index efa70167..bfc63700 100644 --- a/src/Game/Systems/HealthHUDSystem.cpp +++ b/src/Game/Systems/HealthHUDSystem.cpp @@ -23,7 +23,7 @@ void HealthHUDSystem::Update(double dt) if (entity.HasComponent("Text")) { double health = (const double&)entityIDParent["Health"]["Health"]; - double maxHealth = (const double&)entityIDParent["Health"]["Health"]; + double maxHealth = (const double&)entityIDParent["Health"]["MaxHealth"]; std::string s = ""; s = s + std::to_string((int)health); s = s + "/"; From fd50ea3a12ddd0c7478cbc19ed0fa0a77a304079 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 22:02:37 +0100 Subject: [PATCH 41/44] Defender friendly boost hud --- resources/Schema/Entities/WeaponDefenderBlueView.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml index a8bdd68b..9e3d6a51 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -150,12 +150,13 @@ R_Ammo_Joint + true - + @@ -224,7 +225,7 @@ Schema/Entities/FriendlyBoostBlueHUD.xml - + From ce2fcd91098876e0996ef906dab12bb190ea31b5 Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 22:13:37 +0100 Subject: [PATCH 42/44] Now it works --- src/Game/Systems/HealthHUDSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Game/Systems/HealthHUDSystem.cpp b/src/Game/Systems/HealthHUDSystem.cpp index bfc63700..70ccf465 100644 --- a/src/Game/Systems/HealthHUDSystem.cpp +++ b/src/Game/Systems/HealthHUDSystem.cpp @@ -35,7 +35,7 @@ void HealthHUDSystem::Update(double dt) if(entity.HasComponent("Fill")) { double health = (const double&)entityIDParent["Health"]["Health"]; - double maxHealth = (const double&)entityIDParent["Health"]["Health"]; + double maxHealth = (const double&)entityIDParent["Health"]["MaxHealth"]; float healthPercentage = health/maxHealth; entity["Fill"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Fill"]["Color"]).a); entity["Fill"]["Percentage"] = (double)healthPercentage; From d587c9a6928c236b609013764b3574066b656552 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 22:17:55 +0100 Subject: [PATCH 43/44] Fixed first person strafe animation --- .../Engine/Input/FirstPersonInputController.h | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/Engine/Input/FirstPersonInputController.h b/include/Engine/Input/FirstPersonInputController.h index c159e113..67e7270e 100644 --- a/include/Engine/Input/FirstPersonInputController.h +++ b/include/Engine/Input/FirstPersonInputController.h @@ -212,6 +212,33 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm m_EventBroker->Publish(aeb); } } + + + EntityWrapper firstPersonModel = m_PlayerEntity.FirstChildByName("Hands"); + if (firstPersonModel.Valid()) { + if (val > 0) { // Walk/Run + if (!m_Crouching) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Run"; + aeb.RootNode = firstPersonModel; + aeb.SingleLevelBlend = true; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + } else if (val < 0) { // Walk/run Backwards + if (!m_Crouching) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Run"; + aeb.RootNode = firstPersonModel; + aeb.SingleLevelBlend = true; + aeb.Start = true; + aeb.Reverse = true; + m_EventBroker->Publish(aeb); + } + } + } } } } From 00d77607b43e05b2f8c8a9951e3b627007d105d1 Mon Sep 17 00:00:00 2001 From: Ayumiwii Date: Sun, 13 Mar 2016 22:24:27 +0100 Subject: [PATCH 44/44] new scoreboard --- resources/Schema/Entities/ScoreBoard_Main.xml | 103 ++++++++++-------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/resources/Schema/Entities/ScoreBoard_Main.xml b/resources/Schema/Entities/ScoreBoard_Main.xml index ccc1df68..04bf74c9 100644 --- a/resources/Schema/Entities/ScoreBoard_Main.xml +++ b/resources/Schema/Entities/ScoreBoard_Main.xml @@ -2,60 +2,17 @@ - + + + + - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - - - - - - - - - - - Models/Core/UnitCube.mesh - - - - - - - - - - - - - - - - - - - + Schema/Entities/ScoreBoard_Red.xml @@ -63,6 +20,56 @@ + + + + 0.80000019073486328 + Models/Props/ScoreBoard/Scoreboard.mesh + false + + + + + + + + + + + 0.70000028610229492 + Models/Props/ScoreBoard/Spectatorboard.mesh + false + + + + + + + + + + + + Schema/Entities/ScoreBoard_Blue.xml + + + + + + + + + + + + + + + + + + +