From 293a1b6cefaee4e4cca99faff5fe68d7b787c9b3 Mon Sep 17 00:00:00 2001 From: fallahn Date: Thu, 3 Aug 2023 10:04:32 +0100 Subject: [PATCH] add time limit to flag collision sound repeat increase far plane of drone camera to prevent clipping fix inter-hole par calculation on scoreboard --- samples/golf/buildnumber.h | 4 ++-- samples/golf/src/golf/GolfSoundDirector.cpp | 13 ++++++++++--- samples/golf/src/golf/GolfSoundDirector.hpp | 3 +++ samples/golf/src/golf/GolfState.cpp | 2 +- samples/golf/src/golf/GolfStateUI.cpp | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/samples/golf/buildnumber.h b/samples/golf/buildnumber.h index f2965aabd..cfc905ca1 100644 --- a/samples/golf/buildnumber.h +++ b/samples/golf/buildnumber.h @@ -3,7 +3,7 @@ #ifndef BUILD_NUMBER_H_ #define BUILD_NUMBER_H_ -#define BUILDNUMBER 1066 -#define BUILDNUMBER_STR "1066" +#define BUILDNUMBER 1069 +#define BUILDNUMBER_STR "1069" #endif /* BUILD_NUMBER_H_ */ diff --git a/samples/golf/src/golf/GolfSoundDirector.cpp b/samples/golf/src/golf/GolfSoundDirector.cpp index eb1688258..cd1ad26d0 100644 --- a/samples/golf/src/golf/GolfSoundDirector.cpp +++ b/samples/golf/src/golf/GolfSoundDirector.cpp @@ -1,6 +1,6 @@ /*----------------------------------------------------------------------- -Matt Marchant 2021 - 2022 +Matt Marchant 2021 - 2023 http://trederia.blogspot.com Super Video Golf - zlib licence. @@ -64,7 +64,8 @@ GolfSoundDirector::GolfSoundDirector(cro::AudioResource& ar) m_honourID (0), m_newHole (false), m_crowdPositions (nullptr), - m_crowdTime (MinCrowdTime) + m_crowdTime (MinCrowdTime), + m_flagSoundTime (0.f) { //this must match with AudioID enum static const std::array FilePaths = @@ -486,7 +487,11 @@ void GolfSoundDirector::handleMessage(const cro::Message& msg) break; case -1: //flag pole - playSound(AudioID::Pole, data.position).getComponent().setMixerChannel(MixerChannel::Effects); + if (m_flagSoundTime < 0) + { + playSound(AudioID::Pole, data.position).getComponent().setMixerChannel(MixerChannel::Effects); + m_flagSoundTime = 2.f; + } break; default: playSound(AudioID::Ground, data.position).getComponent().setMixerChannel(MixerChannel::Effects); @@ -557,6 +562,8 @@ void GolfSoundDirector::process(float dt) { SoundEffectsDirector::process(dt); + m_flagSoundTime -= dt; + if (m_crowdTimer.elapsed() > m_crowdTime) { if (m_crowdPositions) diff --git a/samples/golf/src/golf/GolfSoundDirector.hpp b/samples/golf/src/golf/GolfSoundDirector.hpp index 7b34b0d14..8ed2acb91 100644 --- a/samples/golf/src/golf/GolfSoundDirector.hpp +++ b/samples/golf/src/golf/GolfSoundDirector.hpp @@ -167,6 +167,9 @@ class GolfSoundDirector final : public SoundEffectsDirector cro::Clock m_crowdTimer; cro::Time m_crowdTime; + //fudge to stop double flag collision sound + float m_flagSoundTime; + cro::Entity playSound(std::int32_t, glm::vec3, float = 1.f); void playSoundDelayed(std::int32_t, glm::vec3, float, float = 1.f, std::uint8_t = 1/*MixerChannel::Effects*/); cro::Entity playAvatarSound(std::int32_t, const std::string&, glm::vec3); diff --git a/samples/golf/src/golf/GolfState.cpp b/samples/golf/src/golf/GolfState.cpp index 369ade14f..b29445b8d 100644 --- a/samples/golf/src/golf/GolfState.cpp +++ b/samples/golf/src/golf/GolfState.cpp @@ -4282,7 +4282,7 @@ void GolfState::buildScene() { auto vpSize = glm::vec2(cro::App::getWindow().getSize()); cam.setPerspective((m_sharedData.fov * cro::Util::Const::degToRad) * camEnt.getComponent().zoom.fov, - vpSize.x / vpSize.y, /*0.1f*/10.f, static_cast(MapSize.x) * 1.25f, + vpSize.x / vpSize.y, 0.1f, static_cast(MapSize.x) * 1.35f, shadowQuality.cascadeCount); cam.viewport = { 0.f, 0.f, 1.f, 1.f }; diff --git a/samples/golf/src/golf/GolfStateUI.cpp b/samples/golf/src/golf/GolfStateUI.cpp index 0d10fe162..cb301cd97 100644 --- a/samples/golf/src/golf/GolfStateUI.cpp +++ b/samples/golf/src/golf/GolfStateUI.cpp @@ -2238,7 +2238,7 @@ void GolfState::updateScoreboard(bool updateParDiff) //we still want to count the current number of strokes... if (s) { - if (updateParDiff || j < (m_currentHole - 1)) + if (updateParDiff || j < (m_currentHole/* - 1*/)) { auto diff = static_cast(s) - m_holeData[j].par; entry.parDiff += diff;