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

This commit is contained in:
Stiffly
2015-10-22 16:27:42 +02:00
46 changed files with 25342 additions and 2084 deletions
+10 -10
View File
@@ -1,6 +1,8 @@
#ifndef DAYDREAM_BALLSYSTEM_H
#define DAYDREAM_BALLSYSTEM_H
#include <random>
#include "Core/System.h"
#include "Core/World.h"
#include "Core/EventBroker.h"
@@ -8,14 +10,17 @@
#include "Core/CTemplate.h"
#include "Core/ResourceManager.h"
#include "Core/ConfigFile.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
#include "Physics/EContact.h"
#include "Rendering/CModel.h"
#include "Rendering/CSprite.h"
#include "Rendering/CPointLight.h"
#include "Rendering/CAnimation.h"
#include "Game/CBall.h"
#include "Game/CPowerUp.h"
#include "Game/CLife.h"
@@ -41,6 +46,7 @@
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
#include "Game/ELifebuoyHit.h"
#include "Physics/ECreateParticleSequence.h"
#include "Sound/CCollisionSound.h"
@@ -77,7 +83,6 @@ public:
void OnEntityRemoved(EntityID entity) override;
EntityID CreateBall();
void CreateLife(int);
EntityID Ball() { return m_Ball; };
void SetBall(const EntityID& ball) { m_Ball = ball; }
@@ -89,22 +94,18 @@ public:
void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; }
int& MultiBalls() { return m_MultiBalls; }
void SetMultiBalls(const int& multiBalls) { m_MultiBalls = multiBalls; }
int& Lives() { return m_Lives; }
void SetLives(const int& lives) { m_Lives = lives; }
int& PastLives() { return m_PastLives; }
void SetPastLives(const int& pastLives) { m_PastLives = pastLives; }
bool ReplaceBall() const { return m_ReplaceBall; }
void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; }
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
std::mt19937 m_RandomGenerator;
float m_XMovementMultiplier = 2.f;
float m_EdgeX = 3.4f; //Actually 3.2, but anyways.
float m_EdgeY = 5.2f;
int m_MultiBalls = 0;
int m_Lives = 3;
int m_PastLives = 3;
bool m_ReplaceBall = false;
bool m_Pause = false;
bool m_Waiting = true;
@@ -116,7 +117,8 @@ private:
double m_KrakenCharge = 0;
bool m_Restarting = false;
int m_StickyCounter = 3;
bool m_GodMode = false;
bool m_First = true;
bool m_StageBlockedWaiting = false;
@@ -128,7 +130,6 @@ private:
std::unordered_map<EntityID, std::list<glm::vec2>> m_Contacts;
void ResolveContacts();
dd::EventRelay<BallSystem, dd::Events::LifeLost> m_ELifeLost;
dd::EventRelay<BallSystem, dd::Events::MultiBallLost> m_EMultiBallLost;
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
@@ -145,7 +146,6 @@ private:
dd::EventRelay<BallSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
bool Contact(const Events::Contact &event);
bool OnLifeLost(const dd::Events::LifeLost &event);
bool OnMultiBallLost(const dd::Events::MultiBallLost &event);
bool OnResetBall(const dd::Events::ResetBall &event);
bool OnMultiBall(const dd::Events::MultiBall &event);
+3 -1
View File
@@ -23,7 +23,9 @@ struct Ball : Component
bool InkBlaster = false;
bool Sticky = false;
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
glm::vec3 SavedSpeed = glm::vec3(0, 0, 0);
glm::vec3 SavedSpeed = glm::vec3(0, 1, 0);
int PosterBoy = 0;
};
}
+2
View File
@@ -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;
+2 -1
View File
@@ -15,7 +15,8 @@ namespace Components
struct BrickPart : Component
{
bool Submerged = false;
int NumberOfPartsInBrick;
};
}
+4 -3
View File
@@ -13,10 +13,11 @@ namespace dd
namespace Components
{
struct Life : Component {
struct Life : Component
{
int Number = 0;
float SinusAltitude = 1;
bool Left = false;
};
}
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-22.
//
#ifndef CNEWWATERVOLUME_H
#define CNEWWATERVOLUME_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct NewWaterVolume : public Component
{
};
}
}
#endif //DAYDREAM_NEWWATERVOLUME_H
+6 -10
View File
@@ -5,7 +5,6 @@
#include "GUI/Slider.h"
#include "Core/ResourceManager.h"
#include "Game/GUI/ELoadingFrameComplete.h"
#include "Sound/EPlaySound.h"
namespace dd
{
@@ -29,9 +28,9 @@ public:
m_Slider->X = Width / 2.f - m_Slider->Width / 2.f;
}
void AddTexturePreload(std::string resourceName)
void AddResource(std::string resourceType, std::string resourceName)
{
m_Items.push_back(resourceName);
m_Preload.push_back(std::make_pair(resourceType, resourceName));
}
void Preload()
@@ -48,18 +47,15 @@ public:
void Update(double dt) override
{
if (m_Preloading) {
ResourceManager::Preload<dd::Texture>(m_Items[m_CurrentItem]);
m_Slider->SetPercentage((m_CurrentItem + 1) / (float)m_Items.size());
ResourceManager::Preload(m_Preload[m_CurrentItem].first, m_Preload[m_CurrentItem].second);
m_Slider->SetPercentage((m_CurrentItem + 1) / (float)m_Preload.size());
m_CurrentItem++;
if (m_CurrentItem >= m_Items.size()) {
if (m_CurrentItem >= m_Preload.size()) {
m_Preloading = false;
dd::Events::LoadingFrameComplete e;
e.FrameName = Name();
e.Frame = this;
EventBroker->Publish(e);
Events::PlaySound se;
se.FilePath = "Sounds/jap-story.wav";
EventBroker->Publish(se);
}
}
}
@@ -67,7 +63,7 @@ public:
private:
bool m_Preloading = false;
int m_CurrentItem = 0;
std::vector<std::string> m_Items;
std::vector<std::pair<std::string, std::string>> m_Preload;
GUI::Slider* m_Slider = nullptr;
};
+14
View File
@@ -2,9 +2,11 @@
#define GUI_MAINMENU_H__
#include "GUI/TextureFrame.h"
#include "Game/GUI/LoadingFrame.h"
#include "Game/GUI/MainMenuMain.h"
#include "Game/GUI/MainMenuOptions.h"
#include "Core/EKeyUp.h"
#include "Game/EGameStart.h"
namespace dd
{
@@ -37,6 +39,18 @@ public:
//EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &MainMenu::OnKeyUp);
}
void Show() override
{
if (ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Debug.SkipMenu", false)) {
Events::GameStart e;
EventBroker->Publish(e);
Hide();
auto hud = new GUI::HUD(BaseFrame, "HUD");
} else {
TextureFrame::Show();
}
}
private:
TextureFrame* m_LeftBanner;
MainMenuMain* m_MainMenuMain;
+1
View File
@@ -58,6 +58,7 @@ private:
if (event.Button == m_SquidoutButton) {
m_Parent->Hide();
auto story = new GUI::Story1(BaseFrame, "Story1");
story->Play();
}
return true;
+13 -43
View File
@@ -3,11 +3,11 @@
#include "Core/ResourceManager.h"
#include "Game/GUI/StoryboardFrame.h"
#include "Game/GUI/ELoadingFrameComplete.h"
#include "Game/GUI/LoadingFrame.h"
#include "Game/EGameStart.h"
#include "Core/EKeyDown.h"
#include "Game/GUI/HUD.h"
#include "Sound/EPlaySound.h"
#include "Sound/EStopSound.h"
namespace dd
{
@@ -20,37 +20,8 @@ public:
Story1(Frame* parent, std::string name)
: StoryboardFrame(parent, name)
{
EVENT_SUBSCRIBE_MEMBER(m_ELoadingFrameComplete, &Story1::OnLoadingFrameComplete);
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &Story1::OnKeyDown);
m_LoadingFrame = new GUI::LoadingFrame(this, "Story1LoadingFrame");
m_LoadingFrame->SetTexture("Textures/GUI/Loading.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn1.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn2.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn3.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn4.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn5.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene1.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene2.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene3.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene4.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene5.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene6.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene7.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene8.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene9.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene10.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene11.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene12.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene13.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene14.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene15.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene16.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene17.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene18.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene19.png");
m_LoadingFrame->Preload();
m_Spacebar = new TextureFrame(this, "ZZZSpacebar");
m_Spacebar->SetTexture("Textures/GUI/SpacebarSkip.png");
m_Spacebar->SetRight(Right() - 10);
@@ -196,6 +167,14 @@ public:
AddTransition(t);
}
virtual void Play() override
{
StoryboardFrame::Play();
Events::PlaySound se;
se.FilePath = "Sounds/jap-story.wav";
EventBroker->Publish(se);
}
void Update(double dt) override
{
StoryboardFrame::Update(dt);
@@ -209,7 +188,6 @@ public:
}
private:
GUI::LoadingFrame* m_LoadingFrame = nullptr;
TextureFrame* m_Spacebar = nullptr;
EventRelay<Frame, Events::KeyDown> m_EKeyDown;
@@ -220,25 +198,17 @@ private:
}
if (event.KeyCode == GLFW_KEY_SPACE) {
m_LoadingFrame->CancelPreload();
Events::GameStart e;
EventBroker->Publish(e);
Events::StopSound se;
se.FilePath = "Sounds/jap-story.wav";
EventBroker->Publish(se);
Hide();
auto hud = new GUI::HUD(BaseFrame, "HUD");
}
return true;
}
EventRelay<Frame, Events::LoadingFrameComplete> m_ELoadingFrameComplete;
bool OnLoadingFrameComplete(const Events::LoadingFrameComplete& event)
{
if (event.FrameName == "Story1LoadingFrame") {
event.Frame->Hide();
m_Spacebar->Hide();
Play();
}
return true;
}
};
}
+2 -2
View File
@@ -33,12 +33,12 @@ public:
m_Timeline.push_back(transition);
}
void Play()
virtual void Play()
{
m_Playing = true;
}
void Skip()
virtual void Skip()
{
m_Playing = false;
OnComplete();
+2
View File
@@ -33,6 +33,8 @@
#include "Game/CBall.h"
#include "Game/CProjectile.h"
#include "Sound/CCollisionSound.h"
#include "Rendering/CAnimation.h"
#include "Rendering/CSprite.h"
//#include "Core/Camera.h" Camera Component
+1 -1
View File
@@ -212,7 +212,7 @@ private:
void GetNextLevel();
void SetBrokenModel(EntityID entity);
void CreateBrokenModelPart(EntityID Parent, std::string ModelPath, glm::vec3 RelativePosition, glm::vec2 Hitbox);
void CreateBrokenModelPart(EntityID Parent, std::string ModelPath, glm::vec3 RelativePosition, glm::vec2 Hitbox, int NumberOfParts);
};
}
+78
View File
@@ -0,0 +1,78 @@
//
// Created by Adniklastrator on 2015-10-22.
//
#ifndef DAYDREAM_LIFESYSTEM_H
#define DAYDREAM_LIFESYSTEM_H
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Core/ConfigFile.h"
#include "Transform/EMove.h"
#include "Rendering/CModel.h"
#include "Game/CLife.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/ELifeLost.h"
#include "Game/EGameOver.h"
#include "Game/EKrakenAttackEnd.h"
#include "Rendering/CAnimation.h"
namespace dd
{
namespace Systems
{
class LifeSystem : public System
{
public:
LifeSystem(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; }
int& Lives() { return m_Lives; }
void SetLives(const int& lives) { m_Lives = lives; }
int& PastLives() { return m_PastLives; }
void SetPastLives(const int& pastLives) { m_PastLives = pastLives; }
private:
bool m_Pause = false;
int m_Lives = 3;
int m_PastLives = 3;
float m_LifeSpeed = 0.8;
bool m_GodMode = false;
void CreateLife(int);
dd::EventRelay<LifeSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LifeSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<LifeSystem, dd::Events::LifeLost> m_ELifeLost;
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnLifeLost(const dd::Events::LifeLost &event);
};
}
}
#endif //DAYDREAM_LIFESYSTEM_H
+5 -1
View File
@@ -105,7 +105,11 @@ private:
double m_KrakenStrength = 0;
double m_PlayerStrength = 0;
float m_Edge = 2.8f;
EntityID m_KrakenArm;
float m_PadOriginalHeight = -4.8;
float m_PadHeight = m_PadOriginalHeight;
EntityID m_KrakenArm = NULL;
EntityID m_KrakenArmHitbox = NULL;
float m_PadRiseSpeed = 0.2;
Components::Transform* m_Transform = nullptr;
Components::Pad* m_Pad = nullptr;
std::shared_ptr<Components::Transform> m_StickTransform;
+1
View File
@@ -18,6 +18,7 @@
#include "Game/EStageCleared.h"
#include "Game/CTravels.h"
#include "Game/CBackground.h"
#include "Game/CNewWaterVolume.h"
namespace dd
+11
View File
@@ -11,9 +11,13 @@
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Core/ConfigFile.h"
#include "Transform/EMove.h"
#include "Physics/CPhysics.h"
#include "Physics/CWaterVolume.h"
#include "Physics/CRectangleShape.h"
#include "Game/CBrickPart.h"
#include "Game/CNewWaterVolume.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/ERelevantObjectCreated.h"
@@ -47,6 +51,13 @@ public:
private:
bool m_Pause = false;
EntityID m_BottomWall = 0;
float m_SubmergedOriginalHeight = -4.5;
float m_SubmergedHeight = m_SubmergedOriginalHeight;
bool m_RaiseWater = false;
bool m_RemoveWater = false;
std::array<int, 10> m_BrickPartCounters;
dd::EventRelay<WaterSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<WaterSystem, dd::Events::Resume> m_EResume;