diff --git a/assets/DefaultConfig.ini b/assets/DefaultConfig.ini index 8f13964..79304b5 100755 --- a/assets/DefaultConfig.ini +++ b/assets/DefaultConfig.ini @@ -9,4 +9,4 @@ BGMVolume=0.5 [Video] Fullscreen=false Width=675 -Height=1080[Water]Radius=0.3 \ No newline at end of file +Height=1080[Water]Radius=0.3[Cheat]GodMode=false \ No newline at end of file diff --git a/include/Game/BallSystem.h b/include/Game/BallSystem.h index 32a158d..235c882 100644 --- a/include/Game/BallSystem.h +++ b/include/Game/BallSystem.h @@ -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" @@ -109,6 +111,7 @@ private: bool m_InkBlockedWaiting = false; bool m_Restarting = false; int m_StickyCounter = 3; + bool m_GodMode = false; bool m_StageBlockedWaiting = false; diff --git a/include/Game/LevelSystem.h b/include/Game/LevelSystem.h index 691230e..83b3fd1 100755 --- a/include/Game/LevelSystem.h +++ b/include/Game/LevelSystem.h @@ -14,6 +14,8 @@ #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" @@ -148,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; diff --git a/src/game/Game/BallSystem.cpp b/src/game/Game/BallSystem.cpp index 04fecfb..ad75c92 100644 --- a/src/game/Game/BallSystem.cpp +++ b/src/game/Game/BallSystem.cpp @@ -64,6 +64,8 @@ void dd::Systems::BallSystem::Initialize() for (int i = 0; i < Lives(); i++) { CreateLife(i); } + + m_GodMode = ResourceManager::Load("Config.ini")->GetValue("Cheat.GodMode", false); } void dd::Systems::BallSystem::Update(double dt) @@ -445,8 +447,9 @@ void dd::Systems::BallSystem::CreateLife(int number) bool dd::Systems::BallSystem::OnLifeLost(const dd::Events::LifeLost &event) { - SetLives(Lives() - 1); - + if (!m_GodMode){ + SetLives(Lives() - 1); + } return true; } diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index d3051e4..b602417 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -23,6 +23,8 @@ void dd::Systems::LevelSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad); EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &LevelSystem::OnBrickGenerating); + m_GodMode = ResourceManager::Load("Config.ini")->GetValue("Cheat.GodMode", false); + //PointLightTest { auto t_Light = m_World->CreateEntity(); @@ -144,7 +146,11 @@ void dd::Systems::LevelSystem::Initialize() std::shared_ptr physics = m_World->AddComponent(BottomWall); physics->CollisionType = CollisionType::Type::Static; physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::LifeBuoy); + if (m_GodMode) { + physics->Mask = static_cast(CollisionLayer::LifeBuoy | CollisionLayer::Ball); + } else { + physics->Mask = static_cast(CollisionLayer::LifeBuoy); + } m_World->CommitEntity(BottomWall); }