PETKA: set walk background when loading room

This commit is contained in:
Andrei Prykhodko 2020-10-02 22:46:36 +03:00
parent 6025f75544
commit 93ae63e563

View File

@ -82,16 +82,23 @@ void InterfaceMain::start(int id) {
void InterfaceMain::loadRoom(int id, bool fromSave) {
QSystem *sys = g_vm->getQSystem();
sys->_currInterface->stop();
if (_roomId == id)
return;
unloadRoom(fromSave);
_roomId = id;
const BGInfo *info = findBGInfo(id);
QObjectBG *room = (QObjectBG *)sys->findObject(id);
QManager *resMgr = g_vm->resMgr();
_roomId = id;
sys->_room = room;
g_vm->resMgr()->loadBitmap(room->_resourceId);
_objs.push_back(room);
resMgr->loadBitmap(room->_resourceId);
for (uint i = 0; i < info->attachedObjIds.size(); ++i) {
QMessageObject *obj = sys->findObject(info->attachedObjIds[i]);
obj->loadSound();
@ -100,11 +107,20 @@ void InterfaceMain::loadRoom(int id, bool fromSave) {
_objs.push_back(obj);
}
sys->getPetka()->_walk->setBackground(g_vm->resMgr()->findResourceName(room->_resourceId));
sys->getChapay()->_walk->setBackground(g_vm->resMgr()->findResourceName(room->_resourceId));
auto petka = sys->getPetka();
auto chapay = sys->getChapay();
auto bkgName = resMgr->findResourceName(room->_resourceId);
petka->_walk->setBackground(bkgName);
chapay->_walk->setBackground(bkgName);
petka->setPos(Common::Point(petka->_x, petka->_y), false);
chapay->setPos(Common::Point(chapay->_x, chapay->_y), false);
playSound(room->_musicId, Audio::Mixer::kMusicSoundType);
playSound(room->_fxId, Audio::Mixer::kSFXSoundType);
if (!fromSave)
sys->addMessageForAllObjects(kInitBG, 0, 0, 0, 0, room);
g_vm->videoSystem()->updateTime();