Added: Music player directory/autoplay options to client.cfg
--HG-- branch : develop
This commit is contained in:
parent
12fb7af8b7
commit
d10e7157ef
5 changed files with 36 additions and 5 deletions
|
@ -359,6 +359,10 @@ SoundGameMusicVolume_min = 0.0;
|
||||||
SoundGameMusicVolume_max = 1.0;
|
SoundGameMusicVolume_max = 1.0;
|
||||||
SoundGameMusicVolume_step = 0.001;
|
SoundGameMusicVolume_step = 0.001;
|
||||||
|
|
||||||
|
// MP3 player
|
||||||
|
MediaPlayerDirectory = "music";
|
||||||
|
MediaPlayerAutoPlay = false;
|
||||||
|
|
||||||
// MISC
|
// MISC
|
||||||
PreDataPath = { "user", "patch", "data", "examples" };
|
PreDataPath = { "user", "patch", "data", "examples" };
|
||||||
NeedComputeVS = 0;
|
NeedComputeVS = 0;
|
||||||
|
|
|
@ -472,6 +472,10 @@ CClientConfig::CClientConfig()
|
||||||
ColorShout = CRGBA(150,0,0,255); // Default Shout color.
|
ColorShout = CRGBA(150,0,0,255); // Default Shout color.
|
||||||
ColorTalk = CRGBA(255,255,255,255); // Default Talk color.
|
ColorTalk = CRGBA(255,255,255,255); // Default Talk color.
|
||||||
|
|
||||||
|
// MP3 player
|
||||||
|
MediaPlayerDirectory = "music";
|
||||||
|
MediaPlayerAutoPlay = false;
|
||||||
|
|
||||||
// PreDataPath.push_back("data/gamedev/language/"); // Default Path for the language data
|
// PreDataPath.push_back("data/gamedev/language/"); // Default Path for the language data
|
||||||
|
|
||||||
// DataPath.push_back("data/"); // Default Path for the Data.
|
// DataPath.push_back("data/"); // Default Path for the Data.
|
||||||
|
@ -1247,6 +1251,10 @@ void CClientConfig::setValues()
|
||||||
// Max track
|
// Max track
|
||||||
READ_INT_FV(MaxTrack)
|
READ_INT_FV(MaxTrack)
|
||||||
|
|
||||||
|
// MP3 Player
|
||||||
|
READ_STRING_FV(MediaPlayerDirectory);
|
||||||
|
READ_BOOL_FV(MediaPlayerAutoPlay);
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// USER COLORS //
|
// USER COLORS //
|
||||||
// Shout Color
|
// Shout Color
|
||||||
|
|
|
@ -366,6 +366,10 @@ struct CClientConfig
|
||||||
/// The max number of track we want to use.
|
/// The max number of track we want to use.
|
||||||
uint MaxTrack;
|
uint MaxTrack;
|
||||||
|
|
||||||
|
// MP3 Player
|
||||||
|
string MediaPlayerDirectory;
|
||||||
|
bool MediaPlayerAutoPlay;
|
||||||
|
|
||||||
/// Pre Data Path.
|
/// Pre Data Path.
|
||||||
std::vector<string> PreDataPath;
|
std::vector<string> PreDataPath;
|
||||||
/// Data Path.
|
/// Data Path.
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "../input.h"
|
#include "../input.h"
|
||||||
#include "../sound_manager.h"
|
#include "../sound_manager.h"
|
||||||
#include "interface_manager.h"
|
#include "interface_manager.h"
|
||||||
|
#include "../client_cfg.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
@ -43,8 +44,6 @@ extern UDriver *Driver;
|
||||||
#define MP3_SAVE_SHUFFLE "UI:SAVE:MP3_SHUFFLE"
|
#define MP3_SAVE_SHUFFLE "UI:SAVE:MP3_SHUFFLE"
|
||||||
#define MP3_SAVE_REPEAT "UI:SAVE:MP3_REPEAT"
|
#define MP3_SAVE_REPEAT "UI:SAVE:MP3_REPEAT"
|
||||||
|
|
||||||
static const std::string MediaPlayerDirectory("music/");
|
|
||||||
|
|
||||||
CMusicPlayer MusicPlayer;
|
CMusicPlayer MusicPlayer;
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -396,7 +395,7 @@ public:
|
||||||
|
|
||||||
// Recursive scan for files from media directory
|
// Recursive scan for files from media directory
|
||||||
vector<string> filesToProcess;
|
vector<string> filesToProcess;
|
||||||
string newPath = CPath::standardizePath(MediaPlayerDirectory);
|
string newPath = CPath::standardizePath(ClientCfg.MediaPlayerDirectory);
|
||||||
CPath::getPathContent (newPath, true, false, true, filesToProcess);
|
CPath::getPathContent (newPath, true, false, true, filesToProcess);
|
||||||
|
|
||||||
uint i;
|
uint i;
|
||||||
|
|
|
@ -1081,6 +1081,8 @@ bool mainLoop()
|
||||||
|
|
||||||
ProgressBar.finish();
|
ProgressBar.finish();
|
||||||
|
|
||||||
|
bool musicTriggerAutoPlay = true;
|
||||||
|
|
||||||
// Main loop. If the window is no more Active -> Exit.
|
// Main loop. If the window is no more Active -> Exit.
|
||||||
while( !UserEntity->permanentDeath()
|
while( !UserEntity->permanentDeath()
|
||||||
&& !game_exit )
|
&& !game_exit )
|
||||||
|
@ -1733,7 +1735,7 @@ bool mainLoop()
|
||||||
bool wantTraversals = !StereoDisplay || StereoDisplay->isSceneFirst();
|
bool wantTraversals = !StereoDisplay || StereoDisplay->isSceneFirst();
|
||||||
bool keepTraversals = StereoDisplay && !StereoDisplay->isSceneLast();
|
bool keepTraversals = StereoDisplay && !StereoDisplay->isSceneLast();
|
||||||
doRenderScene(wantTraversals, keepTraversals);
|
doRenderScene(wantTraversals, keepTraversals);
|
||||||
|
|
||||||
if (!StereoDisplay || StereoDisplay->isSceneLast())
|
if (!StereoDisplay || StereoDisplay->isSceneLast())
|
||||||
{
|
{
|
||||||
if (fullDetail)
|
if (fullDetail)
|
||||||
|
@ -1803,7 +1805,7 @@ bool mainLoop()
|
||||||
{
|
{
|
||||||
displayPACSPrimitive();
|
displayPACSPrimitive();
|
||||||
}
|
}
|
||||||
|
|
||||||
// display Sound box
|
// display Sound box
|
||||||
if (SoundBox)
|
if (SoundBox)
|
||||||
{
|
{
|
||||||
|
@ -2418,6 +2420,17 @@ bool mainLoop()
|
||||||
// Update ingame duration and stat report sending
|
// Update ingame duration and stat report sending
|
||||||
updateStatReport ();
|
updateStatReport ();
|
||||||
|
|
||||||
|
// Auto play once on character login
|
||||||
|
if (musicTriggerAutoPlay)
|
||||||
|
{
|
||||||
|
musicTriggerAutoPlay = false;
|
||||||
|
if (ClientCfg.SoundOn && ClientCfg.MediaPlayerAutoPlay)
|
||||||
|
{
|
||||||
|
MusicPlayer.stop();
|
||||||
|
CAHManager::getInstance()->runActionHandler("music_player", NULL, "play_songs");
|
||||||
|
MusicPlayer.play();
|
||||||
|
}
|
||||||
|
}
|
||||||
// Update the music player
|
// Update the music player
|
||||||
MusicPlayer.update ();
|
MusicPlayer.update ();
|
||||||
|
|
||||||
|
@ -2453,6 +2466,9 @@ bool mainLoop()
|
||||||
// we have just completed init main loop, after reselecting character
|
// we have just completed init main loop, after reselecting character
|
||||||
// repeat the steps before the main loop itself
|
// repeat the steps before the main loop itself
|
||||||
|
|
||||||
|
// new char, retrigger music autoplay
|
||||||
|
musicTriggerAutoPlay = true;
|
||||||
|
|
||||||
// pre main loop in mainLoop
|
// pre main loop in mainLoop
|
||||||
resetIngameTime ();
|
resetIngameTime ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue