Skip to content

Commit

Permalink
PETKA: reimplemented show method of QObject
Browse files Browse the repository at this point in the history
  • Loading branch information
voltya committed Aug 25, 2019
1 parent 9a9f152 commit 4546cb9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
9 changes: 9 additions & 0 deletions engines/petka/interfaces/interface.cpp
Expand Up @@ -32,4 +32,13 @@ void Interface::setText(const Common::U32String &text, uint32 rgb) {
_objs.push_back(new QText(text, rgb));
}

QVisibleObject *Interface::findObject(int resourceId) {
for (uint i = 0; i < _objs.size(); ++i) {
if (_objs[i]->_resourceId == resourceId) {
return _objs[i];
}
}
return nullptr;
}

} // End of namespace Petka
2 changes: 2 additions & 0 deletions engines/petka/interfaces/interface.h
Expand Up @@ -46,6 +46,8 @@ class Interface {

void setText(const Common::U32String &text, uint32 rgb);

QVisibleObject *findObject(int resourceId);

public:
Common::Array<QVisibleObject *> _objs;
QVisibleObject *_objUnderCursor;
Expand Down
12 changes: 4 additions & 8 deletions engines/petka/objects/object.cpp
Expand Up @@ -396,14 +396,10 @@ void QObject::updateZ() {
}

void QObject::show(bool v) {
const Common::Array<QVisibleObject*> & objs = g_vm->getQSystem()->_mainInterface->_objs;
for (uint i = 0; i < objs.size(); ++i) {
if (objs[i]->_resourceId == _resourceId) {
FlicDecoder *flc = g_vm->resMgr()->loadFlic(_resourceId);
if (flc) {
g_vm->videoSystem()->addDirtyRect(Common::Point(_x, _y), *flc);
}
break;
if (g_vm->getQSystem()->_mainInterface->findObject(_resourceId)) {
FlicDecoder *flc = g_vm->resMgr()->loadFlic(_resourceId);
if (flc) {
g_vm->videoSystem()->addDirtyRect(Common::Point(_x, _y), *flc);
}
}
QMessageObject::show(v);
Expand Down

0 comments on commit 4546cb9

Please sign in to comment.