Fixed minor sound and animation issues when switching layout.

This commit is contained in:
Pieter Hulshoff 2016-06-29 13:41:42 +02:00
parent efe9e323cc
commit 4da301802b
4 changed files with 17 additions and 7 deletions

View File

@ -183,16 +183,19 @@ Page *PageBuilder::buildPage( std::string collectionName )
// load sounds
for(xml_node<> *sound = root->first_node("sound"); sound; sound = sound->next_sibling("sound"))
{
xml_attribute<> *src = sound->first_attribute("src");
xml_attribute<> *src = sound->first_attribute("src");
xml_attribute<> *type = sound->first_attribute("type");
std::string file = Configuration::convertToAbsolutePath(layoutPath, src->value());
std::string file = Configuration::convertToAbsolutePath(layoutPath, src->value());
std::string layoutName;
config_.getProperty("layout", layoutName);
std::string altfile = Utils::combinePath(Configuration::absolutePath, "layouts", layoutName, std::string(src->value()));
if(!type)
{
Logger::write(Logger::ZONE_ERROR, "Layout", "Sound tag missing type attribute");
}
else
{
Sound *sound = new Sound(file);
Sound *sound = new Sound(file, altfile);
std::string soundType = type->value();
if(!soundType.compare("load"))

View File

@ -414,7 +414,10 @@ void RetroFE::run()
currentPage_->onNewItemSelected();
currentPage_->reallocateMenuSpritePoints();
currentPage_->enterMenu();
if (currentPage_->getMenuDepth() != 1 )
{
currentPage_->enterMenu();
}
state = RETROFE_NEXT_PAGE_MENU_ENTER;

View File

@ -18,13 +18,17 @@
#include "../Utility/Log.h"
Sound::Sound(std::string file)
Sound::Sound(std::string file, std::string altfile)
: file_(file)
, chunk_(NULL)
{
if(!allocate())
{
Logger::write(Logger::ZONE_ERROR, "Sound", "Cannot load " + file_);
file_ = altfile;
if (!allocate())
{
Logger::write(Logger::ZONE_ERROR, "Sound", "Cannot load " + file_);
}
}
}

View File

@ -20,7 +20,7 @@
class Sound
{
public:
Sound(std::string file);
Sound(std::string file, std::string altfile);
virtual ~Sound();
void play();
bool allocate();