Compare commits

..

25 Commits

Author SHA1 Message Date
Tobias Dahl 7fa634ef7c Revert "Shadow will actually shut itself off and delete itself now" 2016-03-13 21:35:57 +01:00
Tobias Dahl 080f5ac856 Merge pull request #216 from teamfisk/ShadowOptimization
Shadow will actually shut itself off and delete itself now
2016-03-13 21:32:42 +01:00
Jace 4ecbef59bf Merge branch 'master' of github.com:teamfisk/TacticalZ 2016-03-13 21:29:59 +01:00
Jace 8a1217e8b5 Hoodwinked GLFW into creating a fullscreen windowed window by initializing it one pixel higher than the resolution height 2016-03-13 21:29:39 +01:00
FakeShemp 8e150da7ff Use CommonFunctions::DeleteTexture() instead 2016-03-13 21:25:04 +01:00
William Moberg c790b952fb Merge pull request #214 from teamfisk/PerfectSoundForRelease
Perfect sound for release
2016-03-13 21:01:21 +01:00
antc13 be3d75a5cf Merge branch 'master' of https://github.com/teamfisk/TacticalZ 2016-03-13 20:48:23 +01:00
antc13 b3c935c7cc Fixed rotation/translation on some objects on CP_Rocky2. They somehow got weird rotation values. 2016-03-13 20:48:05 +01:00
Jace f05b09ca7a Merge branch 'master' of github.com:teamfisk/TacticalZ 2016-03-13 19:54:22 +01:00
Jace e76740d72b Point lights child of a camera no longer visible to other cameras 2016-03-13 19:53:34 +01:00
Jace d3927de7cc Super fancy new class pick, don't overwrite plz 2016-03-13 19:51:01 +01:00
stiffly fe090504cf Now listens to SetCamera event and the background music should be working properly. 2016-03-13 17:35:05 +01:00
Adam Byléhn 672d6f884d Merge pull request #215 from teamfisk/RestartMap
Added pop up for client when server timeouts.
2016-03-13 16:33:51 +01:00
FakeShemp 9b5e4c10fd Shadow will actually shut itself off and delete itself now 2016-03-13 16:19:17 +01:00
stiffly fb400bb743 Merge remote-tracking branch 'origin/master' into PerfectSoundForRelease 2016-03-13 15:37:14 +01:00
stiffly aa2475dfd6 Stops bgm when the game is reset. 2016-03-13 15:36:56 +01:00
Jace 36c4837813 Merge pull request #213 from teamfisk/Dirtybit
Linker warnings fix
2016-03-13 15:29:45 +01:00
William Moberg 2fa3637018 Transform.cpp was deleted since stuff was moved to TransformSystem, takes care of linker warnings. 2016-03-13 15:26:35 +01:00
antc13 52e5e2527a Merge branch 'master' of https://github.com/teamfisk/TacticalZ 2016-03-13 15:21:44 +01:00
antc13 36253a8afd Made minor changes to light positions on CP_Rocky2. Replaced a model & changed glow value on some walls. 2016-03-13 15:21:29 +01:00
stiffly 5c343cb254 Merge remote-tracking branch 'origin/master' into PerfectSoundForRelease 2016-03-13 15:10:52 +01:00
Adam Byléhn b73595eed0 Merge pull request #210 from teamfisk/RestartMap
Restart map
2016-03-13 15:10:01 +01:00
Teejoon f9e640ffc6 Added borders to capture points so that you can see if your inside of outside when not looking down 2016-03-13 14:59:57 +01:00
stiffly f2c7a9f27a Merge remote-tracking branch 'origin/master' into PerfectSoundForRelease 2016-03-13 14:56:00 +01:00
stiffly 20d46f63c8 The main menu music would not start again when you returned to the main menu. 2016-03-13 00:16:55 +01:00
13 changed files with 14426 additions and 9773 deletions
+1 -1
Submodule assets updated: 504752c949...6ffc1ab82a
+3 -1
View File
@@ -30,6 +30,7 @@
#include "../Engine/Core/EPause.h"
#include "../Engine/Core/EComponentAttached.h"
#include "../Core/EPlayerSpawned.h"
#include "../Rendering/ESetCamera.h"
typedef std::pair<ALuint, std::vector<ALuint>> QueuedBuffers;
@@ -91,7 +92,6 @@ private:
void matchBGMLoop();
Source* m_CurrentBGM = nullptr;
Source* m_CurrentBGMCombo = nullptr;
bool m_DrumLoopHasBeenStarted = false;
// Logic
World* m_World = nullptr;
@@ -139,6 +139,8 @@ private:
bool OnPlayQueueOnEntity(const Events::PlayQueueOnEntity &e);
EventRelay<SoundManager, Events::ChangeBGM> m_EChangeBGM;
bool OnChangeBGM(const Events::ChangeBGM &e);
EventRelay<SoundManager, Events::SetCamera> m_ESetCamera;
bool OnSetCamera(const Events::SetCamera& e);
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="BlueCapturepointBorde" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform>
<Position X="0" Y="0.271661639" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Bottom">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>3</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.392156869" B="10" G="0.784313738" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.5" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="LowerMid">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>2</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0866025388" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.313725501" B="10" G="0.784313738" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.899999976" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="UpperMid">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>1</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0866025463" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.196078435" B="10" G="0.784313738" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="1.29999995" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Top">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.117647059" B="10" G="0.784313738" R="0"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="1.70000005" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="RedCapturepointBorde" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform>
<Position X="0" Y="0.271661639" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Bottom">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>3</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.392156869" B="0" G="0.235294119" R="21.9607849"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.5" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="LowerMid">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>2</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0866025388" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.313725501" B="0" G="0.235294119" R="21.9607849"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.899999976" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="UpperMid">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>1</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0866025463" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.196078435" B="0" G="0.235294119" R="21.9607849"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="1.29999995" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Top">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.117647059" B="0" G="0.235294119" R="21.9607849"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="1.70000005" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SpectatorCapturepointBorde" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform>
<Position X="0" Y="0.271661639" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="Bottom">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>3</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.392156869" B="8.03921604" G="8.03921604" R="8.03921604"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.5" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="LowerMid">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>2</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0866025388" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.313725501" B="10" G="8.03921604" R="8.03921604"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="0.899999976" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="UpperMid">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Time>1</Time>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0866025463" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.196078435" B="8.03921604" G="8.03921604" R="8.03921604"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="1.29999995" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Top">
<Components>
<c:FloatingEffect>
<Period>6</Period>
<Axis X="0" Y="1" Z="0"/>
<Amplitude>0.10000000149011612</Amplitude>
</c:FloatingEffect>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
<Color A="0.117647059" B="8.03921604" G="8.03921604" R="8.03921604"/>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0" Y="1.70000005" Z="0"/>
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
File diff suppressed because it is too large Load Diff
-162
View File
@@ -1,162 +0,0 @@
#include "Core/TransformSystem.h"
std::unordered_map<EntityWrapper, glm::vec3> TransformSystem::PositionCache;
std::unordered_map<EntityWrapper, glm::quat> TransformSystem::OrientationCache;
std::unordered_map<EntityWrapper, glm::vec3> TransformSystem::ScaleCache;
std::unordered_map<EntityWrapper, glm::mat4> TransformSystem::MatrixCache;
int TransformSystem::RecalculatedPositions = 0;
int TransformSystem::RecalculatedOrientations = 0;
int TransformSystem::RecalculatedScales = 0;
TransformSystem::TransformSystem(SystemParams params)
: System(params)
{
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &TransformSystem::OnEntityDeleted);
}
bool TransformSystem::OnEntityDeleted(const Events::EntityDeleted& e)
{
// Clean up deleted entity
PositionCache.erase(e.DeletedEntity);
OrientationCache.erase(e.DeletedEntity);
ScaleCache.erase(e.DeletedEntity);
MatrixCache.erase(e.DeletedEntity);
return true;
}
//glm::mat4 Transform::AbsoluteTransformation(EntityWrapper entity)
//{
// glm::mat4 t = glm::mat4(1.f);
//
// while (entity.Valid()) {
// t = glm::translate((const glm::vec3&)entity["Transform"]["Position"]) * glm::toMat4(glm::quat((const glm::vec3&)entity["Transform"]["Orientation"])) * glm::scale((const glm::vec3&)entity["Transform"]["Scale"]) * t;
// entity = entity.Parent();
// }
//
// return t;
//}
glm::vec3 TransformSystem::AbsolutePosition(World* world, EntityID entity)
{
return TransformSystem::AbsolutePosition(EntityWrapper(world, entity));
}
glm::vec3 TransformSystem::AbsolutePosition(EntityWrapper entity)
{
if (!entity.Valid()) {
return glm::vec3();
}
auto cacheIt = PositionCache.find(entity);
ComponentWrapper cTransform = entity["Transform"];
ComponentWrapper::SubscriptProxy cTransformPosition = cTransform["Position"];
if (cacheIt != PositionCache.end() && !cTransformPosition.Dirty(DirtySetType::Transform)) {
return cacheIt->second;
} else {
EntityWrapper parent = entity.Parent();
// Calculate position
glm::vec3 position = AbsolutePosition(parent) + TransformSystem::AbsoluteOrientation(parent) * (TransformSystem::AbsoluteScale(parent) * (const glm::vec3&)cTransformPosition);
// Cache it
PositionCache[entity] = position;
RecalculatedPositions++;
// Unset dirty flag
cTransformPosition.SetDirty(DirtySetType::Transform, false);
return position;
}
}
glm::vec3 TransformSystem::AbsoluteOrientationEuler(EntityWrapper entity)
{
glm::vec3 orientation;
while (entity.Valid()) {
ComponentWrapper transform = entity["Transform"];
orientation += (Field<glm::vec3>)transform["Orientation"];
entity = entity.Parent();
}
return orientation;
}
glm::quat TransformSystem::AbsoluteOrientation(World* world, EntityID entity)
{
return TransformSystem::AbsoluteOrientation(EntityWrapper(world, entity));
}
glm::quat TransformSystem::AbsoluteOrientation(EntityWrapper entity)
{
if (!entity.Valid()) {
return glm::quat();
}
auto cacheIt = OrientationCache.find(entity);
ComponentWrapper cTransform = entity["Transform"];
ComponentWrapper::SubscriptProxy cTransformOrientation = cTransform["Orientation"];
if (cacheIt != OrientationCache.end() && !cTransformOrientation.Dirty(DirtySetType::Transform)) {
return cacheIt->second;
} else {
EntityWrapper parent = entity.Parent();
// Calculate orientation
glm::quat orientation = AbsoluteOrientation(parent) * glm::quat((const glm::vec3&)cTransformOrientation);
// Cache it
OrientationCache[entity] = orientation;
RecalculatedOrientations++;
// Unset dirty flag
cTransformOrientation.SetDirty(DirtySetType::Transform, false);
return orientation;
}
}
glm::vec3 TransformSystem::AbsoluteScale(World* world, EntityID entity)
{
return TransformSystem::AbsoluteScale(EntityWrapper(world, entity));
}
glm::vec3 TransformSystem::AbsoluteScale(EntityWrapper entity)
{
if (!entity.Valid()) {
return glm::vec3(1.f);
}
auto cacheIt = ScaleCache.find(entity);
ComponentWrapper cTransform = entity["Transform"];
ComponentWrapper::SubscriptProxy cTransformScale = cTransform["Scale"];
if (cacheIt != ScaleCache.end() && !cTransformScale.Dirty(DirtySetType::Transform)) {
return cacheIt->second;
} else {
EntityWrapper parent = entity.Parent();
// Calculate scale
glm::vec3 scale = AbsoluteScale(parent) * (const glm::vec3&)cTransformScale;
// Cache it
ScaleCache[entity] = scale;
RecalculatedPositions++;
// Unset dirty flag
cTransformScale.SetDirty(DirtySetType::Transform, false);
return scale;
}
}
glm::mat4 TransformSystem::ModelMatrix(EntityID entityID, World* world)
{
return ModelMatrix(EntityWrapper(world, entityID));
}
glm::mat4 TransformSystem::ModelMatrix(EntityWrapper entity)
{
auto cacheIt = MatrixCache.find(entity);
ComponentWrapper cTransform = entity["Transform"];
bool isDirty = cTransform["Position"].Dirty(DirtySetType::Transform) || cTransform["Orientation"].Dirty(DirtySetType::Transform) || cTransform["Scale"].Dirty(DirtySetType::Transform);
if (cacheIt != MatrixCache.end() && !isDirty) {
return cacheIt->second;
} else {
glm::mat4 matrix = glm::translate(AbsolutePosition(entity)) * glm::toMat4(AbsoluteOrientation(entity)) * glm::scale(AbsoluteScale(entity));
MatrixCache[entity] = matrix;
return matrix;
}
}
glm::vec3 TransformSystem::TransformPoint(const glm::vec3& point, const glm::mat4& matrix)
{
return glm::vec3(matrix * glm::vec4(point.x, point.y, point.z, 1));
}
+5
View File
@@ -362,6 +362,11 @@ void RenderSystem::fillPointLights(std::list<std::shared_ptr<RenderJob>>& jobs,
continue;
}
EntityWrapper entity(world, pointlightC.EntityID);
if (!isEntityVisible(entity)) {
continue;
}
std::shared_ptr<PointLightJob> pointLightJob = std::shared_ptr<PointLightJob>(new PointLightJob(transformC, pointlightC, m_World));
jobs.push_back(pointLightJob);
}
+12 -3
View File
@@ -67,10 +67,19 @@ void Renderer::InitializeWindow()
// Create a window
GLFWmonitor* monitor = nullptr;
if (m_Fullscreen) {
monitor = glfwGetPrimaryMonitor();
//monitor = glfwGetPrimaryMonitor();
//const GLFWvidmode* mode = glfwGetVideoMode(monitor);
//glfwWindowHint(GLFW_RED_BITS, mode->redBits);
//glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
//glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
//glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);
glfwWindowHint(GLFW_DECORATED, false);
glfwWindowHint(GLFW_AUTO_ICONIFY, false);
}
//glfwWindowHint(GLFW_SAMPLES, 8);
m_Window = glfwCreateWindow(m_Resolution.Width, m_Resolution.Height, "daydream", monitor, nullptr);
//glfwWindowHint(GLFW_SAMPLES, 8);
m_Window = glfwCreateWindow(m_Resolution.Width, m_Resolution.Height + 1, "daydream", monitor, nullptr);
if (!m_Window) {
LOG_ERROR("GLFW: Failed to create window");
exit(EXIT_FAILURE);
+38 -21
View File
@@ -30,10 +30,7 @@ SoundManager::SoundManager(World* world, EventBroker* eventBroker)
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundManager::OnPlayerSpawned);
EVENT_SUBSCRIBE_MEMBER(m_EPlayQueueOnEntity, &SoundManager::OnPlayQueueOnEntity);
EVENT_SUBSCRIBE_MEMBER(m_EChangeBGM, &SoundManager::OnChangeBGM);
Events::ChangeBGM e;
e.FilePath = "Audio/bgm/MenuMusic.wav";
m_EventBroker->Publish(e);
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &SoundManager::OnSetCamera);
}
SoundManager::~SoundManager()
@@ -67,8 +64,7 @@ void SoundManager::Update(double dt)
deleteInactiveEmitters();
updateEmitters(dt);
updateListener(dt);
if (m_DrumLoopHasBeenStarted)
matchBGMLoop();
matchBGMLoop();
}
void SoundManager::deleteInactiveEmitters()
@@ -363,15 +359,6 @@ bool SoundManager::OnPlayerSpawned(const Events::PlayerSpawned &e)
{
if (e.PlayerID == -1) { // Local player
m_LocalPlayer = e.Player;
if (m_DrumLoopHasBeenStarted) {
return true;
}
m_CurrentBGMCombo = createSource("Audio/BGM/Layer2.wav");
m_CurrentBGMCombo->Type = SoundType::BGM;
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
setGain(m_CurrentBGMCombo, 0);
playSound(m_CurrentBGMCombo);
m_DrumLoopHasBeenStarted = true;
return true;
}
return false;
@@ -394,7 +381,9 @@ bool SoundManager::OnPlayQueueOnEntity(const Events::PlayQueueOnEntity &e)
bool SoundManager::OnChangeBGM(const Events::ChangeBGM &e)
{
if (m_CurrentBGM != nullptr) {
stopSound(m_CurrentBGM);
if (getSourceState(m_CurrentBGM->ALsource) == AL_PLAYING) {
stopSound(m_CurrentBGM);
}
}
m_CurrentBGM = createSource(e.FilePath);
m_CurrentBGM->Type = SoundType::BGM;
@@ -403,6 +392,34 @@ bool SoundManager::OnChangeBGM(const Events::ChangeBGM &e)
return true;
}
bool SoundManager::OnSetCamera(const Events::SetCamera& e)
{
if (e.CameraEntity.Name() == "Overview_Camera_Start_Menu") {
if (m_CurrentBGMCombo != nullptr) {
if (getSourceState(m_CurrentBGMCombo->ALsource) == AL_PLAYING) {
stopSound(m_CurrentBGMCombo);
}
}
Events::ChangeBGM changeBGM;
changeBGM.FilePath = "Audio/BGM/MenuMusic.wav";
m_EventBroker->Publish(changeBGM);
} else if (e.CameraEntity.Name() == "PickTeamCamera") {
Events::ChangeBGM changeBGM;
changeBGM.FilePath = "Audio/BGM/Layer1.wav";
m_EventBroker->Publish(changeBGM);
if (m_CurrentBGMCombo != nullptr) {
if (getSourceState(m_CurrentBGMCombo->ALsource) == AL_PLAYING) {
stopSound(m_CurrentBGMCombo);
}
}
m_CurrentBGMCombo = createSource("Audio/BGM/Layer2.wav");
m_CurrentBGMCombo->Type = SoundType::BGM;
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
setGain(m_CurrentBGMCombo, 0);
playSound(m_CurrentBGMCombo);
}
}
ALenum SoundManager::getSourceState(ALuint source)
{
ALenum state;
@@ -419,14 +436,14 @@ void SoundManager::setSoundProperties(Source* source, ComponentWrapper* soundCom
{
float gain;
switch (source->Type) {
case SoundType::SFX:
gain = m_SFXVolumeChannel;
case SoundType::SFX:
gain = m_SFXVolumeChannel;
break;
case SoundType::BGM:
case SoundType::BGM:
gain = m_BGMVolumeChannel;
break;
case SoundType::Announcer:
gain = m_AnnouncerVolumeChannel;
case SoundType::Announcer:
gain = m_AnnouncerVolumeChannel;
break;
default:
gain = 1.f;
-5
View File
@@ -30,11 +30,6 @@ bool SoundSystem::OnPlayerSpawned(const Events::PlayerSpawned &e)
Events::PlayAnonuncerVoice go;
go.FilePath = "Audio/Announcer/" + m_Announcer + "/Go.wav";
m_EventBroker->Publish(go);
{
Events::ChangeBGM ev;
ev.FilePath = "Audio/BGM/Layer1.wav";
m_EventBroker->Publish(ev);
}
}
return true;
}
+5 -1
View File
@@ -61,7 +61,11 @@ bool SpectatorCameraSystem::OnInputCommand(const Events::InputCommand& e)
// TODO: 1 Signifies spectator, should probably have real enum here later.
// Spectators should never end up at the class select, instead put them at the SpectatorCamera.
if (swapToClass && m_PickedTeam != 1) {
camName = "PickClassCamera";
if (m_PickedTeam == 2) {
camName = "PickClassCameraRed";
} else if (m_PickedTeam == 3) {
camName = "PickClassCameraBlue";
}
} else if (e.Command == "SwapToTeamPick") {
camName = "PickTeamCamera";
} else {