Skip to content

Commit

Permalink
PETKA: added CURSOR opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
voltya committed Aug 25, 2019
1 parent 1908109 commit 5134a19
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions engines/petka/objects/object.cpp
Expand Up @@ -193,6 +193,21 @@ void QMessageObject::processMessage(const QMessage &msg) {
g_vm->getQSystem()->_mainInterface->_dialog._field4 = 0;
g_vm->getQSystem()->_mainInterface->_dialog.sub_4155D0(-1);
break;
case kCursor:
if (msg.arg1 == -1) {
g_vm->getQSystem()->_cursor->returnInvItem();
g_vm->getQSystem()->_cursor->_resourceId = 5002;
g_vm->getQSystem()->_cursor->_actionType = 0;
g_vm->getQSystem()->_cursor->_invObj = nullptr;
} else {
g_vm->getQSystem()->_cursor->returnInvItem();
g_vm->getQSystem()->_cursor->_resourceId = msg.arg1;
g_vm->getQSystem()->_cursor->_actionType = kActionObjUse;
g_vm->getQSystem()->_cursor->_invObj = this;
_isShown = 0;
_isActive = 0;
}
g_vm->videoSystem()->makeAllDirty();
case kDialog:
g_vm->getQSystem()->_mainInterface->_dialog.start(msg.arg1, this);
break;
Expand Down
7 changes: 7 additions & 0 deletions engines/petka/objects/object_cursor.cpp
Expand Up @@ -112,4 +112,11 @@ void QObjectCursor::show(bool v) {
QMessageObject::show(v);
}

void QObjectCursor::returnInvItem() {
if (_actionType == kActionObjUse) {
_invObj->show(1);
_invObj->_isActive = true;
}
}

}
1 change: 1 addition & 0 deletions engines/petka/objects/object_cursor.h
Expand Up @@ -46,6 +46,7 @@ class QObjectCursor : public QObject {
void draw() override;
void show(bool v) override;
bool isInPoint(int x, int y) override { return 0; }
void returnInvItem();

public:
int _actionType;
Expand Down

0 comments on commit 5134a19

Please sign in to comment.