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

Conflicts:
	include/Core/Engine.h
This commit is contained in:
viktorljung
2015-10-20 11:01:42 +02:00
53 changed files with 1674 additions and 467 deletions
+7 -1
View File
@@ -6,6 +6,8 @@
#include "Core/EventBroker.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/ResourceManager.h"
#include "Core/ConfigFile.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
@@ -32,6 +34,7 @@
#include "Game/EArrivedAtNewStage.h"
#include "Game/EGameOver.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EHitPad.h"
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
@@ -94,7 +97,7 @@ public:
private:
float m_XMovementMultiplier = 2.f;
float m_EdgeX = 3.2f;
float m_EdgeX = 3.4f; //Actually 3.2, but anyways.
float m_EdgeY = 5.2f;
int m_MultiBalls = 0;
int m_Lives = 3;
@@ -108,6 +111,7 @@ private:
bool m_InkBlockedWaiting = false;
bool m_Restarting = false;
int m_StickyCounter = 3;
bool m_GodMode = false;
bool m_StageBlockedWaiting = false;
@@ -127,6 +131,7 @@ private:
dd::EventRelay<BallSystem, dd::Events::InkBlaster> m_EInkBlaster;
dd::EventRelay<BallSystem, dd::Events::InkBlasterOver> m_EInkBlasterOver;
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<BallSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
dd::EventRelay<BallSystem, dd::Events::StageCleared> m_EStageCleared;
@@ -141,6 +146,7 @@ private:
bool OnInkBlaster(const dd::Events::InkBlaster &event);
bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event);
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnActionButton(const dd::Events::ActionButton &event);
bool OnStageCleared(const dd::Events::StageCleared &event);
bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event);
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-14.
//
#ifndef DAYDREAM_CBACKGROUND_H
#define DAYDREAM_CBACKGROUND_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Background : Component
{
float distanceLeftToCorrectTravelPosition;
};
}
}
#endif //DAYDREAM_CBACKGROUND_H
+1
View File
@@ -19,6 +19,7 @@ struct Brick : Component
//0 = empty, 1 = normal, 2 = multi-brick, 3 = lifebuoy, 4 = sticky, 5 = blaster, 6 = kraken
int Type = 0;
bool Removed = false;
int Number = 0; // For the Kraken to keep track of which bricks needs replacing.
//What number of types each is.
const int EmptyBrickSpace = 0;
+33
View File
@@ -0,0 +1,33 @@
//
// Created by Adniklastrator on 2015-10-15.
//
#ifndef DAYDREAM_CKRAKEN_H
#define DAYDREAM_CKRAKEN_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Kraken : Component {
int Health = 10;
int CurrentAction = 1;
const int Idle = 1;
const int Grabbing = 2;
const int Taunting = 3;
const int Moving = 4;
const int BrickGenerating = 5;
// Idle. Generating bricks. Taunting. No idea.
};
}
}
#endif //DAYDREAM_CKRAKEN_H
+28
View File
@@ -0,0 +1,28 @@
//
// Created by Adniklastrator on 2015-10-15.
//
#ifndef DAYDREAM_CTRAVELS_H
#define DAYDREAM_CTRAVELS_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Travels : Component
{
//This indicates that the object moves upon moving to the next stage. Place this on an object that is to move.
//The camera does not move. Things that are to follow the camera should not have this component.
bool CurrentlyTraveling = false;
};
}
}
#endif //DAYDREAM_CTRAVELS_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-14.
//
#ifndef DAYDREAM_CWALL_H
#define DAYDREAM_CWALL_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Wall : Component
{
};
}
}
#endif //DAYDREAM_CWALL_H
+27
View File
@@ -0,0 +1,27 @@
//
// Created by Adniklastrator on 2015-10-16.
//
#ifndef DAYDREAM_EBRICKGENERATING_H
#define DAYDREAM_EBRICKGENERATING_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct BrickGenerating : Event
{
glm::vec3 Origin;
int TargetLine;
int Set;
};
}
}
#endif //DAYDREAM_EBRICKGENERATING_H
+26
View File
@@ -0,0 +1,26 @@
//
// Created by Adniklastrator on 2015-10-15.
//
#ifndef DAYDREAM_EKRAKENAPPEAR_H
#define DAYDREAM_EKRAKENAPPEAR_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct KrakenAppear : Event
{
int Health;
glm::vec3 Position;
};
}
}
#endif //DAYDREAM_EKRAKENAPPEAR_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Administrator on 2015-10-14.
//
#ifndef DAYDREAM_ERAISEWATER_H
#define DAYDREAM_ERAISEWATER_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct RaiseWater : Event
{
float Amount;
};
}
}
#endif //DAYDREAM_ERAISEWATER_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-14.
//
#ifndef DAYDREAM_ERESETALL_H
#define DAYDREAM_ERESETALL_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct ResetAll : Event
{
};
}
}
#endif //DAYDREAM_ERESETALL_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-19.
//
#ifndef DAYDREAM_ERESUME_H
#define DAYDREAM_ERESUME_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct Resume : Event
{
std::string Type;
};
}
}
#endif //DAYDREAM_ERESUME_H
+5 -2
View File
@@ -25,6 +25,7 @@
#include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EHitLag.h"
#include "Game/EGameOver.h"
#include "Game/ECreatePowerUp.h"
@@ -70,16 +71,18 @@ public:
std::string& CurrentType() { return m_CurrentType; }
void SetCurrentType(const std::string& currentType) { m_CurrentType = currentType; }
private:
bool m_Pause;
bool m_HitLag;
bool m_Pause = false;
bool m_HitLag = false;
float m_HitLagDuration;
float m_HitLagTimer;
std::string m_CurrentType;
dd::EventRelay<HitLagSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<HitLagSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<HitLagSystem, dd::Events::HitLag> m_EHitLag;
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnHitLag(const dd::Events::HitLag &event);
};
+86
View File
@@ -0,0 +1,86 @@
//
// Created by Adniklastrator on 2015-10-15.
//
#ifndef DAYDREAM_KRAKENSYSTEM_H
#define DAYDREAM_KRAKENSYSTEM_H
#include <random>
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Rendering/CModel.h"
#include "Physics/CRectangleShape.h"
#include "Physics/CCircleShape.h"
#include "Physics/CPhysics.h"
#include "Physics/EContact.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EKrakenAppear.h"
#include "Game/EKrakenAttack.h"
#include "Game/EBrickGenerating.h"
#include "Game/CTravels.h"
#include "Game/CKraken.h"
#include "Sound/CCollisionSound.h"
//#include "Core/Camera.h" Camera Component
namespace dd
{
namespace Systems
{
class KrakenSystem : public System
{
public:
KrakenSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override;
void InitializeObjects();
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:
std::mt19937 m_RandomGenerator;
bool m_Pause = false;
bool m_KrakenBattle = false;
bool m_ReturnToIdle = false;
EntityID m_KrakenTemplate;
std::string m_Action = "Idle";
float m_KrakenTimer = 0;
float m_KrakenSecondsToAction = 1;
const int Idle = 1;
std::array<int, 14> m_Bricks;
std::array<int, 14> m_Colors;
dd::EventRelay<KrakenSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<KrakenSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<KrakenSystem, dd::Events::Contact> m_EContact;
dd::EventRelay<KrakenSystem, dd::Events::KrakenAppear> m_EKrakenAppear;
dd::EventRelay<KrakenSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
dd::EventRelay<KrakenSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnContact(const dd::Events::Contact &event);
bool OnKrakenAppear(const dd::Events::KrakenAppear &event);
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
void GetBrickSet();
};
}
}
#endif //DAYDREAM_KRAKENSYSTEM_H
+25 -1
View File
@@ -14,14 +14,22 @@
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Core/ResourceManager.h"
#include "Core/ConfigFile.h"
#include "Rendering/CSprite.h"
#include "Rendering/CModel.h"
#include "Rendering/CPointLight.h"
#include "Transform/EMove.h"
#include "Game/CBrick.h"
#include "Game/CBall.h"
#include "Game/CLife.h"
#include "Game/CWall.h"
#include "Game/CBackground.h"
#include "Game/CProjectile.h"
#include "Game/CPowerUp.h"
#include "Game/CTravels.h"
#include "Game/BrickComponents.h"
@@ -38,14 +46,19 @@
#include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EGameOver.h"
#include "Game/EClusterClear.h"
#include "Game/ECreatePowerUp.h"
#include "Game/EPowerUpTaken.h"
#include "Game/EKrakenAppear.h"
#include "Game/EBrickGenerating.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
#include "Physics/CWaterVolume.h"
#include "Physics/ESetImpulse.h"
#include "Physics/EContact.h"
#include "Sound/CCollisionSound.h"
@@ -82,7 +95,7 @@ public:
void CreateBasicLevel(int, int, glm::vec2, float);
void CreateLevel(int);
void CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
EntityID CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
void BrickHit(EntityID, EntityID, int);
void OnEntityRemoved(EntityID entity);
@@ -137,6 +150,7 @@ private:
float m_SpaceToEdge = 0.25f;
glm::vec2 m_SpaceBetweenBricks = glm::vec2(1, 0.4);
float m_NotResettingTheStage = 5.f;
bool m_GodMode = false;
const int EmptyBrickSpace = 0;
const int StandardBrick = 1;
@@ -146,11 +160,16 @@ private:
const int InkBlasterBrick = 5;
const int KrakenAttackBrick = 6;
const int Kraken = 100;
EntityID m_BrickTemplate;
std::array<int, 42> m_Bricks;
std::array<glm::vec4, 42> m_Colors;
std::array<int, 14> m_BrickSet;
std::array<glm::vec4, 14> m_ColorSet;
dd::EventRelay<LevelSystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LevelSystem, dd::Events::ScoreEvent> m_EScoreEvent;
dd::EventRelay<LevelSystem, dd::Events::MultiBall> m_EMultiBall;
@@ -159,7 +178,9 @@ private:
dd::EventRelay<LevelSystem, dd::Events::PowerUpTaken> m_EPowerUpTaken;
dd::EventRelay<LevelSystem, dd::Events::StageCleared> m_EStageCleared;
dd::EventRelay<LevelSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LevelSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<LevelSystem, dd::Events::HitPad> m_EHitPad;
dd::EventRelay<LevelSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
bool OnContact(const dd::Events::Contact &event);
bool OnScoreEvent(const dd::Events::ScoreEvent &event);
@@ -169,7 +190,10 @@ private:
bool OnPowerUpTaken(const dd::Events::PowerUpTaken &event);
bool OnStageCleared(const dd::Events::StageCleared &event);
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnHitPad(const dd::Events::HitPad &event);
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
void GetBrickSet(int Set);
void GetNextLevel();
void SetBrokenModel(EntityID entity);
+6 -2
View File
@@ -5,6 +5,8 @@
#ifndef DAYDREAM_LIFEBUOYSYSTEM_H
#define DAYDREAM_LIFEBUOYSYSTEM_H
#include <fstream>
#include <iostream>
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
@@ -15,11 +17,11 @@
#include "Physics/CPhysics.h"
#include "Physics/CRectangleShape.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/ELifebuoy.h"
#include "Game/ELifebuoyHit.h"
#include "Game/CLifebuoy.h"
#include <fstream>
#include <iostream>
#include "Physics/ECreateParticleSequence.h"
namespace dd
{
@@ -48,11 +50,13 @@ private:
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LifebuoySystem, dd::Events::Resume> m_EResume;
dd::EventRelay<LifebuoySystem, dd::Events::Lifebuoy> m_ELifebuoy;
dd::EventRelay<LifebuoySystem, dd::Events::LifebuoyHit> m_ELifebuoyHit;
bool OnContact(const dd::Events::Contact &event);
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
+20
View File
@@ -13,20 +13,31 @@
#include "Core/EventBroker.h"
#include "Core/EKeyDown.h"
#include "Core/EKeyUp.h"
#include "Input/EBindKey.h"
#include "Physics/EContact.h"
#include "Physics/CRectangleShape.h"
#include "Physics/CWaterVolume.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/ESetImpulse.h"
#include "Rendering/CSprite.h"
#include "Rendering/CModel.h"
#include "Transform/EMove.h"
#include "Transform/ERotate.h"
#include "Game/CBall.h"
#include "Game/CPad.h"
#include "Game/CPowerUp.h"
#include "Game/CStickyAim.h"
#include "Game/EResetBall.h"
#include "Game/EResetAll.h"
#include "Game/ERaiseWater.h"
#include "Game/EMultiBall.h"
#include "Game/ELifebuoy.h"
#include "Game/EStickyPad.h"
#include "Game/EStickyAttachedToPad.h"
#include "Game/EInkBlaster.h"
@@ -34,11 +45,14 @@
#include "Game/EPowerUpTaken.h"
#include "Game/EStageCleared.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EHitLag.h"
#include "Game/EScreenShake.h"
#include "Game/EActionButton.h"
#include "Rendering/CAnimation.h"
#include "Game/EBrickGenerating.h"
namespace dd
{
@@ -103,7 +117,10 @@ private:
dd::EventRelay<PadSystem, dd::Events::Contact> m_EContactPowerUp;
dd::EventRelay<PadSystem, dd::Events::StageCleared> m_EStageCleared;
dd::EventRelay<PadSystem, dd::Events::ResetBall> m_EResetBall;
dd::EventRelay<PadSystem, dd::Events::ResetAll> m_EResetAll;
dd::EventRelay<PadSystem, dd::Events::RaiseWater> m_ERaiseWater;
dd::EventRelay<PadSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<PadSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<PadSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
dd::EventRelay<PadSystem, dd::Events::StickyPad> m_EStickyPad;
dd::EventRelay<PadSystem, dd::Events::StickyAttachedToPad> m_EStickyAttachedToPad;
@@ -115,7 +132,10 @@ private:
bool OnContactPowerUp(const dd::Events::Contact &event);
bool OnStageCleared(const dd::Events::StageCleared &event);
bool OnResetBall(const dd::Events::ResetBall &event);
bool OnResetAll(const dd::Events::ResetAll &event);
bool OnRaiseWater(const dd::Events::RaiseWater &event);
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
bool OnStickyPad(const dd::Events::StickyPad &event);
bool OnStickyAttachedToPad(const dd::Events::StickyAttachedToPad &event);
+4
View File
@@ -16,12 +16,14 @@
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EInkBlaster.h"
#include "Game/EInkBlasterOver.h"
#include "Game/EActionButton.h"
#include "Game/EHitPad.h"
#include "Game/CProjectile.h"
#include "Game/CBall.h"
#include "Rendering/CSprite.h"
#include <fstream>
#include <iostream>
@@ -56,12 +58,14 @@ private:
dd::EventRelay<ProjectileSystem, dd::Events::Contact> m_EContact;
dd::EventRelay<ProjectileSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<ProjectileSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<ProjectileSystem, dd::Events::InkBlaster> m_EInkBlaster;
dd::EventRelay<ProjectileSystem, dd::Events::HitPad> m_EHitPad;
dd::EventRelay<ProjectileSystem, dd::Events::ActionButton> m_EActionButton;
bool OnContact(const dd::Events::Contact &event);
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnInkBlaster(const dd::Events::InkBlaster &event);
bool OnHitPad(const dd::Events::HitPad &event);
bool OnActionButton(const dd::Events::ActionButton &event);
+71
View File
@@ -0,0 +1,71 @@
//
// Created by Adniklastrator on 2015-10-14.
//
#ifndef DAYDREAM_SCREENSHAKESYSTEM_H
#define DAYDREAM_SCREENSHAKESYSTEM_H
#include <random>
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EScreenShake.h"
//#include "Core/Camera.h" Camera Component
namespace dd
{
namespace Systems
{
class ScreenShakeSystem : public System
{
public:
ScreenShakeSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override;
void InitializeObjects();
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
void FlipPause();
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
std::mt19937 m_RandomGenerator;
bool m_Pause;
bool m_ScreenShake;
int m_ShakeIntensity;
glm::vec3 m_CameraPosition;
float m_ShakeRepresentativeIntensity;
float m_ShakeTimer;
float m_ShakeEndTime;
float m_TimeTakenToCoolDown;
float m_CoolerMultiplier;
glm::vec3 m_Random;
dd::EventRelay<ScreenShakeSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<ScreenShakeSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<ScreenShakeSystem, dd::Events::ScreenShake> m_EScreenShake;
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnScreenShake(const dd::Events::ScreenShake &event);
};
}
}
#endif //DAYDREAM_SCREENSHAKESYSTEM_H
+9
View File
@@ -8,11 +8,16 @@
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Transform/EMove.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/EArrivedAtNewStage.h"
#include "Game/EStageCleared.h"
#include "Game/CTravels.h"
#include "Game/CBackground.h"
namespace dd
@@ -43,10 +48,14 @@ private:
float m_DistanceTravelled = 0;
dd::EventRelay<TravellingSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<TravellingSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<TravellingSystem, dd::Events::StageCleared> m_EStageCleared;
dd::EventRelay<TravellingSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnStageCleared(const dd::Events::StageCleared &event);
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
};
}