From 97f96883038d74cca7250ed468c49479eff9f7bc Mon Sep 17 00:00:00 2001 From: Stiffly Date: Tue, 29 Sep 2015 13:41:50 +0200 Subject: [PATCH 01/13] deleted .orig --- src/game/Game/LevelSystem.cpp.orig | 372 ---------------------------- src/game/Game/PadSystem.cpp.orig | 313 ----------------------- src/game/Sound/SoundSystem.cpp.orig | 183 -------------- 3 files changed, 868 deletions(-) delete mode 100644 src/game/Game/LevelSystem.cpp.orig delete mode 100755 src/game/Game/PadSystem.cpp.orig delete mode 100644 src/game/Sound/SoundSystem.cpp.orig diff --git a/src/game/Game/LevelSystem.cpp.orig b/src/game/Game/LevelSystem.cpp.orig deleted file mode 100644 index b1d1139..0000000 --- a/src/game/Game/LevelSystem.cpp.orig +++ /dev/null @@ -1,372 +0,0 @@ -// -// Created by Adniklastrator on 2015-09-09. -// - - -#include "PrecompiledHeader.h" -#include "Game/LevelSystem.h" - - -void dd::Systems::LevelSystem::Initialize() -{ - EVENT_SUBSCRIBE_MEMBER(m_EContact, LevelSystem::OnContact); - EVENT_SUBSCRIBE_MEMBER(m_ELifeLost, LevelSystem::OnLifeLost); - EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, LevelSystem::OnScoreEvent); - EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, LevelSystem::OnMultiBall); - EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, LevelSystem::OnCreatePowerUp); - EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, LevelSystem::OnPowerUpTaken); - EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, LevelSystem::OnStageCleared); - - for (int i = 0; i < Lives(); i++) { - CreateLife(i); - } - - return; -} - -void dd::Systems::LevelSystem::CreateLife(int number) -{ - auto life = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent(life); - transform->Position = glm::vec3(-1.5f + number * 0.15f, -2.f, -5.f); - transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f); - - std::shared_ptr lifeNr = m_World->AddComponent(life); - lifeNr->Number = number; - - auto model = m_World->AddComponent(life); - model->ModelFile = "Models/Test/Ball/Ballopus.obj"; - - - m_World->CommitEntity(life); -} - -void dd::Systems::LevelSystem::Update(double dt) -{ - if (!m_Initialized) { - CreateBasicLevel(Rows(), Lines(), SpaceBetweenBricks(), SpaceToEdge()); - m_Initialized = true; - } - - if (Lives() < 0) - { - SetLives(3); - Events::GameOver e; - EventBroker->Publish(e); - } -} - -void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) -{ - auto ball = m_World->GetComponent(entity); - - if (ball != nullptr) { - auto transformBall = m_World->GetComponent(entity); - if (glm::abs(transformBall->Velocity.y) < 2) { - if (transformBall->Velocity.y > 0) { - transformBall->Velocity.y = 2; - } else { - transformBall->Velocity.y = -2; - } - } - if (transformBall->Position.y < -EdgeY() - 4) { - if (MultiBalls() != 0) { - SetMultiBalls(MultiBalls() - 1); -// m_World->RemoveComponent(entity); -// m_World->RemoveComponent(entity); -// m_World->RemoveComponent(entity); -// m_World->RemoveComponent(entity); - m_World->RemoveEntity(entity); - } else if (Lives() == PastLives()) { - Events::ResetBall be; - EventBroker->Publish(be); - Events::LifeLost e; - e.Entity = entity; - EventBroker->Publish(e); - return; - } - } else if (transformBall->Position.x > EdgeX()) { - if (transformBall->Velocity.x > 0) { - glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(1, 0)); - transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); - } - } else if (transformBall->Position.x < -EdgeX()) { - if (transformBall->Velocity.x < 0) { - glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(-1, 0)); - transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); - } - } else if (transformBall->Position.y > EdgeY()) { - if (transformBall->Velocity.y > 0) { - glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(0, 1)); - transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); - } - } - } - - if (Lives() != PastLives()) { - auto life = m_World->GetComponent(entity); - if (life != nullptr) { - if (life->Number + 1 == PastLives()) { -// m_World->RemoveComponent(entity); -// m_World->RemoveComponent(entity); - m_World->RemoveEntity(entity); - SetPastLives(Lives()); - } - } - } - if (NumberOfBricks() <= 0) { - /*SetRestarting(true); - if (MultiBalls() <= 0 && PowerUps() <= 0) { - Events::ResetBall e; - EventBroker->Publish(e); - Events::ScoreEvent es; - es.Score = 500; - EventBroker->Publish(es); - Events::StageCleared ec; - EventBroker->Publish(ec); - CreateBasicLevel(Rows(), Lines(), SpaceBetweenBricks(), SpaceToEdge()); - } else { - if (ball != nullptr && MultiBalls() > 0) { - SetMultiBalls(MultiBalls() - 1); - m_World->RemoveComponent(entity); - m_World->RemoveComponent(entity); - m_World->RemoveComponent(entity); - m_World->RemoveComponent(entity); - m_World->RemoveEntity(entity); - auto transformBall = m_World->GetComponent(entity); - } else { - auto powerUp = m_World->GetComponent(entity); - if (powerUp != nullptr) { - SetPowerUps(PowerUps() - 1); - m_World->RemoveComponent(entity); - m_World->RemoveComponent(entity); - m_World->RemoveEntity(entity); - } - } - }*/ - } -} - -void dd::Systems::LevelSystem::CreateBasicLevel(int rows, int lines, glm::vec2 spacesBetweenBricks, float spaceToEdge) -{ - SetNumberOfBricks(rows * lines); - std::cout << "You're only doing this once, right?" << std::endl; - int num = 0; - for (int i = 0; i < rows; i++) { - num++; - for (int j = 0; j < Lines(); j++) { - CreateBrick(i, j, spacesBetweenBricks, spaceToEdge, num); - } - if (num == 7) - num = 0; - } - - SetNumberOfBricks(rows * lines); - SetRestarting(false); - return; -} - -void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBetweenBricks, float spaceToEdge, int num) -{ - auto brick = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent(brick); - auto model = m_World->AddComponent(brick); - std::shared_ptr cBrick = m_World->AddComponent(brick); - std::shared_ptr cRec = m_World->AddComponent(brick); - std::shared_ptr cPhys = m_World->AddComponent(brick); - cPhys->Static = false; - cPhys->GravityScale = 0.f; - cPhys->Category = CollisionLayer::Type::Brick; - cPhys->Mask = CollisionLayer::Type::Ball; - - std::string fileName = "Textures/Bricks/"; - fileName.append(std::to_string(num)); - fileName.append(".png"); - //sprite->SpriteFile = fileName; - model->ModelFile = "Models/Test/Brick/Brick.obj"; - if ((line == 1 && row == 4) || (line == 3 && row == 2) || (line == 6 && row == 6)) { - std::shared_ptr cPow = m_World->AddComponent(brick); - } - float x = line * spacesBetweenBricks.x; - float y = row * spacesBetweenBricks.y; - transform->Scale = glm::vec3(0.8, 0.2, 0.2); - transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y , -10.f); - cBrick->Score = 10 * num; - - //sound - auto collisionSound = m_World->AddComponent(brick); - collisionSound->filePath = "Sounds/Brick/shortbrickbreak.wav"; - - m_World->CommitEntity(brick); - return; -} - -void dd::Systems::LevelSystem::ProcessCollision() -{ - // Like, go into brick component and check what it does upon collision. Maybe not done here? - return; -} - -void dd::Systems::LevelSystem::OnEntityRemoved(EntityID entity) -{ - auto brick = m_World->GetComponent(entity); - if (brick != nullptr) { - SetNumberOfBricks(NumberOfBricks() - 1); - Events::ScoreEvent es; - es.Score = brick->Score; - EventBroker->Publish(es); - /*if (numberOfBricks < 1) { - EndLevel(); - }*/ - } - return; -} - -bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event) -{ - EntityID entityBrick; - EntityID entityBall; - auto ball = m_World->GetComponent(event.Entity2); - auto brick = m_World->GetComponent(event.Entity1); - if (brick != nullptr) { - entityBrick = event.Entity1; - } else { - brick = m_World->GetComponent(event.Entity2); - if (brick != nullptr) { - entityBrick = event.Entity2; - } else { - return false; - } - } - if (ball != nullptr) { - entityBall = event.Entity2; - } else { - ball = m_World->GetComponent(event.Entity1); - if (ball != nullptr) { - entityBall = event.Entity1; - } else { - return false; - } - } - - brick = m_World->GetComponent(entityBrick); - if (brick == nullptr) { - return false; - } - - auto power = m_World->GetComponent(entityBrick); - if (power != nullptr) { - Events::CreatePowerUp e; - auto transform = m_World->GetComponent(entityBrick); - e.Position = transform->Position; - EventBroker->Publish(e); - } - - if (ball != nullptr && Restarting() == false) { - auto ballTransform = m_World->GetComponent(entityBall); - -// m_World->RemoveComponent(entityBrick); -// m_World->RemoveComponent(entityBrick); -// m_World->RemoveComponent(entityBrick); -// m_World->RemoveComponent(entityBrick); -// m_World->RemoveEntity(entityBrick); - - auto physicsComponent = m_World->GetComponent(entityBrick); - physicsComponent->GravityScale = 1.f; - physicsComponent->Mask = CollisionLayer::Type::Water | CollisionLayer::Type::Wall; - - auto transformComponentBrick = m_World->GetComponent(entityBrick); - auto transformComponentBall = m_World->GetComponent(entityBall); - - Events::SetImpulse e; - e.Entity = entityBrick; - - glm::vec2 point = glm::vec2(transformComponentBrick->Position.x + ((transformComponentBrick->Position.x - transformComponentBall->Position.x)/4), transformComponentBrick->Position.y + ((transformComponentBrick->Position.y - transformComponentBall->Position.y )/4)); - - e.Impulse = glm::normalize(point)/2.f; - e.Point = point; - EventBroker->Publish(e); - //TODO: Bricks dont collide with walls D= - - SetNumberOfBricks(NumberOfBricks() - 1); - if (NumberOfBricks() <= 0) { - SetMultiBalls(MultiBalls() + 1); - } - Events::ScoreEvent es; - es.Score = brick->Score; - EventBroker->Publish(es); - -<<<<<<< HEAD - // std::cout << NumberOfBricks() << std::endl; -======= - //std::cout << NumberOfBricks() << std::endl; ->>>>>>> origin/master - //std::cout << "Score: " << Score() << std::endl; - } - - return true; -} - -bool dd::Systems::LevelSystem::OnLifeLost(const dd::Events::LifeLost &event) -{ - SetLives(Lives() - 1); - - return true; -} - -bool dd::Systems::LevelSystem::OnScoreEvent(const dd::Events::ScoreEvent &event) -{ - SetScore(Score() += event.Score); - - return true; -} - -bool dd::Systems::LevelSystem::OnMultiBall(const dd::Events::MultiBall &event) -{ - SetMultiBalls(MultiBalls()+2); -} - -bool dd::Systems::LevelSystem::OnCreatePowerUp(const dd::Events::CreatePowerUp &event) -{ - SetPowerUps(PowerUps() + 1); - auto powerUp = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent(powerUp); - auto model = m_World->AddComponent(powerUp); - std::shared_ptr cRec = m_World->AddComponent(powerUp); - std::shared_ptr cPhys = m_World->AddComponent(powerUp); - cPhys->Static = false; - cPhys->Category = CollisionLayer::Type::PowerUp; - cPhys->Mask = CollisionLayer::Type::Pad; - - std::shared_ptr cPow = m_World->AddComponent(powerUp); - - - transform->Position = event.Position; - transform->Scale = glm::vec3(0.2, 0.2, 0.2); - transform->Velocity = glm::vec3(0, -4, 0); - - model->ModelFile = "Models/Test/Ball/Ballopus.obj"; - - m_World->CommitEntity(powerUp); - - return true; -} - -bool dd::Systems::LevelSystem::OnPowerUpTaken(const dd::Events::PowerUpTaken &event) -{ - SetPowerUps(PowerUps() - 1); - return true; -} - -bool dd::Systems::LevelSystem::OnStageCleared(const dd::Events::StageCleared &event) -{ - return true; -} - -void dd::Systems::LevelSystem::EndLevel() -{ - Events::StageCleared e; - EventBroker->Publish(e); - return; -} - diff --git a/src/game/Game/PadSystem.cpp.orig b/src/game/Game/PadSystem.cpp.orig deleted file mode 100755 index 7d21606..0000000 --- a/src/game/Game/PadSystem.cpp.orig +++ /dev/null @@ -1,313 +0,0 @@ -// -// Created by Adniklastrator on 2015-09-10. -// - -#include "PrecompiledHeader.h" -#include "Game/PadSystem.h" -#include "Core/World.h" -#include -#include -#include - - -void dd::Systems::PadSystem::Initialize() -{ - Events::BindKey r; - r.KeyCode = GLFW_KEY_RIGHT; - r.Command = "right"; - EventBroker->Publish(r); - - Events::BindKey l; - l.KeyCode = GLFW_KEY_LEFT; - l.Command = "left"; - EventBroker->Publish(l); - - EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &PadSystem::OnKeyDown); - EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &PadSystem::OnKeyUp); - EVENT_SUBSCRIBE_MEMBER(m_EContact, &PadSystem::OnContact); - EVENT_SUBSCRIBE_MEMBER(m_EContactPowerUp, &PadSystem::OnContactPowerUp); - EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &PadSystem::OnResetBall); - EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &PadSystem::OnMultiBall); - EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &PadSystem::OnStageCleared); -} - -void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) -{ - auto ball = m_World->GetComponent(entity); - if (ball != nullptr) { - if (ReplaceBall() == true) { - SetReplaceBall(false); - - auto transform = m_World->GetComponent(entity); - transform->Position = glm::vec3(0.0f, 0.26f, -10.f); - transform->Velocity = glm::vec3(0.0f, -ball->Speed, 0.f); - } - } -} - -void dd::Systems::PadSystem::Update(double dt) -{ - if (Entity() == 0) { - for (auto it = m_World->GetEntities()->begin(); it != m_World->GetEntities()->end(); it++) { - if (m_World->GetProperty(it->first, "Name") == "Pad") { - SetEntity(it->first); - SetTransform(m_World->GetComponent(Entity())); - SetPad(m_World->GetComponent(Entity())); - break; - } - } - } - - auto transform = Transform(); - auto pad = Pad(); - auto acceleration = Acceleration(); - - if (transform->Velocity.x < -pad->MaxSpeed) { - transform->Velocity.x = -pad->MaxSpeed; - } - else if (transform->Velocity.x > pad->MaxSpeed) { - transform->Velocity.x = pad->MaxSpeed; - } - transform->Position += transform->Velocity * (float)dt; - transform->Velocity += acceleration * (float)dt; - transform->Velocity -= transform->Velocity * pad->SlowdownModifier * (float)dt; - - - if (Left()) { - acceleration.x = -pad->AccelerationSpeed; -<<<<<<< HEAD - } - else if (Right()) { -======= - } else if (Right()) { ->>>>>>> 72413dc0a93bd3a2f6ab9fa7e19bbc3b846232db - acceleration.x = pad->AccelerationSpeed; - } else { - acceleration.x = 0.f; - } - - SetTransform(transform); - SetPad(pad); - SetAcceleration(acceleration); - - if (MultiBall() == true) { - SetMultiBall(false); - - Events::MultiBall e; - e.padTransform = transform; - EventBroker->Publish(e); - } - - return; -} - -EntityID dd::Systems::PadSystem::CreateBall() -{ - auto ent = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent(ent); - transform->Position = glm::vec3(0.5f, 0.26f, -10.f); - transform->Scale = glm::vec3(0.5f, 0.5f, 0.5f); - auto model = m_World->AddComponent(ent); - model->ModelFile = "Models/Test/Ball/Ballopus.obj"; - //auto pointlight = m_World->AddComponent(ent); - std::shared_ptr circleShape = m_World->AddComponent(ent); - std::shared_ptr cball = m_World->AddComponent(ent); - std::shared_ptr physics = m_World->AddComponent(ent); - physics->Static = false; - - cball->Speed = 10; - - m_World->CommitEntity(ent); - - return ent; -} - -bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) -{ - int val = event.KeyCode; - if (val == GLFW_KEY_UP) { - //std::cout << "Up!" << std::endl; - } else if (val == GLFW_KEY_DOWN) { - //std::cout << "Down!" << std::endl; - } else if (val == GLFW_KEY_LEFT) { - //std::cout << "Left!" << std::endl; - //acceleration.x = -0.01f; - SetLeft(true); - } else if (val == GLFW_KEY_RIGHT) { - //std::cout << "Right!" << std::endl; - //acceleration.x = 0.01f; - SetRight(true); - } else if (val == GLFW_KEY_R) { - SetReplaceBall(true); - } else if (val == GLFW_KEY_M) { - SetMultiBall(true); - } else if (val == GLFW_KEY_D) { - return false; - } - return true; -} - -bool dd::Systems::PadSystem::OnKeyUp(const dd::Events::KeyUp &event) -{ - int val = event.KeyCode; - if (val == GLFW_KEY_UP) { - - } else if (val == GLFW_KEY_DOWN) { - - } else if (val == GLFW_KEY_LEFT) { - SetLeft(false); - } else if (val == GLFW_KEY_RIGHT) { - SetRight(false); - } - return true; -} - -bool dd::Systems::PadSystem::OnContact(const dd::Events::Contact &event) -{ - /* - EntityID entityBall = event.Entity2; - auto ball = m_World->GetComponent(entityBall); - if (ball == NULL) { - return false; - } - EntityID entityPad = event.Entity1; - auto pad = m_World->GetComponent(entityPad); - if (pad == NULL) { - return false; - } - auto transformBall = m_World->GetComponent(entityBall); - auto transformPad = m_World->GetComponent(entityPad); - - float movementMultiplier = 0.5f; - - //float movementX = (event.ContactPoint.x - transformPad->Position.x) * movementMultiplier; - //float movementY = glm::cos((abs(movementX) / (3.2f * movementMultiplier)) * 3.14159265359f / 2) * 2.f; - if (whatX > 0) { - movementX = movementMultiplier * whatX; - //std::cout << "Right!" << std::endl; - } else { - movementX = movementMultiplier * whatX; - //std::cout << "Left!" << std::endl; - } - - // std::cout << movementX << " " << movementY << std::endl; - - //float movementX = (event.ContactPoint.x - transformPad->Position.x) * movementMultiplier; -<<<<<<< HEAD - float movementY = glm::cos((abs(movementX) / ((1.6f) * movementMultiplier)) * 3.14159265359f / 2) + 1; -======= - float movementY = glm::cos((abs(movementX) / ((1.6f) * movementMultiplier)) * 3.14159265359f / 2)+ 0.2; ->>>>>>> 72413dc0a93bd3a2f6ab9fa7e19bbc3b846232db - - //std::cout << movementX << " " << movementY << std::endl; - - float len = glm::length(transformBall->Velocity); - //auto pointlight = m_World->AddComponent(ent); - - - transformBall->Velocity += glm::vec3(transformPad->Velocity.x, 0, 0); - transformBall->Velocity = glm::normalize(transformBall->Velocity) * len; - - - //transform->Velocity = glm::vec3(movementX, movementY, 0.f); - */ -} - -bool dd::Systems::PadSystem::OnContactPowerUp(const dd::Events::Contact &event) -{ - EntityID entityPower; - EntityID entityPad; - auto powerUp = m_World->GetComponent(event.Entity1); - auto pad = m_World->GetComponent(event.Entity2); - if (powerUp != nullptr) { - entityPower = event.Entity1; - } else { - powerUp = m_World->GetComponent(event.Entity2); - if (powerUp != nullptr) { - entityPower = event.Entity2; - } - } - if (pad != nullptr) { - entityPad = event.Entity2; - } else { - pad = m_World->GetComponent(event.Entity1); - if (pad != nullptr) { - entityPad = event.Entity1; - } - } - - if (entityPower == NULL || entityPad == NULL) { - return false; - } - - pad = m_World->GetComponent(entityPad); - if (pad == nullptr) { - return false; - } - - m_World->RemoveComponent(entityPower); - m_World->RemoveComponent(entityPower); - m_World->RemoveComponent(entityPower); - m_World->RemoveEntity(entityPower); - Events::PowerUpTaken ep; - ep.Name = "Something"; - EventBroker->Publish(ep); - - Events::MultiBall e; - auto transform = m_World->GetComponent(entityPad); - e.padTransform = transform; - EventBroker->Publish(e); - return true; -} - -bool dd::Systems::PadSystem::OnResetBall(const dd::Events::ResetBall &event) -{ - SetReplaceBall(true); - return true; -} - -bool dd::Systems::PadSystem::OnMultiBall(const dd::Events::MultiBall &event) -{ - auto ent1 = CreateBall(); - auto ent2 = CreateBall(); - auto transform1 = m_World->GetComponent(ent1); - auto transform2 = m_World->GetComponent(ent2); - auto ball1 = m_World->GetComponent(ent1); - auto ball2 = m_World->GetComponent(ent2); - auto padTransform = event.padTransform; - float x1 = padTransform->Position.x - 2, x2 = padTransform->Position.x + 2; - if (x1 < -3.1) { - x1 = 3; - } - if (x2 > 3.1) { - x2 = -3; - } - transform1->Position = glm::vec3(x1, -5.5, -10); - transform2->Position = glm::vec3(x2, -5.5, -10); - - transform1->Velocity = glm::normalize(glm::vec3(5, 5 ,0.f)) * ball1->Speed; - transform2->Velocity = glm::normalize(glm::vec3(-5, 5 ,0.f)) * ball2->Speed; - - return true; -} - -bool dd::Systems::PadSystem::OnStageCleared(const dd::Events::StageCleared &event) -{ - auto entity = CreateBall(); - return true; -} - -bool dd::Systems::PadSystem::PadSteeringInputController::OnCommand(const Events::InputCommand &event) -{ - std::string command = event.Command; - - std::cout << "Command!" << std::endl; - - if (command == "right") { - std::cout << "Right!" << std::endl; - } else if (command == "left") { - std::cout << "Left!" << std::endl; - } - - return true; -} \ No newline at end of file diff --git a/src/game/Sound/SoundSystem.cpp.orig b/src/game/Sound/SoundSystem.cpp.orig deleted file mode 100644 index bc7e9b3..0000000 --- a/src/game/Sound/SoundSystem.cpp.orig +++ /dev/null @@ -1,183 +0,0 @@ -#include "PrecompiledHeader.h" -#include "Sound/SoundSystem.h" - -dd::Systems::SoundSystem::~SoundSystem() -{ - alcCloseDevice(m_Device); -}; - -void dd::Systems::SoundSystem::Initialize() -{ - //initialize OpenAL - m_Device = alcOpenDevice(NULL); - ALCcontext* context; - - if (m_Device) { - context = alcCreateContext(m_Device, NULL); - alcMakeContextCurrent(context); - } - else { - LOG_ERROR("OpenAL failed to initialize."); - } - alGetError(); - - //Subscribe to events - EVENT_SUBSCRIBE_MEMBER(m_EContact, &SoundSystem::OnContact); - EVENT_SUBSCRIBE_MEMBER(m_EPlaySFX, &SoundSystem::OnPlaySound); - EVENT_SUBSCRIBE_MEMBER(m_EStopSound, &SoundSystem::OnStopSound); - EVENT_SUBSCRIBE_MEMBER(m_EMasterVolume, &SoundSystem::OnMasterVolume); - -<<<<<<< HEAD - //Todo: Move this - { - dd::Events::PlaySound e; - e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav"; - e.IsAmbient = true; - EventBroker->Publish(e); - } - { - dd::Events::PlaySound e; - e.FilePath = "Sounds/BGM/water-flowing.wav"; - e.Gain = 0.3f; - e.IsAmbient = true; - EventBroker->Publish(e); - } -======= - - ->>>>>>> origin/master -} - -void dd::Systems::SoundSystem::Update(double dt) -{ - //Clean up none-active sources - //Only used for SFX's. BGM's are handled on stop sound. - std::vector deleteList; - for (auto& item : m_SFXSourcesToBuffers) { - ALint sourceState; - alGetSourcei(item.first, AL_SOURCE_STATE, &sourceState); - if (sourceState == AL_STOPPED) { - deleteList.push_back(item.first); - } - } - - for (int i = 0; i < deleteList.size(); i++) { - alDeleteSources(1, &deleteList[i]); - //alDeleteBuffers(1, &m_SourcesToBuffers[deleteList[i]]); - m_SFXSourcesToBuffers.erase(deleteList[i]); - } -} - -ALuint dd::Systems::SoundSystem::CreateSource() -{ - ALuint source; - alGenSources((ALuint)1, &source); - - return source; -} - -bool dd::Systems::SoundSystem::OnPlaySound(const dd::Events::PlaySound &event) -{ - //Loading and binding sound buffer to source - Sound *sound = ResourceManager::Load(event.FilePath); - if (sound == nullptr) { - return false; - } - ALuint source = CreateSource(); - ALuint buffer = sound->Buffer(); - alSourcei(source, AL_BUFFER, buffer); - - //Sound settings - float relativeVolume = 1.f; - if (event.IsAmbient) { - alSourcei(source, AL_LOOPING, AL_TRUE); - relativeVolume = m_BGMMasterVolume; - m_BGMSourcesToBuffers[source] = sound; - - } - else if (!event.IsAmbient) - { - m_SFXSourcesToBuffers[source] = sound; - alSourcei(source, AL_LOOPING, AL_FALSE); - relativeVolume = m_SFXMasterVolume; - } - - alSourcef(source, AL_GAIN, (event.Gain * relativeVolume)); - alSourcef(source, AL_PITCH, event.Pitch); - - - //Play - alSourcePlay(source); - return true; -} - -bool dd::Systems::SoundSystem::OnStopSound(const dd::Events::StopSound &event) -{ - ALuint itemToDeleted; - for (auto& item : m_BGMSourcesToBuffers) - { - if (item.second->Path() == event.FilePath) { - itemToDeleted = item.first; - break; - } - } - alSourceStop(itemToDeleted); - alDeleteSources(1, &itemToDeleted); - m_BGMSourcesToBuffers.erase(itemToDeleted); - - //Should not happen because SFX's should be very short. - for (auto item : m_SFXSourcesToBuffers) - { - if (item.second->Path() == event.FilePath) { - alSourceStop(item.first); - return true; - } - } - return false; -} - -bool dd::Systems::SoundSystem::OnMasterVolume(const dd::Events::MasterVolume &event) -{ - //TODO: Make the Gain depend on the value given when stored. - //TODO: .. now it ONLY uses the master Gain - if (event.IsAmbient) { - m_BGMMasterVolume = event.Gain; - for (auto& item : m_BGMSourcesToBuffers) - { - alSourcef(item.first, AL_GAIN, event.Gain); - } - return true; - } - else if (!event.IsAmbient) { - m_SFXMasterVolume = event.Gain; - for (auto& item : m_SFXSourcesToBuffers) - { - alSourcef(item.first, AL_GAIN, event.Gain); - } - return true; - } - return false; -} - -bool dd::Systems::SoundSystem::OnContact(const dd::Events::Contact &event) -{ - //Check which entity has the collisionSound component. - auto collisionSound = m_World->GetComponent(event.Entity1); - if (collisionSound == nullptr) { - collisionSound = m_World->GetComponent(event.Entity2); - if (collisionSound == nullptr) { - //None of the entities had a collisionSound component. - return false; - } - } - - //Send play-sound event - dd::Events::PlaySound e; - e.FilePath = collisionSound->FilePath; - e.IsAmbient = false; - EventBroker->Publish(e); - return true; -} - - - From 55cc1f5b692b7f671460a1b59620a73efe584079 Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Wed, 14 Oct 2015 18:52:04 +0200 Subject: [PATCH 02/13] ScreenShakeSystem made. And some other things. --- include/Game/CBackground.h | 25 ++++++++ include/Game/CWall.h | 25 ++++++++ include/Game/ERaiseWater.h | 25 ++++++++ include/Game/EResetAll.h | 25 ++++++++ include/Game/ScreenShakeSystem.h | 65 ++++++++++++++++++++ src/game/Game/ScreenShakeSystem.cpp | 94 +++++++++++++++++++++++++++++ 6 files changed, 259 insertions(+) create mode 100644 include/Game/CBackground.h create mode 100644 include/Game/CWall.h create mode 100644 include/Game/ERaiseWater.h create mode 100644 include/Game/EResetAll.h create mode 100644 include/Game/ScreenShakeSystem.h create mode 100644 src/game/Game/ScreenShakeSystem.cpp diff --git a/include/Game/CBackground.h b/include/Game/CBackground.h new file mode 100644 index 0000000..a87f10a --- /dev/null +++ b/include/Game/CBackground.h @@ -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 +{ + +}; + +} + +} + +#endif //DAYDREAM_CBACKGROUND_H diff --git a/include/Game/CWall.h b/include/Game/CWall.h new file mode 100644 index 0000000..c7187c9 --- /dev/null +++ b/include/Game/CWall.h @@ -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 diff --git a/include/Game/ERaiseWater.h b/include/Game/ERaiseWater.h new file mode 100644 index 0000000..2697723 --- /dev/null +++ b/include/Game/ERaiseWater.h @@ -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 diff --git a/include/Game/EResetAll.h b/include/Game/EResetAll.h new file mode 100644 index 0000000..4f6dec7 --- /dev/null +++ b/include/Game/EResetAll.h @@ -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 diff --git a/include/Game/ScreenShakeSystem.h b/include/Game/ScreenShakeSystem.h new file mode 100644 index 0000000..52d3174 --- /dev/null +++ b/include/Game/ScreenShakeSystem.h @@ -0,0 +1,65 @@ +// +// Created by Adniklastrator on 2015-10-14. +// + +#ifndef DAYDREAM_SCREENSHAKESYSTEM_H +#define DAYDREAM_SCREENSHAKESYSTEM_H + + +#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/EScreenShake.h" +//#include "Core/Camera.h" Camera Component + + +namespace dd +{ + +namespace Systems +{ + +class ScreenShakeSystem : public System +{ +public: + ScreenShakeSystem(World* world, std::shared_ptr eventBroker) + : System(world, eventBroker) + { } + + void Initialize() override; + void InitializeObjects() override; + + 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: + 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 m_EPause; + dd::EventRelay m_EScreenShake; + bool OnPause(const dd::Events::Pause &event); + bool OnScreenShake(const dd::Events::ScreenShake &event); + + + +}; + +} + +} + +#endif //DAYDREAM_SCREENSHAKESYSTEM_H diff --git a/src/game/Game/ScreenShakeSystem.cpp b/src/game/Game/ScreenShakeSystem.cpp new file mode 100644 index 0000000..e5166fa --- /dev/null +++ b/src/game/Game/ScreenShakeSystem.cpp @@ -0,0 +1,94 @@ +// +// Created by Adniklastrator on 2015-10-14. +// + +#include "PrecompiledHeader.h" +#include "Game/ScreenShakeSystem.h" + +void dd::Systems::ScreenShakeSystem::Initialize() +{ + EVENT_SUBSCRIBE_MEMBER(m_EPause, &ScreenShakeSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EScreenShake, &ScreenShakeSystem::OnScreenShake); + + InitializeObjects(); +} + +void dd::Systems::ScreenShakeSystem::InitializeObjects() +{ + m_Pause = false; + m_ScreenShake = false; + m_ShakeIntensity = 0; + m_CameraPosition = glm::vec3(0, 0, 0); + m_ShakeRepresentativeIntensity = 0; + m_ShakeTimer = 0; + m_ShakeEndTime = 0; + m_TimeTakenToCoolDown = 0; + m_CoolerMultiplier = 0; + m_Random = glm::vec3(0, 0, 0); +} + +void dd::Systems::ScreenShakeSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) +{ + if (IsPaused()) { + return; + } + + /*auto camera = m_World->GetComponent(entity); + + if (camera != nullptr) { + auto transform = m_World->GetComponent(entity); + + if (m_ScreenShake) { + m_CameraPosition = transform->Position - m_Random; + + m_ShakeTimer += dt; + if (m_ShakeTimer >= m_ShakeEndTime) { + //std::cout << "Used: " << m_ShakeIntensity << " True: " << m_ShakeRepresentativeIntensity << std::endl; + m_ShakeRepresentativeIntensity -= m_ShakeRepresentativeIntensity * m_CoolerMultiplier * dt; + m_ShakeIntensity = m_ShakeRepresentativeIntensity; + if (m_ShakeIntensity <= 0) { + m_ScreenShake = false; + transform->Position = glm::vec3(0, 0, 0); + return; + } + } + else { + //std::cout << "Timer: " << m_ShakeTimer << " End: " << m_ShakeEndTime << std::endl; + } + m_Random.x = (rand() % m_ShakeIntensity); + m_Random.y = (rand() % m_ShakeIntensity); + + float half = m_ShakeIntensity / 2; + + m_Random.x = (m_Random.x - half) / 20; + m_Random.y = (m_Random.y - half) / 20; + + //std::cout << "X: " << randomX << " Y: " << randomY << std::endl; + transform->Position = glm::vec3(m_Random); + } else { + m_CameraPosition = transform->Position; + } + }*/ +} + +bool dd::Systems::ScreenShakeSystem::OnPause(const dd::Events::Pause &event) +{ + if (IsPaused()) { + SetPause(false); + } else { + SetPause(true); + } + return true; +} + +bool dd::Systems::ScreenShakeSystem::OnScreenShake(const dd::Events::ScreenShake &event) +{ + m_ScreenShake = true; + m_ShakeIntensity = event.Intensity; + m_ShakeRepresentativeIntensity = event.Intensity; + m_ShakeEndTime = event.Time; + m_ShakeTimer = 0; + m_TimeTakenToCoolDown = event.TimeTakenToCoolDown; + m_CoolerMultiplier = m_ShakeIntensity / m_TimeTakenToCoolDown; + return true; +} \ No newline at end of file From 724d4e7e69ef4fd6c4594914abb55cb8a081bcb2 Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Wed, 14 Oct 2015 18:53:45 +0200 Subject: [PATCH 03/13] If stuck to pad, do not come into contact with other things. --- src/game/Game/BallSystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game/Game/BallSystem.cpp b/src/game/Game/BallSystem.cpp index 68c38f0..cb1f671 100644 --- a/src/game/Game/BallSystem.cpp +++ b/src/game/Game/BallSystem.cpp @@ -266,6 +266,10 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event) return false; } + if (ballComponent->Waiting || ballComponent->Sticky) { + return false; + } + auto ballTransform = m_World->GetComponent(ballEntity); glm::vec2 ballVelocity = glm::vec2(ballTransform->Velocity.x, ballTransform->Velocity.y); From 0650e7c061358365bd8ebabbe629e8b1662ab886 Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Thu, 15 Oct 2015 10:20:05 +0200 Subject: [PATCH 04/13] Basis of RaiseWater implemented in a way that doesn't work with our amount of lag. --- include/Core/Engine.h | 255 +------------------------------ include/Game/LevelSystem.h | 4 + include/Game/PadSystem.h | 8 + include/Game/ScreenShakeSystem.h | 2 +- src/game/Game/LevelSystem.cpp | 195 +++++++++++++++++++++++ src/game/Game/PadSystem.cpp | 50 +++++- 6 files changed, 255 insertions(+), 259 deletions(-) diff --git a/include/Core/Engine.h b/include/Core/Engine.h index 905eea4..910f121 100755 --- a/include/Core/Engine.h +++ b/include/Core/Engine.h @@ -47,6 +47,8 @@ #include "Game/CLifebuoy.h" #include "Game/CProjectile.h" #include "Game/CBrick.h" +#include "Game/CWall.h" +#include "Game/CBackground.h" #include "Game/CStickyAim.h" #include "Game/BallSystem.h" #include "Game/HitLagSystem.h" @@ -120,6 +122,8 @@ public: m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); + m_World->ComponentFactory.Register(); + m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); @@ -168,206 +172,9 @@ public: m_World->ComponentFactory.Register(); m_World->Initialize(); - //PointLightTest - { - auto t_Light = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_Light); - transform->Position = glm::vec3(-3.f, 6.f, -5.f); - transform->Sticky = true; - auto pl = m_World->AddComponent(t_Light); - pl->Radius = 20.f; - pl->Diffuse = glm::vec3(0.8f, 0.7f, 0.05f); - auto model = m_World->AddComponent(t_Light); - model->ModelFile = "Models/Core/UnitSphere.obj"; - m_World->CommitEntity(t_Light); - } - { - auto t_Light = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_Light); - transform->Position = glm::vec3(3.f, -5.f, -5.f); - transform->Sticky = true; - auto pl = m_World->AddComponent(t_Light); - pl->Radius = 15.f; - pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f); - auto model = m_World->AddComponent(t_Light); - model->ModelFile = "Models/Core/UnitSphere.obj"; - m_World->CommitEntity(t_Light); - } - - //Halfpipe background test model. - { - auto t_halfPipe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_halfPipe); - transform->Position = glm::vec3(0.f, 0.f, -15.f); - transform->Scale = glm::vec3(6.f, 6.f, 10.f); - transform->Sticky = false; - auto model = m_World->AddComponent(t_halfPipe); - model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; - model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); - m_World->CommitEntity(t_halfPipe); - } - { - auto t_halfPipe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_halfPipe); - transform->Position = glm::vec3(0.f, 34.6f, -15.f); - transform->Scale = glm::vec3(6.f, 6.f, 10.f); - transform->Sticky = false; - auto model = m_World->AddComponent(t_halfPipe); - model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; - model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); - m_World->CommitEntity(t_halfPipe); - } - - //Background - - { - auto background = m_World->CreateEntity(); - auto transform = m_World->AddComponent(background); - transform->Position = glm::vec3(0.f, 0.f, -30.f); - transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f); - auto sprite = m_World->AddComponent(background); - sprite->SpriteFile = "Textures/Background.png"; - m_World->CommitEntity(background); - } - -// auto particleEmitter= m_World->AddComponent(Pe); - //Water test - { - auto t_waterBody = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_waterBody); - transform->Position = glm::vec3(0.f, -3.5f, -10.f); - transform->Scale = glm::vec3(7.0f, 1.5f, 1.f); - transform->Sticky = true; - auto water = m_World->AddComponent(t_waterBody); - auto body = m_World->AddComponent(t_waterBody); - m_World->CommitEntity(t_waterBody); - } - - //ParticleTest - - - /*{ - auto Pe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(Pe); - auto particleEmitter= m_World->AddComponent(Pe); - auto emitteSprite = m_World->AddComponent(Pe); - - transform->Position = glm::vec3(0.f, 0.f, -10.f); - emitteSprite->SpriteFile = "Textures/Test/Brick_Normal.png"; - particleEmitter->GravityScale = 0.0f; - particleEmitter->SpawnRate = 1.f; - particleEmitter->NumberOfTicks = 2; - particleEmitter->Speed = 1.f; - particleEmitter->ParticlesPerTick = 5; - particleEmitter->Spread = glm::pi()*2; - particleEmitter->EmittingAngle = glm::pi(); - particleEmitter->LifeTime = 50; - - { - auto Pt = m_World->CreateEntity(Pe); - auto PtTransform = m_World->AddComponent(Pt); - auto PtSprite = m_World->AddComponent(Pt); - auto PtParticle = m_World->AddComponent(Pt); - auto PtTemplate = m_World->AddComponent(Pt); - - //PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f); - PtTransform->Position = transform->Position; - PtSprite->SpriteFile = "Textures/Background.png"; - PtParticle->LifeTime = 3.f; - PtParticle->Flags = static_cast(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter); - } - m_World->CommitEntity(Pe); - }*/ - - //TODO: Why does the ball not collide with these bricks? - //BottomBox - { - auto BottomWall = m_World->CreateEntity(); - auto transform = m_World->AddComponent(BottomWall); - transform->Position = glm::vec3(0.f, -6.f, -10.f); - transform->Scale = glm::vec3(20.f, 0.5f, 1.f); - //std::shared_ptr sprite = m_World->AddComponent(BottomWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - std::shared_ptr rectangleShape = m_World->AddComponent(BottomWall); - rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); - std::shared_ptr physics = m_World->AddComponent(BottomWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::LifeBuoy); - transform->Sticky = true; - m_World->CommitEntity(BottomWall); - } - - { - auto topWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent(topWall); - transform->Position = glm::vec3(0.f, 6.f, -10.f); - transform->Scale = glm::vec3(20.f, 0.5f, 1.f); - - //std::shared_ptr sprite = m_World->AddComponent(topWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - - std::shared_ptr rectangleShape = m_World->AddComponent(topWall); - rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); - - std::shared_ptr physics = m_World->AddComponent(topWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; - - m_World->CommitEntity(topWall); - } - - { - auto leftWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent( - leftWall); - transform->Position = glm::vec3(-4.f, 1.f, -10.f); - transform->Scale = glm::vec3(0.5f, 20.f, 1.f); - - //std::shared_ptr sprite = m_World->AddComponent(leftWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - - std::shared_ptr rectangleShape = m_World->AddComponent(leftWall); - rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); - - std::shared_ptr physics = m_World->AddComponent(leftWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; - - m_World->CommitEntity(leftWall); - } - - { - auto rightWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent( - rightWall); - transform->Position = glm::vec3(4.f, 1.f, -10.f); - transform->Scale = glm::vec3(0.5f, 20.f, 1.f); - - //std::shared_ptr sprite = m_World->AddComponent(rightWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - - std::shared_ptr rectangleShape = m_World->AddComponent(rightWall); - rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); - - std::shared_ptr physics = m_World->AddComponent(rightWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; - - m_World->CommitEntity(rightWall); - } - //EVENT_SUBSCRIBE_MEMBER(m_EGameStart, &Engine::OnGameStart); m_EGameStart = decltype(m_EGameStart)(std::bind(&Engine::OnGameStart, this, std::placeholders::_1)); m_EventBroker->Subscribe(m_EGameStart); - m_EScreenShake = decltype(m_EScreenShake)(std::bind(&Engine::OnScreenShake, this, std::placeholders::_1)); - m_EventBroker->Subscribe(m_EScreenShake); m_LastTime = glfwGetTime(); } @@ -388,9 +195,6 @@ public: //ResourceManager::Update(); if (m_GameIsRunning) { m_World->Update(dt); - - // I apologize about this. - ScreenShakeUpdate(dt); } m_EventBroker->Process(); m_FrameStack->UpdateLayered(dt); @@ -563,36 +367,6 @@ public: m_RendererQueue.Forward.Add(job); } - void ScreenShakeUpdate(double dt) - { - if (m_ScreenShake) { - m_ShakeTimer += dt; - if (m_ShakeTimer >= m_ShakeEndTime) { - //std::cout << "Used: " << m_ShakeIntensity << " True: " << m_ShakeRepresentativeIntensity << std::endl; - m_ShakeRepresentativeIntensity -= m_ShakeRepresentativeIntensity * m_CoolerMultiplier * dt; - m_ShakeIntensity = m_ShakeRepresentativeIntensity; - if (m_ShakeIntensity <= 0) { - m_ScreenShake = false; - m_Renderer->PlaceCamera(glm::vec3(0, 0, 0)); - return; - } - } else { - //std::cout << "Timer: " << m_ShakeTimer << " End: " << m_ShakeEndTime << std::endl; - } - float randomX = (rand() % m_ShakeIntensity); - float randomY = (rand() % m_ShakeIntensity); - - float half = m_ShakeIntensity / 2; - - randomX = (randomX - half) / 20; - randomY = (randomY - half) / 20; - - //std::cout << "X: " << randomX << " Y: " << randomY << std::endl; - - m_Renderer->PlaceCamera(glm::vec3(randomX, randomY, 0)); - } - } - private: std::shared_ptr m_EventBroker; GUI::Frame* m_FrameStack = nullptr; @@ -625,27 +399,6 @@ private: return true; }; - - //TODO: Extreme Redo. - bool m_ScreenShake = false; - int m_ShakeIntensity = 0; - float m_ShakeRepresentativeIntensity = 0; - float m_ShakeTimer = 0; - float m_ShakeEndTime = 0; - float m_TimeTakenToCoolDown = 0; - float m_CoolerMultiplier = 0; - dd::EventRelay m_EScreenShake; - bool OnScreenShake(const dd::Events::ScreenShake &event) - { - m_ScreenShake = true; - m_ShakeIntensity = event.Intensity; - m_ShakeRepresentativeIntensity = event.Intensity; - m_ShakeEndTime = event.Time; - m_ShakeTimer = 0; - m_TimeTakenToCoolDown = event.TimeTakenToCoolDown; - m_CoolerMultiplier = m_ShakeIntensity / m_TimeTakenToCoolDown; - return true; - } double m_LastTime; }; diff --git a/include/Game/LevelSystem.h b/include/Game/LevelSystem.h index ee73742..9e29fb6 100755 --- a/include/Game/LevelSystem.h +++ b/include/Game/LevelSystem.h @@ -16,10 +16,13 @@ #include "Core/World.h" #include "Rendering/CSprite.h" #include "Rendering/CModel.h" +#include "Rendering/CPointLight.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" @@ -46,6 +49,7 @@ #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" diff --git a/include/Game/PadSystem.h b/include/Game/PadSystem.h index 789e1e0..6091f39 100755 --- a/include/Game/PadSystem.h +++ b/include/Game/PadSystem.h @@ -16,6 +16,7 @@ #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" @@ -26,7 +27,10 @@ #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" @@ -102,6 +106,8 @@ private: dd::EventRelay m_EContactPowerUp; dd::EventRelay m_EStageCleared; dd::EventRelay m_EResetBall; + dd::EventRelay m_EResetAll; + dd::EventRelay m_ERaiseWater; dd::EventRelay m_EPause; dd::EventRelay m_EKrakenAttack; dd::EventRelay m_EStickyPad; @@ -114,6 +120,8 @@ 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 OnKrakenAttack(const dd::Events::KrakenAttack &event); bool OnStickyPad(const dd::Events::StickyPad &event); diff --git a/include/Game/ScreenShakeSystem.h b/include/Game/ScreenShakeSystem.h index 52d3174..4755fbb 100644 --- a/include/Game/ScreenShakeSystem.h +++ b/include/Game/ScreenShakeSystem.h @@ -30,7 +30,7 @@ public: { } void Initialize() override; - void InitializeObjects() override; + void InitializeObjects(); void UpdateEntity(double dt, EntityID entity, EntityID parent) override; void FlipPause(); diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index 476e334..00f1f2c 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -21,6 +21,201 @@ void dd::Systems::LevelSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause); EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad); + //PointLightTest + { + auto t_Light = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_Light); + transform->Position = glm::vec3(-3.f, 6.f, -5.f); + transform->Sticky = true; + auto pl = m_World->AddComponent(t_Light); + pl->Radius = 20.f; + pl->Diffuse = glm::vec3(0.8f, 0.7f, 0.05f); + auto model = m_World->AddComponent(t_Light); + model->ModelFile = "Models/Core/UnitSphere.obj"; + m_World->CommitEntity(t_Light); + } + { + auto t_Light = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_Light); + transform->Position = glm::vec3(3.f, -5.f, -5.f); + transform->Sticky = true; + auto pl = m_World->AddComponent(t_Light); + pl->Radius = 15.f; + pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f); + auto model = m_World->AddComponent(t_Light); + model->ModelFile = "Models/Core/UnitSphere.obj"; + m_World->CommitEntity(t_Light); + } + + //Halfpipe background test model. + { + auto t_halfPipe = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_halfPipe); + transform->Position = glm::vec3(0.f, 0.f, -15.f); + transform->Scale = glm::vec3(6.f, 6.f, 10.f); + transform->Sticky = false; + auto model = m_World->AddComponent(t_halfPipe); + model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; + model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); + m_World->CommitEntity(t_halfPipe); + } + { + auto t_halfPipe = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_halfPipe); + transform->Position = glm::vec3(0.f, 34.6f, -15.f); + transform->Scale = glm::vec3(6.f, 6.f, 10.f); + transform->Sticky = false; + auto model = m_World->AddComponent(t_halfPipe); + model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; + model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); + m_World->CommitEntity(t_halfPipe); + } + + //Background + + { + auto background = m_World->CreateEntity(); + auto transform = m_World->AddComponent(background); + transform->Position = glm::vec3(0.f, 0.f, -30.f); + transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f); + auto sprite = m_World->AddComponent(background); + sprite->SpriteFile = "Textures/Background.png"; + m_World->CommitEntity(background); + } + + // auto particleEmitter= m_World->AddComponent(Pe); + //Water test + { + auto t_waterBody = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_waterBody); + transform->Position = glm::vec3(0.f, -3.5f, -10.f); + transform->Scale = glm::vec3(7.0f, 1.5f, 1.f); + transform->Sticky = true; + auto water = m_World->AddComponent(t_waterBody); + auto body = m_World->AddComponent(t_waterBody); + m_World->CommitEntity(t_waterBody); + } + + //ParticleTest + + + /*{ + auto Pe = m_World->CreateEntity(); + auto transform = m_World->AddComponent(Pe); + auto particleEmitter= m_World->AddComponent(Pe); + auto emitteSprite = m_World->AddComponent(Pe); + + transform->Position = glm::vec3(0.f, 0.f, -10.f); + emitteSprite->SpriteFile = "Textures/Test/Brick_Normal.png"; + particleEmitter->GravityScale = 0.0f; + particleEmitter->SpawnRate = 1.f; + particleEmitter->NumberOfTicks = 2; + particleEmitter->Speed = 1.f; + particleEmitter->ParticlesPerTick = 5; + particleEmitter->Spread = glm::pi()*2; + particleEmitter->EmittingAngle = glm::pi(); + particleEmitter->LifeTime = 50; + + { + auto Pt = m_World->CreateEntity(Pe); + auto PtTransform = m_World->AddComponent(Pt); + auto PtSprite = m_World->AddComponent(Pt); + auto PtParticle = m_World->AddComponent(Pt); + auto PtTemplate = m_World->AddComponent(Pt); + + //PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f); + PtTransform->Position = transform->Position; + PtSprite->SpriteFile = "Textures/Background.png"; + PtParticle->LifeTime = 3.f; + PtParticle->Flags = static_cast(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter); + } + m_World->CommitEntity(Pe); + }*/ + + //TODO: Why does the ball not collide with these bricks? + //BottomBox + { + auto BottomWall = m_World->CreateEntity(); + auto transform = m_World->AddComponent(BottomWall); + transform->Position = glm::vec3(0.f, -6.f, -10.f); + transform->Scale = glm::vec3(20.f, 0.5f, 1.f); + //std::shared_ptr sprite = m_World->AddComponent(BottomWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + std::shared_ptr rectangleShape = m_World->AddComponent(BottomWall); + rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); + std::shared_ptr physics = m_World->AddComponent(BottomWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(CollisionLayer::LifeBuoy); + transform->Sticky = true; + m_World->CommitEntity(BottomWall); + } + + { + auto topWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent(topWall); + transform->Position = glm::vec3(0.f, 6.f, -10.f); + transform->Scale = glm::vec3(20.f, 0.5f, 1.f); + + //std::shared_ptr sprite = m_World->AddComponent(topWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + + std::shared_ptr rectangleShape = m_World->AddComponent(topWall); + rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); + + std::shared_ptr physics = m_World->AddComponent(topWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); + transform->Sticky = true; + + m_World->CommitEntity(topWall); + } + + { + auto leftWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent( + leftWall); + transform->Position = glm::vec3(-4.f, 1.f, -10.f); + transform->Scale = glm::vec3(0.5f, 20.f, 1.f); + + //std::shared_ptr sprite = m_World->AddComponent(leftWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + + std::shared_ptr rectangleShape = m_World->AddComponent(leftWall); + rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); + + std::shared_ptr physics = m_World->AddComponent(leftWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); + transform->Sticky = true; + + m_World->CommitEntity(leftWall); + } + + { + auto rightWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent( + rightWall); + transform->Position = glm::vec3(4.f, 1.f, -10.f); + transform->Scale = glm::vec3(0.5f, 20.f, 1.f); + + //std::shared_ptr sprite = m_World->AddComponent(rightWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + + std::shared_ptr rectangleShape = m_World->AddComponent(rightWall); + rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); + + std::shared_ptr physics = m_World->AddComponent(rightWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); + transform->Sticky = true; + + m_World->CommitEntity(rightWall); + } + m_BrickTemplate = m_World->CreateEntity(); std::shared_ptr transform = m_World->AddComponent(m_BrickTemplate); auto model = m_World->AddComponent(m_BrickTemplate); diff --git a/src/game/Game/PadSystem.cpp b/src/game/Game/PadSystem.cpp index 7431746..7a47d8f 100755 --- a/src/game/Game/PadSystem.cpp +++ b/src/game/Game/PadSystem.cpp @@ -28,6 +28,8 @@ void dd::Systems::PadSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EContactPowerUp, &PadSystem::OnContactPowerUp); EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &PadSystem::OnStageCleared); EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &PadSystem::OnResetBall); + EVENT_SUBSCRIBE_MEMBER(m_EResetAll, &PadSystem::OnResetAll); + EVENT_SUBSCRIBE_MEMBER(m_ERaiseWater, &PadSystem::OnRaiseWater); EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause); EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &PadSystem::OnKrakenAttack); EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad); @@ -204,7 +206,14 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) { } else if (val == GLFW_KEY_R) { Events::ResetBall e; EventBroker->Publish(e); - } else if (val == GLFW_KEY_M) { + } else if (val == GLFW_KEY_W) { + Events::RaiseWater e; + e.Amount = 0.2; + EventBroker->Publish(e); + } else if (val == GLFW_KEY_A) { + Events::ResetAll e; + EventBroker->Publish(e); + } else if (val == GLFW_KEY_M) { Events::MultiBall e; e.padTransform = Transform(); EventBroker->Publish(e); @@ -226,22 +235,23 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) { e.Time = 3; e.TimeTakenToCoolDown = 10; EventBroker->Publish(e); + } else if (val == GLFW_KEY_L) { + Events::Lifebuoy e; + e.Transform = Transform(); + EventBroker->Publish(e); } else if (val == GLFW_KEY_Y) { Events::StickyPad e; EventBroker->Publish(e); - } - else if (val == GLFW_KEY_I) { + } else if (val == GLFW_KEY_I) { Events::InkBlaster e; EventBroker->Publish(e); - } - else if (val == GLFW_KEY_K) { + } else if (val == GLFW_KEY_K) { Events::KrakenAttack e; e.ChargeUpdate = 0; e.KrakenStrength = 0.1; e.PlayerStrength = 0.05; EventBroker->Publish(e); - } - else if (val == GLFW_KEY_SPACE) { + } else if (val == GLFW_KEY_SPACE) { Events::ActionButton e; e.Position = Transform()->Position; EventBroker->Publish(e); @@ -369,6 +379,32 @@ bool dd::Systems::PadSystem::OnResetBall(const dd::Events::ResetBall &event) return true; } +bool dd::Systems::PadSystem::OnResetAll(const dd::Events::ResetAll &event) +{ + + return true; +} + +bool dd::Systems::PadSystem::OnRaiseWater(const dd::Events::RaiseWater &event) +{ + auto transform = Transform(); + glm::vec3 raise = glm::vec3(0, event.Amount, 0); + transform->Position += raise; + + { + auto t_waterBody = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_waterBody); + transform->Position = glm::vec3(0.f, -3.5f, -10.f); + transform->Scale = glm::vec3(7.0f, event.Amount * 1.6f, 1.f); + transform->Sticky = true; + auto water = m_World->AddComponent(t_waterBody); + auto body = m_World->AddComponent(t_waterBody); + m_World->CommitEntity(t_waterBody); + } + + return true; +} + bool dd::Systems::PadSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event) { if (!m_KrakenAttack) { From 4abce7b17fc47f175c88f5974753dd107dc10c84 Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Thu, 15 Oct 2015 11:11:06 +0200 Subject: [PATCH 05/13] CTravels replaces Sticky = true. Put "Travels" component on anything that should be moved down during travel sequences. --- include/Core/CTransform.h | 3 - include/Core/Engine.h | 2 + include/Game/BallSystem.h | 2 +- include/Game/CTravels.h | 26 +++ include/Game/LevelSystem.h | 1 + include/Game/TravellingSystem.h | 1 + src/game/Game/BallSystem.cpp | 6 +- src/game/Game/LevelSystem.cpp | 331 ++++++++++++++--------------- src/game/Game/LifebuoySystem.cpp | 1 - src/game/Game/PadSystem.cpp | 2 - src/game/Game/ProjectileSystem.cpp | 1 - src/game/Game/TravellingSystem.cpp | 10 +- 12 files changed, 201 insertions(+), 185 deletions(-) create mode 100644 include/Game/CTravels.h diff --git a/include/Core/CTransform.h b/include/Core/CTransform.h index 812e05e..06cbe5c 100644 --- a/include/Core/CTransform.h +++ b/include/Core/CTransform.h @@ -41,9 +41,6 @@ struct Transform : public Component glm::vec3 Velocity; /** Physical scale multiplier. */ glm::vec3 Scale; - - // Sticky is if it sticks with the player or not. True means it will follow the camera. - bool Sticky = true; }; } diff --git a/include/Core/Engine.h b/include/Core/Engine.h index 910f121..b397501 100755 --- a/include/Core/Engine.h +++ b/include/Core/Engine.h @@ -49,6 +49,7 @@ #include "Game/CBrick.h" #include "Game/CWall.h" #include "Game/CBackground.h" +#include "Game/CTravels.h" #include "Game/CStickyAim.h" #include "Game/BallSystem.h" #include "Game/HitLagSystem.h" @@ -128,6 +129,7 @@ public: m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); + m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); diff --git a/include/Game/BallSystem.h b/include/Game/BallSystem.h index d4faa03..585f805 100644 --- a/include/Game/BallSystem.h +++ b/include/Game/BallSystem.h @@ -93,7 +93,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; diff --git a/include/Game/CTravels.h b/include/Game/CTravels.h new file mode 100644 index 0000000..9f4119b --- /dev/null +++ b/include/Game/CTravels.h @@ -0,0 +1,26 @@ +// +// 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. +}; + +} + +} + +#endif //DAYDREAM_CTRAVELS_H diff --git a/include/Game/LevelSystem.h b/include/Game/LevelSystem.h index 9e29fb6..4b21091 100755 --- a/include/Game/LevelSystem.h +++ b/include/Game/LevelSystem.h @@ -25,6 +25,7 @@ #include "Game/CBackground.h" #include "Game/CProjectile.h" #include "Game/CPowerUp.h" +#include "Game/CTravels.h" #include "Game/BrickComponents.h" diff --git a/include/Game/TravellingSystem.h b/include/Game/TravellingSystem.h index ca18a88..9c5f54b 100644 --- a/include/Game/TravellingSystem.h +++ b/include/Game/TravellingSystem.h @@ -13,6 +13,7 @@ #include "Game/EPause.h" #include "Game/EArrivedAtNewStage.h" #include "Game/EStageCleared.h" +#include "Game/CTravels.h" namespace dd diff --git a/src/game/Game/BallSystem.cpp b/src/game/Game/BallSystem.cpp index c287e16..fa5e160 100644 --- a/src/game/Game/BallSystem.cpp +++ b/src/game/Game/BallSystem.cpp @@ -47,7 +47,6 @@ void dd::Systems::BallSystem::Initialize() physics->Category = CollisionLayer::Type::Ball; physics->Mask = static_cast(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy); physics->Calculate = true; - transform->Sticky = true; m_World->CommitEntity(ent); @@ -168,7 +167,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID return; } } //Removing this made the wall collisions work again - /*else if (transformBall->Position.x > EdgeX()) { + else if (transformBall->Position.x > EdgeX()) { if (transformBall->Velocity.x > 0) { glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(1, 0)); transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); @@ -178,7 +177,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(-1, 0)); transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); } - } else if (transformBall->Position.y > EdgeY()) { + } /*else if (transformBall->Position.y > EdgeY()) { if (transformBall->Velocity.y > 0) { glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(0, 1)); transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); @@ -419,7 +418,6 @@ void dd::Systems::BallSystem::CreateLife(int number) std::shared_ptr transform = m_World->AddComponent(life); transform->Position = glm::vec3(-1.5f + number * 0.15f, -2.f, -5.f); transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f); - transform->Sticky = true; std::shared_ptr lifeNr = m_World->AddComponent(life); lifeNr->Number = number; diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index 00f1f2c..22f326c 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -11,22 +11,21 @@ void dd::Systems::LevelSystem::Initialize() { std::random_device rd; m_RandomGenerator = std::mt19937(rd()); - EVENT_SUBSCRIBE_MEMBER(m_EContact, &LevelSystem::OnContact); - EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, &LevelSystem::OnScoreEvent); - EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &LevelSystem::OnMultiBall); - EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, &LevelSystem::OnCreatePowerUp); - EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &LevelSystem::OnMultiBallLost); - EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken); - EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared); - EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause); - EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad); + EVENT_SUBSCRIBE_MEMBER(m_EContact, &LevelSystem::OnContact); + EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, &LevelSystem::OnScoreEvent); + EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &LevelSystem::OnMultiBall); + EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, &LevelSystem::OnCreatePowerUp); + EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &LevelSystem::OnMultiBallLost); + EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken); + EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared); + EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad); //PointLightTest { auto t_Light = m_World->CreateEntity(); auto transform = m_World->AddComponent(t_Light); transform->Position = glm::vec3(-3.f, 6.f, -5.f); - transform->Sticky = true; auto pl = m_World->AddComponent(t_Light); pl->Radius = 20.f; pl->Diffuse = glm::vec3(0.8f, 0.7f, 0.05f); @@ -34,187 +33,184 @@ void dd::Systems::LevelSystem::Initialize() model->ModelFile = "Models/Core/UnitSphere.obj"; m_World->CommitEntity(t_Light); } - { - auto t_Light = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_Light); - transform->Position = glm::vec3(3.f, -5.f, -5.f); - transform->Sticky = true; - auto pl = m_World->AddComponent(t_Light); - pl->Radius = 15.f; - pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f); - auto model = m_World->AddComponent(t_Light); - model->ModelFile = "Models/Core/UnitSphere.obj"; - m_World->CommitEntity(t_Light); - } + { + auto t_Light = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_Light); + transform->Position = glm::vec3(3.f, -5.f, -5.f); + auto pl = m_World->AddComponent(t_Light); + pl->Radius = 15.f; + pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f); + auto model = m_World->AddComponent(t_Light); + model->ModelFile = "Models/Core/UnitSphere.obj"; + m_World->CommitEntity(t_Light); + } - //Halfpipe background test model. - { - auto t_halfPipe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_halfPipe); - transform->Position = glm::vec3(0.f, 0.f, -15.f); - transform->Scale = glm::vec3(6.f, 6.f, 10.f); - transform->Sticky = false; - auto model = m_World->AddComponent(t_halfPipe); - model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; - model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); - m_World->CommitEntity(t_halfPipe); - } - { - auto t_halfPipe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_halfPipe); - transform->Position = glm::vec3(0.f, 34.6f, -15.f); - transform->Scale = glm::vec3(6.f, 6.f, 10.f); - transform->Sticky = false; - auto model = m_World->AddComponent(t_halfPipe); - model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; - model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); - m_World->CommitEntity(t_halfPipe); - } + //Halfpipe background test model. + { + auto t_halfPipe = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_halfPipe); + auto background = m_World->AddComponent(t_halfPipe); + transform->Position = glm::vec3(0.f, 0.f, -15.f); + transform->Scale = glm::vec3(6.f, 6.f, 10.f); + auto travels = m_World->AddComponent(t_halfPipe); + auto model = m_World->AddComponent(t_halfPipe); + model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; + model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); + m_World->CommitEntity(t_halfPipe); - //Background + auto t_halfPipe2 = m_World->CloneEntity(t_halfPipe); + auto transform2 = m_World->GetComponent(t_halfPipe); + transform2->Position = glm::vec3(0.f, 34.6f, -15.f); + } - { - auto background = m_World->CreateEntity(); - auto transform = m_World->AddComponent(background); - transform->Position = glm::vec3(0.f, 0.f, -30.f); - transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f); - auto sprite = m_World->AddComponent(background); - sprite->SpriteFile = "Textures/Background.png"; - m_World->CommitEntity(background); - } + //Background - // auto particleEmitter= m_World->AddComponent(Pe); - //Water test - { - auto t_waterBody = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_waterBody); - transform->Position = glm::vec3(0.f, -3.5f, -10.f); - transform->Scale = glm::vec3(7.0f, 1.5f, 1.f); - transform->Sticky = true; - auto water = m_World->AddComponent(t_waterBody); - auto body = m_World->AddComponent(t_waterBody); - m_World->CommitEntity(t_waterBody); - } + { + auto background = m_World->CreateEntity(); + auto transform = m_World->AddComponent(background); + auto travels = m_World->AddComponent(background); + auto backgroundComponent = m_World->AddComponent(background); + transform->Position = glm::vec3(0.f, 0.f, -30.f); + transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f); + auto sprite = m_World->AddComponent(background); + sprite->SpriteFile = "Textures/Background.png"; + m_World->CommitEntity(background); + } - //ParticleTest + // auto particleEmitter= m_World->AddComponent(Pe); + //Water test + { + auto t_waterBody = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_waterBody); + transform->Position = glm::vec3(0.f, -3.5f, -10.f); + transform->Scale = glm::vec3(7.0f, 1.5f, 1.f); + auto water = m_World->AddComponent(t_waterBody); + auto body = m_World->AddComponent(t_waterBody); + m_World->CommitEntity(t_waterBody); + } + + //ParticleTest - /*{ - auto Pe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(Pe); - auto particleEmitter= m_World->AddComponent(Pe); - auto emitteSprite = m_World->AddComponent(Pe); + /*{ + auto Pe = m_World->CreateEntity(); + auto transform = m_World->AddComponent(Pe); + auto particleEmitter= m_World->AddComponent(Pe); + auto emitteSprite = m_World->AddComponent(Pe); - transform->Position = glm::vec3(0.f, 0.f, -10.f); - emitteSprite->SpriteFile = "Textures/Test/Brick_Normal.png"; - particleEmitter->GravityScale = 0.0f; - particleEmitter->SpawnRate = 1.f; - particleEmitter->NumberOfTicks = 2; - particleEmitter->Speed = 1.f; - particleEmitter->ParticlesPerTick = 5; - particleEmitter->Spread = glm::pi()*2; - particleEmitter->EmittingAngle = glm::pi(); - particleEmitter->LifeTime = 50; + transform->Position = glm::vec3(0.f, 0.f, -10.f); + emitteSprite->SpriteFile = "Textures/Test/Brick_Normal.png"; + particleEmitter->GravityScale = 0.0f; + particleEmitter->SpawnRate = 1.f; + particleEmitter->NumberOfTicks = 2; + particleEmitter->Speed = 1.f; + particleEmitter->ParticlesPerTick = 5; + particleEmitter->Spread = glm::pi()*2; + particleEmitter->EmittingAngle = glm::pi(); + particleEmitter->LifeTime = 50; - { - auto Pt = m_World->CreateEntity(Pe); - auto PtTransform = m_World->AddComponent(Pt); - auto PtSprite = m_World->AddComponent(Pt); - auto PtParticle = m_World->AddComponent(Pt); - auto PtTemplate = m_World->AddComponent(Pt); + { + auto Pt = m_World->CreateEntity(Pe); + auto PtTransform = m_World->AddComponent(Pt); + auto PtSprite = m_World->AddComponent(Pt); + auto PtParticle = m_World->AddComponent(Pt); + auto PtTemplate = m_World->AddComponent(Pt); - //PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f); - PtTransform->Position = transform->Position; - PtSprite->SpriteFile = "Textures/Background.png"; - PtParticle->LifeTime = 3.f; - PtParticle->Flags = static_cast(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter); - } - m_World->CommitEntity(Pe); - }*/ + //PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f); + PtTransform->Position = transform->Position; + PtSprite->SpriteFile = "Textures/Background.png"; + PtParticle->LifeTime = 3.f; + PtParticle->Flags = static_cast(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter); + } + m_World->CommitEntity(Pe); + }*/ - //TODO: Why does the ball not collide with these bricks? - //BottomBox - { - auto BottomWall = m_World->CreateEntity(); - auto transform = m_World->AddComponent(BottomWall); - transform->Position = glm::vec3(0.f, -6.f, -10.f); - transform->Scale = glm::vec3(20.f, 0.5f, 1.f); - //std::shared_ptr sprite = m_World->AddComponent(BottomWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - std::shared_ptr rectangleShape = m_World->AddComponent(BottomWall); - rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); - std::shared_ptr physics = m_World->AddComponent(BottomWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::LifeBuoy); - transform->Sticky = true; - m_World->CommitEntity(BottomWall); - } + //TODO: Why does the ball not collide with these bricks? + //BottomBox + { + auto BottomWall = m_World->CreateEntity(); + auto transform = m_World->AddComponent(BottomWall); + auto wall = m_World->AddComponent(BottomWall); + transform->Position = glm::vec3(0.f, -6.f, -10.f); + transform->Scale = glm::vec3(20.f, 0.5f, 1.f); + //std::shared_ptr sprite = m_World->AddComponent(BottomWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + std::shared_ptr rectangleShape = m_World->AddComponent(BottomWall); + rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); + std::shared_ptr physics = m_World->AddComponent(BottomWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(CollisionLayer::LifeBuoy); + m_World->CommitEntity(BottomWall); + } - { - auto topWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent(topWall); - transform->Position = glm::vec3(0.f, 6.f, -10.f); - transform->Scale = glm::vec3(20.f, 0.5f, 1.f); + { + auto topWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent(topWall); + transform->Position = glm::vec3(0.f, 6.f, -10.f); + transform->Scale = glm::vec3(20.f, 0.5f, 1.f); - //std::shared_ptr sprite = m_World->AddComponent(topWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + auto wall = m_World->AddComponent(topWall); - std::shared_ptr rectangleShape = m_World->AddComponent(topWall); - rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); + //std::shared_ptr sprite = m_World->AddComponent(topWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - std::shared_ptr physics = m_World->AddComponent(topWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; + std::shared_ptr rectangleShape = m_World->AddComponent(topWall); + rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); - m_World->CommitEntity(topWall); - } + std::shared_ptr physics = m_World->AddComponent(topWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - { - auto leftWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent( - leftWall); - transform->Position = glm::vec3(-4.f, 1.f, -10.f); - transform->Scale = glm::vec3(0.5f, 20.f, 1.f); + m_World->CommitEntity(topWall); + } - //std::shared_ptr sprite = m_World->AddComponent(leftWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + { + auto leftWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent( + leftWall); + transform->Position = glm::vec3(-4.f, 1.f, -10.f); + transform->Scale = glm::vec3(0.5f, 20.f, 1.f); - std::shared_ptr rectangleShape = m_World->AddComponent(leftWall); - rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); + auto wall = m_World->AddComponent(leftWall); - std::shared_ptr physics = m_World->AddComponent(leftWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; + //std::shared_ptr sprite = m_World->AddComponent(leftWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - m_World->CommitEntity(leftWall); - } + std::shared_ptr rectangleShape = m_World->AddComponent(leftWall); + rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); - { - auto rightWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent( - rightWall); - transform->Position = glm::vec3(4.f, 1.f, -10.f); - transform->Scale = glm::vec3(0.5f, 20.f, 1.f); + std::shared_ptr physics = m_World->AddComponent(leftWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(/*CollisionLayer::Ball |*/ CollisionLayer::Brick); - //std::shared_ptr sprite = m_World->AddComponent(rightWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + m_World->CommitEntity(leftWall); + } - std::shared_ptr rectangleShape = m_World->AddComponent(rightWall); - rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); + { + auto rightWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent( + rightWall); + transform->Position = glm::vec3(4.f, 1.f, -10.f); + transform->Scale = glm::vec3(0.5f, 20.f, 1.f); - std::shared_ptr physics = m_World->AddComponent(rightWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; + auto wall = m_World->AddComponent(rightWall); - m_World->CommitEntity(rightWall); - } + //std::shared_ptr sprite = m_World->AddComponent(rightWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + + std::shared_ptr rectangleShape = m_World->AddComponent(rightWall); + rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); + + std::shared_ptr physics = m_World->AddComponent(rightWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(/*CollisionLayer::Ball |*/ CollisionLayer::Brick); + + m_World->CommitEntity(rightWall); + } m_BrickTemplate = m_World->CreateEntity(); std::shared_ptr transform = m_World->AddComponent(m_BrickTemplate); @@ -224,11 +220,13 @@ void dd::Systems::LevelSystem::Initialize() cRec->Dimensions = glm::vec2(0.9f, 0.35f); std::shared_ptr cPhys = m_World->AddComponent(m_BrickTemplate); std::shared_ptr cTemplate = m_World->AddComponent(m_BrickTemplate); + + auto travels = m_World->AddComponent(m_BrickTemplate); + cPhys->CollisionType = CollisionType::Type::Static; cPhys->GravityScale = 0.f; cPhys->Category = CollisionLayer::Type::Brick; cPhys->Mask = static_cast(CollisionLayer::Type::Ball | CollisionLayer::Type::Projectile | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy); - transform->Sticky = false; model->ModelFile = "Models/Brick/WhiteBrick.obj"; transform->Position = glm::vec3(50, 50, -10); @@ -633,7 +631,6 @@ bool dd::Systems::LevelSystem::OnCreatePowerUp(const dd::Events::CreatePowerUp & cPhys->CollisionType = CollisionType::Type::Dynamic; cPhys->Category = CollisionLayer::Type::PowerUp; cPhys->Mask = CollisionLayer::Type::Pad; - transform->Sticky = false; std::shared_ptr cPow = m_World->AddComponent(powerUp); diff --git a/src/game/Game/LifebuoySystem.cpp b/src/game/Game/LifebuoySystem.cpp index e1361c6..3265a63 100644 --- a/src/game/Game/LifebuoySystem.cpp +++ b/src/game/Game/LifebuoySystem.cpp @@ -29,7 +29,6 @@ void dd::Systems::LifebuoySystem::Initialize() physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick | CollisionLayer::LifeBuoy | CollisionLayer::Pad | CollisionLayer::Water); physics->Density = 1.0f; physics->GravityScale = 1; - ctransform->Sticky = true; auto cModel = m_World->AddComponent(ent); cModel->ModelFile = "Models/Lifebuoy/Lifebuoy1.obj"; auto lifebuoy = m_World->AddComponent(ent); diff --git a/src/game/Game/PadSystem.cpp b/src/game/Game/PadSystem.cpp index 7a47d8f..17a8327 100755 --- a/src/game/Game/PadSystem.cpp +++ b/src/game/Game/PadSystem.cpp @@ -49,7 +49,6 @@ void dd::Systems::PadSystem::Initialize() physics->Category = CollisionLayer::Type::Pad; physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::PowerUp | CollisionLayer::LifeBuoy); physics->Calculate = true; - ctransform->Sticky = true; auto cModel = m_World->AddComponent(ent); cModel->ModelFile = "Models/Ship/Ship.obj"; @@ -396,7 +395,6 @@ bool dd::Systems::PadSystem::OnRaiseWater(const dd::Events::RaiseWater &event) auto transform = m_World->AddComponent(t_waterBody); transform->Position = glm::vec3(0.f, -3.5f, -10.f); transform->Scale = glm::vec3(7.0f, event.Amount * 1.6f, 1.f); - transform->Sticky = true; auto water = m_World->AddComponent(t_waterBody); auto body = m_World->AddComponent(t_waterBody); m_World->CommitEntity(t_waterBody); diff --git a/src/game/Game/ProjectileSystem.cpp b/src/game/Game/ProjectileSystem.cpp index 566a009..a6b9bc1 100644 --- a/src/game/Game/ProjectileSystem.cpp +++ b/src/game/Game/ProjectileSystem.cpp @@ -29,7 +29,6 @@ void dd::Systems::ProjectileSystem::Initialize() physics->Category = CollisionLayer::Type::Projectile; physics->Mask = static_cast(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall); physics->Calculate = true; - ctransform->Sticky = true; ctransform->Position = glm::vec3(0.f, 0.f, -10.f); ctransform->Scale = glm::vec3(0.1f, 0.1f, 0.1f); auto cModel = m_World->AddComponent(ent); diff --git a/src/game/Game/TravellingSystem.cpp b/src/game/Game/TravellingSystem.cpp index a073488..baa5dad 100644 --- a/src/game/Game/TravellingSystem.cpp +++ b/src/game/Game/TravellingSystem.cpp @@ -31,15 +31,13 @@ void dd::Systems::TravellingSystem::Update(double dt) void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) { if (m_Travelling) { - auto transform = m_World->GetComponent(entity); - if (transform != nullptr) { - if (!transform->Sticky) { + auto travels = m_World->GetComponent(entity); + if (travels != nullptr) { + auto transform = m_World->GetComponent(entity); + if (transform != nullptr) { transform->Position.y -= 6.0f * dt; } } - else { - transform->Position.y -= 6.0f * dt; - } } } From bb23d5a8c4acaa9313e20eb3cc9ad62c66de5aca Mon Sep 17 00:00:00 2001 From: Stiffly Date: Thu, 15 Oct 2015 11:43:10 +0200 Subject: [PATCH 06/13] Added hover and click sounds. Cleanup in SoundSystem. --- assets/Sounds/GUI/click.wav | Bin 0 -> 44144 bytes assets/Sounds/GUI/hover.wav | Bin 0 -> 14942 bytes include/Sound/Sound.h | 1 + include/Sound/SoundSystem.h | 10 ++++++---- src/game/Sound/Sound.cpp | 5 +++++ src/game/Sound/SoundSystem.cpp | 24 ++++++++++++++++++------ 6 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 assets/Sounds/GUI/click.wav create mode 100644 assets/Sounds/GUI/hover.wav diff --git a/assets/Sounds/GUI/click.wav b/assets/Sounds/GUI/click.wav new file mode 100644 index 0000000000000000000000000000000000000000..cda8f60afc4efcffd34badbbffafa021d795ef21 GIT binary patch literal 44144 zcmZ{t2e@WeS?~Avoin}9WHQMlnLd+APYj6kB1T2QM^M8>M6m#(K|usm6fRc;DN5CA zfqSJWgkB$NKnNuPNkSlX(#vEfnaPwhGiOfu_Wl3%FYmKY9-sT2=lgbB>n;Dctaq)o zCwb=2Uv$xnKH4-FKl#^w<^`9$eACLNX$H-(d1~&h{M4`+Z&o(H`}~(bpKCsCKEsEO z-HqI#N7Ia2f7^B}*E8*GJFgjQrrVizJoIMUQTh$insyx9uD#d8T+imY?ZzIWPm8h8 zoeqcjxi_6Y<2laedYJn>ml85SeWq(M=vpGhY_6dOZLUV?Z!2^_8^2199>_zFnLHWq zq=JXK$puM4sOJxjQQD7nM`aQzDR!*7pB}5aM^E$~b;ptjsYM3f=vG>*#jwMrmys4x zwZjXXM(zAg7v!WTJc>3JL0@`%w=}|re2|C!;7#v^&7y}|HqBIfJl6|5dD~cKy5k8V zNIdfpANqkAHqb)IfHd=SZz}D0j&;;zwmav!?X?5aM9^kl$DNkSJ02?YbBLMO%omTEN?tHW&=2jAo4AJ8OsD%~ z*Kabsqr7ezn)J&Yr_&ZD=gX z-(>pl4(~mYdw;0h8yb7_NBhO0uq^(%FnX_SRyQX#>%)6puE1fc^QYx$Hy)iP!+$D& zj3fK=yE~ZN6?+^Ey7&e9lA)G_>S>{IQnN8KtcwI|LU~;@TN#Rj=0MkDA~Ysqjbk0H zBavoFT7Wrzv!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&@9+jggWDo)xdQprv_&3Ia~n z&1H$wP??pd?5@UWpqA!Yw6yYut5|>wd@7ff-xXrowk+6NKpDYZ3UhgBjgsE~Zh>_p z`Y+o5{vP3q0^PcSK&tA2N0j7Na8lJ@pQW>AHfD9~TOqOG2#^m<}pphbFJjR(1! z)50(xc=i3!0bP(=ok}BQgM-(lJw9XHISRNtriX(F)-JucQf9H_xmgwdXhlE%tLFMc zMG;TwM@|RT@>A&QNBD`zR$JpnZpLfnXf#w0`)W5mQjD|^6yVD}DnR72rqjOSQGQs+ zz#mN<4MmH4JSS_xM<3&^=qs6ZkeZaukyKRZ4@di$-+SAYkAsIiJnA=dIcvSD57k#2 z@r3cS#_W3MSePUquKIS0^!-~lge z%~7sk!l&q}b=9@xW_oiiditi-gip*9j6wP({#i2>F{8C!Q@Ms{B9@(9p)Ya~mqwC0 zfkf|X&?=iCyS?;c`YKcTq4M^2;ktM@GSgoAcpF%m(X0f`L0Y(EfVLVSuh~I~_(eW- sqIRzJXr-*U5Pk2#Tin%4&zyTt-5d*)1bnok@!NY2K5uOS4{i1T02>Q?7XSbN literal 0 HcmV?d00001 diff --git a/assets/Sounds/GUI/hover.wav b/assets/Sounds/GUI/hover.wav new file mode 100644 index 0000000000000000000000000000000000000000..8d3baefd279269c331387748db6bd65fbb51d132 GIT binary patch literal 14942 zcmYkD2YgmV`nKnsw~)}JSA~FdkzPV?p@Tpu!h#}2!3M5k@5(Cb+7-nPh`P$!QB-Uw zYXL+>5EW3WAe{gK!aMW7?wREC%lxLEIa8kJe#*>yl0UFtzcHPSIk(rCz876SE2n}n zCNipR12% zR*Q8Rm*V{*+S1fcu`a!*HHWA@YIPZUYUYe9BG*`!H?@9Kyef_Bd>h^A8CIZN>q`1u zs|?Rl#jDFA*PPjmsePn)GfAE#S0C*vNuDOv?4`&f_MJ_xaZ45VQD0G_6i@Yjwtvqs zuEvZ_7VnCxs%!UU=od3i8Q)Li>bc%6a#_CZr0<`ikM@u*&b4Q~FRF=d>g%AJ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vu0i$xqT)Y7J5;G*>7dSv|_}EclATy<|jks#WVYS5m2yo8(ql zH%!MU>o)Bup@3X|r`iwu(}`}`~5lE%X(zvJe34h{Hiaa1M zo0|N7$(}T8=q+t1*;HGy`0a3eUxpdvac9H7z-67;q&4-$uD-@K)WS~m{c?(Pq;{dN zce6QH>g(UM|8n;jT-Ue9%7e5;d>iDTn(n+Dlofw1^$byGP3x(B$kz+0i{d9ZZ;GEM z;hcDSjQa?2?=ba3?jsJ-PrvynFW{MOB@S|*AynwrL$|KFv(P<8xV_L#h{9gl_LJ_X ztoI7I@6avnA>P(Kh<>>|d^NOzp~bP7)AT zaYnyC9wO*gE8I}7T1IZwH<_SYSWF^KJK{0U;PHXkGgW*itXc;TW{_4 zzxt?mxZ&L6-`z=FW9ZjK<-7fJy}yU|^vkxM1?2omu5mS=MigdL)~fZc*1Vf`Ay;b_ zhExkkKJ0sH$J&>$qkSHP7TU9F2cT0xm*^!_2~Uy_)pai?y`}pY>A0iClrJO~j-=I8 z3McrW!-OFrOqfzxsjO+RlELl?4skv1

