Applied (a slightly modified) version of Paul's menu music
patch and added a main theme music. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1463 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
3a3545c058
commit
1a5b7bd7e7
@ -8,6 +8,7 @@
|
||||
(grid-order 1 ) ;; order for grand prix, 1 is most
|
||||
;; points 1st, 0 is least points
|
||||
;; 1st
|
||||
(title-music "oggs/main_theme.ogg")
|
||||
|
||||
;; Attachment related parameters
|
||||
;; -----------------------------
|
||||
|
BIN
oggs/main_theme.ogg
Normal file
BIN
oggs/main_theme.ogg
Normal file
Binary file not shown.
2
oggs/main_theme.readme
Normal file
2
oggs/main_theme.readme
Normal file
@ -0,0 +1,2 @@
|
||||
SuperTuxKart Main Theme
|
||||
Michael Tedstone
|
@ -62,6 +62,8 @@ void GameManager::run()
|
||||
{
|
||||
const GLuint TITLE_SCREEN_TEXTURE =
|
||||
material_manager->getMaterial("st_title_screen.rgb")->getIndex();
|
||||
|
||||
bool music_on = false;
|
||||
while(!m_abort)
|
||||
{
|
||||
sdl_input();
|
||||
@ -76,6 +78,12 @@ void GameManager::run()
|
||||
}
|
||||
|
||||
m_curr_time = SDL_GetTicks();
|
||||
|
||||
if (!music_on && !race_manager->raceIsActive())
|
||||
{
|
||||
sound_manager->playMusic(stk_config->m_title_music);
|
||||
music_on = true;
|
||||
}
|
||||
|
||||
if (race_manager->raceIsActive())
|
||||
{
|
||||
|
@ -20,10 +20,12 @@
|
||||
#ifndef HEADER_MUSIC_H
|
||||
#define HEADER_MUSIC_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class Music
|
||||
{
|
||||
public:
|
||||
virtual bool load(const char* filename)= 0;
|
||||
virtual bool load(const std::string& filename)= 0;
|
||||
|
||||
virtual bool playMusic()= 0;
|
||||
virtual bool stopMusic()= 0;
|
||||
|
@ -50,7 +50,7 @@ MusicOggStream::~MusicOggStream()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool MusicOggStream::load(const char* filename)
|
||||
bool MusicOggStream::load(const std::string& filename)
|
||||
{
|
||||
if(!release())
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
virtual void update();
|
||||
|
||||
virtual bool load(const char* filename);
|
||||
virtual bool load(const std::string& filename);
|
||||
|
||||
virtual bool playMusic();
|
||||
virtual bool stopMusic();
|
||||
|
@ -148,7 +148,7 @@ void SoundManager::playSfx(unsigned int id)
|
||||
} // playSfx
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SoundManager::playMusic(const char* filename)
|
||||
void SoundManager::playMusic(const std::string& filename)
|
||||
{
|
||||
m_description.clear();
|
||||
if(!user_config->doMusic() || !m_initialized) return;
|
||||
@ -159,31 +159,32 @@ void SoundManager::playMusic(const char* filename)
|
||||
m_current_music = NULL;
|
||||
}
|
||||
|
||||
if (filename == NULL || strlen(filename) == 0)
|
||||
if (filename == "" || strlen(filename.c_str()) == 0)
|
||||
{
|
||||
// nothing to play
|
||||
return;
|
||||
}
|
||||
|
||||
#if USE_PLIB_SOUND
|
||||
if (!strcasecmp(".mod", filename+strlen(filename)-4))
|
||||
if (!strcasecmp(".mod", filename.c_str()+filename.size()-4))
|
||||
m_current_music= new MusicPlib();
|
||||
#endif
|
||||
#if HAVE_OGGVORBIS
|
||||
if (!strcasecmp(".ogg", filename+strlen(filename)-4))
|
||||
if (!strcasecmp(".ogg", filename.c_str()+filename.size()-4))
|
||||
m_current_music= new MusicOggStream();
|
||||
#endif
|
||||
if(m_current_music == NULL) // no support for file
|
||||
{
|
||||
fprintf(stderr, "WARNING: music file %s format not recognized.\n", filename);
|
||||
fprintf(stderr, "WARNING: music file %s format not recognized.\n", filename.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if((m_current_music->load(filename)) == false)
|
||||
{
|
||||
delete m_current_music;
|
||||
m_current_music=0;
|
||||
fprintf(stderr, "WARNING: Unabled to load music %s, not supported or not found.\n", filename);
|
||||
m_current_music=0;
|
||||
fprintf(stderr, "WARNING: Unabled to load music %s, not supported or not found.\n",
|
||||
filename.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
void playSfx(unsigned int id);
|
||||
|
||||
void playMusic(const char* filename);
|
||||
void playMusic(const std::string& filename);
|
||||
void stopMusic();
|
||||
void pauseMusic();
|
||||
void resumeMusic();
|
||||
|
@ -116,6 +116,7 @@ void STKConfig::load(const std::string filename)
|
||||
|
||||
} // load
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Init all values with invalid defaults, which are tested later. This
|
||||
* guarantees that all parameters will indeed be initialised, and helps
|
||||
* finding typos.
|
||||
@ -144,6 +145,7 @@ void STKConfig::init_defaults()
|
||||
m_max_karts = -100;
|
||||
m_grid_order = -100;
|
||||
m_air_res_reduce[0] = 1.0f;
|
||||
m_title_music = "";
|
||||
} // init_defaults
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -171,6 +173,7 @@ void STKConfig::getAllData(const lisp::Lisp* lisp)
|
||||
lisp->get("explosion-impulse-objects", m_explosion_impulse_objects);
|
||||
lisp->get("max-karts", m_max_karts );
|
||||
lisp->get("grid-order", m_grid_order );
|
||||
lisp->get("title-music", m_title_music );
|
||||
|
||||
// Get the default KartProperties
|
||||
// ------------------------------
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
float m_explosion_impulse_objects;// impulse of explosion on moving objects, e.g. road cones, ...
|
||||
int m_max_karts; // maximum number of karts
|
||||
int m_grid_order; // whether grand prix grid is in point order or reverse point order
|
||||
std::string m_title_music; // filename of the title music to play
|
||||
|
||||
STKConfig() : KartProperties() {};
|
||||
void init_defaults ();
|
||||
|
@ -156,7 +156,7 @@ World::World(const RaceSetup& raceSetup_) : m_race_setup(raceSetup_)
|
||||
menu_manager->switchToRace();
|
||||
|
||||
const std::string& MUSIC_NAME= track_manager->getTrack(m_race_setup.m_track)->getMusic();
|
||||
if (MUSIC_NAME.size()>0) sound_manager->playMusic(MUSIC_NAME.c_str());
|
||||
if (MUSIC_NAME.size()>0) sound_manager->playMusic(MUSIC_NAME);
|
||||
|
||||
if(user_config->m_profile)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user