Skip to content

Commit

Permalink
add time limit to flag collision sound repeat
Browse files Browse the repository at this point in the history
increase far plane of drone camera to prevent clipping
fix inter-hole par calculation on scoreboard
  • Loading branch information
fallahn committed Aug 3, 2023
1 parent 7fdded4 commit 293a1b6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions samples/golf/buildnumber.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
13 changes: 10 additions & 3 deletions samples/golf/src/golf/GolfSoundDirector.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------
Matt Marchant 2021 - 2022
Matt Marchant 2021 - 2023
http://trederia.blogspot.com
Super Video Golf - zlib licence.
Expand Down Expand Up @@ -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<std::string, AudioID::Count> FilePaths =
Expand Down Expand Up @@ -486,7 +487,11 @@ void GolfSoundDirector::handleMessage(const cro::Message& msg)
break;
case -1:
//flag pole
playSound(AudioID::Pole, data.position).getComponent<cro::AudioEmitter>().setMixerChannel(MixerChannel::Effects);
if (m_flagSoundTime < 0)
{
playSound(AudioID::Pole, data.position).getComponent<cro::AudioEmitter>().setMixerChannel(MixerChannel::Effects);
m_flagSoundTime = 2.f;
}
break;
default:
playSound(AudioID::Ground, data.position).getComponent<cro::AudioEmitter>().setMixerChannel(MixerChannel::Effects);
Expand Down Expand Up @@ -557,6 +562,8 @@ void GolfSoundDirector::process(float dt)
{
SoundEffectsDirector::process(dt);

m_flagSoundTime -= dt;

if (m_crowdTimer.elapsed() > m_crowdTime)
{
if (m_crowdPositions)
Expand Down
3 changes: 3 additions & 0 deletions samples/golf/src/golf/GolfSoundDirector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion samples/golf/src/golf/GolfState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CameraFollower>().zoom.fov,
vpSize.x / vpSize.y, /*0.1f*/10.f, static_cast<float>(MapSize.x) * 1.25f,
vpSize.x / vpSize.y, 0.1f, static_cast<float>(MapSize.x) * 1.35f,
shadowQuality.cascadeCount);
cam.viewport = { 0.f, 0.f, 1.f, 1.f };

Expand Down
2 changes: 1 addition & 1 deletion samples/golf/src/golf/GolfStateUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::int32_t>(s) - m_holeData[j].par;
entry.parDiff += diff;
Expand Down

0 comments on commit 293a1b6

Please sign in to comment.