Merge remote-tracking branch 'origin/master' into Physics
Conflicts: include/Game/BallSystem.h include/Game/ProjectileSystem.h src/game/Game/BallSystem.cpp src/game/Game/ProjectileSystem.cpp src/game/Rendering/AnimationSystem.cpp
This commit is contained in:
+20
-5
@@ -37,6 +37,7 @@
|
||||
#include "Rendering/CModel.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
#include "Rendering/CPointLight.h"
|
||||
#include "Rendering/CCamera.h"
|
||||
#include "Transform/TransformSystem.h"
|
||||
#include "Sound/SoundSystem.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
@@ -67,6 +68,7 @@
|
||||
|
||||
#include "Game/BrickComponents.h"
|
||||
|
||||
#include "Game/ScreenShakeSystem.h"
|
||||
#include "Game/EScreenShake.h"
|
||||
|
||||
#include "Physics/PhysicsSystem.h"
|
||||
@@ -102,9 +104,6 @@ public:
|
||||
ResourceManager::RegisterType<Model>("Model");
|
||||
ResourceManager::RegisterType<Sound>("Sound");
|
||||
ResourceManager::RegisterType<ConfigFile>("ConfigFile");
|
||||
ResourceManager::RegisterType<ShaderProgram>("ShaderProgram");
|
||||
ResourceManager::RegisterType<VertexShader>("VertexShader");
|
||||
ResourceManager::RegisterType<FragmentShader>("FragmentShader");
|
||||
ResourceManager::LoadPreloadsFromFile();
|
||||
|
||||
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
@@ -150,6 +149,7 @@ public:
|
||||
|
||||
m_World->ComponentFactory.Register<Components::Sprite>();
|
||||
|
||||
m_World->ComponentFactory.Register<Components::Camera>();
|
||||
m_World->ComponentFactory.Register<Components::RectangleShape>();
|
||||
m_World->ComponentFactory.Register<Components::Physics>();
|
||||
m_World->ComponentFactory.Register<Components::Ball>();
|
||||
@@ -212,6 +212,9 @@ public:
|
||||
m_World->SystemFactory.Register<Systems::LifeSystem>(
|
||||
[this]() { return new Systems::LifeSystem(m_World.get(), m_EventBroker); });
|
||||
m_World->AddSystem<Systems::LifeSystem>();
|
||||
m_World->SystemFactory.Register<Systems::ScreenShakeSystem>(
|
||||
[this]() { return new Systems::ScreenShakeSystem(m_World.get(), m_EventBroker); });
|
||||
m_World->AddSystem<Systems::ScreenShakeSystem>();
|
||||
|
||||
m_World->ComponentFactory.Register<Components::Model>();
|
||||
m_World->ComponentFactory.Register<Components::Template>();
|
||||
@@ -274,8 +277,6 @@ public:
|
||||
TEMPAddToRenderQueue();
|
||||
}
|
||||
|
||||
std::unique_ptr<dd::Camera> defaultCamera = nullptr;
|
||||
|
||||
// Render scene
|
||||
//TODO send renderqueue to draw.
|
||||
m_Renderer->Draw(m_RendererQueue);
|
||||
@@ -295,6 +296,20 @@ public:
|
||||
{
|
||||
if (!m_TransformSystem)
|
||||
m_TransformSystem = m_World->GetSystem<Systems::TransformSystem>();
|
||||
|
||||
// HACK: How do we handle multiple cameras? Maybe view and projection matrices in render queue...
|
||||
auto cameras = m_World->GetComponentsOfType<Components::Camera>();
|
||||
if (cameras != nullptr) {
|
||||
for (auto& component : *cameras) {
|
||||
auto camera = static_cast<Components::Camera*>(component.get());
|
||||
auto transform = m_World->GetComponent<Components::Transform>(camera->Entity);
|
||||
m_Renderer->Camera()->SetPosition(transform->Position);
|
||||
m_Renderer->Camera()->SetOrientation(transform->Orientation);
|
||||
m_Renderer->Camera()->SetFOV(camera->FOV);
|
||||
m_Renderer->Camera()->SetNearClip(camera->NearClip);
|
||||
m_Renderer->Camera()->SetFarClip(camera->FarClip);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &pair : *m_World->GetEntities())
|
||||
{
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
#include "Physics/ECreateParticleSequence.h"
|
||||
#include "Sound/CCollisionSound.h"
|
||||
#include "Sound/EPlaySound.h"
|
||||
#include "Rendering/EAnimationComplete.h"
|
||||
|
||||
namespace dd
|
||||
|
||||
@@ -25,6 +25,8 @@ struct Ball : Component
|
||||
bool Loaded = false;
|
||||
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
|
||||
glm::vec3 SavedSpeed = glm::vec3(0, 1, 0);
|
||||
|
||||
int PosterBoy = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ struct Brick : Component
|
||||
int Type = 0;
|
||||
bool Removed = false;
|
||||
int Number = 100; // For the Kraken to keep track of which bricks needs replacing.
|
||||
bool BeingGenerated = false;
|
||||
glm::vec3 GenerationGoal;
|
||||
|
||||
//What number of types each is.
|
||||
const int EmptyBrickSpace = 0;
|
||||
|
||||
@@ -17,13 +17,14 @@ struct Kraken : Component {
|
||||
|
||||
int MaxHealth = 30;
|
||||
int Health = MaxHealth;
|
||||
int CurrentAction = 1;
|
||||
int CurrentAction = 3;
|
||||
float RetreatSpeed = 0.2;
|
||||
|
||||
const int Idle = 1;
|
||||
const int Grabbing = 2;
|
||||
const int Taunting = 3;
|
||||
const int Moving = 4;
|
||||
const int BrickGenerating = 5;
|
||||
const int BrickGenerating = 3;
|
||||
const int BrickGenerating2 = 4;
|
||||
const int Waiting = 5;
|
||||
// Idle. Generating bricks. Taunting. No idea.
|
||||
};
|
||||
|
||||
|
||||
@@ -13,10 +13,15 @@ namespace dd
|
||||
namespace Components
|
||||
{
|
||||
|
||||
struct Life : Component {
|
||||
|
||||
struct Life : Component
|
||||
{
|
||||
int Number = 0;
|
||||
|
||||
float SinusAltitude = 0;
|
||||
float Amplitude = 1;
|
||||
float Frequency = 1;
|
||||
float SinusSpeed = 1;
|
||||
bool Left = false;
|
||||
bool Dead = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Adniklastrator on 2015-10-23.
|
||||
//
|
||||
|
||||
#ifndef DAYDREAM_EBREAKALLBRICKS_H
|
||||
#define DAYDREAM_EBREAKALLBRICKS_H
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct BreakAllBricks : Event
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //DAYDREAM_EBREAKALLBRICKS_H
|
||||
@@ -19,6 +19,7 @@ struct BrickGenerating : Event
|
||||
glm::vec3 Origin2;
|
||||
int TargetLine;
|
||||
int Set;
|
||||
int SetCluster;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Game/EKrakenHit.h"
|
||||
#include "Game/EKrakenDefeated.h"
|
||||
#include "Game/EBrickGenerating.h"
|
||||
#include "Game/EArrivedAtNewStage.h"
|
||||
#include "Game/CTravels.h"
|
||||
#include "Game/CKraken.h"
|
||||
#include "Game/CBall.h"
|
||||
@@ -64,12 +65,15 @@ private:
|
||||
|
||||
bool m_Pause = false;
|
||||
bool m_KrakenBattle = false;
|
||||
bool m_KrakenHasArrived = false;
|
||||
bool m_ReturnToIdle = false;
|
||||
EntityID m_KrakenTemplate;
|
||||
std::string m_Action = "Idle";
|
||||
int m_NumberOfActions;
|
||||
float m_KrakenTimer = 0;
|
||||
float m_KrakenSecondsToAction = 10;
|
||||
float m_KrakenMaxSecondsToAction = 10;
|
||||
float m_KrakenMinSecondsToAction = 10;
|
||||
float m_KrakenCurrentSecondsToAction = 15;
|
||||
const int Idle = 1;
|
||||
|
||||
std::array<int, 42> m_Bricks;
|
||||
@@ -83,6 +87,7 @@ private:
|
||||
dd::EventRelay<KrakenSystem, dd::Events::KrakenHit> m_EKrakenHit;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::KrakenDefeated> m_EKrakenDefeated;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::BrickGenerating> m_EBrickGenerating;
|
||||
dd::EventRelay<KrakenSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
|
||||
bool OnPause(const dd::Events::Pause &event);
|
||||
bool OnResume(const dd::Events::Resume &event);
|
||||
bool OnContact(const dd::Events::Contact &event);
|
||||
@@ -91,6 +96,7 @@ private:
|
||||
bool OnKrakenHit(const dd::Events::KrakenHit &event);
|
||||
bool OnKrakenDefeated(const dd::Events::KrakenDefeated &event);
|
||||
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event);
|
||||
void GetBrickSet();
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Rendering/CSprite.h"
|
||||
#include "Rendering/CModel.h"
|
||||
#include "Rendering/CPointLight.h"
|
||||
#include "Rendering/CCamera.h"
|
||||
|
||||
#include "Transform/EMove.h"
|
||||
|
||||
@@ -180,6 +181,8 @@ private:
|
||||
bool m_BrickGenerating = false;
|
||||
dd::Events::BrickGenerating m_BrickGeneratingEvent;
|
||||
|
||||
bool m_BreakAllBricks = false;
|
||||
|
||||
dd::EventRelay<LevelSystem, dd::Events::Contact> m_EContact;
|
||||
dd::EventRelay<LevelSystem, dd::Events::ScoreEvent> m_EScoreEvent;
|
||||
dd::EventRelay<LevelSystem, dd::Events::MultiBall> m_EMultiBall;
|
||||
@@ -207,7 +210,7 @@ private:
|
||||
bool OnHitPad(const dd::Events::HitPad &event);
|
||||
bool OnBrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
bool BrickGenerating(const dd::Events::BrickGenerating &event);
|
||||
void GetBrickSet(int Set);
|
||||
void GetBrickSet(int Set, int SetCluster);
|
||||
bool OnKrakenDefeated(const dd::Events::KrakenDefeated &event);
|
||||
|
||||
void GetNextLevel();
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
#include "Game/EGameOver.h"
|
||||
#include "Game/EKrakenAttackEnd.h"
|
||||
|
||||
#include "Rendering/CAnimation.h"
|
||||
#include "Physics/CParticleEmitter.h"
|
||||
#include "Physics/ECreateParticleSequence.h"
|
||||
|
||||
|
||||
namespace dd
|
||||
{
|
||||
@@ -54,6 +58,7 @@ private:
|
||||
bool m_Pause = false;
|
||||
int m_Lives = 3;
|
||||
int m_PastLives = 3;
|
||||
float m_LifeSpeed = 0.8;
|
||||
|
||||
bool m_GodMode = false;
|
||||
|
||||
|
||||
@@ -72,29 +72,12 @@ public:
|
||||
void Update(double dt) override;
|
||||
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
|
||||
|
||||
EntityID& Entity() { return m_Entity; }
|
||||
void SetEntity(const EntityID& ent) { m_Entity = ent; }
|
||||
glm::vec3 Acceleration() const { return m_Acceleration; }
|
||||
void SetAcceleration(const glm::vec3& acceleration) { m_Acceleration = acceleration; }
|
||||
|
||||
bool Left() const { return m_Left; }
|
||||
void SetLeft(const bool& left) { m_Left = left; }
|
||||
bool Right() const { return m_Right; }
|
||||
void SetRight(const bool& right) { m_Right = right; }
|
||||
float Edge() const { return m_Edge; }
|
||||
void SetEdge(const float& edge) { m_Edge = edge; }
|
||||
|
||||
Components::Transform* Transform() const { return m_Transform; }
|
||||
void SetTransform(Components::Transform* transform) { m_Transform = transform; }
|
||||
Components::Pad* Pad() const { return m_Pad; }
|
||||
void SetPad(Components::Pad* pad) { m_Pad = pad; }
|
||||
|
||||
bool IsPaused() const { return m_Pause; }
|
||||
void SetPause(const bool& pause) { m_Pause = pause; }
|
||||
|
||||
private:
|
||||
EntityID m_Entity = 0;
|
||||
glm::vec3 m_Acceleration = glm::vec3(0.f, 0.f, 0.f);
|
||||
EntityID m_PadEntity = 0;
|
||||
glm::vec3 m_PadAcceleration = glm::vec3(0.f, 0.f, 0.f);
|
||||
bool m_Left = false;
|
||||
bool m_Right = false;
|
||||
bool m_ReplaceBall = false;
|
||||
@@ -107,11 +90,11 @@ private:
|
||||
float m_Edge = 2.8f;
|
||||
float m_PadOriginalHeight = -4.8;
|
||||
float m_PadHeight = m_PadOriginalHeight;
|
||||
EntityID m_KrakenArm = NULL;
|
||||
EntityID m_KrakenArmHitbox = NULL;
|
||||
EntityID m_KrakenArm = 0;
|
||||
EntityID m_KrakenArmHitbox = 0;
|
||||
float m_PadRiseSpeed = 0.2;
|
||||
Components::Transform* m_Transform = nullptr;
|
||||
Components::Pad* m_Pad = nullptr;
|
||||
Components::Transform* m_PadTransform = nullptr;
|
||||
Components::Pad* m_PadComponent = nullptr;
|
||||
std::shared_ptr<Components::Transform> m_StickTransform;
|
||||
std::shared_ptr<Components::StickyAim> m_StickyAim;
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#ifndef DAYDREAM_PROJECTILESYSTEM_H
|
||||
#define DAYDREAM_PROJECTILESYSTEM_H
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "Core/System.h"
|
||||
#include "Core/CTransform.h"
|
||||
#include "Core/CTemplate.h"
|
||||
@@ -26,8 +30,6 @@
|
||||
#include "Game/CProjectile.h"
|
||||
#include "Game/CBall.h"
|
||||
#include "Rendering/CSprite.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include "Rendering/CAnimation.h"
|
||||
|
||||
namespace dd
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Core/CTemplate.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Core/World.h"
|
||||
#include "Rendering/CCamera.h"
|
||||
#include "Game/EPause.h"
|
||||
#include "Game/EResume.h"
|
||||
#include "Game/EScreenShake.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ struct ParticleEmitter : public Component
|
||||
float Speed = 2.f;
|
||||
double LifeTime = 100;
|
||||
float RadiusDistribution = 0;
|
||||
|
||||
bool DefaultScale = false;
|
||||
//values to interpolate between.
|
||||
std::vector<glm::vec3> ScaleValues;
|
||||
std::vector<float> AlphaValues;
|
||||
|
||||
@@ -26,6 +26,7 @@ struct CreateParticleSequence : public Event
|
||||
glm::vec4 Color = glm::vec4(0);
|
||||
EntityID parent = 0;
|
||||
// values to interpolate between.
|
||||
bool DefaultScale = false;
|
||||
std::vector<glm::vec3> ScaleValues;
|
||||
std::vector<float> AlphaValues;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "Core/CTemplate.h"
|
||||
#include "Core/CTransform.h"
|
||||
#include "Core/CTemplate.h"
|
||||
#include "Rendering/Texture.h"
|
||||
|
||||
#include "Physics/EContact.h"
|
||||
#include "Physics/ESetImpulse.h"
|
||||
|
||||
@@ -37,8 +37,8 @@ public:
|
||||
void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
|
||||
bool VSYNC() const { return m_VSYNC; }
|
||||
void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
|
||||
const dd::Camera* Camera() const { return m_Camera; }
|
||||
void SetCamera(const dd::Camera* camera)
|
||||
dd::Camera* Camera() const { return m_Camera; }
|
||||
void SetCamera(dd::Camera* camera)
|
||||
{
|
||||
if (camera == nullptr) {
|
||||
m_Camera = m_DefaultCamera.get();
|
||||
@@ -55,7 +55,7 @@ protected:
|
||||
bool m_Fullscreen = false;
|
||||
bool m_VSYNC = false;
|
||||
std::unique_ptr<dd::Camera> m_DefaultCamera = nullptr;
|
||||
const dd::Camera* m_Camera = nullptr;
|
||||
dd::Camera* m_Camera = nullptr;
|
||||
GLFWwindow* m_Window = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,14 +30,9 @@ namespace Components
|
||||
|
||||
struct Camera : Component
|
||||
{
|
||||
Camera()
|
||||
: FOV(glm::radians(45.f))
|
||||
, NearClip(0.1f)
|
||||
, FarClip(100.f) { }
|
||||
|
||||
float FOV;
|
||||
float NearClip;
|
||||
float FarClip;
|
||||
float FOV = glm::radians(45.f);
|
||||
float NearClip = 0.01f;
|
||||
float FarClip = 100.f;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ class Renderer : public BaseRenderer
|
||||
public:
|
||||
void Initialize() override;
|
||||
void Draw(RenderQueueCollection& rq) override;
|
||||
void PlaceCamera(glm::vec3 position);
|
||||
|
||||
private:
|
||||
int m_GLVersion[2];
|
||||
@@ -97,12 +96,6 @@ private:
|
||||
void DrawWater(RenderQueue &objects);
|
||||
void DrawGUI(RenderQueue& rq);
|
||||
void DebugKeys();
|
||||
|
||||
dd::EventRelay<Renderer, dd::Events::ScreenShake> m_EScreenShake;
|
||||
bool OnScreenShake(dd::Events::ScreenShake &event);
|
||||
bool m_ScreenShake = false;
|
||||
float m_ShakeIntensity = 0;
|
||||
float m_ShakeTimer = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Physics/ECreateParticleSequence.h"
|
||||
#include "Physics/EContact.h"
|
||||
#include "Game/EGameStart.h"
|
||||
#include "Game/EKrakenAppear.h"
|
||||
|
||||
|
||||
namespace dd
|
||||
@@ -42,6 +43,7 @@ private:
|
||||
const std::string GAME_BGM = "Sounds/BGM/under-the-sea-n.wav";
|
||||
const std::string WATER_BGM = "Sounds/BGM/water-flowing.wav";
|
||||
const std::string STORY_VOICE = "Sounds/jap-story.wav";
|
||||
const std::string BOSS_BGM = "Sounds/BGM/boss-fight.wav";
|
||||
|
||||
float m_BGMMasterVolume = 1.f;
|
||||
float m_SFXMasterVolume = 1.f;
|
||||
@@ -62,6 +64,8 @@ private:
|
||||
bool OnMasterVolume(const dd::Events::MasterVolume &event);
|
||||
dd::EventRelay<SoundSystem, dd::Events::GameStart> m_EGameStart;
|
||||
bool OnGameStart(const dd::Events::GameStart &event);
|
||||
dd::EventRelay <SoundSystem, dd::Events::KrakenAppear> m_EKrakenAppear;
|
||||
bool OnKrakenAppear(const dd::Events::KrakenAppear &event);
|
||||
|
||||
|
||||
ALuint CreateSource();
|
||||
|
||||
Reference in New Issue
Block a user