Merge remote-tracking branch 'origin/master' into water

Conflicts:
	src/game/Physics/ContactListener.cpp
	src/game/Physics/PhysicsSystem.cpp
This commit is contained in:
Stiffly
2015-10-08 21:39:48 +02:00
25 changed files with 5314 additions and 94 deletions
+9
View File
@@ -43,9 +43,11 @@
#include "Game/PadSystem.h"
#include "Game/CBall.h"
#include "Game/CPad.h"
#include "Game/CLifebuoy.h"
#include "Game/CBrick.h"
#include "Game/BallSystem.h"
#include "Game/HitLagSystem.h"
#include "Game/LifebuoySystem.h"
#include "Game/Bricks/CPowerUpBrick.h"
#include "Physics/PhysicsSystem.h"
@@ -110,6 +112,7 @@ public:
m_World->ComponentFactory.Register<Components::Brick>();
m_World->ComponentFactory.Register<Components::Pad>();
m_World->ComponentFactory.Register<Components::Life>();
m_World->ComponentFactory.Register<Components::Lifebuoy>();
m_World->ComponentFactory.Register<Components::PowerUp>();
m_World->ComponentFactory.Register<Components::PowerUpBrick>();
@@ -126,6 +129,9 @@ public:
m_World->SystemFactory.Register<Systems::HitLagSystem>(
[this]() { return new Systems::HitLagSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::HitLagSystem>();
m_World->SystemFactory.Register<Systems::LifebuoySystem>(
[this]() { return new Systems::LifebuoySystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::LifebuoySystem>();
m_World->SystemFactory.Register<Systems::PhysicsSystem>(
[this]() { return new Systems::PhysicsSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::PhysicsSystem>();
@@ -181,6 +187,7 @@ public:
auto transform = m_World->AddComponent<Components::Transform>(t_halfPipe);
transform->Position = glm::vec3(0.f, 34.6f, -15.f);
transform->Scale = glm::vec3(6.f, 6.f, 10.f);
transform->Sticky = false;
auto model = m_World->AddComponent<Components::Model>(t_halfPipe);
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f);
@@ -261,6 +268,8 @@ public:
rectangleShape->Dimensions = glm::vec2(20.f, 0.5f);
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(BottomWall);
physics->CollisionType = CollisionType::Type::Static;
physics->Category = CollisionLayer::Wall;
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::LifeBuoy);
transform->Sticky = true;
m_World->CommitEntity(BottomWall);
}
+6
View File
@@ -21,11 +21,13 @@
#include "Game/EResetBall.h"
#include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h"
#include "Game/EStickyPad.h"
#include "Game/EGameOver.h"
#include "Game/EPause.h"
#include "Game/EHitPad.h"
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
#include "Game/CLifebuoy.h"
namespace dd
{
@@ -91,6 +93,8 @@ private:
bool m_ReplaceBall = false;
bool m_Pause = false;
bool m_Waiting = true;
bool m_Sticky = false;
int m_StickyCounter = 5;
EntityID m_LastCollision = 999999;
glm::vec3 m_SavedSpeed;
@@ -105,6 +109,7 @@ private:
dd::EventRelay<BallSystem, dd::Events::MultiBallLost> m_EMultiBallLost;
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
dd::EventRelay<BallSystem, dd::Events::StickyPad> m_EStickyPad;
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
@@ -114,6 +119,7 @@ private:
bool OnMultiBallLost(const dd::Events::MultiBallLost &event);
bool OnResetBall(const dd::Events::ResetBall &event);
bool OnMultiBall(const dd::Events::MultiBall &event);
bool OnStickyPad(const dd::Events::StickyPad &event);
bool OnPause(const dd::Events::Pause &event);
bool OnActionButton(const dd::Events::ActionButton &event);
};
+2
View File
@@ -20,6 +20,8 @@ struct Ball : Component
int Combo = 0;
bool Paused = false;
bool Waiting = true;
bool Sticky = false;
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
glm::vec3 SavedSpeed = glm::vec3(0, 0, 0);
};
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-08.
//
#ifndef DAYDREAM_CLIFEBUOY_H
#define DAYDREAM_CLIFEBUOY_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Lifebuoy : Component
{
};
}
}
#endif //DAYDREAM_CLIFEBUOY_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-09-17.
//
#ifndef DAYDREAM_ELIFEBUOY_H
#define DAYDREAM_ELIFEBUOY_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct Lifebuoy : Event
{
Components::Transform* Transform;
};
}
}
#endif //DAYDREAM_ELIFEBUOY_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-08.
//
#ifndef DAYDREAM_ESTICKYPAD_H
#define DAYDREAM_ESTICKYPAD_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct StickyPad : Event
{
Components::Transform* Transform;
};
}
}
#endif //DAYDREAM_ESTICKYPAD_H
+6 -2
View File
@@ -22,13 +22,15 @@
#include "Game/EScoreEvent.h"
#include "Game/EComboEvent.h"
#include "Game/EHitPad.h"
#include "Game/ELifebuoy.h"
#include "Game/EStickyPad.h"
#include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h"
#include "Game/EPause.h"
#include "Game/EGameOver.h"
#include "Game/ECreatePowerUp.h"
#include "Game/EPowerUpTaken.h"
#include "Game/Bricks/CPowerUpBrick.h"
//#include "Game/Bricks/CPowerUpBrick.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
@@ -108,7 +110,7 @@ private:
bool m_Initialized = false;
bool m_Pause = false;
int m_LooseBricks = 0;
int m_CurrentCluster = 2;
int m_CurrentCluster = 1;
int m_CurrentLevel = 1;
int m_MultiBalls = 0;
int m_PowerUps = 0;
@@ -123,6 +125,8 @@ private:
const int EmptyBrickSpace = 0;
const int StandardBrick = 1;
const int MultiBallBrick = 2;
const int LifebuoyBrick = 3;
const int StickyBrick = 4;
EntityID m_BrickTemplate;
+71
View File
@@ -0,0 +1,71 @@
//
// Created by Adniklastrator on 2015-09-09.
//
#ifndef DAYDREAM_LIFEBUOYSYSTEM_H
#define DAYDREAM_LIFEBUOYSYSTEM_H
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Physics/EContact.h"
#include "Rendering/CModel.h"
#include "Physics/CPhysics.h"
#include "Physics/CRectangleShape.h"
#include "Game/EPause.h"
#include "Game/ELifebuoy.h"
#include "Game/CLifebuoy.h"
#include <fstream>
#include <iostream>
namespace dd
{
namespace Systems
{
class LifebuoySystem : public System
{
public:
LifebuoySystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
bool m_Pause = false;
EntityID m_Template;
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LifebuoySystem, dd::Events::Lifebuoy> m_ELifebuoy;
bool OnContact(const dd::Events::Contact &event);
bool OnPause(const dd::Events::Pause &event);
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
struct LifeBuoyInfo
{
EntityID Entity;
float TimeToLive = 15.f;
};
float m_LeftEdge = -3.8f;
float m_RightEdge = 3.8f;
std::list<LifeBuoyInfo> m_LifeBuoys;
};
}
}
#endif //DAYDREAM_LIFEBUOYSYSTEM_H
+20 -18
View File
@@ -9,13 +9,14 @@ namespace CollisionLayer
{
enum Type
{
Pad = 1 << 0,
Ball = 1 << 1,
Brick = 1 << 2,
Water = 1 << 3,
PowerUp = 1 << 4,
Other = 1 << 5,
Wall = 1 << 6
Pad = 1 << 0,
Ball = 1 << 1,
Brick = 1 << 2,
Water = 1 << 3,
PowerUp = 1 << 4,
Other = 1 << 5,
Wall = 1 << 6,
LifeBuoy = 1 << 7
};
}
@@ -39,20 +40,21 @@ enum Type
bool Calculate = false;
float GravityScale = 0.f;
float Density = 20.f;
CollisionLayer::Type Category = CollisionLayer::Type::Other;
CollisionLayer::Type Mask = static_cast<CollisionLayer::Type>(
CollisionLayer::Pad
| CollisionLayer::Ball
| CollisionLayer::Brick
| CollisionLayer::Water
| CollisionLayer::PowerUp
| CollisionLayer::Wall
| CollisionLayer::Other
);
};
CollisionLayer::Type Mask = static_cast<CollisionLayer::Type>(
CollisionLayer::Pad
| CollisionLayer::Ball
| CollisionLayer::Brick
| CollisionLayer::Water
| CollisionLayer::PowerUp
| CollisionLayer::Wall
| CollisionLayer::LifeBuoy
| CollisionLayer::Other
);
};
}
}
+1 -1
View File
@@ -117,7 +117,7 @@ namespace dd
dd::EventRelay<PhysicsSystem, dd::Events::Contact> m_EContact;
bool OnContact(const dd::Events::Contact &event);
bool m_Travelling = false;
float m_Timer = 0;
float m_DistanceTravelled = 0;
//TODO: Fill struct with info needed.
struct EmitterHandler //TODO CHANGE NAMES