Merge remote-tracking branch 'ryzomcore/develop' into temp/more-patches-26

ryzomclassic-develop
kaetemi 5 years ago
commit 64fd9f0b78

@ -191,7 +191,7 @@ public:
/// Create a native music channel, only supported by the FMod driver. /// Create a native music channel, only supported by the FMod driver.
virtual IMusicChannel *createMusicChannel() { return NULL; } virtual IMusicChannel *createMusicChannel() { return NULL; }
/** Get music info. Returns false if the song is not found or the function is not implemented. /** Get music info. Returns false if the song is not found or the function is not implemented.
* \param filepath path to file, CPath::lookup done by driver * \param filepath full path to file
* \param artist returns the song artist (empty if not available) * \param artist returns the song artist (empty if not available)
* \param title returns the title (empty if not available) * \param title returns the title (empty if not available)
*/ */

@ -110,10 +110,9 @@ IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &type, NLMISC
bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, std::string &title, float &length) bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, std::string &title, float &length)
{ {
std::string lookup = CPath::lookup(filepath, false); if (filepath.empty() || !CFile::fileExists(filepath))
if (lookup.empty())
{ {
nlwarning("Music file %s does not exist!", filepath.c_str()); nlwarning("Music file '%s' does not exist!", filepath.c_str());
return false; return false;
} }
@ -121,7 +120,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st
CIFile ifile; CIFile ifile;
ifile.setCacheFileOnOpen(false); ifile.setCacheFileOnOpen(false);
ifile.allowBNPCacheFileOnOpen(false); ifile.allowBNPCacheFileOnOpen(false);
if (ifile.open(lookup)) if (ifile.open(filepath))
return CAudioDecoderFfmpeg::getInfo(&ifile, artist, title, length); return CAudioDecoderFfmpeg::getInfo(&ifile, artist, title, length);
#else #else
std::string type = CFile::getExtension(filepath); std::string type = CFile::getExtension(filepath);
@ -132,7 +131,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st
CIFile ifile; CIFile ifile;
ifile.setCacheFileOnOpen(false); ifile.setCacheFileOnOpen(false);
ifile.allowBNPCacheFileOnOpen(false); ifile.allowBNPCacheFileOnOpen(false);
if (ifile.open(lookup)) if (ifile.open(filepath))
return CAudioDecoderVorbis::getInfo(&ifile, artist, title, length); return CAudioDecoderVorbis::getInfo(&ifile, artist, title, length);
nlwarning("Unable to open: '%s'", filepath.c_str()); nlwarning("Unable to open: '%s'", filepath.c_str());
@ -143,7 +142,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st
CIFile ifile; CIFile ifile;
ifile.setCacheFileOnOpen(false); ifile.setCacheFileOnOpen(false);
ifile.allowBNPCacheFileOnOpen(false); ifile.allowBNPCacheFileOnOpen(false);
if (ifile.open(lookup)) if (ifile.open(filepath))
return CAudioDecoderMP3::getInfo(&ifile, artist, title, length); return CAudioDecoderMP3::getInfo(&ifile, artist, title, length);
nlwarning("Unable to open: '%s'", filepath.c_str()); nlwarning("Unable to open: '%s'", filepath.c_str());

@ -496,36 +496,20 @@ bool getTag (std::string &result, const char *tag, FSOUND_STREAM *stream)
} }
/** Get music info. Returns false if the song is not found or the function is not implemented. /** Get music info. Returns false if the song is not found or the function is not implemented.
* \param filepath path to file, CPath::lookup done by driver * \param filepath full path to file
* \param artist returns the song artist (empty if not available) * \param artist returns the song artist (empty if not available)
* \param title returns the title (empty if not available) * \param title returns the title (empty if not available)
*/ */
bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title, float &length) bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title, float &length)
{ {
/* Open a stream, get the tag if it exists, close the stream */ if (filepath.empty() || !CFile::fileExists(filepath))
string pathName = CPath::lookup(filepath, false);
uint32 fileOffset = 0, fileSize = 0;
if (pathName.empty())
{ {
nlwarning("NLSOUND FMod Driver: Music file %s not found!", filepath.c_str()); nlwarning("NLSOUND FMod Driver: Music file %s not found!", filepath.c_str());
return false; return false;
} }
// if the file is in a bnp
if (pathName.find('@') != string::npos)
{
if (CBigFile::getInstance().getFileInfo(pathName, fileSize, fileOffset))
{
// set pathname to bnp
pathName = pathName.substr(0, pathName.find('@'));
}
else
{
nlwarning("NLSOUND FMod Driver: BNP BROKEN");
return false;
}
}
FSOUND_STREAM *stream = FSOUND_Stream_Open((const char *)CPath::lookup(filepath, false).c_str(), FSOUND_2D, (sint)fileOffset, (sint)fileSize); uint32 fileOffset = 0, fileSize = 0;
FSOUND_STREAM *stream = FSOUND_Stream_Open(filepath.c_str(), FSOUND_2D, (sint)fileOffset, (sint)fileSize);
if (stream) if (stream)
{ {
getTag(artist, "ARTIST", stream); getTag(artist, "ARTIST", stream);

@ -112,7 +112,7 @@ public:
virtual IMusicChannel *createMusicChannel(); virtual IMusicChannel *createMusicChannel();
/** Get music info. Returns false if the song is not found or the function is not implemented. /** Get music info. Returns false if the song is not found or the function is not implemented.
* \param filepath path to file, CPath::lookup done by driver * \param filepath full path to file
* \param artist returns the song artist (empty if not available) * \param artist returns the song artist (empty if not available)
* \param title returns the title (empty if not available) * \param title returns the title (empty if not available)
*/ */

@ -540,6 +540,9 @@ CCtrlDraggable(param)
_SapBuffIcon = "ico_sap.tga"; _SapBuffIcon = "ico_sap.tga";
_StaBuffIcon = "ico_stamina.tga"; _StaBuffIcon = "ico_stamina.tga";
_FocusBuffIcon = "ico_focus.tga"; _FocusBuffIcon = "ico_focus.tga";
_RegenText = NULL;
_RegenTextValue = 0;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -564,6 +567,11 @@ CDBCtrlSheet::~CDBCtrlSheet()
Driver->deleteTextureFile(_GuildSymb); Driver->deleteTextureFile(_GuildSymb);
_GuildSymb = NULL; _GuildSymb = NULL;
} }
if (_RegenText)
{
delete _RegenText;
_RegenText = NULL;
}
// ensure erase static // ensure erase static
if(this==_CurrMenuSheet) _CurrMenuSheet = NULL; if(this==_CurrMenuSheet) _CurrMenuSheet = NULL;
@ -2039,6 +2047,12 @@ void CDBCtrlSheet::draw()
if (!_LastSheetId) if (!_LastSheetId)
{ {
_RegenTickRange = CTickRange(); _RegenTickRange = CTickRange();
if (_RegenText)
{
delete _RegenText;
_RegenText = NULL;
_RegenTextValue = 0;
}
} }
else else
{ {
@ -2065,6 +2079,36 @@ void CDBCtrlSheet::draw()
{ {
rVR.drawQuad(_RenderLayer + 1, regenTris[tri], backTex, CRGBA::White, false); rVR.drawQuad(_RenderLayer + 1, regenTris[tri], backTex, CRGBA::White, false);
} }
if (!_RegenText) {
_RegenText = new CViewText(CViewBase::TCtorParam());
_RegenText->setId(getId() + ":regen");
_RegenText->setParent(_Parent);
_RegenText->setOverflowText(ucstring(""));
_RegenText->setModulateGlobalColor(false);
_RegenText->setMultiLine(false);
_RegenText->setTextMode(CViewText::ClipWord);
_RegenText->setFontSizing("0", "0");
// TODO: font size / color hardcoded.
_RegenText->setFontSize(8);
_RegenText->setColor(CRGBA::White);
_RegenText->setShadow(true);
_RegenText->setActive(true);
_RegenText->updateTextContext();
}
// TODO: ticks in second hardcoded
uint32 nextValue = _RegenTickRange.EndTick > LastGameCycle ? (_RegenTickRange.EndTick - LastGameCycle) / 10 : 0;
if (_RegenTextValue != nextValue)
{
_RegenTextValue = nextValue;
_RegenText->setText(toString("%d", _RegenTextValue));
_RegenText->updateTextContext();
}
_RegenText->setXReal(_XReal+1);
_RegenText->setYReal(_YReal+2);
_RegenText->setRenderLayer(_RenderLayer+2);
_RegenText->draw();
} }
} }

@ -56,6 +56,7 @@ class COutpostBuildingSheet;
namespace NLGUI namespace NLGUI
{ {
class CViewRenderer; class CViewRenderer;
class CViewText;
} }
class CDBCtrlSheet; class CDBCtrlSheet;
@ -736,6 +737,8 @@ protected:
sint8 _ArmourColorIndex; sint8 _ArmourColorIndex;
CTickRange _RegenTickRange; CTickRange _RegenTickRange;
NLGUI::CViewText *_RegenText;
uint32 _RegenTextValue;
/// D'n'd /// D'n'd
sint32 _DragX, _DragY; sint32 _DragX, _DragY;

Loading…
Cancel
Save