From 98366ec03827ed028206deb82382c6e33a941869 Mon Sep 17 00:00:00 2001 From: William Moberg Date: Thu, 3 Mar 2016 16:59:17 +0100 Subject: [PATCH] PickClass used for class-picking, SwapToClassPick to swap camera. --- resources/DefaultInput.ini | 2 +- src/Engine/GUI/ButtonSystem.cpp | 2 ++ src/Game/Systems/PlayerSpawnSystem.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/DefaultInput.ini b/resources/DefaultInput.ini index 4dea88fd..b47c1e9b 100644 --- a/resources/DefaultInput.ini +++ b/resources/DefaultInput.ini @@ -28,4 +28,4 @@ P=SwitchToPlayer K=TakeDamage,1500 F2=PerformanceTimingResetAllTimers F3=PerformanceTimingCreateExcelData -F4=PickClass \ No newline at end of file +F4=SwapToClassPick \ No newline at end of file diff --git a/src/Engine/GUI/ButtonSystem.cpp b/src/Engine/GUI/ButtonSystem.cpp index cc9f2b47..b28c0119 100644 --- a/src/Engine/GUI/ButtonSystem.cpp +++ b/src/Engine/GUI/ButtonSystem.cpp @@ -45,6 +45,7 @@ bool ButtonSystem::OnMousePress(const Events::MousePress& e) EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity); eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"]; eInputCmd.Value = (float)button["InputCmdButton"]["PressValue"]; + m_EventBroker->Publish(eInputCmd); } else { Events::ButtonPressed ePressed; ePressed.Entity = m_PickEntity; @@ -72,6 +73,7 @@ bool ButtonSystem::OnMouseRelease(const Events::MouseRelease& e) EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity); eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"]; eInputCmd.Value = 0; + m_EventBroker->Publish(eInputCmd); } else { Events::ButtonReleased eReleased; eReleased.EntityName = m_PickEntity.Name(); diff --git a/src/Game/Systems/PlayerSpawnSystem.cpp b/src/Game/Systems/PlayerSpawnSystem.cpp index 7a6881c4..39fa1606 100644 --- a/src/Game/Systems/PlayerSpawnSystem.cpp +++ b/src/Game/Systems/PlayerSpawnSystem.cpp @@ -105,7 +105,7 @@ void PlayerSpawnSystem::Update(double dt) bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e) { - if (e.Command != "PickTeam" && e.Command != "PickClass") { + if (e.Command != "PickTeam" && e.Command != "SwapToClassPick") { return false; } @@ -117,7 +117,7 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e) if (IsClient && !LocalPlayer.Valid()) { // Set the camera as active, if it exists. // Find the respawn camera or class pick camera. - std::string camName = e.Command == "PickClass" ? "PickClassCamera" : "SpectatorCamera"; + std::string camName = e.Command == "SwapToClassPick" ? "PickClassCamera" : "SpectatorCamera"; EntityWrapper spectatorCam = m_World->GetFirstEntityByName(camName); if (spectatorCam.Valid() && spectatorCam.HasComponent("Camera")) { Events::SetCamera eSetCamera; @@ -137,14 +137,14 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e) for (; iter != m_SpawnRequests.end(); ++iter) { if (iter->PlayerID == e.PlayerID) { // If player wants to switch class, remove their spawn request. - if (e.Command == "PickClass") { + if (e.Command == "SwapToClassPick") { m_SpawnRequests.erase(iter); } break; } } - if (e.Command == "PickClass") { + if (e.Command == "SwapToClassPick") { return true; }