# HG changeset patch # User unc0rr # Date 1220038837 0 # Node ID 070629f3902ddacdcc7cac3385572c079a774226 # Parent 1091e2f12751cf8c1a8e11c28b72778df17b4b0c - Set frontend's music volume level to 50% - Aware frontend of "Enable music" checkbox state - Don't load soundtrack if music is off diff -r 1091e2f12751 -r 070629f3902d QTfrontend/SDLs.cpp --- a/QTfrontend/SDLs.cpp Mon Aug 25 18:30:06 2008 +0000 +++ b/QTfrontend/SDLs.cpp Fri Aug 29 19:40:37 2008 +0000 @@ -23,12 +23,13 @@ SDLInteraction::SDLInteraction() { + music = NULL; + SDL_Init(SDL_INIT_VIDEO); SDL_Init(SDL_INIT_AUDIO); Mix_OpenAudio(22050, 0x8010, 2, 512); - Mix_Volume(-1, 50); - music = Mix_LoadMUS(QString(datadir->absolutePath() + "/Music/main theme.ogg").toAscii().constData()); + Mix_VolumeMusic(50); } SDLInteraction::~SDLInteraction() @@ -58,6 +59,9 @@ } void SDLInteraction::StartMusic() { + if (!music) + music = Mix_LoadMUS(QString(datadir->absolutePath() + "/Music/main theme.ogg").toAscii().constData()); + Mix_FadeInMusic(music, -1, 3000); } diff -r 1091e2f12751 -r 070629f3902d QTfrontend/gameuiconfig.cpp --- a/QTfrontend/gameuiconfig.cpp Mon Aug 25 18:30:06 2008 +0000 +++ b/QTfrontend/gameuiconfig.cpp Fri Aug 29 19:40:37 2008 +0000 @@ -33,6 +33,8 @@ { Form = FormWidgets; + connect(Form->ui.pageOptions->CBEnableMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool))); + //Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt()); resizeToConfigValues(); diff -r 1091e2f12751 -r 070629f3902d QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Mon Aug 25 18:30:06 2008 +0000 +++ b/QTfrontend/hwform.cpp Fri Aug 29 19:40:37 2008 +0000 @@ -27,6 +27,7 @@ #include #include #include +#include #include "hwform.h" #include "game.h" @@ -131,8 +132,6 @@ this, SLOT(GoBack())); // executed third GoToPage(ID_PAGE_MAIN); - - sdli.StartMusic(); } void HWForm::onFrontendFullscreen(bool value) @@ -688,3 +687,11 @@ config->SaveOptions(); event->accept(); } + +void HWForm::Music(bool checked) +{ + if (checked) + sdli.StartMusic(); + else + sdli.StopMusic(); +} diff -r 1091e2f12751 -r 070629f3902d QTfrontend/hwform.h --- a/QTfrontend/hwform.h Mon Aug 25 18:30:06 2008 +0000 +++ b/QTfrontend/hwform.h Fri Aug 29 19:40:37 2008 +0000 @@ -85,6 +85,7 @@ void UpdateWeapons(); void NetWeaponNameChanged(const QString& name); void onFrontendFullscreen(bool value); + void Music(bool checked); private: void _NetConnect(const QString & hostName, quint16 port, const QString & nick); diff -r 1091e2f12751 -r 070629f3902d share/hedgewars/Data/Maps/Sheep/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Maps/Sheep/CMakeLists.txt Fri Aug 29 19:40:37 2008 +0000 @@ -0,0 +1,5 @@ +install(FILES + map.png + map.cfg + DESTINATION ${SHAREPATH}Data/Maps/Sheep) +