vwcL(dgm#6wMNDWi_6V6zW2lR;pC^6;iY+=^SAz+`bD{ z`odxl`_~j>%UG){`V(%P0~KHDbgC!PO^H!lXA5L9ivn}gnH>7nFqcu zD m_BGMSourcesToBuffers; std::map m_SFXSourcesToBuffers; ALCdevice* m_Device = nullptr; + ALCcontext* m_Context = nullptr; //Events dd::EventRelay m_EPlaySFX; diff --git a/src/game/Sound/Sound.cpp b/src/game/Sound/Sound.cpp index f98f8eb..0fb9da2 100644 --- a/src/game/Sound/Sound.cpp +++ b/src/game/Sound/Sound.cpp @@ -6,6 +6,11 @@ dd::Sound::Sound(std::string path) m_Path = path; } +dd::Sound::~Sound() +{ + alDeleteBuffers(1, &m_Buffer); +} + ALuint dd::Sound::LoadFile(std::string path) { if (m_BufferCache.find(path) != m_BufferCache.end()) { diff --git a/src/game/Sound/SoundSystem.cpp b/src/game/Sound/SoundSystem.cpp index c11d84e..65465e3 100644 --- a/src/game/Sound/SoundSystem.cpp +++ b/src/game/Sound/SoundSystem.cpp @@ -3,6 +3,19 @@ dd::Systems::SoundSystem::~SoundSystem() { + for (auto &bgm : m_BGMSourcesToBuffers) { + alSourceStop(bgm.first); + alDeleteSources(1, &bgm.first); + bgm.second->~Sound(); + } + for (auto &sfx : m_SFXSourcesToBuffers) { + alSourceStop(sfx.first); + alDeleteSources(1, &sfx.first); + sfx.second->~Sound(); + } + m_BGMSourcesToBuffers.clear(); + m_SFXSourcesToBuffers.clear(); + alcDestroyContext(m_Context); alcCloseDevice(m_Device); } @@ -10,16 +23,16 @@ void dd::Systems::SoundSystem::Initialize() { //initialize OpenAL m_Device = alcOpenDevice(NULL); - ALCcontext* context; + if (m_Device) { - context = alcCreateContext(m_Device, NULL); - alcMakeContextCurrent(context); + m_Context = alcCreateContext(m_Device, NULL); + alcMakeContextCurrent(m_Context); } else { LOG_ERROR("OpenAL failed to initialize."); } - alGetError(); + //alGetError(); //Subscribe to events EVENT_SUBSCRIBE_MEMBER(m_EContact, &SoundSystem::OnContact); @@ -60,7 +73,6 @@ void dd::Systems::SoundSystem::Update(double dt) for (int i = 0; i < deleteList.size(); i++) { alDeleteSources(1, &deleteList[i]); - //alDeleteBuffers(1, &m_SourcesToBuffers[deleteList[i]]); m_SFXSourcesToBuffers.erase(deleteList[i]); } } @@ -76,7 +88,7 @@ ALuint dd::Systems::SoundSystem::CreateSource() bool dd::Systems::SoundSystem::OnPlaySound(const dd::Events::PlaySound &event) { //Loading and binding sound buffer to source - Sound *sound = ResourceManager::Load(event.FilePath); + Sound *sound = ResourceManager::Load(event.FilePath); if (sound == nullptr) { return false; } From 927c96d8631f18607563cd0f33f4a9742aa7718d Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Thu, 15 Oct 2015 13:44:16 +0200 Subject: [PATCH 07/13] TravellingSystem uses EMove. EMove and ERotate copied from Returngeance into TransportSystem. --- include/Game/CBackground.h | 2 +- include/Game/CKraken.h | 26 ++++++ include/Game/CTravels.h | 2 + include/Game/KrakenSystem.h | 51 +++++++++++ include/Game/LevelSystem.h | 2 + include/Game/PadSystem.h | 7 ++ include/Game/TravellingSystem.h | 5 ++ include/Transform/TransformSystem.h | 24 ++++++ src/game/Game/BallSystem.cpp | 9 +- src/game/Game/KrakenSystem.cpp | 36 ++++++++ src/game/Game/LevelSystem.cpp | 39 +++++---- src/game/Game/PadSystem.cpp | 9 ++ src/game/Game/TravellingSystem.cpp | 47 +++++++++- src/game/Transform/TransformSystem.cpp | 113 +++++++++++++++++++++++++ 14 files changed, 347 insertions(+), 25 deletions(-) create mode 100644 include/Game/CKraken.h create mode 100644 include/Game/KrakenSystem.h create mode 100644 src/game/Game/KrakenSystem.cpp diff --git a/include/Game/CBackground.h b/include/Game/CBackground.h index a87f10a..ec4a235 100644 --- a/include/Game/CBackground.h +++ b/include/Game/CBackground.h @@ -15,7 +15,7 @@ namespace Components struct Background : Component { - + float distanceLeftToCorrectTravelPosition; }; } diff --git a/include/Game/CKraken.h b/include/Game/CKraken.h new file mode 100644 index 0000000..aeca335 --- /dev/null +++ b/include/Game/CKraken.h @@ -0,0 +1,26 @@ +// +// Created by Adniklastrator on 2015-09-15. +// + +#ifndef DAYDREAM_CLIFE_H +#define DAYDREAM_CLIFE_H + +#include "Core/Component.h" + +namespace dd +{ + +namespace Components +{ + +struct Life : Component { + + int Number = 0; + +}; + +} + +} + +#endif //DAYDREAM_CLIFE_H diff --git a/include/Game/CTravels.h b/include/Game/CTravels.h index 9f4119b..9a7e659 100644 --- a/include/Game/CTravels.h +++ b/include/Game/CTravels.h @@ -17,6 +17,8 @@ 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; }; } diff --git a/include/Game/KrakenSystem.h b/include/Game/KrakenSystem.h new file mode 100644 index 0000000..7783964 --- /dev/null +++ b/include/Game/KrakenSystem.h @@ -0,0 +1,51 @@ +// +// Created by Adniklastrator on 2015-10-15. +// + +#ifndef DAYDREAM_KRAKENSYSTEM_H +#define DAYDREAM_KRAKENSYSTEM_H + + +#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 "Core/Camera.h" Camera Component + + +namespace dd +{ + +namespace Systems +{ + +class KrakenSystem : public System +{ +public: + KrakenSystem(World* world, std::shared_ptr eventBroker) + : System(world, eventBroker) + { } + + void Initialize() override; + void InitializeObjects(); + + void UpdateEntity(double dt, EntityID entity, EntityID parent) override; + + bool IsPaused() const { return m_Pause; } + void SetPause(const bool& pause) { m_Pause = pause; } +private: + + dd::EventRelay m_EPause; + bool OnPause(const dd::Events::Pause &event); + + + +}; + +} + +} + +#endif //DAYDREAM_KRAKENSYSTEM_H diff --git a/include/Game/LevelSystem.h b/include/Game/LevelSystem.h index 4b21091..f5d6fe5 100755 --- a/include/Game/LevelSystem.h +++ b/include/Game/LevelSystem.h @@ -18,6 +18,8 @@ #include "Rendering/CModel.h" #include "Rendering/CPointLight.h" +#include "Transform/EMove.h" + #include "Game/CBrick.h" #include "Game/CBall.h" #include "Game/CLife.h" diff --git a/include/Game/PadSystem.h b/include/Game/PadSystem.h index 6091f39..b1cd6ce 100755 --- a/include/Game/PadSystem.h +++ b/include/Game/PadSystem.h @@ -13,15 +13,22 @@ #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" diff --git a/include/Game/TravellingSystem.h b/include/Game/TravellingSystem.h index 9c5f54b..8364454 100644 --- a/include/Game/TravellingSystem.h +++ b/include/Game/TravellingSystem.h @@ -8,12 +8,15 @@ #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/EArrivedAtNewStage.h" #include "Game/EStageCleared.h" #include "Game/CTravels.h" +#include "Game/CBackground.h" namespace dd @@ -45,9 +48,11 @@ private: dd::EventRelay m_EPause; dd::EventRelay m_EStageCleared; + dd::EventRelay m_EArrivedAtNewStage; bool OnPause(const dd::Events::Pause &event); bool OnStageCleared(const dd::Events::StageCleared &event); + bool OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event); }; } diff --git a/include/Transform/TransformSystem.h b/include/Transform/TransformSystem.h index 7583fc3..608d8b8 100644 --- a/include/Transform/TransformSystem.h +++ b/include/Transform/TransformSystem.h @@ -39,14 +39,38 @@ public: TransformSystem(World* world, std::shared_ptr eventBroker) : System(world, eventBroker) { } + + void Initialize() override; void Update(double dt) override; + void UpdateEntity(double dt, EntityID entity, EntityID parent) override; Components::Transform AbsoluteTransform(EntityID entity); glm::vec3 AbsolutePosition(EntityID entity); glm::quat AbsoluteOrientation(EntityID entity); glm::vec3 AbsoluteScale(EntityID entity); + // Events + EventRelay m_EMove; + bool OnMove(const Events::Move &event); + EventRelay m_ERotate; + bool OnRotate(const Events::Rotate &event); private: + struct MoveItems + { + EntityID Entity; + glm::vec3 GoalPosition; + float Speed; + }; + std::unordered_map m_MoveItems; + std::multimap m_QueuedMoveItems; + struct RotationItems + { + EntityID Entity; + glm::quat GoalRotation; + double Time; + }; + std::unordered_map m_RotationItems; + std::multimap m_QueuedRotationItems; }; } diff --git a/src/game/Game/BallSystem.cpp b/src/game/Game/BallSystem.cpp index fa5e160..1d90cc5 100644 --- a/src/game/Game/BallSystem.cpp +++ b/src/game/Game/BallSystem.cpp @@ -167,7 +167,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID return; } } //Removing this made the wall collisions work again - else if (transformBall->Position.x > EdgeX()) { + /* else if (transformBall->Position.x > EdgeX()) { if (transformBall->Velocity.x > 0) { glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(1, 0)); transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); @@ -322,9 +322,6 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event) EventBroker->Publish(particleEvent); } - - - ballComponent->Combo = 56; if (!ballComponent->Waiting) { if (m_InkBlaster) { @@ -342,7 +339,8 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event) m_Sticky = false; m_Waiting = true; ballComponent->Sticky = true; - ballComponent->StickyPlacement = ballTransform->Position - padTransform->Position; + //ballComponent->StickyPlacement = ballTransform->Position - padTransform->Position; + ballComponent->StickyPlacement = glm::vec3(0, 0.5f, 0); ballComponent->SavedSpeed = glm::normalize(glm::vec3(x, y, 0.f)) * ballComponent->Speed; ballTransform->Velocity *= -1; Events::StickyAttachedToPad e; @@ -485,6 +483,7 @@ bool dd::Systems::BallSystem::OnMultiBall(const dd::Events::MultiBall &event) bool dd::Systems::BallSystem::OnStickyPad(const dd::Events::StickyPad &event) { m_Sticky = true; + m_StickyCounter = event.Times; return true; } diff --git a/src/game/Game/KrakenSystem.cpp b/src/game/Game/KrakenSystem.cpp new file mode 100644 index 0000000..fb67435 --- /dev/null +++ b/src/game/Game/KrakenSystem.cpp @@ -0,0 +1,36 @@ +// +// Created by Adniklastrator on 2015-10-15. +// + +#include "PrecompiledHeader.h" +#include "Game/KrakenSystem.h" + +void dd::Systems::KrakenSystem::Initialize() +{ + EVENT_SUBSCRIBE_MEMBER(m_EPause, &KrakenSystem::OnPause); + + InitializeObjects(); +} + +void dd::Systems::KrakenSystem::InitializeObjects() +{ + +} + +void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) +{ + if (IsPaused()) { + return; + } + +} + +bool dd::Systems::KrakenSystem::OnPause(const dd::Events::Pause &event) +{ + if (IsPaused()) { + SetPause(false); + } else { + SetPause(true); + } + return true; +} diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index 22f326c..bfbf654 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -53,6 +53,7 @@ void dd::Systems::LevelSystem::Initialize() transform->Position = glm::vec3(0.f, 0.f, -15.f); transform->Scale = glm::vec3(6.f, 6.f, 10.f); auto travels = m_World->AddComponent(t_halfPipe); + travels->CurrentlyTraveling = false; auto model = m_World->AddComponent(t_halfPipe); model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); @@ -60,22 +61,23 @@ void dd::Systems::LevelSystem::Initialize() auto t_halfPipe2 = m_World->CloneEntity(t_halfPipe); auto transform2 = m_World->GetComponent(t_halfPipe); - transform2->Position = glm::vec3(0.f, 34.6f, -15.f); + transform2->Position = glm::vec3(0.f, 34.6f, -15.f); //Halfpipe Value } //Background - { + /*{ auto background = m_World->CreateEntity(); auto transform = m_World->AddComponent(background); auto travels = m_World->AddComponent(background); + travels->CurrentlyTraveling = false; auto backgroundComponent = m_World->AddComponent(background); transform->Position = glm::vec3(0.f, 0.f, -30.f); transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f); auto sprite = m_World->AddComponent(background); sprite->SpriteFile = "Textures/Background.png"; m_World->CommitEntity(background); - } + }*/ // auto particleEmitter= m_World->AddComponent(Pe); //Water test @@ -184,7 +186,7 @@ void dd::Systems::LevelSystem::Initialize() std::shared_ptr physics = m_World->AddComponent(leftWall); physics->CollisionType = CollisionType::Type::Static; physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(/*CollisionLayer::Ball |*/ CollisionLayer::Brick); + physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); m_World->CommitEntity(leftWall); } @@ -207,7 +209,7 @@ void dd::Systems::LevelSystem::Initialize() std::shared_ptr physics = m_World->AddComponent(rightWall); physics->CollisionType = CollisionType::Type::Static; physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(/*CollisionLayer::Ball |*/ CollisionLayer::Brick); + physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); m_World->CommitEntity(rightWall); } @@ -222,6 +224,7 @@ void dd::Systems::LevelSystem::Initialize() std::shared_ptr cTemplate = m_World->AddComponent(m_BrickTemplate); auto travels = m_World->AddComponent(m_BrickTemplate); + travels->CurrentlyTraveling = false; cPhys->CollisionType = CollisionType::Type::Static; cPhys->GravityScale = 0.f; @@ -255,15 +258,19 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID if (templateCheck != nullptr){ return; } // Check the background. - auto model = m_World->GetComponent(entity); - if (model != nullptr) { - if (model->ModelFile == "Models/Test/halfpipe/Halfpipe.obj") { - auto transform = m_World->GetComponent(entity); - if (transform->Position.y <= -34.6) { - transform->Position.y = 34.6; - } - } - } + auto background = m_World->GetComponent(entity); + if (background != nullptr) { + auto transform = m_World->GetComponent(entity); + if (transform->Position.y <= -34.6) { //Halfpipe Value. + transform->Position.y = 34.6; + Events::Move e; + e.Entity = entity; + e.GoalPosition = glm::vec3(transform->Position.x, 34.6 + background->distanceLeftToCorrectTravelPosition, transform->Position.z); + e.Speed = 6.0f; + e.Queue = false; + EventBroker->Publish(e); + } + } auto brick = m_World->GetComponent(entity); if (brick != nullptr) { @@ -281,9 +288,11 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID EventBroker->Publish(e); } else if (brick->Type == StickyBrick) { Events::StickyPad e; + e.Times = 3; EventBroker->Publish(e); } else if (brick->Type == InkBlasterBrick) { Events::InkBlaster e; + e.Shots = 5; EventBroker->Publish(e); } else if(brick->Type == KrakenAttackBrick) { Events::KrakenAttack e; @@ -664,7 +673,7 @@ bool dd::Systems::LevelSystem::OnStageCleared(const dd::Events::StageCleared &ev m_CurrentLevel++; if (m_CurrentLevel < 6) { GetNextLevel(); - CreateLevel(12); + CreateLevel(12); //NextLevelDistance } else { // Win Events::ClusterClear e; diff --git a/src/game/Game/PadSystem.cpp b/src/game/Game/PadSystem.cpp index 17a8327..bc58553 100755 --- a/src/game/Game/PadSystem.cpp +++ b/src/game/Game/PadSystem.cpp @@ -240,9 +240,11 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) { EventBroker->Publish(e); } else if (val == GLFW_KEY_Y) { Events::StickyPad e; + e.Times = 3; EventBroker->Publish(e); } else if (val == GLFW_KEY_I) { Events::InkBlaster e; + e.Shots = 5; EventBroker->Publish(e); } else if (val == GLFW_KEY_K) { Events::KrakenAttack e; @@ -250,6 +252,13 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) { e.KrakenStrength = 0.1; e.PlayerStrength = 0.05; EventBroker->Publish(e); + } else if (val == GLFW_KEY_Q) { + Events::Move e; + e.Entity = Entity(); + e.GoalPosition = glm::vec3(0, 0, -10); + e.Speed = 5; + e.Queue = false; + EventBroker->Publish(e); } else if (val == GLFW_KEY_SPACE) { Events::ActionButton e; e.Position = Transform()->Position; diff --git a/src/game/Game/TravellingSystem.cpp b/src/game/Game/TravellingSystem.cpp index baa5dad..3e488d9 100644 --- a/src/game/Game/TravellingSystem.cpp +++ b/src/game/Game/TravellingSystem.cpp @@ -17,7 +17,7 @@ void dd::Systems::TravellingSystem::Update(double dt) return; } if (m_Travelling) { - if (m_DistanceTravelled > 12.f) { + if (m_DistanceTravelled > 12.f) { //NextLevelDistance m_DistanceTravelled = 0; m_Travelling = false; Events::ArrivedAtNewStage e; @@ -30,14 +30,47 @@ void dd::Systems::TravellingSystem::Update(double dt) void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) { + auto templateCheck = m_World->GetComponent(entity); + if (templateCheck != nullptr){ return; } + if (m_Travelling) { auto travels = m_World->GetComponent(entity); if (travels != nullptr) { - auto transform = m_World->GetComponent(entity); - if (transform != nullptr) { - transform->Position.y -= 6.0f * dt; + if (!travels->CurrentlyTraveling) { + auto transform = m_World->GetComponent(entity); + if (transform != nullptr) { + Events::Move e; + e.Entity = entity; + glm::vec3 position = transform->Position; + glm::vec3 goalPosition = position; + e.Queue = false; + e.Speed = 6; + goalPosition.y -= 12; //NextLevelDistance + if (goalPosition.y < -34.6) { //Halfpipe Value + auto background = m_World->GetComponent(entity); + if (background != nullptr) { + float yValue = position.y; // A negative value between -34.6 and -22.6; + yValue += 22.6; // A positive value between -12 and 0. The distance it should travel from 34.6; + background->distanceLeftToCorrectTravelPosition = yValue; + std::cout << "This happened." << std::endl; + } else { + m_World->RemoveEntity(entity); + return; + } + } + e.GoalPosition = goalPosition; + + travels->CurrentlyTraveling = true; + EventBroker->Publish(e); + //transform->Position.y -= 6.0f * dt; + } } } + } else { + auto travels = m_World->GetComponent(entity); + if (travels != nullptr) { + travels->CurrentlyTraveling = false; + } } } @@ -60,5 +93,11 @@ bool dd::Systems::TravellingSystem::OnStageCleared(const dd::Events::StageCleare if (event.ClearedStage < 5) { m_Travelling = true; } + return true; +} + +bool dd::Systems::TravellingSystem::OnArrivedAtNewStage(const dd::Events::ArrivedAtNewStage &event) +{ + return true; } \ No newline at end of file diff --git a/src/game/Transform/TransformSystem.cpp b/src/game/Transform/TransformSystem.cpp index d154ab3..bf932ae 100644 --- a/src/game/Transform/TransformSystem.cpp +++ b/src/game/Transform/TransformSystem.cpp @@ -20,12 +20,125 @@ #include "Transform/TransformSystem.h" #include "Core/World.h" +void dd::Systems::TransformSystem::Initialize() +{ + EVENT_SUBSCRIBE_MEMBER(m_EMove, &Systems::TransformSystem::OnMove); + EVENT_SUBSCRIBE_MEMBER(m_ERotate, &Systems::TransformSystem::OnRotate); +} + void dd::Systems::TransformSystem::Update(double dt) { return; } +void dd::Systems::TransformSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) +{ + if (m_MoveItems.find(entity) != m_MoveItems.end()) + { + auto transform = m_World->GetComponent(entity); + + glm::vec3 direction = glm::normalize(m_MoveItems[entity].GoalPosition - transform->Position); + glm::vec3 movement = direction * m_MoveItems[entity].Speed * (float)dt; + + glm::vec3 v1 = m_MoveItems[entity].GoalPosition - transform->Position; + glm::vec3 v2 = movement; + + if (glm::length(v2) >= glm::length(v1)) + { + transform->Position = m_MoveItems[entity].GoalPosition; + //transform->Velocity = glm::vec3(0, 0, 0); + + m_MoveItems.erase(entity); + + if (m_QueuedMoveItems.find(entity) != m_QueuedMoveItems.end()) + { + auto it = m_QueuedMoveItems.find(entity); + m_MoveItems[entity] = it->second; + m_QueuedMoveItems.erase(it->first); + } + } + else + { + transform->Position += movement; + //transform->Velocity = movement; + } + } + + if (m_RotationItems.find(entity) != m_RotationItems.end()) + { + auto transform = m_World->GetComponent(entity); + auto absolutetransform = AbsoluteTransform(entity); + + float percentage = dt / m_RotationItems[entity].Time; + m_RotationItems[entity].Time -= dt; + glm::clamp(percentage, 0.f, 1.0f); + transform->Orientation = glm::slerp(transform->Orientation, m_RotationItems[entity].GoalRotation, percentage); + + if (m_RotationItems[entity].Time <= 0) + { + m_RotationItems.erase(entity); + + if (m_QueuedRotationItems.find(entity) != m_QueuedRotationItems.end()) + { + auto it = m_QueuedRotationItems.find(entity); + m_RotationItems[entity] = it->second; + m_QueuedRotationItems.erase(it->first); + } + } + } +} + +bool dd::Systems::TransformSystem::OnRotate(const Events::Rotate &event) +{ + RotationItems item; + item.Entity = event.Entity; + item.GoalRotation = event.GoalRotation; + item.Time = event.Time; + + if (event.Queue) + { + if (m_RotationItems.find(event.Entity) != m_RotationItems.end()) + { + m_QueuedRotationItems.insert(std::make_pair(event.Entity, item)); + } + else + { + m_RotationItems[event.Entity] = item; + } + } + else + { + m_RotationItems[event.Entity] = item; + } + return true; +} + +bool dd::Systems::TransformSystem::OnMove(const Events::Move &event) +{ + MoveItems item; + item.Entity = event.Entity; + item.GoalPosition = event.GoalPosition; + item.Speed = event.Speed; + + if (event.Queue) + { + if (m_MoveItems.find(event.Entity) != m_MoveItems.end()) + { + m_QueuedMoveItems.insert(std::make_pair(event.Entity, item)); + } + else + { + m_MoveItems[event.Entity] = item; + } + } + else + { + m_MoveItems[event.Entity] = item; + } + return true; +} + glm::vec3 dd::Systems::TransformSystem::AbsolutePosition(EntityID entity) { glm::vec3 absPosition; From 64f903a6b6abe7b582f8bcaa0295ca53321cb8ac Mon Sep 17 00:00:00 2001 From: Stiffly Date: Thu, 15 Oct 2015 13:48:05 +0200 Subject: [PATCH 08/13] WIP --- include/Core/Engine.h | 20 +++++++++------- include/GUI/Button.h | 4 ++++ include/GUI/Slider.h | 6 +++++ include/GUI/TextureFrame.h | 1 + src/game/Sound/SoundSystem.cpp | 44 ++++++++++++++++------------------ 5 files changed, 43 insertions(+), 32 deletions(-) diff --git a/include/Core/Engine.h b/include/Core/Engine.h index 905eea4..b31458f 100755 --- a/include/Core/Engine.h +++ b/include/Core/Engine.h @@ -391,6 +391,8 @@ public: // I apologize about this. ScreenShakeUpdate(dt); + } else { + m_EventBroker->Process(); } m_EventBroker->Process(); m_FrameStack->UpdateLayered(dt); @@ -610,17 +612,17 @@ private: m_GameIsRunning = true; //Todo: Move this { - dd::Events::PlaySound e; - e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav"; - e.IsAmbient = true; - m_EventBroker->Publish(e); +// dd::Events::PlaySound e; +// e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav"; +// e.IsAmbient = true; +// m_EventBroker->Publish(e); } { - dd::Events::PlaySound e; - e.FilePath = "Sounds/BGM/water-flowing.wav"; - e.Gain = 0.3f; - e.IsAmbient = true; - m_EventBroker->Publish(e); +// dd::Events::PlaySound e; +// e.FilePath = "Sounds/BGM/water-flowing.wav"; +// e.Gain = 0.3f; +// e.IsAmbient = true; +// m_EventBroker->Publish(e); } return true; diff --git a/include/GUI/Button.h b/include/GUI/Button.h index dcfdae6..e25f8c0 100644 --- a/include/GUI/Button.h +++ b/include/GUI/Button.h @@ -75,6 +75,10 @@ protected: Events::ButtonEnter e; e.FrameName = m_Name; EventBroker->Publish(e); + Events::PlaySound soundEvent; + soundEvent.FilePath = "Sounds/GUI/hover.wav"; + EventBroker->Publish(soundEvent); + } else if (!isOver && m_MouseIsOver) { // Leave if (!m_IsDown) { if (!m_TextureReleased.empty()) { diff --git a/include/GUI/Slider.h b/include/GUI/Slider.h index de53245..a4987a6 100644 --- a/include/GUI/Slider.h +++ b/include/GUI/Slider.h @@ -7,6 +7,7 @@ #include "GUI/EButtonRelease.h" #include "GUI/ESliderUpdate.h" #include "Core/EMouseMove.h" +#include "Sound/EPlaySound.h" namespace dd { @@ -79,6 +80,11 @@ private: if (event.Button == m_SliderButton) { m_IsGrabbed = true; } + else { + Events::PlaySound e; + e.FilePath = "Sounds/GUI/click.wav"; + EventBroker->Publish(e); + } return true; } diff --git a/include/GUI/TextureFrame.h b/include/GUI/TextureFrame.h index 5db574c..1bc340d 100644 --- a/include/GUI/TextureFrame.h +++ b/include/GUI/TextureFrame.h @@ -62,6 +62,7 @@ public: if (m_Texture == nullptr) { m_Texture = ResourceManager::Load("Textures/Core/ErrorTexture.png"); } + SizeToTexture(); } diff --git a/src/game/Sound/SoundSystem.cpp b/src/game/Sound/SoundSystem.cpp index 65465e3..1e12456 100644 --- a/src/game/Sound/SoundSystem.cpp +++ b/src/game/Sound/SoundSystem.cpp @@ -6,12 +6,12 @@ dd::Systems::SoundSystem::~SoundSystem() for (auto &bgm : m_BGMSourcesToBuffers) { alSourceStop(bgm.first); alDeleteSources(1, &bgm.first); - bgm.second->~Sound(); + //bgm.second->~Sound(); } for (auto &sfx : m_SFXSourcesToBuffers) { alSourceStop(sfx.first); alDeleteSources(1, &sfx.first); - sfx.second->~Sound(); + //sfx.second->~Sound(); } m_BGMSourcesToBuffers.clear(); m_SFXSourcesToBuffers.clear(); @@ -40,22 +40,20 @@ void dd::Systems::SoundSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EStopSound, &SoundSystem::OnStopSound); EVENT_SUBSCRIBE_MEMBER(m_EMasterVolume, &SoundSystem::OnMasterVolume); - //Todo: Move this - { - dd::Events::PlaySound e; - e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav"; - e.IsAmbient = true; - EventBroker->Publish(e); - } - { - dd::Events::PlaySound e; - e.FilePath = "Sounds/BGM/water-flowing.wav"; - e.Gain = 0.3f; - e.IsAmbient = true; - EventBroker->Publish(e); - } - - +// //Todo: Move this +// { +// dd::Events::PlaySound e; +// e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav"; +// e.IsAmbient = true; +// EventBroker->Publish(e); +// } +// { +// dd::Events::PlaySound e; +// e.FilePath = "Sounds/BGM/water-flowing.wav"; +// e.Gain = 0.3f; +// e.IsAmbient = true; +// EventBroker->Publish(e); +// } } void dd::Systems::SoundSystem::Update(double dt) @@ -88,7 +86,7 @@ ALuint dd::Systems::SoundSystem::CreateSource() bool dd::Systems::SoundSystem::OnPlaySound(const dd::Events::PlaySound &event) { //Loading and binding sound buffer to source - Sound *sound = ResourceManager::Load(event.FilePath); + Sound *sound = ResourceManager::Load(event.FilePath); if (sound == nullptr) { return false; } @@ -181,10 +179,10 @@ bool dd::Systems::SoundSystem::OnContact(const dd::Events::Contact &event) //Send play-sound event { - dd::Events::PlaySound e; - e.FilePath = collisionSound->FilePath; - e.IsAmbient = false; - EventBroker->Publish(e); +// dd::Events::PlaySound e; +// e.FilePath = collisionSound->FilePath; +// e.IsAmbient = false; +// EventBroker->Publish(e); } return true; From b2127c6c4e0e8247a39631c1d6c826c53f2245b9 Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Thu, 15 Oct 2015 13:48:35 +0200 Subject: [PATCH 09/13] Fixed error so you can actually play LevelSystemAndSuch branch. --- include/Game/KrakenSystem.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/Game/KrakenSystem.h b/include/Game/KrakenSystem.h index 7783964..945a26e 100644 --- a/include/Game/KrakenSystem.h +++ b/include/Game/KrakenSystem.h @@ -36,12 +36,10 @@ public: bool IsPaused() const { return m_Pause; } void SetPause(const bool& pause) { m_Pause = pause; } private: + bool m_Pause = false; dd::EventRelay m_EPause; bool OnPause(const dd::Events::Pause &event); - - - }; } From bd59cd4108b14acaa52a684722d6279bf8f4da33 Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Thu, 15 Oct 2015 15:08:05 +0200 Subject: [PATCH 10/13] Implimented the basis for Kraken encounter. --- include/Core/Engine.h | 6 ++ include/Game/CKraken.h | 12 ++-- include/Game/EKrakenAppear.h | 26 +++++++++ include/Game/KrakenSystem.h | 14 +++++ include/Game/LevelSystem.h | 6 +- src/game/Game/KrakenSystem.cpp | 42 ++++++++++++++ src/game/Game/LevelSystem.cpp | 91 +++++++++++++++++++++--------- src/game/Game/TravellingSystem.cpp | 1 - 8 files changed, 164 insertions(+), 34 deletions(-) create mode 100644 include/Game/EKrakenAppear.h diff --git a/include/Core/Engine.h b/include/Core/Engine.h index b397501..1f61c0a 100755 --- a/include/Core/Engine.h +++ b/include/Core/Engine.h @@ -48,6 +48,7 @@ #include "Game/CProjectile.h" #include "Game/CBrick.h" #include "Game/CWall.h" +#include "Game/CKraken.h" #include "Game/CBackground.h" #include "Game/CTravels.h" #include "Game/CStickyAim.h" @@ -56,6 +57,7 @@ #include "Game/TravellingSystem.h" #include "Game/LifebuoySystem.h" #include "Game/ProjectileSystem.h" +#include "Game/KrakenSystem.h" #include "Game/Bricks/CPowerUpBrick.h" #include "Game/BrickComponents.h" @@ -128,6 +130,7 @@ public: m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); + m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); @@ -165,6 +168,9 @@ public: m_World->SystemFactory.Register( [this]() { return new Systems::TravellingSystem(m_World.get(), m_EventBroker); }); m_World->AddSystem(); + m_World->SystemFactory.Register( + [this]() { return new Systems::KrakenSystem(m_World.get(), m_EventBroker); }); + m_World->AddSystem(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); diff --git a/include/Game/CKraken.h b/include/Game/CKraken.h index aeca335..48ac112 100644 --- a/include/Game/CKraken.h +++ b/include/Game/CKraken.h @@ -1,9 +1,9 @@ // -// Created by Adniklastrator on 2015-09-15. +// Created by Adniklastrator on 2015-10-15. // -#ifndef DAYDREAM_CLIFE_H -#define DAYDREAM_CLIFE_H +#ifndef DAYDREAM_CKRAKEN_H +#define DAYDREAM_CKRAKEN_H #include "Core/Component.h" @@ -13,9 +13,9 @@ namespace dd namespace Components { -struct Life : Component { +struct Kraken : Component { - int Number = 0; + int Health = 10; }; @@ -23,4 +23,4 @@ struct Life : Component { } -#endif //DAYDREAM_CLIFE_H +#endif //DAYDREAM_CKRAKEN_H diff --git a/include/Game/EKrakenAppear.h b/include/Game/EKrakenAppear.h new file mode 100644 index 0000000..b2ce91b --- /dev/null +++ b/include/Game/EKrakenAppear.h @@ -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 diff --git a/include/Game/KrakenSystem.h b/include/Game/KrakenSystem.h index 945a26e..a94aa38 100644 --- a/include/Game/KrakenSystem.h +++ b/include/Game/KrakenSystem.h @@ -11,7 +11,16 @@ #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 "Game/EPause.h" +#include "Game/EKrakenAppear.h" +#include "Game/EKrakenAttack.h" +#include "Game/CTravels.h" +#include "Game/CKraken.h" +#include "Sound/CCollisionSound.h" //#include "Core/Camera.h" Camera Component @@ -37,9 +46,14 @@ public: void SetPause(const bool& pause) { m_Pause = pause; } private: bool m_Pause = false; + EntityID m_KrakenTemplate; dd::EventRelay m_EPause; + dd::EventRelay m_EKrakenAppear; + dd::EventRelay m_EKrakenAttack; bool OnPause(const dd::Events::Pause &event); + bool OnKrakenAppear(const dd::Events::KrakenAppear &event); + bool OnKrakenAttack(const dd::Events::KrakenAttack &event); }; } diff --git a/include/Game/LevelSystem.h b/include/Game/LevelSystem.h index f5d6fe5..08a8aca 100755 --- a/include/Game/LevelSystem.h +++ b/include/Game/LevelSystem.h @@ -49,6 +49,8 @@ #include "Game/ECreatePowerUp.h" #include "Game/EPowerUpTaken.h" +#include "Game/EKrakenAppear.h" + #include "Physics/CPhysics.h" #include "Physics/CCircleShape.h" #include "Physics/CRectangleShape.h" @@ -133,7 +135,7 @@ private: bool m_Initialized = false; bool m_Pause = false; int m_LooseBricks = 0; - int m_CurrentCluster = 1; + int m_CurrentCluster = 0; int m_CurrentLevel = 1; int m_MultiBalls = 0; int m_PowerUps = 0; @@ -153,6 +155,8 @@ private: const int InkBlasterBrick = 5; const int KrakenAttackBrick = 6; + const int Kraken = 100; + EntityID m_BrickTemplate; std::array m_Bricks; diff --git a/src/game/Game/KrakenSystem.cpp b/src/game/Game/KrakenSystem.cpp index fb67435..0fe0614 100644 --- a/src/game/Game/KrakenSystem.cpp +++ b/src/game/Game/KrakenSystem.cpp @@ -8,6 +8,33 @@ void dd::Systems::KrakenSystem::Initialize() { EVENT_SUBSCRIBE_MEMBER(m_EPause, &KrakenSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EKrakenAppear, &KrakenSystem::OnKrakenAppear); + EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &KrakenSystem::OnKrakenAttack); + + EntityID ent = m_World->CreateEntity(); + auto transform = m_World->AddComponent(ent); + auto model = m_World->AddComponent(ent); + std::shared_ptr cCircle = m_World->AddComponent(ent); + cCircle->Radius = 2; + std::shared_ptr cPhys = m_World->AddComponent(ent); + std::shared_ptr cTemplate = m_World->AddComponent(ent); + + auto travels = m_World->AddComponent(ent); + travels->CurrentlyTraveling = false; + + cPhys->CollisionType = CollisionType::Type::Static; + cPhys->GravityScale = 0.f; + cPhys->Category = CollisionLayer::Type::Brick; + cPhys->Mask = static_cast(CollisionLayer::Type::Ball | CollisionLayer::Type::Projectile | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy); + + model->ModelFile = "Models/Test/Ball/Sid.obj"; + transform->Position = glm::vec3(50, 50, -10); + //sound + auto collisionSound = m_World->AddComponent(ent); + collisionSound->FilePath = "Sounds/Brick/shortbrickbreak.wav"; + m_World->CommitEntity(ent); + + m_KrakenTemplate = ent; InitializeObjects(); } @@ -34,3 +61,18 @@ bool dd::Systems::KrakenSystem::OnPause(const dd::Events::Pause &event) } return true; } + +bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &event) +{ + auto ent = m_World->CloneEntity(m_KrakenTemplate); + m_World->RemoveComponent(ent); + auto transform = m_World->GetComponent(ent); + transform->Position = event.Position; + return true; +} + +bool dd::Systems::KrakenSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event) +{ + + return true; +} diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index bfbf654..9f93bfa 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -400,6 +400,11 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe auto transform = m_World->GetComponent(brick); auto cBrick = m_World->GetComponent(brick); auto model = m_World->GetComponent(brick); + + float x = line * spacesBetweenBricks.x; + float y = row * spacesBetweenBricks.y; + transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y + aboveLevel, -10.f); + if (typeInt == StandardBrick) { cBrick->Type = StandardBrick; auto type = m_World->AddComponent(brick); @@ -425,12 +430,15 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe cBrick->Type = KrakenAttackBrick; auto type = m_World->AddComponent(brick); model->Color = glm::vec4(0.f, 0.5f, 1.0f, .0f); + } else if (typeInt == Kraken) { + Events::KrakenAppear e; + e.Position = transform->Position; + e.Health = 10; + EventBroker->Publish(e); + m_World->RemoveEntity(brick); + return; } - - float x = line * spacesBetweenBricks.x; - float y = row * spacesBetweenBricks.y; - transform->Position = glm::vec3(x - 3, 5 - spaceToEdge - y + aboveLevel, -10.f); cBrick->Score = 10 * num; return; } @@ -700,6 +708,8 @@ void dd::Systems::LevelSystem::GetNextLevel() // 5 is ink blaster brick. // 6 is kraken attack brick. + // 100 is KRAKEN! + // wolor array determines the color of standard bricks. // w is white. // r is red. @@ -733,25 +743,8 @@ void dd::Systems::LevelSystem::GetNextLevel() glm::vec4 p4 = glm::vec4(125.f / 255.f, 0.f / 255.f, 147.f / 255.f, 1.f); - - if (m_CurrentCluster == 0) { if (m_CurrentLevel == 1) { - level = - {0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0}; - color = - {w, w, w, w, w, w, w, - w, w, w, w, w, w, w, - w, w, w, w, w, w, w, - w, w, w, w, w, w, w, - w, w, w, w, w, w, w, - w, w, w, w, w, w, w}; - } else if (m_CurrentLevel == 2) { level = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -766,7 +759,7 @@ void dd::Systems::LevelSystem::GetNextLevel() w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w}; - } else if (m_CurrentLevel == 3) { + } else if (m_CurrentLevel == 2) { level = {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, @@ -781,7 +774,7 @@ void dd::Systems::LevelSystem::GetNextLevel() w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w}; - } else if (m_CurrentLevel == 4) { + } else if (m_CurrentLevel == 3) { level = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -796,7 +789,7 @@ void dd::Systems::LevelSystem::GetNextLevel() w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w}; - } else if (m_CurrentLevel == 5) { + } else if (m_CurrentLevel == 4) { level = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -811,7 +804,37 @@ void dd::Systems::LevelSystem::GetNextLevel() w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w}; - } + } else if (m_CurrentLevel == 5) { + level = + {0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 100, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0}; + color = + {w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w}; + } else if (m_CurrentLevel == 6) { + level = + {0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0}; + color = + {w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w}; + } } else if (m_CurrentCluster == 1) { if (m_CurrentLevel == 1) { level = @@ -888,7 +911,23 @@ void dd::Systems::LevelSystem::GetNextLevel() w, br, w, g, w, lb1, w, y, w, y, d, b, w, b, w, br, w, w, w, lb1, w}; - } + } + else if (m_CurrentLevel == 6) { + level = + {0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 100, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0}; + color = + {w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w, + w, w, w, w, w, w, w}; + } } else if (m_CurrentCluster == 3) { } diff --git a/src/game/Game/TravellingSystem.cpp b/src/game/Game/TravellingSystem.cpp index 3e488d9..91377c3 100644 --- a/src/game/Game/TravellingSystem.cpp +++ b/src/game/Game/TravellingSystem.cpp @@ -52,7 +52,6 @@ void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, Ent float yValue = position.y; // A negative value between -34.6 and -22.6; yValue += 22.6; // A positive value between -12 and 0. The distance it should travel from 34.6; background->distanceLeftToCorrectTravelPosition = yValue; - std::cout << "This happened." << std::endl; } else { m_World->RemoveEntity(entity); return; From c5d88301ad2aba6ba0dcc6248d5207fdc092e3bc Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Mon, 19 Oct 2015 13:31:38 +0200 Subject: [PATCH 11/13] Implemented a Kraken State Machine that can grab the player, and the Generating Bricks option. --- assets/Sounds/Brick/LTTP_Boss_Hit.wav | Bin 0 -> 18860 bytes include/Game/CBrick.h | 1 + include/Game/CKraken.h | 9 +- include/Game/EBrickGenerating.h | 27 +++++ include/Game/KrakenSystem.h | 20 ++++ include/Game/LevelSystem.h | 11 ++- include/Game/PadSystem.h | 2 + include/Game/ScreenShakeSystem.h | 3 + src/game/Game/BallSystem.cpp | 2 +- src/game/Game/KrakenSystem.cpp | 71 +++++++++++++- src/game/Game/LevelSystem.cpp | 136 ++++++++++++++++++++++++-- src/game/Game/PadSystem.cpp | 5 + src/game/Game/ScreenShakeSystem.cpp | 18 +++- 13 files changed, 282 insertions(+), 23 deletions(-) create mode 100644 assets/Sounds/Brick/LTTP_Boss_Hit.wav create mode 100644 include/Game/EBrickGenerating.h diff --git a/assets/Sounds/Brick/LTTP_Boss_Hit.wav b/assets/Sounds/Brick/LTTP_Boss_Hit.wav new file mode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FvQ5A1G%ALoQZ;B@a*U zD(!yLS=r8L%WL_k`FT@I#YD2$EKSxONC!f<*^o+bnqmgxg|NVWvjk)Xavj7w*p}F?*g9-1 zbS%0HoJW(QPS_}HBRI?Z6r6O=z`p!ErJoAU#`m7u&jOGK;(E{SXZ}3JpZPOY21wa= zIzA7?=KoCd4W#RZLU7Ww1f1Ib3eF7n=FR(AQZ5LUfYbby;8b@x@HbEbt{)&}K7c}S z!n+uRdrx|Q2k;HRSMXm1pcI^;ssVW_K+ZDo)O#|#62$c0tHCMlW&jOXJvhODE$49=dngR~vsY;5PxFxY4bpcTaS zL2oJTz&AoCxO#p9*mwcXhl{~(H7U4y<3vB92RuuG-vK$M#1ucT-g_^|!E-P4#`pTA z=nMCT)IXum%SE5pir$!B&lbI&KYC;Oyj=Y9bkXPaqVHX=?~7k=dt-W^dgFS%B=iC} ziUOc7=09=0-ZpyuWb}I4_yxawi}ZTo=!4!gztZ)k?Y;ks?e)~rd;NFld*AD$qxVgp zCzC$kAAR0Jdh7j_=2wbdUm(AHmHhIr(&q`K@BS;U&$CG1Q=d1J-f&-R-}8UJ_r3jJ z^YzC3-@`BeH2+WkdwsC~>wWtF-VYr5`ftBp9Q!==^o9Cf|DQ1bPpbdZ S+y86af2-*KfBb))1OEdd@)`&L literal 0 HcmV?d00001 diff --git a/include/Game/CBrick.h b/include/Game/CBrick.h index a264125..e120fdb 100644 --- a/include/Game/CBrick.h +++ b/include/Game/CBrick.h @@ -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; diff --git a/include/Game/CKraken.h b/include/Game/CKraken.h index 48ac112..41c831d 100644 --- a/include/Game/CKraken.h +++ b/include/Game/CKraken.h @@ -16,7 +16,14 @@ 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. }; } diff --git a/include/Game/EBrickGenerating.h b/include/Game/EBrickGenerating.h new file mode 100644 index 0000000..6debb0b --- /dev/null +++ b/include/Game/EBrickGenerating.h @@ -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 diff --git a/include/Game/KrakenSystem.h b/include/Game/KrakenSystem.h index a94aa38..63eca64 100644 --- a/include/Game/KrakenSystem.h +++ b/include/Game/KrakenSystem.h @@ -5,6 +5,7 @@ #ifndef DAYDREAM_KRAKENSYSTEM_H #define DAYDREAM_KRAKENSYSTEM_H +#include #include "Core/System.h" #include "Core/CTransform.h" @@ -15,9 +16,11 @@ #include "Physics/CRectangleShape.h" #include "Physics/CCircleShape.h" #include "Physics/CPhysics.h" +#include "Physics/EContact.h" #include "Game/EPause.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" @@ -40,20 +43,37 @@ public: 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 m_Bricks; + std::array m_Colors; dd::EventRelay m_EPause; + dd::EventRelay m_EContact; dd::EventRelay m_EKrakenAppear; dd::EventRelay m_EKrakenAttack; + dd::EventRelay m_EBrickGenerating; bool OnPause(const dd::Events::Pause &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(); }; } diff --git a/include/Game/LevelSystem.h b/include/Game/LevelSystem.h index 08a8aca..56eb49f 100755 --- a/include/Game/LevelSystem.h +++ b/include/Game/LevelSystem.h @@ -50,6 +50,7 @@ #include "Game/EPowerUpTaken.h" #include "Game/EKrakenAppear.h" +#include "Game/EBrickGenerating.h" #include "Physics/CPhysics.h" #include "Physics/CCircleShape.h" @@ -91,7 +92,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); @@ -135,7 +136,7 @@ private: bool m_Initialized = false; bool m_Pause = false; int m_LooseBricks = 0; - int m_CurrentCluster = 0; + int m_CurrentCluster = 1; int m_CurrentLevel = 1; int m_MultiBalls = 0; int m_PowerUps = 0; @@ -162,6 +163,9 @@ private: std::array m_Bricks; std::array m_Colors; + std::array m_BrickSet; + std::array m_ColorSet; + dd::EventRelay m_EContact; dd::EventRelay m_EScoreEvent; dd::EventRelay m_EMultiBall; @@ -171,6 +175,7 @@ private: dd::EventRelay m_EStageCleared; dd::EventRelay m_EPause; dd::EventRelay m_EHitPad; + dd::EventRelay m_EBrickGenerating; bool OnContact(const dd::Events::Contact &event); bool OnScoreEvent(const dd::Events::ScoreEvent &event); @@ -181,6 +186,8 @@ private: bool OnStageCleared(const dd::Events::StageCleared &event); bool OnPause(const dd::Events::Pause &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); diff --git a/include/Game/PadSystem.h b/include/Game/PadSystem.h index b1cd6ce..28ace94 100755 --- a/include/Game/PadSystem.h +++ b/include/Game/PadSystem.h @@ -49,6 +49,8 @@ #include "Game/EScreenShake.h" #include "Game/EActionButton.h" +#include "Game/EBrickGenerating.h" + namespace dd { diff --git a/include/Game/ScreenShakeSystem.h b/include/Game/ScreenShakeSystem.h index 4755fbb..2f8b15f 100644 --- a/include/Game/ScreenShakeSystem.h +++ b/include/Game/ScreenShakeSystem.h @@ -5,6 +5,7 @@ #ifndef DAYDREAM_SCREENSHAKESYSTEM_H #define DAYDREAM_SCREENSHAKESYSTEM_H +#include #include "Core/System.h" #include "Core/CTransform.h" @@ -38,6 +39,8 @@ public: 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; diff --git a/src/game/Game/BallSystem.cpp b/src/game/Game/BallSystem.cpp index 1d90cc5..462084e 100644 --- a/src/game/Game/BallSystem.cpp +++ b/src/game/Game/BallSystem.cpp @@ -31,7 +31,7 @@ void dd::Systems::BallSystem::Initialize() { auto ent = m_World->CreateEntity(); std::shared_ptr transform = m_World->AddComponent(ent); - transform->Position = glm::vec3(0.f, 0.26f, -10.f); + transform->Position = glm::vec3(-20.f, 0.26f, -10.f); transform->Scale = glm::vec3(0.3f, 0.3f, 0.3f); transform->Velocity = glm::vec3(0.f, 0.f, 0.f); auto model = m_World->AddComponent(ent); diff --git a/src/game/Game/KrakenSystem.cpp b/src/game/Game/KrakenSystem.cpp index 0fe0614..5c8aad8 100644 --- a/src/game/Game/KrakenSystem.cpp +++ b/src/game/Game/KrakenSystem.cpp @@ -7,15 +7,20 @@ void dd::Systems::KrakenSystem::Initialize() { + std::random_device rd; + m_RandomGenerator = std::mt19937(rd()); EVENT_SUBSCRIBE_MEMBER(m_EPause, &KrakenSystem::OnPause); EVENT_SUBSCRIBE_MEMBER(m_EKrakenAppear, &KrakenSystem::OnKrakenAppear); EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &KrakenSystem::OnKrakenAttack); + EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &KrakenSystem::OnBrickGenerating); EntityID ent = m_World->CreateEntity(); auto transform = m_World->AddComponent(ent); auto model = m_World->AddComponent(ent); - std::shared_ptr cCircle = m_World->AddComponent(ent); - cCircle->Radius = 2; + auto kraken = m_World->AddComponent(ent); + std::shared_ptr cCircle = m_World->AddComponent(ent); + cCircle->Dimensions = glm::vec2(2, 4); + //cCircle->Radius = 2; std::shared_ptr cPhys = m_World->AddComponent(ent); std::shared_ptr cTemplate = m_World->AddComponent(ent); @@ -31,7 +36,7 @@ void dd::Systems::KrakenSystem::Initialize() transform->Position = glm::vec3(50, 50, -10); //sound auto collisionSound = m_World->AddComponent(ent); - collisionSound->FilePath = "Sounds/Brick/shortbrickbreak.wav"; + collisionSound->FilePath = "Sounds/Brick/LTTP_Boss_Hit.wav"; m_World->CommitEntity(ent); m_KrakenTemplate = ent; @@ -44,16 +49,66 @@ void dd::Systems::KrakenSystem::InitializeObjects() } +void dd::Systems::KrakenSystem::Update(double dt) +{ + +} + void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) { if (IsPaused()) { return; } + auto templateCheck = m_World->GetComponent(entity); + if (templateCheck != nullptr){ return; } + + auto kraken = m_World->GetComponent(entity); + if (kraken != nullptr) { + Events::KrakenAttack krakenAttack; + switch (kraken->CurrentAction) + { + case 1: // Idle + //m_KrakenTimer += dt; + if (m_KrakenTimer > m_KrakenSecondsToAction) { + m_KrakenTimer = 0; + std::uniform_real_distribution dist(1, 2.999f); + float random = dist(m_RandomGenerator); + std::cout << random << std::endl; + kraken->CurrentAction = random; + std::cout << kraken->CurrentAction << std::endl; + } + break; + case 2: // Grabbing + kraken->CurrentAction = 5; + krakenAttack.ChargeUpdate = 0; + krakenAttack.KrakenStrength = 0.1; + krakenAttack.PlayerStrength = 0.05; + EventBroker->Publish(krakenAttack); + break; + case 3: // Brick Generating + break; + case 4: // Moving + break; + case 5: // Taunting + if (m_ReturnToIdle) { + m_ReturnToIdle = false; + kraken->CurrentAction = Idle; + } + break; + default: + //LOG_INFO("Something's probably off about the random number generator."); + break; + } + } } bool dd::Systems::KrakenSystem::OnPause(const dd::Events::Pause &event) { + if (event.Type != "KrakenSystem" && event.Type != "All") { + return false; + } + if (IsPaused()) { SetPause(false); } else { @@ -68,11 +123,19 @@ bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &e m_World->RemoveComponent(ent); auto transform = m_World->GetComponent(ent); transform->Position = event.Position; + m_KrakenBattle = true; return true; } bool dd::Systems::KrakenSystem::OnKrakenAttack(const dd::Events::KrakenAttack &event) { - + if (event.ChargeUpdate >= 1) { + m_ReturnToIdle = true; + } return true; } + +bool dd::Systems::KrakenSystem::OnBrickGenerating(const dd::Events::BrickGenerating &event) +{ + return true; +} \ No newline at end of file diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index 9f93bfa..000a9d3 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -20,6 +20,7 @@ void dd::Systems::LevelSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared); EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause); EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad); + EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &LevelSystem::OnBrickGenerating); //PointLightTest { @@ -389,11 +390,11 @@ void dd::Systems::LevelSystem::CreateLevel(int aboveBasicLevel) SetRestarting(false); } -void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBetweenBricks, float spaceToEdge, int aboveLevel, int num, int typeInt, glm::vec4 colorVec) +EntityID dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBetweenBricks, float spaceToEdge, int aboveLevel, int num, int typeInt, glm::vec4 colorVec) { if (typeInt == EmptyBrickSpace) { SetNumberOfBricks(NumberOfBricks() - 1); - return; + return NULL; } auto brick = m_World->CloneEntity(m_BrickTemplate); m_World->RemoveComponent(brick); @@ -436,13 +437,128 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe e.Health = 10; EventBroker->Publish(e); m_World->RemoveEntity(brick); - return; + return brick; } cBrick->Score = 10 * num; - return; + return brick; } +bool dd::Systems::LevelSystem::OnBrickGenerating(const dd::Events::BrickGenerating &event) +{ + GetBrickSet(event.Set); + LOG_DEBUG("This is happening."); + + int rows = 2; + int lines = 7; + int getter = 0; + for (int i = 0; i < rows; i++) { + for (int j = 0; j < lines; j++) { + auto ent = CreateBrick(i, j, SpaceBetweenBricks(), SpaceToEdge(), -4, 1, m_BrickSet[getter], m_ColorSet[getter]); + if (ent != NULL) { + auto transform = m_World->GetComponent(ent); + Events::Move e; + e.GoalPosition = transform->Position; + transform->Position = event.Origin; + e.Entity = ent; + e.Speed = 6; + e.Queue = false; + EventBroker->Publish(e); + m_LooseBricks++; + SetNumberOfBricks(NumberOfBricks() + 1); + } + getter++; + } + } + return true; +} + +void dd::Systems::LevelSystem::GetBrickSet(int set) +{ + std::array level; + std::array color; + // Level array indicates type of brick. + // 0 is empty space. + // 1 is standard brick. + // 2 is multiball brick. + // 3 is lifebuoy brick. + // 4 is sticky brick. + // 5 is ink blaster brick. + // 6 is kraken attack brick. + + // color array determines the color of standard bricks. + // w is white. + // r is red. + // g is green. + // b is blue. + // y is yellow. + // c is cyan. + // m is magenta. + // d is dark. + // Feel free to make your own. + glm::vec4 w = glm::vec4(1, 1, 1, 0); + glm::vec4 r = glm::vec4(1, 0, 0, 0); + glm::vec4 g = glm::vec4(0, 1, 0, 0); + glm::vec4 b = glm::vec4(0, 0, 1, 0); + glm::vec4 y = glm::vec4(1, 1, 0, 0); + glm::vec4 c = glm::vec4(0, 1, 1, 0); + glm::vec4 m = glm::vec4(1, 0, 1, 0); + glm::vec4 d = glm::vec4(0, 0, 0, 0); + + if (set == 1) { + level = + {1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 }; + color = + {r, r, r, r, r, r, r, + r, r, r, r, r, r, r }; + } + else if (set == 2) { + level = + {2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2 }; + color = + {w, w, w, w, w, w, w, + w, w, w, w, w, w, w }; + } + else if (set == 3) { + level = + {0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }; + color = + {w, w, w, w, w, w, w, + w, w, w, w, w, w, w }; + } + else if (set == 4) { + level = + {0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }; + color = + {w, w, w, w, w, w, w, + w, w, w, w, w, w, w }; + } + else if (set == 5) { + level = + {0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }; + color = + {w, w, w, w, w, w, w, + w, w, w, w, w, w, w }; + } + else if (set == 6) { + level = + {0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }; + color = + {w, w, w, w, w, w, w, + w, w, w, w, w, w, w }; + } + + std::copy(std::begin(level), std::end(level), std::begin(m_BrickSet)); + std::copy(std::begin(color), std::end(color), std::begin(m_ColorSet)); +} + + void dd::Systems::LevelSystem::OnEntityRemoved(EntityID entity) { @@ -710,7 +826,7 @@ void dd::Systems::LevelSystem::GetNextLevel() // 100 is KRAKEN! - // wolor array determines the color of standard bricks. + // color array determines the color of standard bricks. // w is white. // r is red. // g is green. @@ -746,12 +862,12 @@ void dd::Systems::LevelSystem::GetNextLevel() if (m_CurrentCluster == 0) { if (m_CurrentLevel == 1) { level = - {1, 0, 0, 0, 0, 0, 0, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0}; + 0, 0, 0, 0, 0, 0, 1}; color = {w, w, w, w, w, w, w, w, w, w, w, w, w, w, @@ -761,9 +877,9 @@ void dd::Systems::LevelSystem::GetNextLevel() w, w, w, w, w, w, w}; } else if (m_CurrentLevel == 2) { level = - {0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -808,7 +924,7 @@ void dd::Systems::LevelSystem::GetNextLevel() level = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 100, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; diff --git a/src/game/Game/PadSystem.cpp b/src/game/Game/PadSystem.cpp index bc58553..97fb384 100755 --- a/src/game/Game/PadSystem.cpp +++ b/src/game/Game/PadSystem.cpp @@ -234,6 +234,11 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) { e.Time = 3; e.TimeTakenToCoolDown = 10; EventBroker->Publish(e); + } else if (val == GLFW_KEY_G) { + Events::BrickGenerating e; + e.Origin = glm::vec3(-5, 7, -10); + e.Set = 1; + EventBroker->Publish(e); } else if (val == GLFW_KEY_L) { Events::Lifebuoy e; e.Transform = Transform(); diff --git a/src/game/Game/ScreenShakeSystem.cpp b/src/game/Game/ScreenShakeSystem.cpp index e5166fa..ec322da 100644 --- a/src/game/Game/ScreenShakeSystem.cpp +++ b/src/game/Game/ScreenShakeSystem.cpp @@ -7,6 +7,8 @@ void dd::Systems::ScreenShakeSystem::Initialize() { + std::random_device rd; + m_RandomGenerator = std::mt19937(rd()); EVENT_SUBSCRIBE_MEMBER(m_EPause, &ScreenShakeSystem::OnPause); EVENT_SUBSCRIBE_MEMBER(m_EScreenShake, &ScreenShakeSystem::OnScreenShake); @@ -55,13 +57,15 @@ void dd::Systems::ScreenShakeSystem::UpdateEntity(double dt, EntityID entity, En else { //std::cout << "Timer: " << m_ShakeTimer << " End: " << m_ShakeEndTime << std::endl; } - m_Random.x = (rand() % m_ShakeIntensity); - m_Random.y = (rand() % m_ShakeIntensity); + std::uniform_real_distribution dist(-m_ShakeIntensity, m_ShakeIntensity); + //float impulseStrength = dist(m_RandomGenerator); + m_Random.x = dist(m_RandomGenerator) / 20; + m_Random.y = dist(m_RandomGenerator) / 20; - float half = m_ShakeIntensity / 2; + //float half = m_ShakeIntensity / 2; - m_Random.x = (m_Random.x - half) / 20; - m_Random.y = (m_Random.y - half) / 20; + //m_Random.x = (m_Random.x - half) / 20; + //m_Random.y = (m_Random.y - half) / 20; //std::cout << "X: " << randomX << " Y: " << randomY << std::endl; transform->Position = glm::vec3(m_Random); @@ -73,6 +77,10 @@ void dd::Systems::ScreenShakeSystem::UpdateEntity(double dt, EntityID entity, En bool dd::Systems::ScreenShakeSystem::OnPause(const dd::Events::Pause &event) { + if (event.Type != "ScreenShakeSystem" && event.Type != "All") { + return false; + } + if (IsPaused()) { SetPause(false); } else { From dc2ec46cfa6d5fdb8cad9615db67e21be4265bc0 Mon Sep 17 00:00:00 2001 From: Stiffly Date: Mon, 19 Oct 2015 13:53:42 +0200 Subject: [PATCH 12/13] Playing sound on EGameStart. Menu sounds. --- include/Game/EGameStart.h | 4 ---- include/Sound/SoundSystem.h | 4 ++++ src/game/Sound/SoundSystem.cpp | 43 +++++++++++++++++++--------------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/include/Game/EGameStart.h b/include/Game/EGameStart.h index bfee0fd..faf89a2 100644 --- a/include/Game/EGameStart.h +++ b/include/Game/EGameStart.h @@ -1,7 +1,3 @@ -// -// Created by Adam on 2015-09-25. -// - #ifndef EVENTS_EGAMESTART_H__ #define EVENTS_EGAMESTART_H__ diff --git a/include/Sound/SoundSystem.h b/include/Sound/SoundSystem.h index 3d02ef2..5349258 100644 --- a/include/Sound/SoundSystem.h +++ b/include/Sound/SoundSystem.h @@ -19,6 +19,7 @@ #include "Sound/EMasterVolume.h" #include "Physics/ECreateParticleSequence.h" #include "Physics/EContact.h" +#include "Game/EGameStart.h" namespace dd @@ -54,6 +55,9 @@ private: bool OnStopSound(const dd::Events::StopSound &event); dd::EventRelay m_EMasterVolume; bool OnMasterVolume(const dd::Events::MasterVolume &event); + dd::EventRelay m_EGameStart; + bool OnGameStart(const dd::Events::GameStart &event); + ALuint CreateSource(); }; diff --git a/src/game/Sound/SoundSystem.cpp b/src/game/Sound/SoundSystem.cpp index 78def4e..7580b99 100644 --- a/src/game/Sound/SoundSystem.cpp +++ b/src/game/Sound/SoundSystem.cpp @@ -39,24 +39,10 @@ void dd::Systems::SoundSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EPlaySFX, &SoundSystem::OnPlaySound); EVENT_SUBSCRIBE_MEMBER(m_EStopSound, &SoundSystem::OnStopSound); EVENT_SUBSCRIBE_MEMBER(m_EMasterVolume, &SoundSystem::OnMasterVolume); + EVENT_SUBSCRIBE_MEMBER(m_EGameStart, &SoundSystem::OnGameStart); m_SFXMasterVolume = ResourceManager::Load("Config.ini")->GetValue("Audio.SFXVolume", 1.f); m_BGMMasterVolume = ResourceManager::Load("Config.ini")->GetValue("Audio.BGMVolume", 1.f); - -// //Todo: Move this -// { -// dd::Events::PlaySound e; -// e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav"; -// e.IsAmbient = true; -// EventBroker->Publish(e); -// } -// { -// dd::Events::PlaySound e; -// e.FilePath = "Sounds/BGM/water-flowing.wav"; -// e.Gain = 0.3f; -// e.IsAmbient = true; -// EventBroker->Publish(e); -// } } void dd::Systems::SoundSystem::Update(double dt) @@ -182,14 +168,33 @@ bool dd::Systems::SoundSystem::OnContact(const dd::Events::Contact &event) //Send play-sound event { -// dd::Events::PlaySound e; -// e.FilePath = collisionSound->FilePath; -// e.IsAmbient = false; -// EventBroker->Publish(e); + dd::Events::PlaySound e; + e.FilePath = collisionSound->FilePath; + e.IsAmbient = false; + e.Gain = 0.8f; + EventBroker->Publish(e); } return true; } +bool dd::Systems::SoundSystem::OnGameStart(const dd::Events::GameStart &event) +{ + { + dd::Events::PlaySound e; + e.FilePath = "Sounds/BGM/under-the-sea-instrumental.wav"; + e.IsAmbient = true; + EventBroker->Publish(e); + } + { + dd::Events::PlaySound e; + e.FilePath = "Sounds/BGM/water-flowing.wav"; + e.Gain = 0.3f; + e.IsAmbient = true; + EventBroker->Publish(e); + } + return true; +} + From 7aa7e7cbf03ab7e61816a15aa187e2f5c4488876 Mon Sep 17 00:00:00 2001 From: PlatinumSkink Date: Mon, 19 Oct 2015 14:56:44 +0200 Subject: [PATCH 13/13] Pause and Resume events completed and game-crashing bug fixed. I think. --- include/Game/BallSystem.h | 3 +++ include/Game/EResume.h | 25 +++++++++++++++++ include/Game/HitLagSystem.h | 7 +++-- include/Game/KrakenSystem.h | 3 +++ include/Game/LevelSystem.h | 3 +++ include/Game/LifebuoySystem.h | 3 +++ include/Game/PadSystem.h | 3 +++ include/Game/ProjectileSystem.h | 3 +++ include/Game/ScreenShakeSystem.h | 3 +++ include/Game/TravellingSystem.h | 3 +++ include/Physics/PhysicsSystem.h | 3 +++ include/Rendering/AnimationSystem.h | 3 +++ src/game/Game/BallSystem.cpp | 34 ++++++++++++++++------- src/game/Game/HitLagSystem.cpp | 25 +++++++++++------ src/game/Game/KrakenSystem.cpp | 25 +++++++++++------ src/game/Game/LevelSystem.cpp | 21 ++++++++++----- src/game/Game/LifebuoySystem.cpp | 20 +++++++++----- src/game/Game/PadSystem.cpp | 37 +++++++++++++++++++------- src/game/Game/ProjectileSystem.cpp | 24 +++++++++++------ src/game/Game/ScreenShakeSystem.cpp | 19 ++++++++----- src/game/Game/TravellingSystem.cpp | 24 +++++++++++------ src/game/Physics/PhysicsSystem.cpp | 25 +++++++++++------ src/game/Rendering/AnimationSystem.cpp | 9 ++++++- 23 files changed, 241 insertions(+), 84 deletions(-) create mode 100644 include/Game/EResume.h diff --git a/include/Game/BallSystem.h b/include/Game/BallSystem.h index f74b52f..32a158d 100644 --- a/include/Game/BallSystem.h +++ b/include/Game/BallSystem.h @@ -32,6 +32,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" @@ -127,6 +128,7 @@ private: dd::EventRelay m_EInkBlaster; dd::EventRelay m_EInkBlasterOver; dd::EventRelay m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_Contact; dd::EventRelay m_EActionButton; dd::EventRelay m_EStageCleared; @@ -141,6 +143,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); diff --git a/include/Game/EResume.h b/include/Game/EResume.h new file mode 100644 index 0000000..7653b04 --- /dev/null +++ b/include/Game/EResume.h @@ -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 diff --git a/include/Game/HitLagSystem.h b/include/Game/HitLagSystem.h index 2d9fa3f..d8e31e2 100644 --- a/include/Game/HitLagSystem.h +++ b/include/Game/HitLagSystem.h @@ -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 m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_EHitLag; bool OnPause(const dd::Events::Pause &event); + bool OnResume(const dd::Events::Resume &event); bool OnHitLag(const dd::Events::HitLag &event); }; diff --git a/include/Game/KrakenSystem.h b/include/Game/KrakenSystem.h index 63eca64..fb836e8 100644 --- a/include/Game/KrakenSystem.h +++ b/include/Game/KrakenSystem.h @@ -18,6 +18,7 @@ #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" @@ -64,11 +65,13 @@ private: std::array m_Colors; dd::EventRelay m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_EContact; dd::EventRelay m_EKrakenAppear; dd::EventRelay m_EKrakenAttack; dd::EventRelay 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); diff --git a/include/Game/LevelSystem.h b/include/Game/LevelSystem.h index 56eb49f..691230e 100755 --- a/include/Game/LevelSystem.h +++ b/include/Game/LevelSystem.h @@ -44,6 +44,7 @@ #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" @@ -174,6 +175,7 @@ private: dd::EventRelay m_EPowerUpTaken; dd::EventRelay m_EStageCleared; dd::EventRelay m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_EHitPad; dd::EventRelay m_EBrickGenerating; @@ -185,6 +187,7 @@ 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); diff --git a/include/Game/LifebuoySystem.h b/include/Game/LifebuoySystem.h index 4897468..21c0378 100644 --- a/include/Game/LifebuoySystem.h +++ b/include/Game/LifebuoySystem.h @@ -15,6 +15,7 @@ #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" @@ -48,11 +49,13 @@ private: dd::EventRelay m_EContact; dd::EventRelay m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_ELifebuoy; dd::EventRelay 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); diff --git a/include/Game/PadSystem.h b/include/Game/PadSystem.h index 28ace94..d5b43aa 100755 --- a/include/Game/PadSystem.h +++ b/include/Game/PadSystem.h @@ -45,6 +45,7 @@ #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" @@ -118,6 +119,7 @@ private: dd::EventRelay m_EResetAll; dd::EventRelay m_ERaiseWater; dd::EventRelay m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_EKrakenAttack; dd::EventRelay m_EStickyPad; dd::EventRelay m_EStickyAttachedToPad; @@ -132,6 +134,7 @@ private: 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); diff --git a/include/Game/ProjectileSystem.h b/include/Game/ProjectileSystem.h index 14c3657..d4a6e11 100644 --- a/include/Game/ProjectileSystem.h +++ b/include/Game/ProjectileSystem.h @@ -16,6 +16,7 @@ #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" @@ -56,12 +57,14 @@ private: dd::EventRelay m_EContact; dd::EventRelay m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_EInkBlaster; dd::EventRelay m_EHitPad; dd::EventRelay 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); diff --git a/include/Game/ScreenShakeSystem.h b/include/Game/ScreenShakeSystem.h index 2f8b15f..62d31d6 100644 --- a/include/Game/ScreenShakeSystem.h +++ b/include/Game/ScreenShakeSystem.h @@ -13,6 +13,7 @@ #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 @@ -53,8 +54,10 @@ private: glm::vec3 m_Random; dd::EventRelay m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_EScreenShake; bool OnPause(const dd::Events::Pause &event); + bool OnResume(const dd::Events::Resume &event); bool OnScreenShake(const dd::Events::ScreenShake &event); diff --git a/include/Game/TravellingSystem.h b/include/Game/TravellingSystem.h index 8364454..6f9f2ce 100644 --- a/include/Game/TravellingSystem.h +++ b/include/Game/TravellingSystem.h @@ -13,6 +13,7 @@ #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" @@ -47,10 +48,12 @@ private: float m_DistanceTravelled = 0; dd::EventRelay m_EPause; + dd::EventRelay m_EResume; dd::EventRelay m_EStageCleared; dd::EventRelay 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); }; diff --git a/include/Physics/PhysicsSystem.h b/include/Physics/PhysicsSystem.h index bd37c74..4b0b3fb 100755 --- a/include/Physics/PhysicsSystem.h +++ b/include/Physics/PhysicsSystem.h @@ -32,6 +32,7 @@ #include "CRectangleShape.h" #include "Game/EPause.h" +#include "Game/EResume.h" #include "Game/CPad.h" #include "Game/CBrick.h" #include "Game/CBall.h" @@ -114,6 +115,8 @@ namespace dd bool SetImpulse(const Events::SetImpulse &event); dd::EventRelay m_EPause; bool OnPause(const dd::Events::Pause &event); + dd::EventRelay m_EResume; + bool OnResume(const dd::Events::Resume &event); dd::EventRelay m_EContact; bool OnContact(const dd::Events::Contact &event); EventRelay m_ECreateParticleSequence; diff --git a/include/Rendering/AnimationSystem.h b/include/Rendering/AnimationSystem.h index bbf0d23..4fe4cb8 100644 --- a/include/Rendering/AnimationSystem.h +++ b/include/Rendering/AnimationSystem.h @@ -5,6 +5,7 @@ #include "Core/World.h" #include "Rendering/CAnimation.h" #include "Game/EPause.h" +#include "Game/EResume.h" namespace dd { @@ -25,7 +26,9 @@ private: bool m_Paused = false; EventRelay m_EPause; + EventRelay m_EResume; bool OnPause(const Events::Pause& e); + bool OnResume(const Events::Resume& e); }; } diff --git a/src/game/Game/BallSystem.cpp b/src/game/Game/BallSystem.cpp index a12a300..04fecfb 100644 --- a/src/game/Game/BallSystem.cpp +++ b/src/game/Game/BallSystem.cpp @@ -21,7 +21,8 @@ void dd::Systems::BallSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &BallSystem::OnStickyPad); EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &BallSystem::OnInkBlaster); EVENT_SUBSCRIBE_MEMBER(m_EInkBlasterOver, &BallSystem::OnInkBlasterOver); - EVENT_SUBSCRIBE_MEMBER(m_EPause, &BallSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EPause, &BallSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &BallSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &BallSystem::OnActionButton); EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared); EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage); @@ -86,8 +87,13 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID { //TODO: When the ball collides with 2 bricks on the same frame it is reflected and then reflected again, make it reflect only once like a list or something? + if (IsPaused()) { + return; + } + auto ballComponent = m_World->GetComponent(entity); - if (IsPaused()) { + + /*if (IsPaused()) { if (ballComponent != nullptr) { auto transform = m_World->GetComponent(entity); @@ -107,7 +113,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID ballComponent->Paused = false; } } - } + }*/ auto templateCheck = m_World->GetComponent(entity); if (templateCheck != nullptr){ return; } @@ -211,18 +217,26 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID bool dd::Systems::BallSystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "BallSystem" && event.Type != "All") { + /*if (event.Type != "BallSystem" && event.Type != "All") { return false; - } + }*/ + + m_Pause = true; - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } return true; } +bool dd::Systems::BallSystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "BallSystem" && event.Type != "All") { + return false; + }*/ + + m_Pause = false; + + return true; +} + void dd::Systems::BallSystem::OnEntityCommit(EntityID entity) { diff --git a/src/game/Game/HitLagSystem.cpp b/src/game/Game/HitLagSystem.cpp index 8243900..6cb8547 100644 --- a/src/game/Game/HitLagSystem.cpp +++ b/src/game/Game/HitLagSystem.cpp @@ -8,6 +8,7 @@ void dd::Systems::HitLagSystem::Initialize() { EVENT_SUBSCRIBE_MEMBER(m_EPause, &HitLagSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &HitLagSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_EHitLag, &HitLagSystem::OnHitLag); } @@ -29,25 +30,33 @@ void dd::Systems::HitLagSystem::Update(double dt) void dd::Systems::HitLagSystem::FlipPause() { - Events::Pause e; - e.Type = CurrentType(); - EventBroker->Publish(e); + if (!IsPaused()) { + Events::Pause e; + e.Type = CurrentType(); + EventBroker->Publish(e); + } else { + Events::Resume e; + e.Type = CurrentType(); + EventBroker->Publish(e); + } } bool dd::Systems::HitLagSystem::OnPause(const dd::Events::Pause &event) { - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } + m_Pause = true; return true; } +bool dd::Systems::HitLagSystem::OnResume(const dd::Events::Resume &event) +{ + m_Pause = false; + return true; +} bool dd::Systems::HitLagSystem::OnHitLag(const dd::Events::HitLag &event) { if (HitLag()) { FlipPause(); + SetHitLagTimer(0); } SetHitLag(true); SetCurrentType(event.Type); diff --git a/src/game/Game/KrakenSystem.cpp b/src/game/Game/KrakenSystem.cpp index 5c8aad8..61f7088 100644 --- a/src/game/Game/KrakenSystem.cpp +++ b/src/game/Game/KrakenSystem.cpp @@ -10,6 +10,7 @@ void dd::Systems::KrakenSystem::Initialize() std::random_device rd; m_RandomGenerator = std::mt19937(rd()); EVENT_SUBSCRIBE_MEMBER(m_EPause, &KrakenSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &KrakenSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_EKrakenAppear, &KrakenSystem::OnKrakenAppear); EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &KrakenSystem::OnKrakenAttack); EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &KrakenSystem::OnBrickGenerating); @@ -51,7 +52,9 @@ void dd::Systems::KrakenSystem::InitializeObjects() void dd::Systems::KrakenSystem::Update(double dt) { - + if (m_Pause) { + return; + } } void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) @@ -105,18 +108,24 @@ void dd::Systems::KrakenSystem::UpdateEntity(double dt, EntityID entity, EntityI bool dd::Systems::KrakenSystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "KrakenSystem" && event.Type != "All") { + /*if (event.Type != "KrakenSystem" && event.Type != "All") { return false; - } + }*/ + + m_Pause = true; - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } return true; } +bool dd::Systems::KrakenSystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "KrakenSystem" && event.Type != "All") { + return false; + }*/ + m_Pause = false; + return true; +} + bool dd::Systems::KrakenSystem::OnKrakenAppear(const dd::Events::KrakenAppear &event) { auto ent = m_World->CloneEntity(m_KrakenTemplate); diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index 878058e..d3051e4 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -19,6 +19,7 @@ void dd::Systems::LevelSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken); EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared); EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &LevelSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad); EVENT_SUBSCRIBE_MEMBER(m_EBrickGenerating, &LevelSystem::OnBrickGenerating); @@ -338,18 +339,24 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID bool dd::Systems::LevelSystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "LevelSystem" && event.Type != "All") { + /*if (event.Type != "LevelSystem" && event.Type != "All") { return false; - } + }*/ + + m_Pause = true; - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } return true; } +bool dd::Systems::LevelSystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "LevelSystem" && event.Type != "All") { + return false; + }*/ + m_Pause = false; + return true; +} + void dd::Systems::LevelSystem::CreateBasicLevel(int rows, int lines, glm::vec2 spacesBetweenBricks, float spaceToEdge) { SetNumberOfBricks(rows * lines); diff --git a/src/game/Game/LifebuoySystem.cpp b/src/game/Game/LifebuoySystem.cpp index 3265a63..db0bd5f 100644 --- a/src/game/Game/LifebuoySystem.cpp +++ b/src/game/Game/LifebuoySystem.cpp @@ -11,6 +11,7 @@ void dd::Systems::LifebuoySystem::Initialize() { EVENT_SUBSCRIBE_MEMBER(m_EContact, &LifebuoySystem::OnContact); EVENT_SUBSCRIBE_MEMBER(m_EPause, &LifebuoySystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &LifebuoySystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_ELifebuoy, &LifebuoySystem::OnLifebuoy); EVENT_SUBSCRIBE_MEMBER(m_ELifebuoyHit, &LifebuoySystem::OnLifebuoyHit); @@ -88,18 +89,23 @@ void dd::Systems::LifebuoySystem::UpdateEntity(double dt, EntityID entity, Entit bool dd::Systems::LifebuoySystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "LifebuoySystem" && event.Type != "All") { + /*if (event.Type != "LifebuoySystem" && event.Type != "All") { return false; - } + }*/ + + m_Pause = true; - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } return true; } +bool dd::Systems::LifebuoySystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "LifebuoySystem" && event.Type != "All") { + return false; + }*/ + m_Pause = false; + return true; +} bool dd::Systems::LifebuoySystem::OnContact(const dd::Events::Contact &event) { diff --git a/src/game/Game/PadSystem.cpp b/src/game/Game/PadSystem.cpp index 97fb384..b366d64 100755 --- a/src/game/Game/PadSystem.cpp +++ b/src/game/Game/PadSystem.cpp @@ -31,6 +31,7 @@ void dd::Systems::PadSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EResetAll, &PadSystem::OnResetAll); EVENT_SUBSCRIBE_MEMBER(m_ERaiseWater, &PadSystem::OnRaiseWater); EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &PadSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &PadSystem::OnKrakenAttack); EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad); EVENT_SUBSCRIBE_MEMBER(m_EStickyAttachedToPad, &PadSystem::OnStickyAttachedToPad); @@ -80,6 +81,10 @@ void dd::Systems::PadSystem::Initialize() void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) { + if (m_Pause) { + return; + } + auto templateCheck = m_World->GetComponent(entity); if (templateCheck != nullptr){ return; } @@ -176,18 +181,24 @@ void dd::Systems::PadSystem::Update(double dt) bool dd::Systems::PadSystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "PadSystem" && event.Type != "All") { + /*if (event.Type != "PadSystem" && event.Type != "All") { return false; - } + }*/ + + m_Pause = true; - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } return true; } +bool dd::Systems::PadSystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "PadSystem" && event.Type != "All") { + return false; + }*/ + m_Pause = false; + return true; +} + bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) { int val = event.KeyCode; if (val == GLFW_KEY_UP) { @@ -217,9 +228,15 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) { e.padTransform = Transform(); EventBroker->Publish(e); } else if (val == GLFW_KEY_P) { - Events::Pause e; - e.Type = "All"; - EventBroker->Publish(e); + if (IsPaused()) { + Events::Resume e; + e.Type = "All"; + EventBroker->Publish(e); + } else { + Events::Pause e; + e.Type = "All"; + EventBroker->Publish(e); + } } else if (val == GLFW_KEY_H) { Events::HitLag e; e.Time = 0.2; diff --git a/src/game/Game/ProjectileSystem.cpp b/src/game/Game/ProjectileSystem.cpp index a6b9bc1..7e73f86 100644 --- a/src/game/Game/ProjectileSystem.cpp +++ b/src/game/Game/ProjectileSystem.cpp @@ -11,6 +11,7 @@ void dd::Systems::ProjectileSystem::Initialize() { EVENT_SUBSCRIBE_MEMBER(m_EContact, &ProjectileSystem::OnContact); EVENT_SUBSCRIBE_MEMBER(m_EPause, &ProjectileSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &ProjectileSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_EInkBlaster, &ProjectileSystem::OnInkBlaster); EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &ProjectileSystem::OnHitPad); EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &ProjectileSystem::OnActionButton); @@ -45,7 +46,9 @@ void dd::Systems::ProjectileSystem::Initialize() void dd::Systems::ProjectileSystem::Update(double dt) { - + if (m_Pause) { + return; + } } void dd::Systems::ProjectileSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) @@ -67,18 +70,23 @@ void dd::Systems::ProjectileSystem::UpdateEntity(double dt, EntityID entity, Ent bool dd::Systems::ProjectileSystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "ProjectileSystem" && event.Type != "All") { + /*if (event.Type != "ProjectileSystem" && event.Type != "All") { return false; - } + }*/ + + m_Pause = true; - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } return true; } +bool dd::Systems::ProjectileSystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "ProjectileSystem" && event.Type != "All") { + return false; + }*/ + m_Pause = false; + return true; +} bool dd::Systems::ProjectileSystem::OnContact(const dd::Events::Contact &event) { diff --git a/src/game/Game/ScreenShakeSystem.cpp b/src/game/Game/ScreenShakeSystem.cpp index ec322da..483cf6c 100644 --- a/src/game/Game/ScreenShakeSystem.cpp +++ b/src/game/Game/ScreenShakeSystem.cpp @@ -10,6 +10,7 @@ void dd::Systems::ScreenShakeSystem::Initialize() std::random_device rd; m_RandomGenerator = std::mt19937(rd()); EVENT_SUBSCRIBE_MEMBER(m_EPause, &ScreenShakeSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &ScreenShakeSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_EScreenShake, &ScreenShakeSystem::OnScreenShake); InitializeObjects(); @@ -77,17 +78,21 @@ void dd::Systems::ScreenShakeSystem::UpdateEntity(double dt, EntityID entity, En bool dd::Systems::ScreenShakeSystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "ScreenShakeSystem" && event.Type != "All") { + /*if (event.Type != "ScreenShakeSystem" && event.Type != "All") { return false; - } + }*/ - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } + m_Pause = true; return true; } +bool dd::Systems::ScreenShakeSystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "ScreenShakeSystem" && event.Type != "All") { + return false; + }*/ + m_Pause = false; + return true; +} bool dd::Systems::ScreenShakeSystem::OnScreenShake(const dd::Events::ScreenShake &event) { diff --git a/src/game/Game/TravellingSystem.cpp b/src/game/Game/TravellingSystem.cpp index 91377c3..13dc89b 100644 --- a/src/game/Game/TravellingSystem.cpp +++ b/src/game/Game/TravellingSystem.cpp @@ -8,6 +8,7 @@ void dd::Systems::TravellingSystem::Initialize() { EVENT_SUBSCRIBE_MEMBER(m_EPause, &TravellingSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &TravellingSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &TravellingSystem::OnStageCleared); } @@ -30,6 +31,10 @@ void dd::Systems::TravellingSystem::Update(double dt) void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) { + if (m_Pause) { + return; + } + auto templateCheck = m_World->GetComponent(entity); if (templateCheck != nullptr){ return; } @@ -75,17 +80,20 @@ void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, Ent bool dd::Systems::TravellingSystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "TravellingSystem" && event.Type != "All") { + /*if (event.Type != "TravellingSystem" && event.Type != "All") { return false; - } - - if (IsPaused()) { - SetPause(false); - } else { - SetPause(true); - } + }*/ + m_Pause = true; return true; } +bool dd::Systems::TravellingSystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "TravellingSystem" && event.Type != "All") { + return false; + }*/ + m_Pause = false; + return true; +} bool dd::Systems::TravellingSystem::OnStageCleared(const dd::Events::StageCleared &event) { diff --git a/src/game/Physics/PhysicsSystem.cpp b/src/game/Physics/PhysicsSystem.cpp index 6c55530..37619b0 100755 --- a/src/game/Physics/PhysicsSystem.cpp +++ b/src/game/Physics/PhysicsSystem.cpp @@ -23,6 +23,7 @@ void dd::Systems::PhysicsSystem::Initialize() InitializeWater(); EVENT_SUBSCRIBE_MEMBER(m_SetImpulse, &PhysicsSystem::SetImpulse); EVENT_SUBSCRIBE_MEMBER(m_EPause, &PhysicsSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &PhysicsSystem::OnResume); EVENT_SUBSCRIBE_MEMBER(m_ECreateParticleSequence, &PhysicsSystem::CreateParticleSequence); EVENT_SUBSCRIBE_MEMBER(m_EContact, &PhysicsSystem::OnContact); } @@ -244,6 +245,10 @@ void dd::Systems::PhysicsSystem::Update(double dt) void dd::Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) { + if (m_Pause) { + return; + } + auto particle = m_World->GetComponent(entity); auto pTemplate = m_World->GetComponent(entity); @@ -333,18 +338,22 @@ glm::vec3 dd::Systems::PhysicsSystem::VectorInterpolation(float timeProgress, st bool dd::Systems::PhysicsSystem::OnPause(const dd::Events::Pause &event) { - if (event.Type != "PhysicsSystem" && event.Type != "All") { + /*if (event.Type != "PhysicsSystem" && event.Type != "All") { return false; - } - - if (m_Pause) { - m_Pause = false; - } else { - m_Pause = true; - } + }*/ + m_Pause = true; return true; } +bool dd::Systems::PhysicsSystem::OnResume(const dd::Events::Resume &event) +{ + /*if (event.Type != "PhysicsSystem" && event.Type != "All") { + return false; + }*/ + m_Pause = false; + return true; +} + void dd::Systems::PhysicsSystem::OnEntityCommit(EntityID entity) { auto physicsComponent = m_World->GetComponent(entity); diff --git a/src/game/Rendering/AnimationSystem.cpp b/src/game/Rendering/AnimationSystem.cpp index 9887e70..35f853a 100644 --- a/src/game/Rendering/AnimationSystem.cpp +++ b/src/game/Rendering/AnimationSystem.cpp @@ -9,6 +9,7 @@ void dd::Systems::AnimationSystem::RegisterComponents(ComponentFactory* cf) void dd::Systems::AnimationSystem::Initialize() { EVENT_SUBSCRIBE_MEMBER(m_EPause, &AnimationSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EResume, &AnimationSystem::OnResume); } void dd::Systems::AnimationSystem::Update(double dt) @@ -30,6 +31,12 @@ void dd::Systems::AnimationSystem::Update(double dt) bool dd::Systems::AnimationSystem::OnPause(const Events::Pause& e) { - m_Paused = !m_Paused; + m_Paused = true; + return true; +} + +bool dd::Systems::AnimationSystem::OnResume(const Events::Resume& e) +{ + m_Paused = false; return true; }