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

@ -186,13 +186,16 @@ Page *PageBuilder::buildPage( std::string collectionName )
xml_attribute<> *src = sound->first_attribute("src"); xml_attribute<> *src = sound->first_attribute("src");
xml_attribute<> *type = sound->first_attribute("type"); 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) if(!type)
{ {
Logger::write(Logger::ZONE_ERROR, "Layout", "Sound tag missing type attribute"); Logger::write(Logger::ZONE_ERROR, "Layout", "Sound tag missing type attribute");
} }
else else
{ {
Sound *sound = new Sound(file); Sound *sound = new Sound(file, altfile);
std::string soundType = type->value(); std::string soundType = type->value();
if(!soundType.compare("load")) if(!soundType.compare("load"))

View File

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

View File

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

View File

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