From 43f8963a01445e57a341470b1c28004607d0d1d9 Mon Sep 17 00:00:00 2001 From: yasin-ghannam Date: Sun, 18 Aug 2013 12:25:08 +0000 Subject: [PATCH] Goal SFX added. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/soccer@13498 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/modes/soccer_world.cpp | 10 ++++++---- src/modes/soccer_world.hpp | 1 + src/modes/world_status.cpp | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/modes/soccer_world.cpp b/src/modes/soccer_world.cpp index 2f8aea704..1ebf0e428 100644 --- a/src/modes/soccer_world.cpp +++ b/src/modes/soccer_world.cpp @@ -21,6 +21,7 @@ #include #include "audio/music_manager.hpp" +#include "audio/sfx_base.hpp" #include "io/file_manager.hpp" #include "karts/abstract_kart.hpp" #include "karts/kart.hpp" @@ -58,6 +59,7 @@ void SoccerWorld::init() fprintf(stderr, "No AI exists for this game mode\n"); exit(1); } + m_goal_sound = sfx_manager->createSoundSource("goal_scored"); m_goal_target = race_manager->getMaxGoal(); printf("Max Goal: %d\n", m_goal_target); } // init @@ -102,12 +104,12 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal) printf("*** GOOOOOOOOOAAAAAAALLLLLL!!!! (team: %d) ***\n", first_goal ? 0 : 1); m_team_goals[first_goal ? 0 : 1]++; printf("Score:\nTeam One %d : %d Team Two\n", m_team_goals[0], m_team_goals[1]); + World *world = World::getWorld(); + world->setPhase(WorldStatus::GOAL_PHASE); + world->setClockMode(World::CLOCK_COUNTDOWN, 1.0); + m_goal_sound->play(); } - World *world = World::getWorld(); - world->setPhase(WorldStatus::GOAL_PHASE); - world->setClockMode(World::CLOCK_COUNTDOWN, 1.0); - //m_check_goals_enabled = false; // TODO: remove? // Reset original positions for the soccer balls diff --git a/src/modes/soccer_world.hpp b/src/modes/soccer_world.hpp index bf4953302..e6a1fff06 100644 --- a/src/modes/soccer_world.hpp +++ b/src/modes/soccer_world.hpp @@ -50,6 +50,7 @@ private: /** Whether or not goals can be scored (they are disabled when a point is scored and re-enabled when the next game can be played)*/ bool m_can_score_points; + SFXBase *m_goal_sound; /** Team karts */ diff --git a/src/modes/world_status.cpp b/src/modes/world_status.cpp index b5a8cc0ba..2165e85bb 100644 --- a/src/modes/world_status.cpp +++ b/src/modes/world_status.cpp @@ -237,7 +237,7 @@ void WorldStatus::update(const float dt) // Nothing to do here. break; case GOAL_PHASE: - printf("%f", m_time); + // Nothing to do here as well. default: break; }