Added a cheatmode setting in config

This commit is contained in:
tleety
2015-10-19 15:56:26 +02:00
parent 36947611d3
commit 7b428f2b54
5 changed files with 19 additions and 4 deletions
+1 -1
View File
@@ -9,4 +9,4 @@ BGMVolume=0.5
[Video]
Fullscreen=false
Width=675
Height=1080[Water]Radius=0.3
Height=1080[Water]Radius=0.3[Cheat]GodMode=false
+3
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"
@@ -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;
+3
View File
@@ -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;
+5 -2
View File
@@ -64,6 +64,8 @@ void dd::Systems::BallSystem::Initialize()
for (int i = 0; i < Lives(); i++) {
CreateLife(i);
}
m_GodMode = ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("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;
}
+7 -1
View File
@@ -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<ConfigFile>("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<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);
if (m_GodMode) {
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::LifeBuoy | CollisionLayer::Ball);
} else {
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::LifeBuoy);
}
m_World->CommitEntity(BottomWall);
}