From f6a8534c15aa00f3e13233981e61433cac37ddaf Mon Sep 17 00:00:00 2001 From: Tleety Date: Sun, 13 Mar 2016 01:23:51 +0100 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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;